mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
CLOUDSTACK-2288: NPE while creating volume from snapshot when the primary storage is in maintenance state.
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
This commit is contained in:
parent
e07a8b3f51
commit
ffd5f1a777
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user