Improve error handling for a host-side error

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

Branch: refs/heads/hotfix/CLOUDSTACK-7776
Commit: 8766c8ad439da80125fb169d13a098f23fd823de
Parents: 1b5bb7d
Author: Mike Tutkowski <mike.tutkow...@solidfire.com>
Authored: Mon Oct 20 15:48:29 2014 -0600
Committer: Mike Tutkowski <mike.tutkow...@solidfire.com>
Committed: Tue Oct 21 16:01:14 2014 -0600

----------------------------------------------------------------------
 .../storage/test/FakePrimaryDataStoreDriver.java       |  2 +-
 .../snapshot/StorageSystemSnapshotStrategy.java        | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8766c8ad/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
 
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
index 18637b0..4810fbd 100644
--- 
a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
+++ 
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/FakePrimaryDataStoreDriver.java
@@ -49,7 +49,7 @@ public class FakePrimaryDataStoreDriver implements 
PrimaryDataStoreDriver {
     }
 
     @Override
-    public boolean  grantAccess(DataObject dataObject, Host host, DataStore 
dataStore) { return false; }
+    public boolean grantAccess(DataObject dataObject, Host host, DataStore 
dataStore) { return false; }
 
     @Override
     public void revokeAccess(DataObject dataObject, Host host, DataStore 
dataStore) {}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8766c8ad/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
index 1ba9d58..a36afd3 100644
--- 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -245,6 +245,19 @@ public class StorageSystemSnapshotStrategy extends 
SnapshotStrategyBase {
                     }
                 }
 
+                if (snapshotAndCopyAnswer == null || 
!snapshotAndCopyAnswer.getResult()) {
+                    final String errMsg;
+
+                    if (snapshotAndCopyAnswer != null && 
snapshotAndCopyAnswer.getDetails() != null && 
!snapshotAndCopyAnswer.getDetails().isEmpty()) {
+                        errMsg = snapshotAndCopyAnswer.getDetails();
+                    }
+                    else {
+                        errMsg = "Unable to perform host-side operation";
+                    }
+
+                    throw new CloudRuntimeException(errMsg);
+                }
+
                 String path = snapshotAndCopyAnswer.getPath(); // for 
XenServer, this is the VDI's UUID
 
                 SnapshotDetailsVO snapshotDetail = new 
SnapshotDetailsVO(snapshotInfo.getId(),

Reply via email to