| 1 | import unittest |
| 2 | import libvirt |
| 3 | |
| 4 | |
| 5 | class TestLibvirtStorage(unittest.TestCase): |
| 6 | def setUp(self): |
| 7 | self.conn = libvirt.open("test:///default") |
| 8 | self.pool = self.conn.storagePoolLookupByName("default-pool") |
| 9 | |
| 10 | def tearDown(self): |
| 11 | self.pool = None |
| 12 | self.conn = None |
| 13 | |
| 14 | def testAttr(self): |
| 15 | self.assertEqual(self.pool.name(), "default-pool") |
| 16 | |
| 17 | def testVol(self): |
| 18 | volxml = '''<volume type="file"> |
| 19 | <name>raw.img</name> |
| 20 | <allocation unit="M">10</allocation> |
| 21 | <capacity unit="M">1000</capacity> |
| 22 | </volume>''' |
| 23 | |
| 24 | vol = self.pool.createXML(volxml) |