def create(self, context, listener, certificate=None): default_pool = None lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] if listener.default_pool and listener.default_pool.id: pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.default_pool.id) if pool_binding: default_pool = pool_binding['edge_pool_id'] edge_cert_id = None if certificate: try: edge_cert_id = self._upload_certificate( context, edge_id, listener.default_tls_container_id, certificate) except Exception: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) app_profile = listener_to_edge_app_profile(listener, edge_cert_id) app_profile_id = None try: with locking.LockManager.get_lock(edge_id): h = (self.vcns.create_app_profile(edge_id, app_profile))[0] app_profile_id = lb_common.extract_resource_id(h['location']) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error('Failed to create app profile on edge: %s', lb_binding['edge_id']) vse = listener_to_edge_vse(context, listener, lb_binding['vip_address'], default_pool, app_profile_id) try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_vip(edge_id, vse)[0] edge_vse_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_listener_binding(context.session, lb_id, listener.id, app_profile_id, edge_vse_id) self.lbv2_driver.listener.successful_completion(context, listener) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error('Failed to create vip on Edge: %s', edge_id) self.vcns.delete_app_profile(edge_id, app_profile_id)
def delete(self, context, pool, completor): lb_id = pool['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, pool['id']) edge_id = lb_binding['edge_id'] if not pool_binding: completor(success=True) return edge_pool_id = pool_binding['edge_pool_id'] listeners_to_update = [] try: if pool['listeners']: for listener in pool['listeners']: # the pool session persistence may affect the associated # pool application profile if (pool['session_persistence'] and listener['default_pool'] and listener['default_pool']['id'] == pool['id']): listeners_to_update.append(listener) listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener['id']) vse = listener_mgr.listener_to_edge_vse( context, listener, lb_binding['vip_address'], None, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip( edge_id, listener_binding['vse_id'], vse) self.vcns.delete_pool(edge_id, edge_pool_id) completor(success=True) nsxv_db.del_nsxv_lbaas_pool_binding( context.session, lb_id, pool['id']) for listener in listeners_to_update: # need to update the listeners too, now with no default pool listener['default_pool'] = None listener_mgr.update_app_profile( self.vcns, context, listener, edge_id) old_lb = lb_common.is_lb_on_router_edge( context, self.core_plugin, lb_binding['edge_id']) if old_lb: lb_common.update_pool_fw_rule(self.vcns, pool['id'], edge_id, self._get_lbaas_fw_section_id(), []) except nsxv_exc.VcnsApiException: completor(success=False) LOG.error('Failed to delete pool %s', pool['id'])
def delete(self, context, listener, completor): lb_id = listener['loadbalancer_id'] listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener['id']) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if lb_binding and listener_binding: edge_id = lb_binding['edge_id'] edge_vse_id = listener_binding['vse_id'] app_profile_id = listener_binding['app_profile_id'] try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_vip(edge_id, edge_vse_id) except (vcns_exc.ResourceNotFound, vcns_exc.RequestBad): LOG.error('vip not found on edge: %s', edge_id) except vcns_exc.VcnsApiException: LOG.error('Failed to delete vip on edge: %s', edge_id) try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_app_profile(edge_id, app_profile_id) except (vcns_exc.ResourceNotFound, vcns_exc.RequestBad): LOG.error('app profile not found on edge: %s', edge_id) except vcns_exc.VcnsApiException: LOG.error('Failed to delete app profile on Edge: %s', edge_id) nsxv_db.del_nsxv_lbaas_listener_binding(context.session, lb_id, listener['id']) completor(success=True)
def update(self, context, old_hm, new_hm, completor): lb_id = new_hm['pool']['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, new_hm['pool']['id'], new_hm['id'], edge_id) edge_monitor = self._convert_lbaas_monitor(new_hm) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_health_monitor(edge_id, hm_binding['edge_mon_id'], edge_monitor) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update monitor on edge: %s', edge_id) completor(success=True)
def _handle_subnet_gw_change(self, *args, **kwargs): # As the Edge appliance doesn't use DHCP, we should change the # default gateway here when the subnet GW changes. context = kwargs.get('context') orig = kwargs['original_subnet'] updated = kwargs['subnet'] if orig['gateway_ip'] == updated['gateway_ip']: return subnet_id = updated['id'] subnet = self.core_plugin.get_subnet(context.elevated(), subnet_id) filters = {'fixed_ips': {'subnet_id': [subnet_id]}, 'device_owner': [constants.DEVICE_OWNER_LOADBALANCERV2]} lb_ports = self.core_plugin.get_ports(context.elevated(), filters=filters) if lb_ports: for lb_port in lb_ports: if lb_port['device_id']: edge_bind = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_port['device_id']) edge_id = edge_bind['edge_id'] self.core_plugin.nsx_v.update_routes( edge_id, subnet['gateway_ip'], [])
def update(self, context, old_listener, new_listener, certificate=None): default_pool = None if new_listener.default_pool and new_listener.default_pool.id: pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, new_listener.loadbalancer_id, new_listener.default_pool.id) if pool_binding: default_pool = pool_binding['edge_pool_id'] else: LOG.error(_LE("Couldn't find pool binding for pool %s"), new_listener.default_pool.id) lb_id = new_listener.loadbalancer_id listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, new_listener.id) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] edge_cert_id = None if certificate: if (old_listener.default_tls_container_id != new_listener.default_tls_container_id): try: edge_cert_id = self._upload_certificate( context, edge_id, new_listener.default_tls_container_id, certificate) except Exception: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion( context, new_listener) else: cert_binding = nsxv_db.get_nsxv_lbaas_certificate_binding( context.session, new_listener.default_tls_container_id, edge_id) edge_cert_id = cert_binding['edge_cert_id'] app_profile_id = listener_binding['app_profile_id'] app_profile = listener_to_edge_app_profile(new_listener, edge_cert_id) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_app_profile(edge_id, app_profile_id, app_profile) vse = listener_to_edge_vse(new_listener, lb_binding['vip_address'], default_pool, app_profile_id) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.lbv2_driver.listener.successful_completion( context, new_listener) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion( context, new_listener) LOG.error(_LE('Failed to update app profile on edge: %s'), edge_id)
def update(self, context, old_pool, new_pool): edge_pool = { 'name': 'pool_' + new_pool.id, 'description': getattr(new_pool, 'description', getattr(new_pool, 'name')), 'algorithm': lb_const.BALANCE_MAP.get( new_pool.lb_algorithm, 'round-robin'), 'transparent': False } listener = new_pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, new_pool.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: with locking.LockManager.get_lock(edge_id): self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.pool.successful_completion(context, new_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.pool.failed_completion(context, new_pool) LOG.error(_LE('Failed to update pool %s'), new_pool['id'])
def update(self, context, old_pool, new_pool): edge_pool = { 'name': 'pool_' + new_pool.id, 'description': getattr(new_pool, 'description', getattr(new_pool, 'name')), 'algorithm': lb_const.BALANCE_MAP.get(new_pool.lb_algorithm, 'round-robin'), 'transparent': False } listener = new_pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, new_pool.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: with locking.LockManager.get_lock(edge_id): self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.pool.successful_completion(context, new_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.pool.failed_completion(context, new_pool) LOG.error(_LE('Failed to update pool %s'), new_pool['id'])
def update(self, context, old_hm, new_hm): lb_id = new_hm.pool.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, new_hm.pool.id, new_hm.id, edge_id) edge_monitor = self._convert_lbaas_monitor(new_hm) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_health_monitor(edge_id, hm_binding['edge_mon_id'], edge_monitor) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion( context, new_hm) LOG.error('Failed to update monitor on edge: %s', edge_id) self.lbv2_driver.health_monitor.successful_completion(context, new_hm)
def create(self, context, hm): lb_id = hm.pool.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, hm.pool.id) if not pool_binding: self.lbv2_driver.health_monitor.failed_completion(context, hm) msg = _('Failed to create health monitor on edge: %s. ' 'Binding not found') % edge_id LOG.error(msg) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, hm.pool.id, hm.id, edge_id) edge_mon_id = None if hm_binding: edge_mon_id = hm_binding['edge_mon_id'] else: edge_monitor = self._convert_lbaas_monitor(hm) try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_health_monitor(edge_id, edge_monitor)[0] edge_mon_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_monitor_binding(context.session, lb_id, hm.pool.id, hm.id, edge_id, edge_mon_id) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion( context, hm) LOG.error('Failed to create health monitor on edge: %s', edge_id) try: # Associate monitor with Edge pool with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('monitorId'): edge_pool['monitorId'].append(edge_mon_id) else: edge_pool['monitorId'] = [edge_mon_id] self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion(context, hm) LOG.error('Failed to create health monitor on edge: %s', edge_id) self.lbv2_driver.health_monitor.successful_completion(context, hm)
def update(self, context, old_listener, new_listener, completor, certificate=None): default_pool = None if (new_listener.get('default_pool') and new_listener['default_pool'].get('id')): pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, new_listener['loadbalancer_id'], new_listener['default_pool']['id']) if pool_binding: default_pool = pool_binding['edge_pool_id'] else: LOG.error("Couldn't find pool binding for pool %s", new_listener['default_pool']['id']) lb_id = new_listener['loadbalancer_id'] listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, new_listener['id']) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] edge_cert_id = None if certificate: if (old_listener['default_tls_container_id'] != new_listener['default_tls_container_id']): try: edge_cert_id = self._upload_certificate( context, edge_id, new_listener['default_tls_container_id'], certificate) except Exception: with excutils.save_and_reraise_exception(): completor(success=False) else: cert_binding = nsxv_db.get_nsxv_lbaas_certificate_binding( context.session, new_listener['default_tls_container_id'], edge_id) edge_cert_id = cert_binding['edge_cert_id'] try: app_profile_id = update_app_profile(self.vcns, context, new_listener, edge_id, edge_cert_id=edge_cert_id) vse = listener_to_edge_vse(context, new_listener, lb_binding['vip_address'], default_pool, app_profile_id) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) completor(success=True) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update app profile on edge: %s', edge_id)
def delete(self, context, pool): listener = pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, pool.id) listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: vse = listener_mgr.listener_to_edge_vse( listener, lb_binding['vip_address'], None, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.vcns.delete_pool(edge_id, edge_pool_id) self.lbv2_driver.pool.successful_completion( context, pool, delete=True) nsxv_db.del_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, pool.id) except nsxv_exc.VcnsApiException: self.lbv2_driver.pool.failed_completion(context, pool) LOG.error(_LE('Failed to delete pool %s'), pool['id'])
def update(self, context, old_hm, new_hm): listener = new_hm.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, listener.id, new_hm.pool.id, new_hm.id, edge_id) edge_monitor = self._convert_lbaas_monitor(new_hm) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_health_monitor(edge_id, hm_binding['edge_mon_id'], edge_monitor) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion(context, new_hm) LOG.error( _LE('Failed to update monitor on edge: %s'), edge_id) self.lbv2_driver.health_monitor.successful_completion(context, new_hm)
def delete(self, context, member): listener = member.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, member.pool_id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(member.id): edge_pool['member'].pop(i) break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.member.successful_completion( context, member, delete=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion(context, member) LOG.error(_LE('Failed to delete member on edge: %s'), edge_id)
def delete(self, context, pool): listener = pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, pool.id) listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: vse = listener_mgr.listener_to_edge_vse( listener, lb_binding['vip_address'], None, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.vcns.delete_pool(edge_id, edge_pool_id) self.lbv2_driver.pool.successful_completion(context, pool, delete=True) nsxv_db.del_nsxv_lbaas_pool_binding(context.session, lb_id, listener.id, pool.id) except nsxv_exc.VcnsApiException: self.lbv2_driver.pool.failed_completion(context, pool) LOG.error(_LE('Failed to delete pool %s'), pool['id'])
def stats(self, context, lb): stats = {'bytes_in': 0, 'bytes_out': 0, 'active_connections': 0, 'total_connections': 0} binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(context.session, lb.id) try: lb_stats = self.vcns.get_loadbalancer_statistics( binding['edge_id']) except nsxv_exc.VcnsApiException: msg = (_('Failed to read load balancer statistics, edge: %s') % binding['edge_id']) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) pools_stats = lb_stats[1].get('pool', []) for pool_stats in pools_stats: stats['bytes_in'] += pool_stats.get('bytesIn', 0) stats['bytes_out'] += pool_stats.get('bytesOut', 0) stats['active_connections'] += pool_stats.get('curSessions', 0) stats['total_connections'] += pool_stats.get('totalSessions', 0) return stats
def delete(self, context, member, completor): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member['pool_id']) edge_id = lb_binding['edge_id'] old_lb = lb_common.is_lb_on_router_edge( context, self.core_plugin, edge_id) with locking.LockManager.get_lock(edge_id): if not cfg.CONF.nsxv.use_routers_as_lbaas_platform: # we should remove LB subnet interface if no members are # attached and this is not the LB's VIP interface remove_interface = True pool = member['pool'] subnet_id = member['subnet_id'] if subnet_id == pool['loadbalancer']['vip_subnet_id']: remove_interface = False else: for m in pool['members']: if (m['subnet_id'] == subnet_id and m['id'] != member['id']): remove_interface = False if remove_interface: lb_common.delete_lb_interface(context, self.core_plugin, lb_id, subnet_id) if not pool_binding: completor(success=True) return edge_pool_id = pool_binding['edge_pool_id'] edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(member['id']): edge_pool['member'].pop(i) break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) if old_lb: member_ips = self._get_pool_member_ips(member['pool'], 'del', member['address']) lb_common.update_pool_fw_rule( self.vcns, member['pool_id'], edge_id, self._get_lbaas_fw_section_id(), member_ips) completor(success=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to delete member on edge: %s', edge_id)
def create(self, context, member, completor): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member['pool_id']) if not pool_binding: completor(success=False) msg = _('Failed to create member on edge: %s. ' 'Binding not found') % edge_id LOG.error(msg) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_pool_id = pool_binding['edge_pool_id'] old_lb = lb_common.is_lb_on_router_edge(context, self.core_plugin, edge_id) with locking.LockManager.get_lock(edge_id): if not cfg.CONF.nsxv.use_routers_as_lbaas_platform and not old_lb: # Verify that Edge appliance is connected to the member's # subnet (only if this is a dedicated loadbalancer edge) if not lb_common.get_lb_interface(context, self.core_plugin, lb_id, member['subnet_id']): lb_common.create_lb_interface(context, self.core_plugin, lb_id, member['subnet_id'], member['tenant_id']) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] edge_member = { 'ipAddress': member['address'], 'weight': member['weight'], 'port': member['protocol_port'], 'monitorPort': member['protocol_port'], 'name': lb_common.get_member_id(member['id']), 'condition': 'enabled' if member['admin_state_up'] else 'disabled' } if edge_pool.get('member'): edge_pool['member'].append(edge_member) else: edge_pool['member'] = [edge_member] try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) if old_lb: member_ips = self._get_pool_member_ips( member['pool'], 'add', member['address']) lb_common.update_pool_fw_rule( self.vcns, member['pool_id'], edge_id, self._get_lbaas_fw_section_id(), member_ips) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create member on edge: %s', edge_id)
def create(self, context, hm, completor): lb_id = hm['pool']['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_id = hm['pool']['id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, pool_id) if not pool_binding: completor(success=False) msg = _('Failed to create health monitor on edge: %s. ' 'Binding not found') % edge_id LOG.error(msg) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm['id'], edge_id) edge_mon_id = None if hm_binding: edge_mon_id = hm_binding['edge_mon_id'] else: edge_monitor = self._convert_lbaas_monitor(hm) try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_health_monitor(edge_id, edge_monitor)[0] edge_mon_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm['id'], edge_id, edge_mon_id) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create health monitor on edge: %s', edge_id) try: # Associate monitor with Edge pool with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('monitorId'): edge_pool['monitorId'].append(edge_mon_id) else: edge_pool['monitorId'] = [edge_mon_id] self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create health monitor on edge: %s', edge_id) completor(success=True)
def update(self, context, old_listener, new_listener, certificate=None): default_pool = None if new_listener.default_pool and new_listener.default_pool.id: pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, new_listener.default_pool.id) if pool_binding: default_pool = pool_binding['edge_pool_id'] lb_id = new_listener.loadbalancer_id listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, new_listener.id) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] edge_cert_id = None if certificate: if (old_listener.default_tls_container_id != new_listener.default_tls_container_id): try: edge_cert_id = self._upload_certificate( context, edge_id, new_listener.default_tls_container_id, certificate) except Exception: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion( context, new_listener) else: cert_binding = nsxv_db.get_nsxv_lbaas_certificate_binding( context.session, new_listener.default_tls_container_id, edge_id) edge_cert_id = cert_binding['edge_cert_id'] app_profile_id = listener_binding['app_profile_id'] app_profile = listener_to_edge_app_profile(new_listener, edge_cert_id) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_app_profile( edge_id, app_profile_id, app_profile) vse = listener_to_edge_vse(new_listener, lb_binding['vip_address'], default_pool, app_profile_id) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.lbv2_driver.listener.successful_completion(context, new_listener) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, new_listener) LOG.error(_LE('Failed to update app profile on edge: %s'), edge_id)
def create(self, context, listener, certificate=None): default_pool = None lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] if listener.default_pool and listener.default_pool.id: pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, listener.default_pool.id) if pool_binding: default_pool = pool_binding['edge_pool_id'] edge_cert_id = None if certificate: try: edge_cert_id = self._upload_certificate( context, edge_id, listener.default_tls_container_id, certificate) except Exception: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) app_profile = listener_to_edge_app_profile(listener, edge_cert_id) app_profile_id = None try: with locking.LockManager.get_lock(edge_id): h = (self.vcns.create_app_profile(edge_id, app_profile))[0] app_profile_id = lb_common.extract_resource_id(h['location']) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error(_LE('Failed to create app profile on edge: %s'), lb_binding['edge_id']) vse = listener_to_edge_vse(listener, lb_binding['vip_address'], default_pool, app_profile_id) try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_vip(edge_id, vse)[0] edge_vse_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_listener_binding(context.session, lb_id, listener.id, app_profile_id, edge_vse_id) self.lbv2_driver.listener.successful_completion(context, listener) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error(_LE('Failed to create vip on Edge: %s'), edge_id) self.vcns.delete_app_profile(edge_id, app_profile_id)
def stats(self, context, lb): binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb['id']) stats = _get_edge_loadbalancer_statistics(self.vcns, binding['edge_id']) return stats
def update(self, context, old_listener, new_listener, completor, certificate=None): default_pool = None if (new_listener.get('default_pool') and new_listener['default_pool'].get('id')): pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, new_listener['loadbalancer_id'], new_listener['default_pool']['id']) if pool_binding: default_pool = pool_binding['edge_pool_id'] else: LOG.error("Couldn't find pool binding for pool %s", new_listener['default_pool']['id']) lb_id = new_listener['loadbalancer_id'] listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, new_listener['id']) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] edge_cert_id = None if certificate: if (old_listener['default_tls_container_id'] != new_listener['default_tls_container_id']): try: edge_cert_id = self._upload_certificate( context, edge_id, new_listener['default_tls_container_id'], certificate) except Exception: with excutils.save_and_reraise_exception(): completor(success=False) else: cert_binding = nsxv_db.get_nsxv_lbaas_certificate_binding( context.session, new_listener['default_tls_container_id'], edge_id) edge_cert_id = cert_binding['edge_cert_id'] try: app_profile_id = update_app_profile( self.vcns, context, new_listener, edge_id, edge_cert_id=edge_cert_id) vse = listener_to_edge_vse(context, new_listener, lb_binding['vip_address'], default_pool, app_profile_id) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) completor(success=True) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update app profile on edge: %s', edge_id)
def update(self, context, old_pool, new_pool, completor): edge_pool = { 'name': 'pool_' + new_pool['id'], 'description': new_pool.get('description', new_pool.get('name')), 'algorithm': lb_const.BALANCE_MAP.get(new_pool['lb_algorithm'], 'round-robin'), 'transparent': False } if new_pool['listener']: listener = new_pool['listener'] lb_id = listener['loadbalancer_id'] else: lb_id = new_pool['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, new_pool['id']) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: with locking.LockManager.get_lock(edge_id): # get the configured monitor-id org_edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] monitor_id = org_edge_pool.get('monitorId') if monitor_id: edge_pool['monitorId'] = monitor_id # Keep the current members if org_edge_pool.get('member'): edge_pool['member'] = org_edge_pool['member'] self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) # if the session_persistence was changed, # we may need to update the listener application profile if new_pool['listener']: old_sess_persist = old_pool['session_persistence'] new_sess_persist = new_pool['session_persistence'] if new_sess_persist != old_sess_persist: listener_mgr.update_app_profile(self.vcns, context, new_pool['listener'], edge_id) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update pool %s', new_pool['id'])
def delete(self, context, member, completor): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member['pool_id']) edge_id = lb_binding['edge_id'] old_lb = lb_common.is_lb_on_router_edge(context, self.core_plugin, edge_id) with locking.LockManager.get_lock(edge_id): if not cfg.CONF.nsxv.use_routers_as_lbaas_platform: # we should remove LB subnet interface if no members are # attached and this is not the LB's VIP interface remove_interface = True pool = member['pool'] subnet_id = member['subnet_id'] if subnet_id == pool['loadbalancer']['vip_subnet_id']: remove_interface = False else: for m in pool['members']: if (m['subnet_id'] == subnet_id and m['id'] != member['id']): remove_interface = False if remove_interface: lb_common.delete_lb_interface(context, self.core_plugin, lb_id, subnet_id) if not pool_binding: completor(success=True) return edge_pool_id = pool_binding['edge_pool_id'] edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(member['id']): edge_pool['member'].pop(i) break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) if old_lb: member_ips = self._get_pool_member_ips( member['pool'], 'del', member['address']) lb_common.update_pool_fw_rule( self.vcns, member['pool_id'], edge_id, self._get_lbaas_fw_section_id(), member_ips) completor(success=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to delete member on edge: %s', edge_id)
def delete(self, context, lb): # Discard any ports which are associated with LB filters = { 'device_id': [lb.id], 'device_owner': [constants.DEVICE_OWNER_NEUTRON_PREFIX + 'LB'] } lb_ports = self.core_plugin.get_ports(context.elevated(), filters=filters) for lb_port in lb_ports: self.core_plugin.delete_port(context.elevated(), lb_port['id']) binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb.id) if binding: edge_binding = nsxv_db.get_nsxv_router_binding_by_edge( context.session, binding['edge_id']) # set LB default rule lb_common.set_lb_firewall_default_rule(self.vcns, binding['edge_id'], 'deny') if edge_binding: old_lb = lb_common.is_lb_on_router_edge( context, self.core_plugin, binding['edge_id']) if not old_lb: resource_id = lb_common.get_lb_resource_id(lb.id) self.core_plugin.edge_manager.delete_lrouter(context, resource_id, dist=False) else: # Edge was created on an exclusive router with the old code try: lb_common.del_vip_fw_rule(self.vcns, binding['edge_id'], binding['edge_fw_rule_id']) except nsxv_exc.VcnsApiException as e: LOG.error( 'Failed to delete loadbalancer %(lb)s ' 'FW rule. exception is %(exc)s', { 'lb': lb.id, 'exc': e }) try: lb_common.del_vip_as_secondary_ip( self.vcns, binding['edge_id'], lb.vip_address) except Exception as e: LOG.error( 'Failed to delete loadbalancer %(lb)s ' 'interface IP. exception is %(exc)s', { 'lb': lb.id, 'exc': e }) nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session, lb.id) self.lbv2_driver.load_balancer.successful_completion(context, lb, delete=True)
def create(self, context, pol, completor): # find out the edge to be updated, by the listener of this policy listener = pol['listener'] lb_id = listener['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if not lb_binding: msg = _('No suitable Edge found for listener %s') % listener['id'] raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) if (listener['protocol'] == lb_const.LB_PROTOCOL_HTTPS or listener['protocol'] == lb_const.LB_PROTOCOL_TERMINATED_HTTPS): msg = _( 'L7 policy is not supported for %(prot)s listener %(ls)s') % { 'prot': listener['protocol'], 'ls': pol['listener_id'] } raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_id = lb_binding['edge_id'] app_rule = policy_to_application_rule(pol) app_rule_id = None try: with locking.LockManager.get_lock(edge_id): # create the backend application rule for this policy h = (self.vcns.create_app_rule(edge_id, app_rule))[0] app_rule_id = lb_common.extract_resource_id(h['location']) # add the nsx application rule (neutron policy) to the nsx # virtual server (neutron listener) vse_id = self._get_vse_id(context, pol) if vse_id: self._add_app_rule_to_virtual_server( edge_id, vse_id, app_rule_id, pol['position']) except Exception as e: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error( 'Failed to create L7policy on edge %(edge)s: ' '%(err)s', { 'edge': edge_id, 'err': e }) if app_rule_id: # Failed to add the rule to the vip: delete the rule # from the backend. try: self.vcns.delete_app_rule(edge_id, app_rule_id) except Exception: pass # save the nsx application rule id in the DB nsxv_db.add_nsxv_lbaas_l7policy_binding(context.session, pol['id'], edge_id, app_rule_id) # complete the transaction completor(success=True)
def create(self, context, hm): listener = hm.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, hm.pool.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, listener.id, hm.pool.id, hm.id, edge_id) edge_mon_id = None if hm_binding: edge_mon_id = hm_binding['edge_mon_id'] else: edge_monitor = self._convert_lbaas_monitor(hm) try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_health_monitor(edge_id, edge_monitor)[0] edge_mon_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_monitor_binding( context.session, lb_id, listener.id, hm.pool.id, hm.id, edge_id, edge_mon_id) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion( context, hm) LOG.error(_LE('Failed to create health monitor on edge: %s' ), edge_id) try: # Associate monitor with Edge pool with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('monitorId'): edge_pool['monitorId'].append(edge_mon_id) else: edge_pool['monitorId'] = [edge_mon_id] self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion(context, hm) LOG.error( _LE('Failed to create health monitor on edge: %s'), edge_id) self.lbv2_driver.health_monitor.successful_completion(context, hm)
def update(self, context, old_pool, new_pool, completor): edge_pool = { 'name': 'pool_' + new_pool['id'], 'description': new_pool.get('description', new_pool.get('name')), 'algorithm': lb_const.BALANCE_MAP.get( new_pool['lb_algorithm'], 'round-robin'), 'transparent': False } if new_pool['listener']: listener = new_pool['listener'] lb_id = listener['loadbalancer_id'] else: lb_id = new_pool['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, new_pool['id']) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] try: with locking.LockManager.get_lock(edge_id): # get the configured monitor-id org_edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] monitor_id = org_edge_pool.get('monitorId') if monitor_id: edge_pool['monitorId'] = monitor_id # Keep the current members if org_edge_pool.get('member'): edge_pool['member'] = org_edge_pool['member'] self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) # if the session_persistence was changed, # we may need to update the listener application profile if new_pool['listener']: old_sess_persist = old_pool['session_persistence'] new_sess_persist = new_pool['session_persistence'] if new_sess_persist != old_sess_persist: listener_mgr.update_app_profile( self.vcns, context, new_pool['listener'], edge_id) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update pool %s', new_pool['id'])
def delete(self, context, hm): pool_id = hm.pool.id lb_id = hm.pool.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, pool_id) if not pool_binding: nsxv_db.del_nsxv_lbaas_monitor_binding(context.session, lb_id, pool_id, hm.id, edge_id) self.lbv2_driver.health_monitor.successful_completion(context, hm, delete=True) return edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm.id, edge_id) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if hm_binding['edge_mon_id'] in edge_pool['monitorId']: edge_pool['monitorId'].remove(hm_binding['edge_mon_id']) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion( context, hm) LOG.error('Failed to delete monitor mapping on edge: %s', edge_id) # If this monitor is not used on this edge anymore, delete it if not edge_pool['monitorId']: try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_health_monitor(hm_binding['edge_id'], hm_binding['edge_mon_id']) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion( context, hm) LOG.error('Failed to delete monitor on edge: %s', edge_id) nsxv_db.del_nsxv_lbaas_monitor_binding(context.session, lb_id, pool_id, hm.id, edge_id) self.lbv2_driver.health_monitor.successful_completion(context, hm, delete=True)
def create(self, context, pool, completor): pool_id = pool['id'] edge_pool = { 'name': 'pool_' + pool_id, 'description': pool.get('description', pool.get('name')), 'algorithm': lb_const.BALANCE_MAP.get(pool['lb_algorithm'], 'round-robin'), 'transparent': False } lb_id = pool['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if not lb_binding: msg = _( 'No suitable Edge found for pool %s') % pool_id raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_id = lb_binding['edge_id'] try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_pool(edge_id, edge_pool)[0] edge_pool_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_pool_binding(context.session, lb_id, pool_id, edge_pool_id) if pool['listener']: listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, pool['listener']['id']) # Associate listener with pool vse = listener_mgr.listener_to_edge_vse( context, pool['listener'], lb_binding['vip_address'], edge_pool_id, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) # This action also set this pool as the default pool of the # listener, so the application profile may need to be updated if pool['session_persistence']: listener_mgr.update_app_profile( self.vcns, context, pool['listener'], edge_id) completor(success=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create pool %s', pool['id'])
def create(self, context, member): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member.pool_id) if not pool_binding: self.lbv2_driver.member.failed_completion( context, member) msg = _('Failed to create member on edge: %s. ' 'Binding not found') % edge_id LOG.error(msg) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_pool_id = pool_binding['edge_pool_id'] with locking.LockManager.get_lock(edge_id): if not lb_common.is_lb_on_router_edge( context.elevated(), self.core_plugin, edge_id): # Verify that Edge appliance is connected to the member's # subnet (only if this is a dedicated loadbalancer edge) if not lb_common.get_lb_interface( context, self.core_plugin, lb_id, member.subnet_id): lb_common.create_lb_interface( context, self.core_plugin, lb_id, member.subnet_id, member.tenant_id) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] edge_member = { 'ipAddress': member.address, 'weight': member.weight, 'port': member.protocol_port, 'monitorPort': member.protocol_port, 'name': lb_common.get_member_id(member.id), 'condition': 'enabled' if member.admin_state_up else 'disabled'} if edge_pool.get('member'): edge_pool['member'].append(edge_member) else: edge_pool['member'] = [edge_member] try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.member.successful_completion(context, member) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion(context, member) LOG.error('Failed to create member on edge: %s', edge_id)
def create(self, context, pol, completor): # find out the edge to be updated, by the listener of this policy listener = pol['listener'] lb_id = listener['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if not lb_binding: msg = _( 'No suitable Edge found for listener %s') % listener['id'] raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) if (listener['protocol'] == lb_const.LB_PROTOCOL_HTTPS or listener['protocol'] == lb_const.LB_PROTOCOL_TERMINATED_HTTPS): msg = _( 'L7 policy is not supported for %(prot)s listener %(ls)s') % { 'prot': listener['protocol'], 'ls': pol['listener_id']} raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_id = lb_binding['edge_id'] app_rule = policy_to_application_rule(pol) app_rule_id = None try: with locking.LockManager.get_lock(edge_id): # create the backend application rule for this policy h = (self.vcns.create_app_rule(edge_id, app_rule))[0] app_rule_id = lb_common.extract_resource_id(h['location']) # add the nsx application rule (neutron policy) to the nsx # virtual server (neutron listener) vse_id = self._get_vse_id(context, pol) if vse_id: self._add_app_rule_to_virtual_server( edge_id, vse_id, app_rule_id, pol['position']) except Exception as e: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create L7policy on edge %(edge)s: ' '%(err)s', {'edge': edge_id, 'err': e}) if app_rule_id: # Failed to add the rule to the vip: delete the rule # from the backend. try: self.vcns.delete_app_rule(edge_id, app_rule_id) except Exception: pass # save the nsx application rule id in the DB nsxv_db.add_nsxv_lbaas_l7policy_binding(context.session, pol['id'], edge_id, app_rule_id) # complete the transaction completor(success=True)
def get_operating_status(self, context, id, with_members=False): """Return a map of the operating status of all connected LB objects """ lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, id) if not lb_binding or not lb_binding['edge_id']: return {} edge_id = lb_binding['edge_id'] lb_stats = self.vcns.get_loadbalancer_statistics(edge_id) lb_status = (lb_const.ONLINE if lb_stats is not None else lb_const.OFFLINE) statuses = { lb_const.LOADBALANCERS: [{ 'id': id, 'status': lb_status }], lb_const.LISTENERS: [], lb_const.POOLS: [], lb_const.MEMBERS: [] } for vs in lb_stats[1].get('virtualServer', []): vs_id = vs['name'][4:] vs_status = (lb_const.ONLINE if vs['status'] == 'OPEN' else lb_const.OFFLINE) statuses[lb_const.LISTENERS].append({ 'id': vs_id, 'status': vs_status }) for pool in lb_stats[1].get('pool', []): pool_id = pool['name'][5:] pool_status = (lb_const.ONLINE if pool['status'] == 'UP' else lb_const.OFFLINE) statuses[lb_const.POOLS].append({ 'id': pool_id, 'status': pool_status }) if with_members: for member in pool.get('member', []): member_id = member['name'][7:] member_status = (lb_const.ONLINE if member['status'] == 'UP' else lb_const.OFFLINE) statuses[lb_const.MEMBERS].append({ 'id': member_id, 'status': member_status }) return statuses
def delete(self, context, pool): lb_id = pool.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, pool.id) edge_id = lb_binding['edge_id'] if not pool_binding: self.lbv2_driver.pool.successful_completion(context, pool, delete=True) return edge_pool_id = pool_binding['edge_pool_id'] listeners_to_update = [] try: if pool.listeners: for listener in pool.listeners: # the pool session persistence may affect the associated # pool application profile if (pool.session_persistence and listener.default_pool and listener.default_pool.id == pool.id): listeners_to_update.append(listener) listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener.id) vse = listener_mgr.listener_to_edge_vse( context, listener, lb_binding['vip_address'], None, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.vcns.delete_pool(edge_id, edge_pool_id) self.lbv2_driver.pool.successful_completion(context, pool, delete=True) nsxv_db.del_nsxv_lbaas_pool_binding(context.session, lb_id, pool.id) for listener in listeners_to_update: # need to update the listeners too, now with no default pool listener.default_pool = None listener_mgr.update_app_profile(self.vcns, context, listener, edge_id) except nsxv_exc.VcnsApiException: self.lbv2_driver.pool.failed_completion(context, pool) LOG.error('Failed to delete pool %s', pool.id)
def get_lb_edge_name(context, lb_id): """Look for the resource name of the edge hosting the LB. For older loadbalancers this may be a router edge """ binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if binding: edge_binding = nsxv_db.get_nsxv_router_binding_by_edge( context.session, binding['edge_id']) if edge_binding: return edge_binding['router_id'] # fallback return get_lb_resource_id(lb_id)
def update(self, context, old_member, new_member): listener = new_member.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, new_member.pool_id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] edge_member = { 'ipAddress': new_member.address, 'weight': new_member.weight, 'port': new_member.protocol_port, 'monitorPort': new_member.protocol_port, 'name': lb_common.get_member_id(new_member.id), 'condition': 'enabled' if new_member.admin_state_up else 'disabled' } with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('member'): for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(new_member.id): edge_pool['member'][i] = edge_member break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.member.successful_completion( context, new_member) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion( context, new_member) LOG.error(_LE('Failed to update member on edge: %s'), edge_id) else: LOG.error( _LE('Pool %(pool_id)s on Edge %(edge_id)s has no ' 'members to update') % { 'pool_id': new_member.pool.id, 'edge_id': edge_id })
def delete(self, context, hm, completor): pool_id = hm['pool']['id'] lb_id = hm['pool']['loadbalancer_id'] lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, pool_id) if not pool_binding: nsxv_db.del_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm['id'], edge_id) completor(success=True) return edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm['id'], edge_id) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if hm_binding and hm_binding['edge_mon_id'] in edge_pool['monitorId']: edge_pool['monitorId'].remove(hm_binding['edge_mon_id']) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to delete monitor mapping on edge: %s', edge_id) # If this monitor is not used on this edge anymore, delete it if hm_binding and not edge_pool['monitorId']: try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_health_monitor(hm_binding['edge_id'], hm_binding['edge_mon_id']) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to delete monitor on edge: %s', edge_id) nsxv_db.del_nsxv_lbaas_monitor_binding( context.session, lb_id, pool_id, hm['id'], edge_id) completor(success=True)
def update(self, context, old_member, new_member): listener = new_member.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(context.session, lb_id, listener.id, new_member.pool_id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] edge_member = { 'ipAddress': new_member.address, 'weight': new_member.weight, 'port': new_member.protocol_port, 'monitorPort': new_member.protocol_port, 'name': lb_common.get_member_id(new_member.id), 'condition': 'enabled' if new_member.admin_state_up else 'disabled'} with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('member'): for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(new_member.id): edge_pool['member'][i] = edge_member break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.member.successful_completion( context, new_member) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion( context, new_member) LOG.error(_LE('Failed to update member on edge: %s'), edge_id) else: LOG.error(_LE('Pool %(pool_id)s on Edge %(edge_id)s has no ' 'members to update') % {'pool_id': new_member.pool.id, 'edge_id': edge_id})
def delete(self, context, member): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member.pool_id) edge_id = lb_binding['edge_id'] with locking.LockManager.get_lock(edge_id): # we should remove LB subnet interface if no members are attached # and this is not the LB's VIP interface remove_interface = True if member.subnet_id == member.pool.loadbalancer.vip_subnet_id: remove_interface = False else: for m in member.pool.members: if m.subnet_id == member.subnet_id and m.id != member.id: remove_interface = False if remove_interface: lb_common.delete_lb_interface(context, self.core_plugin, lb_id, member.subnet_id) if not pool_binding: self.lbv2_driver.member.successful_completion( context, member, delete=True) return edge_pool_id = pool_binding['edge_pool_id'] edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(member.id): edge_pool['member'].pop(i) break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) self.lbv2_driver.member.successful_completion( context, member, delete=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion(context, member) LOG.error('Failed to delete member on edge: %s', edge_id)
def create(self, context, pol): # find out the edge to be updated, by the listener of this policy lb_id = pol.listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if not lb_binding: msg = _('No suitable Edge found for listener %s') % pol.listener_id raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_id = lb_binding['edge_id'] app_rule = policy_to_application_rule(pol) app_rule_id = None try: with locking.LockManager.get_lock(edge_id): # create the backend application rule for this policy h = (self.vcns.create_app_rule(edge_id, app_rule))[0] app_rule_id = lb_common.extract_resource_id(h['location']) # add the nsx application rule (neutron policy) to the nsx # virtual server (neutron listener) vse_id = self._get_vse_id(context, pol) if vse_id: self._add_app_rule_to_virtual_server( edge_id, vse_id, app_rule_id, pol.position) except Exception as e: with excutils.save_and_reraise_exception(): self.lbv2_driver.l7policy.failed_completion(context, pol) LOG.error( 'Failed to create L7policy on edge %(edge)s: ' '%(err)s', { 'edge': edge_id, 'err': e }) if app_rule_id: # Failed to add the rule to the vip: delete the rule # from the backend. try: self.vcns.delete_app_rule(edge_id, app_rule_id) except Exception: pass # save the nsx application rule id in the DB nsxv_db.add_nsxv_lbaas_l7policy_binding(context.session, pol.id, edge_id, app_rule_id) # complete the transaction self.lbv2_driver.l7policy.successful_completion(context, pol)
def update(self, context, old_member, new_member, completor): lb_id = self._get_pool_lb_id(new_member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, new_member['pool_id']) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] edge_member = { 'ipAddress': new_member['address'], 'weight': new_member['weight'], 'port': new_member['protocol_port'], 'monitorPort': new_member['protocol_port'], 'name': lb_common.get_member_id(new_member['id']), 'condition': 'enabled' if new_member['admin_state_up'] else 'disabled' } with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('member'): for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(new_member['id']): edge_pool['member'][i] = edge_member break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update member on edge: %s', edge_id) else: LOG.error( 'Pool %(pool_id)s on Edge %(edge_id)s has no ' 'members to update', { 'pool_id': new_member['pool']['id'], 'edge_id': edge_id })
def delete(self, context, lb): try: binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb.id) if binding: lb_common.del_vip_fw_rule(self.vcns, binding['edge_id'], binding['edge_fw_rule_id']) lb_common.del_vip_as_secondary_ip(self.vcns, binding['edge_id'], lb.vip_address) nsxv_db.del_nsxv_lbaas_loadbalancer_binding(context.session, lb.id) self.lbv2_driver.load_balancer.successful_completion( context, lb, delete=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.load_balancer.failed_completion(context, lb) LOG.error(_LE('Failed to delete pool %s'), lb.id)
def delete(self, context, hm): listener = hm.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, hm.pool.id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding( context.session, lb_id, listener.id, hm.pool.id, hm.id, edge_id) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] edge_pool['monitorId'].remove(hm_binding['edge_mon_id']) try: with locking.LockManager.get_lock(edge_id): self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion(context, hm) LOG.error( _LE('Failed to delete monitor mapping on edge: %s'), edge_id) # If this monitor is not used on this edge anymore, delete it if not edge_pool['monitorId']: try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_health_monitor(hm_binding['edge_id'], hm_binding['edge_mon_id']) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.health_monitor.failed_completion(context, hm) LOG.error( _LE('Failed to delete monitor on edge: %s'), edge_id) nsxv_db.del_nsxv_lbaas_monitor_binding( context.session, lb_id, listener.id, hm.pool.id, hm.id, edge_id) self.lbv2_driver.health_monitor.successful_completion( context, hm, delete=True)
def delete(self, context, listener): lb_id = listener.loadbalancer_id listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener.id) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) if lb_binding and listener_binding: edge_id = lb_binding['edge_id'] edge_vse_id = listener_binding['vse_id'] app_profile_id = listener_binding['app_profile_id'] try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_vip(edge_id, edge_vse_id) except vcns_exc.ResourceNotFound: LOG.error(_LE('vip not found on edge: %s'), edge_id) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error( _LE('Failed to delete vip on edge: %s'), edge_id) try: with locking.LockManager.get_lock(edge_id): self.vcns.delete_app_profile(edge_id, app_profile_id) except vcns_exc.ResourceNotFound: LOG.error(_LE('app profile not found on edge: %s'), edge_id) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.listener.failed_completion(context, listener) LOG.error( _LE('Failed to delete app profile on Edge: %s'), edge_id) nsxv_db.del_nsxv_lbaas_listener_binding(context.session, lb_id, listener.id) self.lbv2_driver.listener.successful_completion( context, listener, delete=True)
def create(self, context, member): listener = member.pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, listener.id, member.pool_id) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] edge_member = { 'ipAddress': member.address, 'weight': member.weight, 'port': member.protocol_port, 'monitorPort': member.protocol_port, 'name': lb_common.get_member_id(member.id), 'condition': 'enabled' if member.admin_state_up else 'disabled'} if edge_pool.get('member'): edge_pool['member'].append(edge_member) else: edge_pool['member'] = [edge_member] try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) member_ips = self._get_pool_member_ips(member.pool, 'add', member.address) lb_common.update_pool_fw_rule(self.vcns, member.pool_id, edge_id, self._get_lbaas_fw_section_id(), member_ips) self.lbv2_driver.member.successful_completion(context, member) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.member.failed_completion(context, member) LOG.error(_LE('Failed to create member on edge: %s'), edge_id)
def create(self, context, pool): edge_pool = { 'name': 'pool_' + pool.id, 'description': getattr(pool, 'description', getattr(pool, 'name')), 'algorithm': lb_const.BALANCE_MAP.get(pool.lb_algorithm, 'round-robin'), 'transparent': False } listener = pool.listener lb_id = listener.loadbalancer_id lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) listener_binding = nsxv_db.get_nsxv_lbaas_listener_binding( context.session, lb_id, listener.id) edge_id = lb_binding['edge_id'] try: with locking.LockManager.get_lock(edge_id): h = self.vcns.create_pool(edge_id, edge_pool)[0] edge_pool_id = lb_common.extract_resource_id(h['location']) nsxv_db.add_nsxv_lbaas_pool_binding(context.session, lb_id, listener.id, pool.id, edge_pool_id) # Associate listener with pool vse = listener_mgr.listener_to_edge_vse( listener, lb_binding['vip_address'], edge_pool_id, listener_binding['app_profile_id']) with locking.LockManager.get_lock(edge_id): self.vcns.update_vip(edge_id, listener_binding['vse_id'], vse) self.lbv2_driver.pool.successful_completion(context, pool) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): self.lbv2_driver.pool.failed_completion(context, pool) LOG.error(_LE('Failed to create pool %s'), pool['id'])
def update(self, context, old_member, new_member, completor): lb_id = self._get_pool_lb_id(new_member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, new_member['pool_id']) edge_id = lb_binding['edge_id'] edge_pool_id = pool_binding['edge_pool_id'] edge_member = { 'ipAddress': new_member['address'], 'weight': new_member['weight'], 'port': new_member['protocol_port'], 'monitorPort': new_member['protocol_port'], 'name': lb_common.get_member_id(new_member['id']), 'condition': 'enabled' if new_member['admin_state_up'] else 'disabled'} with locking.LockManager.get_lock(edge_id): edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] if edge_pool.get('member'): for i, m in enumerate(edge_pool['member']): if m['name'] == lb_common.get_member_id(new_member['id']): edge_pool['member'][i] = edge_member break try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to update member on edge: %s', edge_id) else: LOG.error('Pool %(pool_id)s on Edge %(edge_id)s has no ' 'members to update', {'pool_id': new_member['pool']['id'], 'edge_id': edge_id})
def create(self, context, member, completor): lb_id = self._get_pool_lb_id(member) lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding( context.session, lb_id) edge_id = lb_binding['edge_id'] pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding( context.session, lb_id, member['pool_id']) if not pool_binding: completor(success=False) msg = _('Failed to create member on edge: %s. ' 'Binding not found') % edge_id LOG.error(msg) raise n_exc.BadRequest(resource='edge-lbaas', msg=msg) edge_pool_id = pool_binding['edge_pool_id'] old_lb = lb_common.is_lb_on_router_edge( context, self.core_plugin, edge_id) with locking.LockManager.get_lock(edge_id): if not cfg.CONF.nsxv.use_routers_as_lbaas_platform and not old_lb: # Verify that Edge appliance is connected to the member's # subnet (only if this is a dedicated loadbalancer edge) if not lb_common.get_lb_interface( context, self.core_plugin, lb_id, member['subnet_id']): lb_common.create_lb_interface( context, self.core_plugin, lb_id, member['subnet_id'], member['tenant_id']) edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1] edge_member = { 'ipAddress': member['address'], 'weight': member['weight'], 'port': member['protocol_port'], 'monitorPort': member['protocol_port'], 'name': lb_common.get_member_id(member['id']), 'condition': 'enabled' if member['admin_state_up'] else 'disabled'} if edge_pool.get('member'): edge_pool['member'].append(edge_member) else: edge_pool['member'] = [edge_member] try: self.vcns.update_pool(edge_id, edge_pool_id, edge_pool) completor(success=True) if old_lb: member_ips = self._get_pool_member_ips(member['pool'], 'add', member['address']) lb_common.update_pool_fw_rule( self.vcns, member['pool_id'], edge_id, self._get_lbaas_fw_section_id(), member_ips) except nsxv_exc.VcnsApiException: with excutils.save_and_reraise_exception(): completor(success=False) LOG.error('Failed to create member on edge: %s', edge_id)