Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
[Subnet Mgr] Allow to delete a subnet without a gateway port (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanmo96 authored Jul 8, 2021
1 parent 799ee03 commit 091e158
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ free of charge, to any person obtaining a copy of this software and associated d
import static com.futurewei.alcor.common.constants.CommonConstants.QUERY_ATTR_HEADER;
import static org.springframework.web.bind.annotation.RequestMethod.*;

import org.springframework.web.client.HttpClientErrorException;

@RestController
@ComponentScan(value = "com.futurewei.alcor.common.stats")
public class SubnetController {
Expand Down Expand Up @@ -537,7 +539,11 @@ public ResponseId deleteSubnetState(@PathVariable String projectId, @PathVariabl
}

// delete subnet routing rule in route manager
this.subnetService.deleteSubnetRoutingRuleInRM(projectId, subnetId);
try {
this.subnetService.deleteSubnetRoutingTable(projectId, subnetId);
} catch (HttpClientErrorException.NotFound e) {
logger.warn(e.getMessage());
}

// TODO: delete gateway port in port manager. Temporary solution, need PM fix issue
GatewayPortDetail gatewayPortDetail = subnetEntity.getGatewayPortDetail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void fallbackOperation (AtomicReference<RouteWebJson> routeResponseAtomic
public void updateSubnetHostRoutes (String subnetId, NewHostRoutes resource) throws ResourceNotFoundException, ResourcePersistenceException, DatabasePersistenceException, SubnetEntityNotFound, DestinationOrOperationTypeIsNull;

// delete subnet routing rule in route manager
public void deleteSubnetRoutingRuleInRM (String projectId, String subnetId) throws SubnetIdIsNull;
public void deleteSubnetRoutingTable (String projectId, String subnetId) throws SubnetIdIsNull;

// update subnet routing rule in route manager
public void updateSubnetRoutingRuleInRM (String projectId, String subnetId, SubnetEntity subnetEntity) throws SubnetIdIsNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public void updateSubnetHostRoutes(String subnetId, NewHostRoutes resource) thro


@Override
public void deleteSubnetRoutingRuleInRM(String projectId, String subnetId) throws SubnetIdIsNull {
public void deleteSubnetRoutingTable(String projectId, String subnetId) throws SubnetIdIsNull {

if (subnetId == null) {
throw new SubnetIdIsNull();
Expand Down

0 comments on commit 091e158

Please sign in to comment.