From ec2eafdfde1b70100391f56528b73f7a54bb4a7b Mon Sep 17 00:00:00 2001 From: Edison Su Date: Thu, 8 Aug 2013 17:16:12 -0700 Subject: [PATCH] CLOUDSTACK-3538: if passcmdline succeed, don't need to retry again, and increase the retry to 5 minutes at most --- .../kvm/resource/LibvirtComputingResource.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 542136adf6f..64faba674d4 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -1092,7 +1092,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; @@ -1101,7 +1101,9 @@ ServerResource { result = command.execute(); if (result != null) { s_logger.debug("passcmd failed:" + result); + return false; } + return true; } boolean isDirectAttachedNetwork(String type) { @@ -3459,8 +3461,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) {