rename vm to diskimage, ensure state is setup

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-11-07 17:40:39 +01:00
parent a4b2e2ce95
commit 265d1af56a
2 changed files with 7 additions and 5 deletions

View file

@ -2,7 +2,8 @@
# State: absent is handled by manifest - we need only to do stuff if image is
# not existing and state != absent
#
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
state="present"
[ -f "$__object/parameter/state" ] state="$(cat "$__object/parameter/state")"
[ "$state" = "absent" ] && exit 0
exists="$(cat "$__object/explorer/exists")"
@ -15,6 +16,6 @@ exists="$(cat "$__object/explorer/exists")"
format=qcow2
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
size="$(cat "$__object/parameter/size")"
vm="/$__object_id"
diskimage="/$__object_id"
echo qemu-img create -f \"$format\" \"$vm\" \"$size\"
echo qemu-img create -f \"$format\" \"$diskimage\" \"$size\"

View file

@ -3,12 +3,13 @@
#
format=qcow2
state=present
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
[ -f "$__object/parameter/state" ] && state="$(cat "$__object/parameter/state")"
vm="/$__object_id"
diskimage="/$__object_id"
# Absent is ensured by __file, present by gencode-remote
if [ "$state" = "absent" ]; then
__file "$vm" --state absent
__file "$diskimage" --state absent
fi