cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [45/50] [abbrv] git commit: updated refs/heads/vmsync to f737019
Date Mon, 01 Jul 2013 21:25:29 GMT
CLOUDSTACK-2288: NPE while creating volume from snapshot when the primary storage is in maintenance
state.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>


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

Branch: refs/heads/vmsync
Commit: ffd5f1a777ac9af5b65b1fcd357684d7dafcce87
Parents: e07a8b3
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Thu Jun 6 16:43:04 2013 +0530
Committer: Prasanna Santhanam <tsp@apache.org>
Committed: Mon Jul 1 20:17:11 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeManagerImpl.java | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ffd5f1a7/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index a293da5..30fb322 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -527,7 +527,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
 
     @DB
     protected VolumeInfo createVolumeFromSnapshot(VolumeVO volume,
-            SnapshotVO snapshot) {
+            SnapshotVO snapshot) throws StorageUnavailableException {
         Account account = _accountDao.findById(volume.getAccountId());
 
         final HashSet<StoragePool> poolsToAvoid = new HashSet<StoragePool>();
@@ -555,6 +555,12 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
             }
         }
 
+        if (pool == null) {
+            String msg = "There are no available storage pools to store the volume in";
+            s_logger.info(msg);
+            throw new StorageUnavailableException(msg, -1);
+        }
+
         VolumeInfo vol = volFactory.getVolume(volume.getId());
         DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
         SnapshotInfo snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Image);
@@ -605,7 +611,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager
{
         }
     }
 
-    protected VolumeVO createVolumeFromSnapshot(VolumeVO volume, long snapshotId) {
+    protected VolumeVO createVolumeFromSnapshot(VolumeVO volume, long snapshotId) throws
StorageUnavailableException {
         VolumeInfo createdVolume = null;
         SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
         createdVolume = createVolumeFromSnapshot(volume,


Mime
View raw message