Repository: cloudstack
Updated Branches:
  refs/heads/master 47278556f -> d702b63bf

CLOUDSTACK-8569: The latter snapshot export for the same volume will fail is 2 
snapshot exports are queued
This closes #469


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

Branch: refs/heads/master
Commit: d702b63bfb91f744d838ae081430308b5190fff6
Parents: 4727855
Author: Sanjay Tripathi <sanjay.tripa...@citrix.com>
Authored: Wed Jun 17 15:16:43 2015 +0530
Committer: Sanjay Tripathi <sanjay.tripa...@citrix.com>
Committed: Wed Jun 17 15:27:03 2015 +0530

----------------------------------------------------------------------
 .../xenserver/resource/XenServerStorageProcessor.java         | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d702b63b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
 
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
index 0cf40f5..f489e5c 100644
--- 
a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
+++ 
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/XenServerStorageProcessor.java
@@ -1157,10 +1157,15 @@ public class XenServerStorageProcessor implements 
StorageProcessor {
             if (volume == null) {
                 throw new InternalErrorException("Could not destroy snapshot 
on volume " + volumeUuid + " due to can not find it");
             }
+            // To avoid deleting snapshots which are still waiting in queue to 
get backed up.
+            VDI avoidSnapshot = getVDIbyUuid(conn, avoidSnapshotUuid);
+            if (avoidSnapshot == null) {
+                throw new InternalErrorException("Could not find current 
snapshot " + avoidSnapshotUuid);
+            }
             final Set<VDI> snapshots = volume.getSnapshots(conn);
             for (final VDI snapshot : snapshots) {
                 try {
-                    if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid)) {
+                    if (!snapshot.getUuid(conn).equals(avoidSnapshotUuid) && 
snapshot.getSnapshotTime(conn).before(avoidSnapshot.getSnapshotTime(conn))) {
                         snapshot.destroy(conn);
                     }
                 } catch (final Exception e) {

Reply via email to