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 9ed4ab7
Date Thu, 16 Jan 2014 02:47:53 GMT
Updated Branches:
  refs/heads/4.3 90e01b1e1 -> 9ed4ab731


CLOUDSTACK-5395: mark snapshot_store_ref as destroyed 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/9ed4ab73
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9ed4ab73
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9ed4ab73

Branch: refs/heads/4.3
Commit: 9ed4ab731fc5d722e3e0b819958ec8a2f4beccdb
Parents: 90e01b1
Author: Edison Su <sudison@gmail.com>
Authored: Wed Jan 15 18:46:29 2014 -0800
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Jan 15 18:46:57 2014 -0800

----------------------------------------------------------------------
 .../storage/snapshot/SnapshotServiceImpl.java   |  4 ++
 .../xen/resource/XenServerStorageProcessor.java | 48 +++++++++++---------
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ed4ab73/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 f1a7d74..3b456ce 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
@@ -313,6 +313,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/9ed4ab73/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 dd26861..d5ef334 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
@@ -31,23 +31,6 @@ import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
-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 org.apache.cloudstack.storage.command.AttachAnswer;
 import org.apache.cloudstack.storage.command.AttachCommand;
 import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer;
@@ -66,6 +49,8 @@ import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol;
 import org.apache.cloudstack.storage.to.SnapshotObjectTO;
 import org.apache.cloudstack.storage.to.TemplateObjectTO;
 import org.apache.cloudstack.storage.to.VolumeObjectTO;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.CreateStoragePoolCommand;
@@ -88,6 +73,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);
@@ -488,11 +486,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();
@@ -1328,6 +1330,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