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

[subnet] Cannot delete a subnet without a gateway port and routing table #648

Open
cj-chung opened this issue Jun 23, 2021 · 2 comments
Open

Comments

@cj-chung
Copy link
Contributor

Issue:
Cannot delete a subnet without a gateway port
It will return

{
    "timestamp": "2021-06-23T19:24:44.531+0000",
    "status": 500,
    "error": "Internal Server Error",
    "message": "404 : [{\"timestamp\":\"2021-06-23T19:24:44.493+0000\",\"status\":404,\"error\":\"Not Found\",\"message\":\"Port not found\",\"path\":\"/project/3dda2801-d675-4688-a63f-dcda8d327f50/ports/145e37e1-e9b1-4f92-b6f6-6a62c636c4e8\"}]",
    "path": "/project/3dda2801-d675-4688-a63f-dcda8d327f50/subnets/8182a4d4-ffff-4ece-b3f0-8d36e3d88001"
}

Suggestion:
A subnet without gateway port should be able to be deleted.

@cj-chung
Copy link
Contributor Author

cj-chung commented Jun 25, 2021

Temporary Solution:
For temporary solution in Subnet Manager, we can modify codes in SubnetController.java line 543 to:

...
import org.springframework.web.client.HttpClientErrorException;
...
            // TODO: delete gateway port in port manager. Temporary solution, need PM fix issue
            GatewayPortDetail gatewayPortDetail = subnetEntity.getGatewayPortDetail();
            if (gatewayPortDetail != null) {
                try {
                    this.subnetToPortManagerService.deleteGatewayPort(projectId, gatewayPortDetail.getGatewayPortId());
                } catch (HttpClientErrorException.NotFound e) {
                    logger.warn(e.getMessage());
                }
            }

For the formal solution, we still need to modify PM's code. Check if the deleted port is subnet's gateway port. If it is a gateway port, PM needs to notify SM to update subnet's GatewayPortDetail. This is same as gateway port's update.

@cj-chung
Copy link
Contributor Author

cj-chung commented Jun 29, 2021

Subnet's routing table also has similar issue. We need to try and catch this.subnetService.deleteSubnetRoutingRuleInRM(projectId, subnetId); too:

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant