From 9dd363eb7d9393b5a906ebdfca463875f96d8ddf Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Sat, 7 Feb 2009 09:04:31 +0000
Subject: [PATCH] KVM: don't boot from a virtio cdrom

Apparently it's not supported. Also add -boot command line parameters
to kvm, since they seem to help booting from the right place. Everything
will still only work when not using a kernel, but well... :)

Reviewed-by: iustinp
---
 lib/hypervisor/hv_kvm.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index c8b63cea5..e43a24cc4 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -240,6 +240,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
                                      " are not supported by KVM")
       # TODO: handle FD_LOOP and FD_BLKTAP (?)
       if boot_disk:
+        kvm_cmd.extend(['-boot', 'c'])
         boot_val = ',boot=on'
         boot_disk = False
       else:
@@ -253,9 +254,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
 
     iso_image = instance.hvparams[constants.HV_CDROM_IMAGE_PATH]
     if iso_image:
-      options = ',format=raw,if=virtio,media=cdrom'
+      options = ',format=raw,media=cdrom'
       if boot_cdrom:
+        kvm_cmd.extend(['-boot', 'd'])
         options = '%s,boot=on' % options
+      else:
+        options = '%s,if=virtio' % options
       drive_val = 'file=%s%s' % (iso_image, options)
       kvm_cmd.extend(['-drive', drive_val])
 
-- 
GitLab