From 4304964a4b0fcbb1fbf732bc3a8821c03cc39714 Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 9 Jun 2011 09:01:30 +0000 Subject: [PATCH] Don't add ",boot=on" to disks on kvm >= 0.14 Under newer kvm this prevents the vm from starting. Ah, change! Signed-off-by: Guido Trotter <ultrotter@google.com> Reviewed-by: Michael Hanselmann <hansmi@google.com> --- lib/hypervisor/hv_kvm.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 6df67df81..e65d3309c 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -506,6 +506,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): """Generate KVM information to start an instance. """ + kvm_version = self._GetKVMVersion() + if kvm_version: + _, v_major, v_min, _ = kvm_version + else: + raise errors.HypervisorError("Unable to get KVM version") + pidfile = self._InstancePidFile(instance.name) kvm = constants.KVM_PATH kvm_cmd = [kvm] @@ -548,16 +554,12 @@ class KVMHypervisor(hv_base.BaseHypervisor): raise errors.HypervisorError("Instance has read-only disks which" " are not supported by KVM") # TODO: handle FD_LOOP and FD_BLKTAP (?) + boot_val = "" if boot_disk: kvm_cmd.extend(['-boot', 'c']) - if disk_type != constants.HT_DISK_IDE: - boot_val = ',boot=on' - else: - boot_val = '' - # We only boot from the first disk boot_disk = False - else: - boot_val = '' + if (v_major, v_min) < (0, 14) and disk_type != constants.HT_DISK_IDE: + boot_val = ",boot=on" drive_val = 'file=%s,format=raw%s%s%s' % (dev_path, if_val, boot_val, cache_val) -- GitLab