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

software/kvm: Reuse disk-image-corruption template

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