framework icon indicating copy to clipboard operation
framework copied to clipboard

ignore nsm cluster if already present in the abm

Open jeroenmaelbrancke opened this issue 7 years ago • 2 comments

Readding a backend (delete, add) with external Arakoons ends up with errors:

May 09 11:44:04 stor-221-3 celery[14181]:   File "/opt/OpenvStorage/ovs/lib/alba.py", line 536, in _alba_arakoon_checkup
May 09 11:44:04 stor-221-3 celery[14181]:     ip=clients.keys()[0])
May 09 11:44:04 stor-221-3 celery[14181]:   File "/opt/OpenvStorage/ovs/lib/alba.py", line 1105, in _register_nsm
May 09 11:44:04 stor-221-3 celery[14181]:     client=SSHClient(endpoint=ip))
May 09 11:44:04 stor-221-3 celery[14181]:   File "/opt/OpenvStorage/ovs/extensions/plugins/albacli.py", line 139, in run
May 09 11:44:04 stor-221-3 celery[14181]:     raise AlbaError(output['error']['message'], output['error']['exception_code'])
May 09 11:44:04 stor-221-3 celery[14181]: AlbaError: Albamgr exception(Albamgr_protocol.Protocol.Error.Nsm_host_already_exists,Albamgr_protocol.Protocol.Error.Nsm_host_already_exists)

You can fix this with checking the list-nsm-hosts on the abm and if not present register else return

    @staticmethod
    def _register_nsm(abm_name, nsm_name, ip):
        """
        Register the NSM service to the cluster
        :param abm_name: Name of the ABM cluster
        :type abm_name: str
        :param nsm_name: Name of the NSM cluster
        :type nsm_name: str
        :param ip: IP of node in the cluster to register
        :type ip: str
        :return: None
        """
        nsm_config_file = Configuration.get_configuration_path(ArakoonClusterConfig.CONFIG_KEY.format(nsm_name))
        abm_config_file = Configuration.get_configuration_path(ArakoonClusterConfig.CONFIG_KEY.format(abm_name))
        for host in AlbaCLI.run(command='list-nsm-hosts', config=abm_config_file, client=SSHClient(ip)):
            if host['cluster_id'] == nsm_name:
                return
        AlbaCLI.run(command='add-nsm-host',
                    config=abm_config_file,
                    extra_params=[nsm_config_file],
                    client=SSHClient(endpoint=ip))

jeroenmaelbrancke avatar May 09 '17 10:05 jeroenmaelbrancke