Revision 24be50e0 lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
570 | 570 |
if boot_network: |
571 | 571 |
kvm_cmd.extend(["-boot", "n"]) |
572 | 572 |
|
573 |
# whether this is an older KVM version that uses the boot=on flag |
|
574 |
# on devices |
|
575 |
needs_boot_flag = (v_major, v_min) < (0, 14) |
|
576 |
|
|
573 | 577 |
disk_type = hvp[constants.HV_DISK_TYPE] |
574 | 578 |
if disk_type == constants.HT_DISK_PARAVIRTUAL: |
575 | 579 |
if_val = ",if=virtio" |
... | ... | |
597 | 601 |
if boot_disk: |
598 | 602 |
kvm_cmd.extend(["-boot", "c"]) |
599 | 603 |
boot_disk = False |
600 |
if (v_major, v_min) < (0, 14) and disk_type != constants.HT_DISK_IDE:
|
|
604 |
if needs_boot_flag and disk_type != constants.HT_DISK_IDE:
|
|
601 | 605 |
boot_val = ",boot=on" |
602 | 606 |
|
603 | 607 |
drive_val = "file=%s,format=raw%s%s%s" % (dev_path, if_val, boot_val, |
... | ... | |
612 | 616 |
iso_image = hvp[constants.HV_CDROM_IMAGE_PATH] |
613 | 617 |
if iso_image: |
614 | 618 |
options = ",format=raw,media=cdrom" |
619 |
# set cdrom 'if' type |
|
615 | 620 |
if boot_cdrom: |
616 |
kvm_cmd.extend(["-boot", "d"]) |
|
617 |
if cdrom_disk_type != constants.HT_DISK_IDE: |
|
618 |
options = "%s,boot=on,if=%s" % (options, constants.HT_DISK_IDE) |
|
619 |
else: |
|
620 |
options = "%s,boot=on" % options |
|
621 |
actual_cdrom_type = constants.HT_DISK_IDE |
|
622 |
elif cdrom_disk_type == constants.HT_DISK_PARAVIRTUAL: |
|
623 |
actual_cdrom_type = "virtio" |
|
621 | 624 |
else: |
622 |
if cdrom_disk_type == constants.HT_DISK_PARAVIRTUAL: |
|
623 |
if_val = ",if=virtio" |
|
624 |
else: |
|
625 |
if_val = ",if=%s" % cdrom_disk_type |
|
626 |
options = "%s%s" % (options, if_val) |
|
627 |
drive_val = "file=%s%s" % (iso_image, options) |
|
625 |
actual_cdrom_type = cdrom_disk_type |
|
626 |
if_val = ",if=%s" % actual_cdrom_type |
|
627 |
# set boot flag, if needed |
|
628 |
boot_val = "" |
|
629 |
if boot_cdrom: |
|
630 |
kvm_cmd.extend(["-boot", "d"]) |
|
631 |
if needs_boot_flag: |
|
632 |
boot_val = ",boot=on" |
|
633 |
# and finally build the entire '-drive' value |
|
634 |
drive_val = "file=%s%s%s%s" % (iso_image, options, if_val, boot_val) |
|
628 | 635 |
kvm_cmd.extend(["-drive", drive_val]) |
629 | 636 |
|
630 | 637 |
iso_image2 = hvp[constants.HV_KVM_CDROM2_IMAGE_PATH] |
... | ... | |
634 | 641 |
if_val = ",if=virtio" |
635 | 642 |
else: |
636 | 643 |
if_val = ",if=%s" % cdrom_disk_type |
637 |
options = "%s%s" % (options, if_val) |
|
638 |
drive_val = "file=%s%s" % (iso_image2, options) |
|
644 |
drive_val = "file=%s%s%s" % (iso_image2, options, if_val) |
|
639 | 645 |
kvm_cmd.extend(["-drive", drive_val]) |
640 | 646 |
|
641 | 647 |
floppy_image = hvp[constants.HV_KVM_FLOPPY_IMAGE_PATH] |
Also available in: Unified diff