aboutsummaryrefslogtreecommitdiffstats
path: root/modules/libvirtd/files/storage_add.py
blob: 10369e36aa77684646d2762ca3018ca256e23852 (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
#!/usr/bin/python3
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)