Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F22210E76 for ; Wed, 10 Jul 2013 12:59:53 +0000 (UTC) Received: (qmail 19600 invoked by uid 500); 10 Jul 2013 12:59:50 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 19545 invoked by uid 500); 10 Jul 2013 12:59:48 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 19534 invoked by uid 99); 10 Jul 2013 12:59:48 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jul 2013 12:59:48 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0F24988BBD0; Wed, 10 Jul 2013 12:59:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: devdeep@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master-6-17-stable to 527080e Date: Wed, 10 Jul 2013 12:59:48 +0000 (UTC) Updated Branches: refs/heads/master-6-17-stable 1c0239099 -> 527080e8e CLOUDSTACK-2288: NPE while creating volume from snapshot when the primary storage is in maintenance state. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/527080e8 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/527080e8 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/527080e8 Branch: refs/heads/master-6-17-stable Commit: 527080e8effe675e7875fff6a0a69de606e3e3eb Parents: 1c02390 Author: Sanjay Tripathi Authored: Thu Jun 6 16:43:04 2013 +0530 Committer: Devdeep Singh Committed: Wed Jul 10 18:21:38 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/storage/VolumeManagerImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/527080e8/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 d36374a..5eece13 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -496,7 +496,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 poolsToAvoid = new HashSet(); @@ -523,7 +523,13 @@ 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 = this.volFactory.getVolume(volume.getId()); DataStore store = this.dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary); SnapshotInfo snapInfo = this.snapshotFactory.getSnapshot(snapshot.getId()); @@ -582,7 +588,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,