Commit f6da94eb authored by Łukasz Nowak's avatar Łukasz Nowak

fixup! kvm: Implement external-disk

parent aca81eb3
Pipeline #22229 failed with stage
in 0 seconds
......@@ -55,7 +55,7 @@ md5sum = a8cf453d20f01c707f02c4b4014580d8
[template-kvm-run]
filename = template/template-kvm-run.in
md5sum = 2b025e5828901a92d2ed25d6ee9f7412
md5sum = d2835e75f27e3bebada549924000c0e3
[template-kvm-controller]
filename = template/kvm-controller-run.in
......
......@@ -562,7 +562,7 @@
},
"index": {
"title": "Index of a disk",
"description": "An index value used to order disks for the VM, if not specified, disk order will be random on each run.",
"description": "An index value used to order disks for the VM, required if more than one disk is used to have stable ordering.",
"type": "integer",
"default": 0
}
......
......@@ -419,7 +419,7 @@
},
"index": {
"title": "Index of a disk",
"description": "An index value used to order disks for the VM, if not specified, disk order will be random on each run.",
"description": "An index value used to order disks for the VM, required if more than one disk is used to have stable ordering.",
"type": "integer",
"default": 0
}
......
......@@ -308,15 +308,12 @@ for disk in additional_disk_list:
kvm_argument_list.extend([
'-drive', 'file=%s,if=%s' % (disk, disk_type)])
# support external-disk parameter
# allow empty index if only one disk is provided
automatic_index_applied = False
for entry in external_disk.keys():
if 'index' not in external_disk[entry]:
if automatic_index_applied:
if len(external_disk) > 1:
for key, value in external_disk.items():
if 'index' not in value:
raise ValueError('index is missing and more than one disk is present in external-disk configuration')
external_disk[entry]['index'] = 0
automatic_index_applied = True
# support external-disk parameter
for disk_info in sorted(external_disk.values(), key=operator.itemgetter('index')):
if disk_info['path'].startswith('rbd:') or disk_info['path'].startswith('/'):
path = disk_info['path']
......
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