Revision fba7f911 lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
164 | 164 |
constants.HV_VNC_X509: hv_base.OPT_DIR_CHECK, |
165 | 165 |
constants.HV_VNC_X509_VERIFY: hv_base.NO_CHECK, |
166 | 166 |
constants.HV_VNC_PASSWORD_FILE: hv_base.OPT_FILE_CHECK, |
167 |
constants.HV_KVM_FLOPPY_IMAGE_PATH: hv_base.OPT_FILE_CHECK, |
|
167 | 168 |
constants.HV_CDROM_IMAGE_PATH: hv_base.OPT_FILE_CHECK, |
169 |
constants.HV_KVM_CDROM2_IMAGE_PATH: hv_base.OPT_FILE_CHECK, |
|
168 | 170 |
constants.HV_BOOT_ORDER: |
169 | 171 |
hv_base.ParamInSet(True, constants.HT_KVM_VALID_BO_TYPES), |
170 | 172 |
constants.HV_NIC_TYPE: |
171 | 173 |
hv_base.ParamInSet(True, constants.HT_KVM_VALID_NIC_TYPES), |
172 | 174 |
constants.HV_DISK_TYPE: |
173 | 175 |
hv_base.ParamInSet(True, constants.HT_KVM_VALID_DISK_TYPES), |
176 |
constants.HV_KVM_CDROM_DISK_TYPE: |
|
177 |
hv_base.ParamInSet(False, constants.HT_KVM_VALID_DISK_TYPES), |
|
174 | 178 |
constants.HV_USB_MOUSE: |
175 | 179 |
hv_base.ParamInSet(False, constants.HT_KVM_VALID_MOUSE_TYPES), |
176 | 180 |
constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK, |
... | ... | |
517 | 521 |
hvp = instance.hvparams |
518 | 522 |
boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK |
519 | 523 |
boot_cdrom = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_CDROM |
524 |
boot_floppy = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_FLOPPY |
|
520 | 525 |
boot_network = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_NETWORK |
521 | 526 |
|
522 | 527 |
if hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED: |
... | ... | |
558 | 563 |
cache_val) |
559 | 564 |
kvm_cmd.extend(['-drive', drive_val]) |
560 | 565 |
|
566 |
#Now we can specify a different device type for CDROM devices. |
|
567 |
cdrom_disk_type = hvp[constants.HV_KVM_CDROM_DISK_TYPE] |
|
568 |
if not cdrom_disk_type: |
|
569 |
cdrom_disk_type = disk_type |
|
570 |
|
|
561 | 571 |
iso_image = hvp[constants.HV_CDROM_IMAGE_PATH] |
562 | 572 |
if iso_image: |
563 | 573 |
options = ',format=raw,media=cdrom' |
564 | 574 |
if boot_cdrom: |
565 | 575 |
kvm_cmd.extend(['-boot', 'd']) |
566 |
if disk_type != constants.HT_DISK_IDE: |
|
576 |
if cdrom_disk_type != constants.HT_DISK_IDE: |
|
577 |
options = '%s,boot=on,if=%s' % (options, constants.HT_DISK_IDE) |
|
578 |
else: |
|
567 | 579 |
options = '%s,boot=on' % options |
568 | 580 |
else: |
569 |
if disk_type == constants.HT_DISK_PARAVIRTUAL: |
|
581 |
if cdrom_disk_type == constants.HT_DISK_PARAVIRTUAL:
|
|
570 | 582 |
if_val = ',if=virtio' |
571 | 583 |
else: |
572 |
if_val = ',if=%s' % disk_type |
|
584 |
if_val = ',if=%s' % cdrom_disk_type
|
|
573 | 585 |
options = '%s%s' % (options, if_val) |
574 | 586 |
drive_val = 'file=%s%s' % (iso_image, options) |
575 | 587 |
kvm_cmd.extend(['-drive', drive_val]) |
576 | 588 |
|
589 |
iso_image2 = hvp[constants.HV_KVM_CDROM2_IMAGE_PATH] |
|
590 |
if iso_image2: |
|
591 |
options = ',format=raw,media=cdrom' |
|
592 |
if cdrom_disk_type == constants.HT_DISK_PARAVIRTUAL: |
|
593 |
if_val = ',if=virtio' |
|
594 |
else: |
|
595 |
if_val = ',if=%s' % cdrom_disk_type |
|
596 |
options = '%s%s' % (options, if_val) |
|
597 |
drive_val = 'file=%s%s' % (iso_image2, options) |
|
598 |
kvm_cmd.extend(['-drive', drive_val]) |
|
599 |
|
|
600 |
floppy_image = hvp[constants.HV_KVM_FLOPPY_IMAGE_PATH] |
|
601 |
if floppy_image: |
|
602 |
options = ',format=raw,media=disk' |
|
603 |
if boot_floppy: |
|
604 |
kvm_cmd.extend(['-boot', 'a']) |
|
605 |
options = '%s,boot=on' % options |
|
606 |
if_val = ',if=floppy' |
|
607 |
options = '%s%s' % (options, if_val) |
|
608 |
drive_val = 'file=%s%s' % (floppy_image, options) |
|
609 |
kvm_cmd.extend(['-drive', drive_val]) |
|
610 |
|
|
577 | 611 |
kernel_path = hvp[constants.HV_KERNEL_PATH] |
578 | 612 |
if kernel_path: |
579 | 613 |
kvm_cmd.extend(['-kernel', kernel_path]) |
Also available in: Unified diff