Ejemplo n.º 1
0
class StorageServersModel(object):
    def __init__(self, **kargs):
        self.conn = kargs['conn']
        self.pool = StoragePoolModel(**kargs)
        self.pools = StoragePoolsModel(**kargs)

    def get_list(self, _target_type=None):
        if not _target_type:
            target_type = STORAGE_SERVERS
        else:
            target_type = [_target_type]

        pools = self.pools.get_list()

        server_list = []
        for pool in pools:
            try:
                pool_info = self.pool.lookup(pool)
                if (pool_info['type'] in target_type and
                        pool_info['source']['addr'] not in server_list):
                    # Avoid to add same server for multiple times
                    # if it hosts more than one storage type
                    server_list.append(pool_info['source']['addr'])
            except NotFoundError:
                pass

        return server_list
Ejemplo n.º 2
0
class StorageServersModel(object):
    def __init__(self, **kargs):
        self.conn = kargs['conn']
        self.pool = StoragePoolModel(**kargs)
        self.pools = StoragePoolsModel(**kargs)

    def get_list(self, _target_type=None):
        if not _target_type:
            target_type = STORAGE_SERVERS
        else:
            target_type = [_target_type]

        pools = self.pools.get_list()

        server_list = []
        for pool in pools:
            try:
                pool_info = self.pool.lookup(pool)
                if (pool_info['type'] in target_type
                        and pool_info['source']['addr'] not in server_list):
                    # Avoid to add same server for multiple times
                    # if it hosts more than one storage type
                    server_list.append(pool_info['source']['addr'])
            except NotFoundError:
                pass

        return server_list
Ejemplo n.º 3
0
 def __init__(self, **kargs):
     self.conn = kargs['conn']
     self.pool = StoragePoolModel(**kargs)
     self.pools = StoragePoolsModel(**kargs)
Ejemplo n.º 4
0
 def __init__(self, **kargs):
     self.conn = kargs['conn']
     self.pool = StoragePoolModel(**kargs)
     self.pools = StoragePoolsModel(**kargs)