DaanHoogland commented on a change in pull request #4701:
URL: https://github.com/apache/cloudstack/pull/4701#discussion_r657731148



##########
File path: 
plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java
##########
@@ -5732,16 +5733,24 @@ protected Answer execute(UnregisterNicCommand cmd) {
     }
 
     public void cleanupNetwork(HostMO hostMo, NetworkDetails netDetails) {
-        // we will no longer cleanup VLAN networks in order to support native 
VMware HA
-        /*
-         * assert(netDetails.getName() != null); try { synchronized(this) { 
NetworkMO networkMo = new
-         * NetworkMO(hostMo.getContext(), netDetails.getNetworkMor()); 
ManagedObjectReference[] vms =
-         * networkMo.getVMsOnNetwork(); if(vms == null || vms.length == 0) { 
if(s_logger.isInfoEnabled()) {
-         * s_logger.info("Cleanup network as it is currently not in use: " + 
netDetails.getName()); }
-         *
-         * hostMo.deletePortGroup(netDetails.getName()); } } } catch(Throwable 
e) {
-         * s_logger.warn("Unable to cleanup network due to exception, skip for 
next time"); }
-         */
+        if (!VmwareManager.s_vmwareCleanupPortGroups.value()){
+            return;
+        }
+        assert(netDetails.getName() != null);

Review comment:
       assert is not fine as it will either not run in production (as 
assertions are disabled) or it will exit the server immediately. Why is this 
here?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to