CLOUDSTACK-3538: if passcmdline succeed, don't need to retry again, and increase the retry to 5 minutes at most

This commit is contained in:
Edison Su 2013-08-08 17:16:12 -07:00
parent aa8d56652d
commit 2b32477aca
1 changed files with 9 additions and 3 deletions

View File

@ -1095,7 +1095,7 @@ ServerResource {
}
}
private void passCmdLine(String vmName, String cmdLine)
private boolean passCmdLine(String vmName, String cmdLine)
throws InternalErrorException {
final Script command = new Script(_patchViaSocketPath, 5*1000, s_logger);
String result;
@ -1104,7 +1104,9 @@ ServerResource {
result = command.execute();
if (result != null) {
s_logger.debug("passcmd failed:" + result);
return false;
}
return true;
}
boolean isDirectAttachedNetwork(String type) {
@ -3462,8 +3464,12 @@ ServerResource {
// pass cmdline info to system vms
if (vmSpec.getType() != VirtualMachine.Type.User) {
if ((_kernelVersion < 2006034) && (conn.getVersion() < 1001000)) { // CLOUDSTACK-2823: try passCmdLine some times if kernel < 2.6.34 and qemu < 1.1.0 on hypervisor (for instance, CentOS 6.4)
for (int count = 0; count < 10; count ++) {
passCmdLine(vmName, vmSpec.getBootArgs());
//wait for 5 minutes at most
for (int count = 0; count < 30; count ++) {
boolean succeed = passCmdLine(vmName, vmSpec.getBootArgs());
if (succeed) {
break;
}
try {
Thread.sleep(5000);
} catch (InterruptedException e) {