Ejemplo n.º 1
0
def createPool(conn,
               ptype,
               poolname=None,
               fmt=None,
               target_path=None,
               source_path=None,
               source_name=None,
               uuid=None):
    poolclass = StoragePool.get_pool_class(ptype)

    if poolname is None:
        poolname = _findFreePoolName(conn, str(ptype) + "-pool")

    if uuid is None:
        uuid = generate_uuid_from_string(poolname)

    pool_inst = poolclass(conn=conn, name=poolname, uuid=uuid)

    if hasattr(pool_inst, "host"):
        pool_inst.host = "some.random.hostname"
    if hasattr(pool_inst, "source_path"):
        pool_inst.source_path = source_path or "/some/source/path"
    if hasattr(pool_inst, "target_path"):
        pool_inst.target_path = target_path or "/some/target/path"
    if fmt and hasattr(pool_inst, "format"):
        pool_inst.format = fmt
    if source_name and hasattr(pool_inst, "source_name"):
        pool_inst.source_name = source_name

    return poolCompare(pool_inst)
Ejemplo n.º 2
0
def createPool(conn, ptype, poolname=None, fmt=None, target_path=None,
               source_path=None, source_name=None, uuid=None, iqn=None):
    poolclass = StoragePool.get_pool_class(ptype)

    if poolname is None:
        poolname = _findFreePoolName(conn, str(ptype) + "-pool")

    if uuid is None:
        uuid = generate_uuid_from_string(poolname)

    pool_inst = poolclass(conn=conn, name=poolname, uuid=uuid)

    if hasattr(pool_inst, "host"):
        pool_inst.host = "some.random.hostname"
    if hasattr(pool_inst, "source_path"):
        pool_inst.source_path = source_path or "/some/source/path"
    if hasattr(pool_inst, "target_path"):
        pool_inst.target_path = target_path or "/some/target/path"
    if fmt and hasattr(pool_inst, "format"):
        pool_inst.format = fmt
    if source_name and hasattr(pool_inst, "source_name"):
        pool_inst.source_name = source_name
    if iqn and hasattr(pool_inst, "iqn"):
        pool_inst.iqn = iqn

    return poolCompare(pool_inst)
Ejemplo n.º 3
0
    def testEnumerateiSCSI(self):
        name = "pool-iscsi-list"
        host = "example.com"

        lst = StoragePool.pool_list_from_sources(self.conn, name,
                                                 StoragePool.TYPE_ISCSI,
                                                 host=host)
        self.assertTrue(len(lst) == 0)
Ejemplo n.º 4
0
    def testEnumerateNetFS(self):
        name = "pool-netfs-list"
        host = "example.com"

        lst = StoragePool.pool_list_from_sources(self.conn, name,
                                                 StoragePool.TYPE_NETFS,
                                                 host=host)
        self._enumerateCompare(lst)
Ejemplo n.º 5
0
    def testEnumerateiSCSI(self):
        name = "pool-iscsi-list"
        host = "example.com"

        lst = StoragePool.pool_list_from_sources(self.conn,
                                                 name,
                                                 StoragePool.TYPE_ISCSI,
                                                 host=host)
        self.assertTrue(len(lst) == 0)
Ejemplo n.º 6
0
    def testEnumerateNetFS(self):
        name = "pool-netfs-list"
        host = "example.com"

        lst = StoragePool.pool_list_from_sources(self.conn,
                                                 name,
                                                 StoragePool.TYPE_NETFS,
                                                 host=host)
        self._enumerateCompare(lst)
Ejemplo n.º 7
0
    def testEnumerateLogical(self):
        name = "pool-logical-list"

        lst = StoragePool.pool_list_from_sources(self.conn, name,
                                                 StoragePool.TYPE_LOGICAL)
        self._enumerateCompare(lst)
Ejemplo n.º 8
0
    def testEnumerateLogical(self):
        name = "pool-logical-list"

        lst = StoragePool.pool_list_from_sources(self.conn, name,
                                                 StoragePool.TYPE_LOGICAL)
        self._enumerateCompare(lst)