begin type __qemu_img

Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
Nico Schottelius 2012-09-19 21:29:44 +02:00
parent 16ac158c41
commit f6de6d8957
5 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#!/bin/sh
#
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
# Check whether file exists or not
#
destination="/$__object_id"
if [ -e "$destination" ]; then
echo yes
fi

View File

@ -0,0 +1,20 @@
################################################################################
# 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" = "absent" ] && exit 0
exists="$(cat "$__object/explorer/exists")"
[ "$exists" ] && exit 0
################################################################################
# Still there? Create image
#
format=qcow2
[ -f "$__object/parameter/format" ] && format="$(cat "$__object/parameter/format")"
size="$(cat "$__object/parameter/size")"
vm="/$__object_id"
echo qemu-img create -f \"$format\" \"$vm\" \"$size\"

View File

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

View File

@ -0,0 +1 @@
format

View File

@ -0,0 +1 @@
size