Commit 2b846304 authored by Iustin Pop's avatar Iustin Pop
Browse files

KVM: only pass boot flag once

This addresses issue 230: passing two methods of booting to KVM can,
depending on the KVM version, confuse it.

Note that commit 4304964a

 introduced a partial fix for this (but only
for disks, and keyed on KVM versions). However, it didn't fix cdrom
booting, which still fails with the same error, so let's fix it more
generically; we still leave the per-disk check since that is about
-boot c versus -drive …,boot=on rather than two boot methods.

Patch is based on the one submitted by Vladimir Mencl, many thanks!
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent deb717a0
......@@ -551,10 +551,14 @@ class KVMHypervisor(hv_base.BaseHypervisor):
kvm_cmd.extend(["-no-reboot"])
hvp = instance.hvparams
boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
boot_cdrom = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_CDROM
boot_floppy = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_FLOPPY
boot_network = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_NETWORK
kernel_path = hvp[constants.HV_KERNEL_PATH]
if kernel_path:
boot_disk = boot_cdrom = boot_floppy = boot_network = False
else:
boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
boot_cdrom = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_CDROM
boot_floppy = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_FLOPPY
boot_network = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_NETWORK
self.ValidateParameters(hvp)
......@@ -645,7 +649,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
drive_val = "file=%s%s" % (floppy_image, options)
kvm_cmd.extend(["-drive", drive_val])
kernel_path = hvp[constants.HV_KERNEL_PATH]
if kernel_path:
kvm_cmd.extend(["-kernel", kernel_path])
initrd_path = hvp[constants.HV_INITRD_PATH]
......
......@@ -175,9 +175,11 @@ boot\_order
as 'dc'.
For KVM the boot order is either "floppy", "cdrom", "disk" or
"network". Please note that older versions of KVM couldn't
netboot from virtio interfaces. This has been fixed in more recent
versions and is confirmed to work at least with qemu-kvm 0.11.1.
"network". Please note that older versions of KVM couldn't netboot
from virtio interfaces. This has been fixed in more recent versions
and is confirmed to work at least with qemu-kvm 0.11.1. Also note
that if you have set the ``kernel_path`` option, that will be used
for booting, and this setting will be silently ignored.
blockdev\_prefix
Valid for the Xen HVM and PVM hypervisors.
......@@ -326,9 +328,10 @@ kernel\_path
Valid for the Xen PVM and KVM hypervisors.
This option specifies the path (on the node) to the kernel to boot
the instance with. Xen PVM instances always require this, while
for KVM if this option is empty, it will cause the machine to load
the kernel from its disks.
the instance with. Xen PVM instances always require this, while for
KVM if this option is empty, it will cause the machine to load the
kernel from its disks (and the boot will be done accordingly to
``boot_order``).
kernel\_args
Valid for the Xen PVM and KVM hypervisors.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment