def delete_firewall(self, context, edge_id): try: self.vcns.delete_firewall(edge_id) except vcns_exc.VcnsApiException as e: LOG.exception(_LE("Failed to delete firewall " "with edge_id:%s"), edge_id) raise e nsxv_db.cleanup_nsxv_edge_firewallrule_binding( context.session, edge_id)
def delete_firewall(self, context, edge_id): try: self.vcns.delete_firewall(edge_id) except vcns_exc.VcnsApiException as e: LOG.exception(_LE("Failed to delete firewall " "with edge_id:%s"), edge_id) raise e nsxv_db.cleanup_nsxv_edge_firewallrule_binding(context.session, edge_id)
def update_firewall(self, context, edge_id, firewall): fw_req = self._convert_firewall(context, firewall) try: self.vcns.update_firewall(edge_id, fw_req) except vcns_exc.VcnsApiException as e: LOG.exception(_LE("Failed to update firewall " "with edge_id: %s"), edge_id) raise e fw_res = self._get_firewall(context, edge_id) nsxv_db.cleanup_nsxv_edge_firewallrule_binding( context.session, edge_id) self._create_rule_id_mapping(context, edge_id, firewall, fw_res)
def update_firewall(self, context, edge_id, firewall): fw_req = self._convert_firewall(context, firewall) try: self.vcns.update_firewall(edge_id, fw_req) except vcns_exc.VcnsApiException as e: LOG.exception(_LE("Failed to update firewall " "with edge_id: %s"), edge_id) raise e fw_res = self._get_firewall(context, edge_id) nsxv_db.cleanup_nsxv_edge_firewallrule_binding(context.session, edge_id) self._create_rule_id_mapping(context, edge_id, firewall, fw_res)
def update_firewall(self, edge_id, firewall, context, allow_external=True): config = self._convert_firewall(firewall, allow_external=allow_external) try: self.vcns.update_firewall(edge_id, config) except vcns_exc.VcnsApiException: with excutils.save_and_reraise_exception(): LOG.exception("Failed to update firewall " "with edge_id: %s", edge_id) vcns_fw_config = self._get_firewall(edge_id) nsxv_db.cleanup_nsxv_edge_firewallrule_binding(context.session, edge_id) self._create_rule_id_mapping(context, edge_id, firewall, vcns_fw_config)
def delete_old_edge(context, old_edge_id): LOG.info("Deleting the old edge: %s", old_edge_id) # clean it up from the DB nsxv_db.clean_edge_router_binding(context.session, old_edge_id) nsxv_db.clean_edge_vnic_binding(context.session, old_edge_id) nsxv_db.cleanup_nsxv_edge_firewallrule_binding(context.session, old_edge_id) with locking.LockManager.get_lock(old_edge_id): # Delete from NSXv backend # Note - If we will not delete the edge, but free it - it will be # immediately used as the new one, So it is better to delete it. try: nsxv = utils.get_nsxv_client() nsxv.delete_edge(old_edge_id) except Exception as e: LOG.warning("Failed to delete the old edge %(id)s: %(e)s", {'id': old_edge_id, 'e': e})
def delete_old_edge(context, old_edge_id): LOG.info(_LI("Deleting the old edge: %s"), old_edge_id) # clean it up from the DB nsxv_db.clean_edge_router_binding(context.session, old_edge_id) nsxv_db.clean_edge_vnic_binding(context.session, old_edge_id) nsxv_db.cleanup_nsxv_edge_firewallrule_binding(context.session, old_edge_id) with locking.LockManager.get_lock(old_edge_id): # Delete from NSXv backend # Note - If we will not delete the edge, but free it - it will be # immediately used as the new one, So it is better to delete it. try: nsxv = utils.get_nsxv_client() nsxv.delete_edge(old_edge_id) except Exception as e: LOG.warning(_LW("Failed to delete the old edge %(id)s: %(e)s"), {'id': old_edge_id, 'e': e})