Commit 3a75be90 authored by Łukasz Nowak's avatar Łukasz Nowak

software/kvm: Reuse disk-image-corruption template

parent a462749c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 1b8048238d27d87ddadf205d4a4aa941 md5sum = 62e03ff190c85b29d692fd8a04d03e36
[template-kvm] [template-kvm]
filename = instance-kvm.cfg.jinja2 filename = instance-kvm.cfg.jinja2
...@@ -31,7 +31,7 @@ md5sum = 12d46a7d45f00e091d18e6d4552d0973 ...@@ -31,7 +31,7 @@ md5sum = 12d46a7d45f00e091d18e6d4552d0973
[template-kvm-import] [template-kvm-import]
filename = instance-kvm-import.cfg.jinja2.in filename = instance-kvm-import.cfg.jinja2.in
md5sum = 0829d08337a09b8ef017e71fbb9384fb md5sum = 197f5f20c6ebbeaf61847a30a8c57b89
[template-kvm-import-script] [template-kvm-import-script]
filename = template/kvm-import.sh.jinja2 filename = template/kvm-import.sh.jinja2
......
...@@ -69,19 +69,16 @@ context = ...@@ -69,19 +69,16 @@ context =
raw qmprestore {{ qmprestore }} raw qmprestore {{ qmprestore }}
[kvm-disk-image-corruption-bin] [kvm-disk-image-corruption-bin]
recipe = collective.recipe.template recipe = slapos.recipe.template:jinja2
input = inline:#!/bin/sh url = {{ disk_image_corruption }}
QEMU_IMAGE="${directory:srv}/virtual.qcow2" qemu_img_path = {{ qemu_location }}/bin/qemu-img
if [ ! -s "$QEMU_IMAGE" ]; then disk_path = ${directory:srv}/virtual.qcow2
exit 0 # force empty disk device
fi disk_device_path =
{{ qemu_location }}/bin/qemu-img check $QEMU_IMAGE context =
RETURN_CODE=$? key disk_device_path :disk_device_path
if [ $RETURN_CODE -eq 0 ] || [ $RETURN_CODE -eq 3 ]; then key qemu_img_path :qemu_img_path
exit 0 key disk_path :disk_path
else
exit 1
fi
output = ${directory:bin}/kvm-disk-image-corruption output = ${directory:bin}/kvm-disk-image-corruption
mode = 700 mode = 700
......
...@@ -171,3 +171,4 @@ context = ...@@ -171,3 +171,4 @@ context =
key pbsready_import_template template-pbsready-import:output key pbsready_import_template template-pbsready-import:output
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key qmprestore qmprestore-binary:wrapper-path key qmprestore qmprestore-binary:wrapper-path
raw disk_image_corruption ${disk-image-corruption.sh:target}
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