Github user jburwell commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/801#discussion_r39902380
  
    --- Diff: 
plugins/network-elements/nuage-vsp/src/com/cloud/network/guru/NuageVspGuestNetworkGuru.java
 ---
    @@ -255,43 +319,22 @@ protected boolean canHandle(NetworkOffering offering, 
final NetworkType networkT
         }
     
         @Override
    -    public boolean release(NicProfile nic, VirtualMachineProfile vm, 
String reservationId) {
    -        long networkId = nic.getNetworkId();
    -        Network network = _networkDao.findById(networkId);
    -        s_logger.debug("Handling release() call back, which is called when 
a VM is stopped or destroyed, to delete the VM with state " + 
vm.getVirtualMachine().getState()
    -                + " from netork " + network.getName());
    -        if 
(vm.getVirtualMachine().getState().equals(VirtualMachine.State.Stopping)) {
    -            try {
    -                HostVO nuageVspHost = 
getNuageVspHost(network.getPhysicalNetworkId());
    -                ReleaseVmVspCommand cmd = new 
ReleaseVmVspCommand(network.getUuid(), vm.getUuid(), vm.getInstanceName());
    -                ReleaseVmVspAnswer answer = 
(ReleaseVmVspAnswer)_agentMgr.easySend(nuageVspHost.getId(), cmd);
    -                if (answer == null || !answer.getResult()) {
    -                    s_logger.error("ReleaseVmNuageVspCommand for VM " + 
vm.getUuid() + " failed");
    -                    if ((null != answer) && (null != answer.getDetails())) 
{
    -                        s_logger.error(answer.getDetails());
    -                    }
    -                }
    -            } catch (InsufficientVirtualNetworkCapacityException e) {
    -                s_logger.debug("Handling release() call back. Failed to 
delete CS VM " + vm.getInstanceName() + " in VSP. " + e.getMessage());
    -            }
    -        } else {
    -            s_logger.debug("Handling release() call back. VM " + 
vm.getInstanceName() + " is in " + vm.getVirtualMachine().getState() + " state. 
So, the CS VM is not deleted."
    -                    + " This could be a case where VM interface is 
deleted. deallocate() call back should be called later");
    -        }
    -
    -        return super.release(nic, vm, reservationId);
    -    }
    -
    -    @Override
         @DB
         public void deallocate(Network network, NicProfile nic, 
VirtualMachineProfile vm) {
    +        boolean lockedNetwork = lockNetworkForUserVm(network, vm);
    +        if (lockedNetwork) {
    +            s_logger.debug("Locked network " + network.getId() + " for 
deallocation of user VM " + vm.getInstanceName());
    +        }
     
             try {
                 s_logger.debug("Handling deallocate() call back, which is 
called when a VM is destroyed or interface is removed, " + "to delete VM 
Interface with IP "
    --- End diff --
    
    Wrap in a if (s_logger.isDebugEnabled()) { ... } block to avoid unnecessary 
pressure on the string pool when debug logging is not enabled.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to