From 564c30a0407886fea865ae93c67ed4cf00e2fdd8 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Mon, 15 Jul 2013 10:54:38 +0200 Subject: [PATCH] CLOUDSTACK-2823: move kernelVersion to global configuration in LibvirtComputingResource.java --- .../kvm/resource/LibvirtComputingResource.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 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 a2e4044016f..85a8fa0e4fb 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 @@ -289,6 +289,7 @@ ServerResource { private int _migrateSpeed; private long _hvVersion; + private long _kernelVersion; private KVMHAMonitor _monitor; private final String _SSHKEYSPATH = "/root/.ssh"; private final String _SSHPRVKEYPATH = _SSHKEYSPATH + File.separator @@ -846,6 +847,10 @@ ServerResource { storageProcessor.configure(name, params); storageHandler = new StorageSubsystemCommandHandlerBase(storageProcessor); + String unameKernelVersion = Script.runSimpleBashScript("uname -r"); + String[] kernelVersions = unameKernelVersion.split("[\\.\\-]"); + _kernelVersion = Integer.parseInt(kernelVersions[0]) * 1000 * 1000 + Integer.parseInt(kernelVersions[1]) * 1000 + Integer.parseInt(kernelVersions[2]); + return true; } @@ -3312,10 +3317,7 @@ ServerResource { // pass cmdline info to system vms if (vmSpec.getType() != VirtualMachine.Type.User) { - String unameKernelVersion = Script.runSimpleBashScript("uname -r"); - String[] kernelVersions = unameKernelVersion.split("[\\.\\-]"); - long kernelVersion = Integer.parseInt(kernelVersions[0]) * 1000 * 1000 + Integer.parseInt(kernelVersions[1]) * 1000 + Integer.parseInt(kernelVersions[2]); - 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) + 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()); try {