def add_alba_backend(name, wait=True): """ Put an ALBA backend in the model :param name: Name of the backend :param wait: Wait for backend to enter RUNNING state :return: Newly created ALBA backend """ backend = GeneralBackend.get_by_name(name) if backend is None: backend = GeneralBackend.add_backend(name, 'alba') alba_backend = AlbaBackend(GeneralAlba.api.add('alba/backends', {'backend_guid': backend.guid})['guid']) if wait is True: GeneralAlba.wait_for_alba_backend_status(alba_backend) out, err, _ = General.execute_command('etcdctl ls /ovs/alba/asdnodes') if err == '' and len(out): AlbaNodeController.model_local_albanode() return GeneralBackend.get_by_name(name).alba_backend
def add_alba_backend(name, scaling='LOCAL', wait=True): """ Put an ALBA backend in the model :param name: Name of the backend :param scaling: Alba backend can be LOCAL or GLOBAL :param wait: Wait for backend to enter RUNNING state :return: Newly created ALBA backend """ alba_backend = GeneralAlba.get_by_name(name) if alba_backend is None: backend = GeneralBackend.add_backend(name, 'alba') alba_backend = AlbaBackend(GeneralAlba.api.add('alba/backends', {'backend_guid': backend.guid, 'scaling': scaling})['guid']) if wait is True: GeneralAlba.wait_for_alba_backend_status(alba_backend) alba_nodes = [alba_node for alba_node in Configuration.list('/ovs/alba/asdnodes')] if len(alba_nodes): AlbaNodeController.model_albanodes() return GeneralAlba.get_by_name(name)