cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/4.3 to f438f55
Date Wed, 08 Jan 2014 22:15:54 GMT
Updated Branches:
  refs/heads/4.3 6b756c8b3 -> f438f55ab


CLOUDSTACK-5370: delete snapshot on primary storage in case of backup snapshot failed.


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

Branch: refs/heads/4.3
Commit: f438f55ab091113b29c64326310a2d704e6c0a4a
Parents: 6b756c8
Author: edison <sudison@gmail.com>
Authored: Wed Jan 8 14:14:52 2014 -0800
Committer: edison <sudison@gmail.com>
Committed: Wed Jan 8 14:15:29 2014 -0800

----------------------------------------------------------------------
 .../xen/resource/XenServerStorageProcessor.java      | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f438f55a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
index 5df37ea..dd26861 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
@@ -1304,6 +1304,7 @@ public class XenServerStorageProcessor implements StorageProcessor {
         Long physicalSize = null;
         Map<String, String> options = cmd.getOptions();
         boolean fullbackup = Boolean.parseBoolean(options.get("fullSnapshot"));
+        boolean result = false;
         try {
             SR primaryStorageSR = hypervisorResource.getSRByNameLabelandHost(conn, primaryStorageNameLabel);
             if (primaryStorageSR == null) {
@@ -1423,17 +1424,23 @@ public class XenServerStorageProcessor implements StorageProcessor
{
             } else {
                 newSnapshot.setParentSnapshotPath(prevBackupUuid);
             }
+            result = true;
             return new CopyCmdAnswer(newSnapshot);
         } catch (XenAPIException e) {
             details = "BackupSnapshot Failed due to " + e.toString();
             s_logger.warn(details, e);
-            // remove last bad primary snapshot when exception happens
-            destroySnapshotOnPrimaryStorage(conn, snapshotUuid);
         } catch (Exception e) {
             details = "BackupSnapshot Failed due to " + e.getMessage();
             s_logger.warn(details, e);
-            // remove last bad primary snapshot when exception happens
-            destroySnapshotOnPrimaryStorage(conn, snapshotUuid);
+        } finally {
+            if (!result) {
+                // remove last bad primary snapshot when exception happens
+                try {
+                    destroySnapshotOnPrimaryStorage(conn, snapshotUuid);
+                } catch (Exception e) {
+                    s_logger.debug("clean up snapshot failed", e);
+                }
+            }
         }
 
         return new CopyCmdAnswer(details);


Mime
View raw message