From 2efdc9d62bfd184b475aedc0cfeccd5916d423c4 Mon Sep 17 00:00:00 2001 From: nit Date: Tue, 22 Feb 2011 17:49:56 +0530 Subject: [PATCH] bug 8471: Check whether secondary storage URL is null when copying volumes across storage pools. --- server/src/com/cloud/storage/StorageManagerImpl.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index a6ad6f7a4f3..a13944a2768 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1286,14 +1286,16 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag HostPodVO destPoolPod = _podDao.findById(destPoolPodId); StoragePoolVO destPool = findStoragePool(dskCh, destPoolDataCenter, destPoolPod, destPoolClusterId, null, null, null, new HashSet()); + String secondaryStorageURL = getSecondaryStorageURL(volume.getDataCenterId()); + String secondaryStorageVolumePath = null; if (destPool == null) { throw new CloudRuntimeException("Failed to find a storage pool with enough capacity to move the volume to."); + }if (secondaryStorageURL == null){ + throw new CloudRuntimeException("Failed to find secondary storage."); } - StoragePoolVO srcPool = _storagePoolDao.findById(volume.getPoolId()); - String secondaryStorageURL = getSecondaryStorageURL(volume.getDataCenterId()); - String secondaryStorageVolumePath = null; + StoragePoolVO srcPool = _storagePoolDao.findById(volume.getPoolId()); // Copy the volume from the source storage pool to secondary storage CopyVolumeCommand cvCmd = new CopyVolumeCommand(volume.getId(), volume.getPath(), srcPool, secondaryStorageURL, true);