Esempio n. 1
0
    def load(vpool):
        """
        Initializes the wrapper for a given vPool
        :param vpool: vPool for which the FileSystemMetaDataClient needs to be loaded
        """
        if FileSystemMetaDataClient is None:
            raise FeatureNotAvailableException()

        if os.environ.get('RUNNING_UNITTESTS') == 'True':
            return FileSystemMetaDataClient(str(vpool.guid), None, None)

        key = vpool.identifier
        if key not in fsmclient_vpool_cache:
            arakoon_cluster_name = str(
                Configuration.get('/ovs/framework/arakoon_clusters|voldrv'))
            config = ArakoonClusterConfig(cluster_id=arakoon_cluster_name)
            arakoon_node_configs = []
            for node in config.nodes:
                arakoon_node_configs.append(
                    ArakoonNodeConfig(str(node.name), str(node.ip),
                                      node.client_port))
            client = FileSystemMetaDataClient(str(vpool.guid),
                                              arakoon_cluster_name,
                                              arakoon_node_configs)
            fsmclient_vpool_cache[key] = client
        return fsmclient_vpool_cache[key]
Esempio n. 2
0
    def load(vpool):
        """
        Initializes the wrapper for a given vpool
        :param vpool: vPool for which the ClusterRegistryClient needs to be loaded
        """
        if os.environ.get('RUNNING_UNITTESTS') == 'True':
            return ClusterRegistry(str(vpool.guid), None, None)

        key = vpool.identifier
        if key not in crclient_vpool_cache:
            arakoon_cluster_name = str(
                Configuration.get('/ovs/framework/arakoon_clusters|voldrv'))
            config = ArakoonClusterConfig(cluster_id=arakoon_cluster_name)
            arakoon_node_configs = []
            for node in config.nodes:
                arakoon_node_configs.append(
                    ArakoonNodeConfig(str(node.name), str(node.ip),
                                      node.client_port))
            client = ClusterRegistry(str(vpool.guid), arakoon_cluster_name,
                                     arakoon_node_configs)
            crclient_vpool_cache[key] = client
        return crclient_vpool_cache[key]