cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] branch master updated: CLOUDSTACK-9964: Snapahots are getting deleted if VM is assigned to another user (#2159)
Date Sat, 19 Aug 2017 19:11:48 GMT
This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/master by this push:
     new 250c47e  CLOUDSTACK-9964: Snapahots are getting deleted if VM is assigned to another
user (#2159)
250c47e is described below

commit 250c47eb62f51357a68394bc2f73e5d66af49f77
Author: pavanaravapalli <pavankumar_a@accelerite.com>
AuthorDate: Sun Aug 20 00:41:45 2017 +0530

    CLOUDSTACK-9964: Snapahots are getting deleted if VM is assigned to another user (#2159)
---
 server/src/com/cloud/vm/UserVmManagerImpl.java | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 5b3c5ba..c74507c 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -297,6 +297,7 @@ import com.cloud.vm.dao.VMInstanceDao;
 import com.cloud.vm.snapshot.VMSnapshotManager;
 import com.cloud.vm.snapshot.VMSnapshotVO;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
+import com.cloud.storage.snapshot.SnapshotApiService;
 
 public class UserVmManagerImpl extends ManagerBase implements UserVmManager, VirtualMachineGuru,
UserVmService, Configurable {
     private static final Logger s_logger = Logger.getLogger(UserVmManagerImpl.class);
@@ -487,6 +488,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
     protected VMNetworkMapDao _vmNetworkMapDao;
     @Inject
     protected IpAddressManager _ipAddrMgr;
+    @Inject
+    private SnapshotApiService _snapshotService;
 
     protected ScheduledExecutorService _executor = null;
     protected ScheduledExecutorService _vmIpFetchExecutor = null;
@@ -5386,7 +5389,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
             //snapshots: mark these removed in db
             List<SnapshotVO> snapshots = _snapshotDao.listByVolumeIdIncludingRemoved(volume.getId());
             for (SnapshotVO snapshot : snapshots) {
-                _snapshotDao.remove(snapshot.getId());
+                    boolean result = _snapshotService.deleteSnapshot(snapshot.getId());
+                    if (result) {
+                        s_logger.info("Snapshot id: " + snapshot.getId() + " delete successfully
");
+                    } else {
+                        s_logger.error("Unable to delete Snapshot id: " + snapshot.getId());
+                    }
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].

Mime
View raw message