Commit 1213604d authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: actually support different disk types

By passing the relevant if= value to the disk we support different disk
types. The only change is that we'll translate "paravirtual" to
"virtio" to keep only one "paravirtualized" value, around ganeti. The
if= value is calculated outside the disks loop, as it's the same for all
disks (as currently ganeti doesn't support per-disk params).

Reviewed-by: iustinp
parent 5155ede7
......@@ -236,6 +236,12 @@ class KVMHypervisor(hv_base.BaseHypervisor):
boot_disk = (instance.hvparams[constants.HV_BOOT_ORDER] == "disk")
boot_cdrom = (instance.hvparams[constants.HV_BOOT_ORDER] == "cdrom")
disk_type = instance.hvparams[constants.HV_DISK_TYPE]
if disk_type == constants.HT_DISK_PARAVIRTUAL:
if_val = ',if=virtio'
else:
if_val = ',if=%s' % disk_type
for cfdev, dev_path in block_devices:
if cfdev.mode != constants.DISK_RDWR:
raise errors.HypervisorError("Instance has read-only disks which"
......@@ -248,9 +254,6 @@ class KVMHypervisor(hv_base.BaseHypervisor):
else:
boot_val = ''
# TODO: handle different if= types
if_val = ',if=virtio'
drive_val = 'file=%s,format=raw%s%s' % (dev_path, if_val, boot_val)
kvm_cmd.extend(['-drive', drive_val])
......
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