Revision 5f045eb8 lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
1307 | 1307 |
data.append(info) |
1308 | 1308 |
return data |
1309 | 1309 |
|
1310 |
def _GenerateKVMBlockDevicesOptions(self, instance, kvm_disks, |
|
1310 |
def _GenerateKVMBlockDevicesOptions(self, instance, up_hvp, kvm_disks,
|
|
1311 | 1311 |
kvmhelp, devlist): |
1312 | 1312 |
"""Generate KVM options regarding instance's block devices. |
1313 | 1313 |
|
1314 | 1314 |
@type instance: L{objects.Instance} |
1315 | 1315 |
@param instance: the instance object |
1316 |
@type up_hvp: dict |
|
1317 |
@param up_hvp: the instance's runtime hypervisor parameters |
|
1316 | 1318 |
@type kvm_disks: list of tuples |
1317 | 1319 |
@param kvm_disks: list of tuples [(disk, link_name)..] |
1318 | 1320 |
@type kvmhelp: string |
... | ... | |
1323 | 1325 |
@return: list of command line options eventually used by kvm executable |
1324 | 1326 |
|
1325 | 1327 |
""" |
1326 |
hvp = instance.hvparams |
|
1327 |
kernel_path = hvp[constants.HV_KERNEL_PATH] |
|
1328 |
kernel_path = up_hvp[constants.HV_KERNEL_PATH] |
|
1328 | 1329 |
if kernel_path: |
1329 | 1330 |
boot_disk = False |
1330 | 1331 |
else: |
1331 |
boot_disk = hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK |
|
1332 |
boot_disk = up_hvp[constants.HV_BOOT_ORDER] == constants.HT_BO_DISK
|
|
1332 | 1333 |
|
1333 | 1334 |
# whether this is an older KVM version that uses the boot=on flag |
1334 | 1335 |
# on devices |
... | ... | |
1336 | 1337 |
|
1337 | 1338 |
dev_opts = [] |
1338 | 1339 |
device_driver = None |
1339 |
disk_type = hvp[constants.HV_DISK_TYPE] |
|
1340 |
disk_type = up_hvp[constants.HV_DISK_TYPE]
|
|
1340 | 1341 |
if disk_type == constants.HT_DISK_PARAVIRTUAL: |
1341 | 1342 |
if_val = ",if=%s" % self._VIRTIO |
1342 | 1343 |
try: |
... | ... | |
1349 | 1350 |
else: |
1350 | 1351 |
if_val = ",if=%s" % disk_type |
1351 | 1352 |
# Cache mode |
1352 |
disk_cache = hvp[constants.HV_DISK_CACHE] |
|
1353 |
disk_cache = up_hvp[constants.HV_DISK_CACHE]
|
|
1353 | 1354 |
if instance.disk_template in constants.DTS_EXT_MIRROR: |
1354 | 1355 |
if disk_cache != "none": |
1355 | 1356 |
# TODO: make this a hard error, instead of a silent overwrite |
... | ... | |
1903 | 1904 |
devlist = self._GetKVMOutput(kvm_path, self._KVMOPT_DEVICELIST) |
1904 | 1905 |
|
1905 | 1906 |
bdev_opts = self._GenerateKVMBlockDevicesOptions(instance, |
1907 |
up_hvp, |
|
1906 | 1908 |
kvm_disks, |
1907 | 1909 |
kvmhelp, |
1908 | 1910 |
devlist) |
Also available in: Unified diff