Merge branch 'master' into __pf_ruleset

This commit is contained in:
Jake Guffey 2012-09-19 17:53:07 -04:00
commit 5f435c1be7
7 changed files with 116 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,51 @@
cdist-type__qemu_img(7)
========================
Nico Schottelius <nico-cdist--@--schottelius.org>
NAME
----
cdist-type__qemu_img - Manage VM disk images
DESCRIPTION
-----------
The qemu-img program is used to create qemu images for
qemu and (qemu-)kvm.
REQUIRED PARAMETERS
-------------------
size::
Size of the image in qemu-img compatible units.
See qemu-img(1).
OPTIONAL PARAMETERS
-------------------
state::
The state of the image file: either "present" or "absent".
Defaults to "present".
EXAMPLES
--------
--------------------------------------------------------------------------------
# Ensure zsh in installed
__qemu_img /home/services/kvm/vm/myvmname/system-disk --size 50G
# Remove image
__qemu_img /home/services/kvm/vm/myoldvm/system-disk --state absent
--------------------------------------------------------------------------------
SEE ALSO
--------
- cdist-type(7)
COPYING
-------
Copyright \(C) 2012 Nico Schottelius. Free use of this software is
granted under the terms of the GNU General Public License version 3 (GPLv3).

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

View file

@ -6,6 +6,7 @@ Changelog
2.0.15:
* Core: Make variable __object_name available in type explorers (Steven Armtrong)
* New Type: __qemu_img
2.0.14: 2012-09-07
* Bugfix Type: __jail: Use correct variable (Jake Guffey)