cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [1/4] git commit: updated refs/heads/master to 818063c
Date Mon, 25 Jul 2016 20:38:05 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 46a6530e7 -> 818063c8e


CLOUDSTACK-9436: Release network resources on expunge command


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/148e9744
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/148e9744
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/148e9744

Branch: refs/heads/master
Commit: 148e9744828cd7dd3efe9487fc5be303b21b58d3
Parents: 46a6530
Author: nvazquez <nicolas.m.vazquez@gmail.com>
Authored: Mon Jun 6 11:47:45 2016 -0300
Committer: nvazquez <nicolas.m.vazquez@gmail.com>
Committed: Thu Jul 21 12:25:22 2016 -0300

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/148e9744/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 9eddf6d..dd7e817 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2046,6 +2046,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
             return false;
         }
         try {
+
+            releaseNetworkResourcesOnExpunge(vm.getId());
+
             List<VolumeVO> rootVol = _volsDao.findByInstanceAndType(vm.getId(), Volume.Type.ROOT);
             // expunge the vm
             _itMgr.advanceExpunge(vm.getUuid());
@@ -2086,6 +2089,23 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         }
     }
 
+    /**
+     * Release network resources, it was done on vm stop previously.
+     * @param id vm id
+     * @throws ConcurrentOperationException
+     * @throws ResourceUnavailableException
+     */
+    private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException,
ResourceUnavailableException {
+        final VMInstanceVO vmInstance = _vmDao.findById(id);
+        if (vmInstance != null){
+            final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance);
+            _networkMgr.release(profile, false);
+        }
+        else {
+            s_logger.error("Couldn't find vm with id = " + id + ", unable to release network
resources");
+        }
+    }
+
     private boolean cleanupVmResources(long vmId) {
         boolean success = true;
         // Remove vm from security groups


Mime
View raw message