add copied version __dog_vdi from __qemu_img
Signed-off-by: Nico Schottelius <nico@bento.schottelius.org>
This commit is contained in:
		
					parent
					
						
							
								63347497ad
							
						
					
				
			
			
				commit
				
					
						ff8f7ac287
					
				
			
		
					 7 changed files with 97 additions and 0 deletions
				
			
		
							
								
								
									
										23
									
								
								cdist/conf/type/__dog_vdi/explorer/list
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								cdist/conf/type/__dog_vdi/explorer/list
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
#
 | 
			
		||||
# 2014 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/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
name="$__object_id"
 | 
			
		||||
 | 
			
		||||
dog vdi list -r "$name"
 | 
			
		||||
							
								
								
									
										19
									
								
								cdist/conf/type/__dog_vdi/gencode-remote
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								cdist/conf/type/__dog_vdi/gencode-remote
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,19 @@
 | 
			
		|||
################################################################################
 | 
			
		||||
# State: absent is handled by manifest - we need only to do stuff if image is
 | 
			
		||||
# not existing and state != absent
 | 
			
		||||
#
 | 
			
		||||
state="$(cat "$__object/parameter/state")"
 | 
			
		||||
[ "$state" = "absent" ] && exit 0
 | 
			
		||||
 | 
			
		||||
exists="$(cat "$__object/explorer/exists")"
 | 
			
		||||
[ "$exists" ] && exit 0
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# Still there? Create image
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
format="$(cat "$__object/parameter/format")"
 | 
			
		||||
size="$(cat "$__object/parameter/size")"
 | 
			
		||||
diskimage="/$__object_id"
 | 
			
		||||
 | 
			
		||||
echo qemu-img create -f \"$format\" \"$diskimage\" \"$size\"
 | 
			
		||||
							
								
								
									
										50
									
								
								cdist/conf/type/__dog_vdi/man.text
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								cdist/conf/type/__dog_vdi/man.text
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,50 @@
 | 
			
		|||
cdist-type__dog_vdi(7)
 | 
			
		||||
======================
 | 
			
		||||
Nico Schottelius <nico-cdist--@--schottelius.org>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
cdist-type__dog_vdi - Manage Sheepdog VM images
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
The dog program is used to create qemu images for
 | 
			
		||||
qemu and (qemu-)kvm.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
REQUIRED PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
size::
 | 
			
		||||
    Size of the image in dog vdi compatible units.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
OPTIONAL PARAMETERS
 | 
			
		||||
-------------------
 | 
			
		||||
state::
 | 
			
		||||
    Either "present" or "absent", defaults to "present"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
# Create a 50G size image
 | 
			
		||||
__dog_vdi nico-privat.sky.ungleich.ch --size 50G
 | 
			
		||||
 | 
			
		||||
# Remove image
 | 
			
		||||
__dog_vdi nico-privat.sky.ungleich.ch --state absent
 | 
			
		||||
--------------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
SEE ALSO
 | 
			
		||||
--------
 | 
			
		||||
- cdist-type(7)
 | 
			
		||||
- dog(8)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
COPYING
 | 
			
		||||
-------
 | 
			
		||||
Copyright \(C) 2014 Nico Schottelius. Free use of this software is
 | 
			
		||||
granted under the terms of the GNU General Public License version 3 (GPLv3).
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/default/format
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/default/format
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
qcow2
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/default/state
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
present
 | 
			
		||||
							
								
								
									
										2
									
								
								cdist/conf/type/__dog_vdi/parameter/optional
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								cdist/conf/type/__dog_vdi/parameter/optional
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
format
 | 
			
		||||
state
 | 
			
		||||
							
								
								
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/required
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								cdist/conf/type/__dog_vdi/parameter/required
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
size
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue