bug 7993: fix npe

status 7993: resolved fixed
This commit is contained in:
Chiradeep Vittal 2011-01-13 14:48:09 -08:00
parent 389e77fc46
commit d7d9a251be
1 changed files with 2 additions and 2 deletions

View File

@ -2623,14 +2623,14 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
}
Pair<VolumeTO, StoragePool> created = createVolume(newVol, _diskOfferingDao.findById(newVol.getDiskOfferingId()), vm, vols, dest);
if (created == null) {
long poolId = newVol.getPoolId();
Long poolId = newVol.getPoolId();
newVol.setPoolId(null);
try {
_volsDao.update(newVol, Volume.Event.OperationFailed);
} catch (ConcurrentOperationException e) {
throw new CloudRuntimeException("Unable to update the failure on a volume: " + newVol, e);
}
throw new StorageUnavailableException("Unable to create " + newVol, poolId);
throw new StorageUnavailableException("Unable to create " + newVol, poolId==null?-1L:poolId);
}
created.first().setDeviceId(newVol.getDeviceId().intValue());
newVol.setStatus(AsyncInstanceCreateStatus.Created);