Skip to content

Commit

Permalink
Merge pull request #275 from heypnus/vpc/GetPortsOfSubnet
Browse files Browse the repository at this point in the history
Get port number by subnet ID from subnetport store
  • Loading branch information
heypnus committed Aug 14, 2023
2 parents 7566aea + 5d17ce4 commit d6c96f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pkg/controllers/subnet/subnet_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ func (r *SubnetReconciler) DeleteSubnet(obj v1alpha1.Subnet) error {
log.Info("no subnet found for subnet CR", "uid", string(obj.GetUID()))
return nil
}
// TODO Get port number by subnet ID from subnetport store.
portNums := 0 // portNums := commonctl.ServiceMediator.GetPortOfSubnet(nsxSubnet.Id)
portNums := len(common.ServiceMediator.GetPortsOfSubnet(*nsxSubnets[0].Id))
if portNums > 0 {
err := errors.New("subnet still attached by port")
log.Error(err, "", "ID", *nsxSubnets[0].Id)
Expand Down
3 changes: 1 addition & 2 deletions pkg/controllers/subnetset/subnetset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ func (r *SubnetSetReconciler) DeleteSubnetForSubnetSet(obj v1alpha1.SubnetSet, u
nsxSubnets := r.Service.SubnetStore.GetByIndex(servicecommon.TagScopeSubnetCRUID, string(obj.GetUID()))
hitError := false
for _, subnet := range nsxSubnets {
// TODO Get port number by subnet ID from subnetport store.
portNums := 0 // portNums := commonctl.ServiceMediator.GetPortOfSubnet(nsxSubnet.Id)
portNums := len(common.ServiceMediator.GetPortsOfSubnet(*subnet.Id))
if portNums > 0 {
continue
}
Expand Down

0 comments on commit d6c96f7

Please sign in to comment.