cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject [06/27] git commit: updated refs/heads/master to d4d5cab
Date Fri, 28 Mar 2014 23:35:13 GMT
CLOUDSTACK-5395: mark snapshot_store_ref as destroyed in case of backup snapshot failed

Conflicts:

	plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java


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

Branch: refs/heads/master
Commit: e656201fee5b9fa8afb497f1f473128c0e22e88c
Parents: a72222d
Author: Edison Su <sudison@gmail.com>
Authored: Thu Mar 27 15:37:51 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Fri Mar 28 16:21:22 2014 -0700

----------------------------------------------------------------------
 .../storage/snapshot/SnapshotServiceImpl.java   |  4 ++
 .../xen/resource/XenServerStorageProcessor.java | 43 ++++++++++++--------
 2 files changed, 29 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e656201f/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
index 8331012..684b5bd 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
@@ -302,6 +302,10 @@ public class SnapshotServiceImpl implements SnapshotService {
         if (result.isFailed()) {
             try {
                 destSnapshot.processEvent(Event.OperationFailed);
+                //if backup snapshot failed, mark srcSnapshot in snapshot_store_ref as failed
also
+                srcSnapshot.processEvent(Event.DestroyRequested);
+                srcSnapshot.processEvent(Event.OperationSuccessed);
+
                 srcSnapshot.processEvent(Snapshot.Event.OperationFailed);
             } catch (NoTransitionException e) {
                 s_logger.debug("Failed to update state: " + e.toString());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e656201f/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 a762f86..086862b 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
@@ -30,19 +30,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VmPowerState;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.VMGuestMetrics;
+import javax.ws.rs.HEAD;
 
 import org.apache.cloudstack.storage.command.AttachAnswer;
 import org.apache.cloudstack.storage.command.AttachCommand;
@@ -87,6 +75,19 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.storage.encoding.DecodedDataObject;
 import com.cloud.utils.storage.encoding.DecodedDataStore;
 import com.cloud.utils.storage.encoding.Decoder;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.VMGuestMetrics;
 
 public class XenServerStorageProcessor implements StorageProcessor {
     private static final Logger s_logger = Logger.getLogger(XenServerStorageProcessor.class);
@@ -475,11 +476,15 @@ public class XenServerStorageProcessor implements StorageProcessor {
                 Boolean isISCSI = IsISCSI(type);
                 String snapshotParentUUID = getVhdParent(conn, srUUID, snapshotUUID, isISCSI);
 
-                String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID,
isISCSI);
-                if (snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID))
{
-                    // this is empty snapshot, remove it
-                    snapshot.destroy(conn);
-                    snapshotUUID = preSnapshotUUID;
+                try {
+                    String preSnapshotParentUUID = getVhdParent(conn, srUUID, preSnapshotUUID,
isISCSI);
+                    if( snapshotParentUUID != null && snapshotParentUUID.equals(preSnapshotParentUUID))
{
+                        // this is empty snapshot, remove it
+                        snapshot.destroy(conn);
+                        snapshotUUID = preSnapshotUUID;
+                    }
+                } catch(Exception e) {
+                    s_logger.debug("Failed to get parent snapshot", e);
                 }
             }
             SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
@@ -1368,6 +1373,8 @@ public class XenServerStorageProcessor implements StorageProcessor {
                         }
                     }
                 } catch (Exception e) {
+                    s_logger.debug("Failed to get parent snapshots, take full snapshot",
e);
+                    fullbackup = true;
                 }
             }
 


Mime
View raw message