Signed-off-by: Giuseppe Scrivano <gscrivan@xxxxxxxxxx> --- tests/storage.py | 3 +++ tests/xmlparse-xml/pool-gluster-out.xml | 9 +++++++++ tests/xmlparse-xml/pool-gluster.xml | 8 ++++++++ tests/xmlparse.py | 13 +++++++++++++ virtinst/storage.py | 10 ++++++---- 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 tests/xmlparse-xml/pool-gluster-out.xml create mode 100644 tests/xmlparse-xml/pool-gluster.xml diff --git a/tests/storage.py b/tests/storage.py index 7363a2c..547bd8b 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 0000000..b38999a --- /dev/null +++ b/tests/xmlparse-xml/pool-gluster-out.xml @@ -0,0 +1,9 @@ +<pool type="gluster"> + <name>pool-gluster</name> + <uuid>10310811-7115-1161-0111-410310811711</uuid> + <source> + <host name="my.host"/> + <name>pool-gluster</name> + <dir path="/foo"/> + </source> +</pool> diff --git a/tests/xmlparse-xml/pool-gluster.xml b/tests/xmlparse-xml/pool-gluster.xml new file mode 100644 index 0000000..1fb1276 --- /dev/null +++ b/tests/xmlparse-xml/pool-gluster.xml @@ -0,0 +1,8 @@ +<pool type="gluster"> + <name>pool-gluster</name> + <uuid>10310811-7115-1161-0111-410310811711</uuid> + <source> + <host name="some.random.hostname"/> + <name>pool-gluster</name> + </source> +</pool> diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 4724f22..dcd6865 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 8e0f8f9..98fcc7c 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): """ -- 1.8.5.3 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list