Updated Branches:
  refs/heads/master 3115ddf00 -> fd79f6b60

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


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fd79f6b6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fd79f6b6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fd79f6b6

Branch: refs/heads/master
Commit: fd79f6b6020ae653c4f2d1f6222685becb792b77
Parents: 3115ddf
Author: Koushik Das <[email protected]>
Authored: Thu May 30 17:20:44 2013 +0530
Committer: Koushik Das <[email protected]>
Committed: Thu May 30 17:20:44 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/VolumeManagerImpl.java   |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd79f6b6/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 aedb68e..c206252 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) {

Reply via email to