Fixed private gateway can't be deleted#4016
Conversation
|
@blueorangutan package |
weizhouapache
left a comment
There was a problem hiding this comment.
@Spaceman1984
In the case as you said "When the static route service is not available on the VPC when a static route is created, the static route is created in a revoked state", could you add some changes to avoid it ?
engine/schema/src/main/java/com/cloud/network/vpc/dao/StaticRouteDao.java
Outdated
Show resolved
Hide resolved
@weizhouapache The state of the route is changed to revoked after failing validation. The other option here would be to delete the record at this point, which I think was the intention, but the delete method is also failing validation. I thought to leave things this way, to keep some history until the gateway is removed. I'm happy to force delete the record after failing validation if you believe it's a better way to go? |
|
@blueorangutan package |
|
@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✔debian. JID-1145 |
@Spaceman1984 I think it would be better to remove the record if there is error/exception in the creation. |
|
@blueorangutan package |
|
@Spaceman1984 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✔debian. JID-1153 |
Done |
|
@Spaceman1984 this looks like deletes pg in CloudStack DB, have you verified if this would also cleanup rules on the VR properly? |
No, I'll check. |
@rhtyd I have checked iptables on the VR before and after trying to add a static route, there is no difference, also this code removes the static route, not the private gateway. Having broken static routes referencing the gateway prevented it from being deleted. |
|
@Spaceman1984 private gateway would mean a nic, IP and route on the VR, not iptables rules |
|
ping @Spaceman1984 no update? |
|
@blueorangutan test |
|
@Spaceman1984 a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@Spaceman1984 ping, any update on this? |
|
@blueorangutan package |
|
@Spaceman1984 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔centos7 ✔debian. JID-1651 |
|
@blueorangutan test |
|
@Spaceman1984 a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@rhtyd I have tested creating and deleting a private gateway, the nic, ip and route is created and removed. |
|
@weizhouapache @rhtyd further doubts/questions or are we good to merge? |
|
@blueorangutan test |
|
@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-2281)
|
|
@DaanHoogland @Spaceman1984 - my concern is that whether removing privategateway also remove the nic/configuration from the VPC VR or not? Based on code, I think it will solve the issue or removing it from the DB. @Spaceman1984 did you test the case by adding privategateway with some static routes (also deploy VMs as VR programming is lazy) and check if VPC VR has a new nic and then removing it removes it both from VR and DB? |
@rhtyd I'll do some more testing |
@rhtyd I have confirmed that it works as expected. |
| gatewayid: args.context.vpcGateways[0].id, | ||
| listAll: true | ||
| listAll: true, | ||
| state: "Active" |
There was a problem hiding this comment.
@Spaceman1984 can you send the related change to Primate as well cc @davidjumani
Description
When the static route service is not available on the VPC and a static route is created, the static route is created in a revoked state.
Currently, the UI doesn't distinguish between active or revoked static routes.
This PR adds the missing state filter to the list routes command and only lists active routes in the UI.
It also ignores revoked routes when the private gateway is being removed but clears out the inactive routes before the gateway is removed.
Fixes #2908
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?
This has been tested by creating a VPC with no services, adding a private gateway, adding a static route and deleting the gateway.