diff --git a/tests/storage.py b/tests/storage.py index 7363a2cc0..547bd8b7f 100644 --- a/tests/storage.py +++ b/tests/storage.py @@ -214,6 +214,9 @@ class TestStorage(unittest.TestCase): def testMpathPool(self): createPool(self.conn, StoragePool.TYPE_MPATH, "pool-mpath") + def testGlusterPool(self): + createPool(self.conn, StoragePool.TYPE_GLUSTER, "pool-gluster") + def _enumerateCompare(self, name, pool_list): for pool in pool_list: pool.name = name + str(pool_list.index(pool)) diff --git a/tests/xmlparse-xml/pool-gluster-out.xml b/tests/xmlparse-xml/pool-gluster-out.xml new file mode 100644 index 000000000..b38999a0b --- /dev/null +++ b/tests/xmlparse-xml/pool-gluster-out.xml @@ -0,0 +1,9 @@ + + pool-gluster + 10310811-7115-1161-0111-410310811711 + + + pool-gluster + + + diff --git a/tests/xmlparse-xml/pool-gluster.xml b/tests/xmlparse-xml/pool-gluster.xml new file mode 100644 index 000000000..1fb127611 --- /dev/null +++ b/tests/xmlparse-xml/pool-gluster.xml @@ -0,0 +1,8 @@ + + pool-gluster + 10310811-7115-1161-0111-410310811711 + + + pool-gluster + + diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 4724f2223..dcd6865fa 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -1050,6 +1050,19 @@ class XMLParseTest(unittest.TestCase): utils.diff_compare(pool.get_xml_config(), outfile) utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML") + def testGlusterPool(self): + basename = "pool-gluster" + infile = "tests/storage-xml/%s.xml" % basename + outfile = "tests/xmlparse-xml/%s-out.xml" % basename + pool = virtinst.StoragePool(conn, parsexml=file(infile).read()) + + check = self._make_checker(pool) + check("host", "some.random.hostname", "my.host") + check("source_dir", None, "/foo") + + utils.diff_compare(pool.get_xml_config(), outfile) + utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML") + def testVol(self): basename = "pool-dir-vol" infile = "tests/xmlparse-xml/%s-in.xml" % basename diff --git a/virtinst/storage.py b/virtinst/storage.py index 8e0f8f9c0..98fcc7c15 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -99,6 +99,7 @@ class StoragePool(_StorageObject): TYPE_ISCSI = "iscsi" TYPE_SCSI = "scsi" TYPE_MPATH = "mpath" + TYPE_GLUSTER = "gluster" # Pool type descriptions for use in higher level programs _descs = {} @@ -110,6 +111,7 @@ class StoragePool(_StorageObject): _descs[TYPE_ISCSI] = _("iSCSI Target") _descs[TYPE_SCSI] = _("SCSI Host Adapter") _descs[TYPE_MPATH] = _("Multipath Device Enumerator") + _descs[TYPE_GLUSTER] = _("Gluster Filesystem") @staticmethod def get_pool_types(): @@ -384,9 +386,9 @@ class StoragePool(_StorageObject): users = { "source_path": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_LOGICAL, self.TYPE_DISK, self.TYPE_ISCSI, self.TYPE_SCSI], - "source_name": [self.TYPE_LOGICAL], - "host": [self.TYPE_NETFS, self.TYPE_ISCSI], - "source_dir" : [self.TYPE_NETFS], + "source_name": [self.TYPE_LOGICAL, self.TYPE_GLUSTER], + "source_dir" : [self.TYPE_GLUSTER, self.TYPE_NETFS], + "host": [self.TYPE_NETFS, self.TYPE_ISCSI, self.TYPE_GLUSTER], "format": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_DISK], "iqn": [self.TYPE_ISCSI], "target_path" : [self.TYPE_DIR, self.TYPE_FS, self.TYPE_NETFS, @@ -412,7 +414,7 @@ class StoragePool(_StorageObject): return self.type in [ StoragePool.TYPE_DIR, StoragePool.TYPE_FS, StoragePool.TYPE_NETFS, StoragePool.TYPE_LOGICAL, - StoragePool.TYPE_DISK] + StoragePool.TYPE_DISK, StoragePool.TYPE_GLUSTER] def get_vm_disk_type(self): """