mirror of https://github.com/apache/cloudstack.git
Remove distributed firewall policy on segment deletion
This commit is contained in:
parent
c6acd8fb61
commit
1a24ba6949
|
|
@ -389,6 +389,7 @@ public class NsxApiClient {
|
|||
public void deleteSegment(long zoneId, long domainId, long accountId, Long vpcId, long networkId, String segmentName) {
|
||||
try {
|
||||
Segments segmentService = (Segments) nsxService.apply(Segments.class);
|
||||
removeSegmentDistributedFirewallRules(segmentName);
|
||||
removeGroupForSegment(segmentName);
|
||||
LOGGER.debug(String.format("Removing the segment with ID %s", segmentName));
|
||||
segmentService.delete(segmentName);
|
||||
|
|
@ -754,6 +755,18 @@ public class NsxApiClient {
|
|||
service.delete(DEFAULT_DOMAIN, segmentName, true, false);
|
||||
}
|
||||
|
||||
private void removeSegmentDistributedFirewallRules(String segmentName) {
|
||||
try {
|
||||
SecurityPolicies services = (SecurityPolicies) nsxService.apply(SecurityPolicies.class);
|
||||
services.delete(DEFAULT_DOMAIN, segmentName);
|
||||
} catch (Error error) {
|
||||
ApiError ae = error.getData()._convertTo(ApiError.class);
|
||||
String msg = String.format("Failed to remove NSX distributed firewall policy for segment %s, due to: %s", segmentName, ae.getErrorMessage());
|
||||
LOGGER.error(msg);
|
||||
throw new CloudRuntimeException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
public void createSegmentDistributedFirewall(String policyName, List<NsxNetworkRule> nsxRules) {
|
||||
try {
|
||||
SecurityPolicies services = (SecurityPolicies) nsxService.apply(SecurityPolicies.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue