mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-02 09:47:16 +03:00
storage: add support for gluster fs pools.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
a2706e9258
commit
7a1ffff927
@ -214,6 +214,9 @@ class TestStorage(unittest.TestCase):
|
|||||||
def testMpathPool(self):
|
def testMpathPool(self):
|
||||||
createPool(self.conn, StoragePool.TYPE_MPATH, "pool-mpath")
|
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):
|
def _enumerateCompare(self, name, pool_list):
|
||||||
for pool in pool_list:
|
for pool in pool_list:
|
||||||
pool.name = name + str(pool_list.index(pool))
|
pool.name = name + str(pool_list.index(pool))
|
||||||
|
9
tests/xmlparse-xml/pool-gluster-out.xml
Normal file
9
tests/xmlparse-xml/pool-gluster-out.xml
Normal file
@ -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>
|
8
tests/xmlparse-xml/pool-gluster.xml
Normal file
8
tests/xmlparse-xml/pool-gluster.xml
Normal file
@ -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>
|
@ -1050,6 +1050,19 @@ class XMLParseTest(unittest.TestCase):
|
|||||||
utils.diff_compare(pool.get_xml_config(), outfile)
|
utils.diff_compare(pool.get_xml_config(), outfile)
|
||||||
utils.test_create(conn, pool.get_xml_config(), "storagePoolDefineXML")
|
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):
|
def testVol(self):
|
||||||
basename = "pool-dir-vol"
|
basename = "pool-dir-vol"
|
||||||
infile = "tests/xmlparse-xml/%s-in.xml" % basename
|
infile = "tests/xmlparse-xml/%s-in.xml" % basename
|
||||||
|
@ -99,6 +99,7 @@ class StoragePool(_StorageObject):
|
|||||||
TYPE_ISCSI = "iscsi"
|
TYPE_ISCSI = "iscsi"
|
||||||
TYPE_SCSI = "scsi"
|
TYPE_SCSI = "scsi"
|
||||||
TYPE_MPATH = "mpath"
|
TYPE_MPATH = "mpath"
|
||||||
|
TYPE_GLUSTER = "gluster"
|
||||||
|
|
||||||
# Pool type descriptions for use in higher level programs
|
# Pool type descriptions for use in higher level programs
|
||||||
_descs = {}
|
_descs = {}
|
||||||
@ -110,6 +111,7 @@ class StoragePool(_StorageObject):
|
|||||||
_descs[TYPE_ISCSI] = _("iSCSI Target")
|
_descs[TYPE_ISCSI] = _("iSCSI Target")
|
||||||
_descs[TYPE_SCSI] = _("SCSI Host Adapter")
|
_descs[TYPE_SCSI] = _("SCSI Host Adapter")
|
||||||
_descs[TYPE_MPATH] = _("Multipath Device Enumerator")
|
_descs[TYPE_MPATH] = _("Multipath Device Enumerator")
|
||||||
|
_descs[TYPE_GLUSTER] = _("Gluster Filesystem")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_pool_types():
|
def get_pool_types():
|
||||||
@ -384,9 +386,9 @@ class StoragePool(_StorageObject):
|
|||||||
users = {
|
users = {
|
||||||
"source_path": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_LOGICAL,
|
"source_path": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_LOGICAL,
|
||||||
self.TYPE_DISK, self.TYPE_ISCSI, self.TYPE_SCSI],
|
self.TYPE_DISK, self.TYPE_ISCSI, self.TYPE_SCSI],
|
||||||
"source_name": [self.TYPE_LOGICAL],
|
"source_name": [self.TYPE_LOGICAL, self.TYPE_GLUSTER],
|
||||||
"host": [self.TYPE_NETFS, self.TYPE_ISCSI],
|
"source_dir" : [self.TYPE_GLUSTER, self.TYPE_NETFS],
|
||||||
"source_dir" : [self.TYPE_NETFS],
|
"host": [self.TYPE_NETFS, self.TYPE_ISCSI, self.TYPE_GLUSTER],
|
||||||
"format": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_DISK],
|
"format": [self.TYPE_FS, self.TYPE_NETFS, self.TYPE_DISK],
|
||||||
"iqn": [self.TYPE_ISCSI],
|
"iqn": [self.TYPE_ISCSI],
|
||||||
"target_path" : [self.TYPE_DIR, self.TYPE_FS, self.TYPE_NETFS,
|
"target_path" : [self.TYPE_DIR, self.TYPE_FS, self.TYPE_NETFS,
|
||||||
@ -412,7 +414,7 @@ class StoragePool(_StorageObject):
|
|||||||
return self.type in [
|
return self.type in [
|
||||||
StoragePool.TYPE_DIR, StoragePool.TYPE_FS,
|
StoragePool.TYPE_DIR, StoragePool.TYPE_FS,
|
||||||
StoragePool.TYPE_NETFS, StoragePool.TYPE_LOGICAL,
|
StoragePool.TYPE_NETFS, StoragePool.TYPE_LOGICAL,
|
||||||
StoragePool.TYPE_DISK]
|
StoragePool.TYPE_DISK, StoragePool.TYPE_GLUSTER]
|
||||||
|
|
||||||
def get_vm_disk_type(self):
|
def get_vm_disk_type(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user