aboutsummaryrefslogtreecommitdiffstats
path: root/modules/libvirtd/files/storage_add.py
blob: 5d95922d5f71dd935444fcffb348fd871508b677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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.storagePoolDefineXML(storage_xml,0)