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 ...@@ -55,7 +55,7 @@ md5sum = a8cf453d20f01c707f02c4b4014580d8
[template-kvm-run] [template-kvm-run]
filename = template/template-kvm-run.in filename = template/template-kvm-run.in
md5sum = 2b025e5828901a92d2ed25d6ee9f7412 md5sum = d2835e75f27e3bebada549924000c0e3
[template-kvm-controller] [template-kvm-controller]
filename = template/kvm-controller-run.in filename = template/kvm-controller-run.in
......
...@@ -562,7 +562,7 @@ ...@@ -562,7 +562,7 @@
}, },
"index": { "index": {
"title": "Index of a disk", "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", "type": "integer",
"default": 0 "default": 0
} }
......
...@@ -419,7 +419,7 @@ ...@@ -419,7 +419,7 @@
}, },
"index": { "index": {
"title": "Index of a disk", "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", "type": "integer",
"default": 0 "default": 0
} }
......
...@@ -308,15 +308,12 @@ for disk in additional_disk_list: ...@@ -308,15 +308,12 @@ for disk in additional_disk_list:
kvm_argument_list.extend([ kvm_argument_list.extend([
'-drive', 'file=%s,if=%s' % (disk, disk_type)]) '-drive', 'file=%s,if=%s' % (disk, disk_type)])
# support external-disk parameter
# allow empty index if only one disk is provided # allow empty index if only one disk is provided
automatic_index_applied = False if len(external_disk) > 1:
for entry in external_disk.keys(): for key, value in external_disk.items():
if 'index' not in external_disk[entry]: if 'index' not in value:
if automatic_index_applied:
raise ValueError('index is missing and more than one disk is present in external-disk configuration') 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')): for disk_info in sorted(external_disk.values(), key=operator.itemgetter('index')):
if disk_info['path'].startswith('rbd:') or disk_info['path'].startswith('/'): if disk_info['path'].startswith('rbd:') or disk_info['path'].startswith('/'):
path = disk_info['path'] 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