cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [2/2] git commit: updated refs/heads/master to ce3337c
Date Tue, 16 Apr 2013 05:18:40 GMT
CLOUDSTACK-2040 VM with snapshot not getting destroyed during account delation


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

Branch: refs/heads/master
Commit: cbe021b8d2867a4c02d1797e722e38b322a17c06
Parents: 7bff1d0
Author: Mice Xia <mice_xia@tcloudcomputing.com>
Authored: Tue Apr 16 12:38:52 2013 +0800
Committer: Mice Xia <mice_xia@tcloudcomputing.com>
Committed: Tue Apr 16 13:18:44 2013 +0800

----------------------------------------------------------------------
 .../agent/api/DeleteSnapshotBackupCommand.java     |    6 ++++--
 .../driver/AncientImageDataStoreDriverImpl.java    |   10 +++++++---
 .../storage/snapshot/SnapshotManagerImpl.java      |   11 +++++------
 3 files changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbe021b8/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
index 6114148..128df84 100644
--- a/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
+++ b/api/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
@@ -19,6 +19,7 @@ package com.cloud.agent.api;
 import com.cloud.agent.api.LogLevel.Log4jLevel;
 import com.cloud.agent.api.to.S3TO;
 import com.cloud.agent.api.to.SwiftTO;
+import com.cloud.storage.StoragePool;
 
 /**
  * This command encapsulates a primitive operation which enables coalescing the backed up
VHD snapshots on the secondary server
@@ -78,7 +79,8 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
      * @param backupUUID                  The VHD which has to be deleted
      * @param childUUID                   The child VHD file of the backup whose parent is
reset to its grandparent.
      */
-    public DeleteSnapshotBackupCommand(SwiftTO swift,
+    public DeleteSnapshotBackupCommand(StoragePool pool,
+                                       SwiftTO swift,
                                        S3TO s3,
                                        String secondaryStoragePoolURL,
                                        Long   dcId,
@@ -86,7 +88,7 @@ public class DeleteSnapshotBackupCommand extends SnapshotCommand {
                                        Long   volumeId,
  String backupUUID, Boolean all)
     {
-        super(null, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
+        super(pool, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
         setSwift(swift);
         this.s3 = s3;
         setAll(all);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbe021b8/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java
index 97ea6c4..4c16f2f 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java
@@ -33,6 +33,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcConext;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.image.ImageDataStoreDriver;
 import org.apache.log4j.Logger;
 
@@ -45,8 +47,8 @@ import com.cloud.agent.api.to.SwiftTO;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
 import com.cloud.storage.RegisterVolumePayload;
-import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.SnapshotVO;
+import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VMTemplateZoneVO;
@@ -80,6 +82,7 @@ public class AncientImageDataStoreDriverImpl implements ImageDataStoreDriver
{
     @Inject SnapshotDao snapshotDao;
     @Inject AgentManager agentMgr;
     @Inject SnapshotManager snapshotMgr;
+    @Inject PrimaryDataStoreDao primaryDataStoreDao;
 	@Inject
     private SwiftManager _swiftMgr;
     @Inject 
@@ -196,9 +199,10 @@ public class AncientImageDataStoreDriverImpl implements ImageDataStoreDriver
{
     		}
     		SwiftTO swift = _swiftMgr.getSwiftTO(snapshot.getSwiftId());
     		S3TO s3 = _s3Mgr.getS3TO();
-
+            VolumeVO volume = volumeDao.findById(volumeId);
+            StoragePoolVO pool = primaryDataStoreDao.findById(volume.getPoolId());
     		DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand(
-    				swift, s3, secondaryStoragePoolUrl, dcId, accountId, volumeId,
+    				pool, swift, s3, secondaryStoragePoolUrl, dcId, accountId, volumeId,
     				backupOfSnapshot, false);
     		Answer answer = agentMgr.sendToSSVM(dcId, cmd);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cbe021b8/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 3a453d5..490948b 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -181,9 +181,8 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
     private ResourceTagDao _resourceTagDao;
     @Inject
     private ConfigurationDao _configDao;
-
-    @Inject 
-    private VMSnapshotDao _vmSnapshotDao;
+    @Inject  
+    private PrimaryDataStoreDao _primaryDataStoreDao;
     String _name;
 
     @Inject TemplateManager templateMgr;
@@ -694,11 +693,11 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             S3TO s3 = _s3Mgr.getS3TO();
 
             checkObjectStorageConfiguration(swift, s3);
-
+            StoragePoolVO pool = _primaryDataStoreDao.findById(volume.getPoolId());
             if (swift == null && s3 == null) {
                 for (HostVO ssHost : ssHosts) {
                     DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand(
-                            null, null, ssHost.getStorageUrl(), dcId,
+                            pool,null, null, ssHost.getStorageUrl(), dcId,
                             accountId, volumeId, "", true);
                     Answer answer = null;
                     try {
@@ -717,7 +716,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
                 }
             } else {
                 DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand(
-                        swift, s3, "", dcId, accountId, volumeId, "", true);
+                        pool,swift, s3, "", dcId, accountId, volumeId, "", true);
                 Answer answer = null;
                 try {
                     answer = _agentMgr.sendToSSVM(dcId, cmd);


Mime
View raw message