Skip to content

Commit 2b32477

Browse files
committed
CLOUDSTACK-3538: if passcmdline succeed, don't need to retry again, and increase the retry to 5 minutes at most
1 parent aa8d566 commit 2b32477

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ private boolean checkOvsNetwork(String networkName) {
10951095
}
10961096
}
10971097

1098-
private void passCmdLine(String vmName, String cmdLine)
1098+
private boolean passCmdLine(String vmName, String cmdLine)
10991099
throws InternalErrorException {
11001100
final Script command = new Script(_patchViaSocketPath, 5*1000, s_logger);
11011101
String result;
@@ -1104,7 +1104,9 @@ private void passCmdLine(String vmName, String cmdLine)
11041104
result = command.execute();
11051105
if (result != null) {
11061106
s_logger.debug("passcmd failed:" + result);
1107+
return false;
11071108
}
1109+
return true;
11081110
}
11091111

11101112
boolean isDirectAttachedNetwork(String type) {
@@ -3462,8 +3464,12 @@ protected StartAnswer execute(StartCommand cmd) {
34623464
// pass cmdline info to system vms
34633465
if (vmSpec.getType() != VirtualMachine.Type.User) {
34643466
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)
3465-
for (int count = 0; count < 10; count ++) {
3466-
passCmdLine(vmName, vmSpec.getBootArgs());
3467+
//wait for 5 minutes at most
3468+
for (int count = 0; count < 30; count ++) {
3469+
boolean succeed = passCmdLine(vmName, vmSpec.getBootArgs());
3470+
if (succeed) {
3471+
break;
3472+
}
34673473
try {
34683474
Thread.sleep(5000);
34693475
} catch (InterruptedException e) {

0 commit comments

Comments
 (0)