aboutsummaryrefslogtreecommitdiffstats
path: root/modules/libvirtd/files/storage_add.py
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-03-29 22:47:59 +0000
committerMichael Scherer <misc@mageia.org>2011-03-29 22:47:59 +0000
commit5d5a3a39efe043dd49897f087528d6e03e5893e5 (patch)
tree9fac44a96292a034e8e418e10e75dbaad13865fc /modules/libvirtd/files/storage_add.py
parent008e72818c517857b16da51871bca3b85510831c (diff)
downloadpuppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.gz
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.bz2
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.tar.xz
puppet-5d5a3a39efe043dd49897f087528d6e03e5893e5.zip
add a type to be able to manage storage directory for libvirtd
Diffstat (limited to 'modules/libvirtd/files/storage_add.py')
-rw-r--r--modules/libvirtd/files/storage_add.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/libvirtd/files/storage_add.py b/modules/libvirtd/files/storage_add.py
new file mode 100644
index 00000000..88475ec6
--- /dev/null
+++ b/modules/libvirtd/files/storage_add.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python
+import libvirt
+import sys
+
+name = sys.argv[1]
+path = sys.argv[2]
+
+storage_xml = """
+<pool type='dir'>
+ <name>%s</name>
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ </source>
+ <target>
+ <path>%s</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>-1</owner>
+ <group>-1</group>
+ </permissions>
+ </target>
+</pool>""" % ( name, path )
+
+c=libvirt.open("qemu:///system")
+c.storagePoolCreateXML(storage_xml,0)
+