From fd79f6b6020ae653c4f2d1f6222685becb792b77 Mon Sep 17 00:00:00 2001 From: Koushik Das Date: Thu, 30 May 2013 17:20:44 +0530 Subject: [PATCH] CLOUDSTACK-2276: NPE while attaching the volume to the instance which is created from ROOT Disk Snapshot The NPE comes as the storage pool id is set to null in the in-memory volume object which is not in sync with the db. entry. Reloading the volume from db. fixes the issue --- server/src/com/cloud/storage/VolumeManagerImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index aedb68e1316..c20625257fe 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -1725,6 +1725,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { } } + // reload the volume from db + volumeOnPrimaryStorage = volFactory.getVolume(volumeOnPrimaryStorage.getId()); boolean moveVolumeNeeded = needMoveVolume(rootVolumeOfVm, volumeOnPrimaryStorage); if (moveVolumeNeeded) {