cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.4 to 3b286d7
Date Wed, 10 Dec 2014 13:58:46 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 5bc2d06c4 -> 3b286d77c


CLOUDSTACK-8014: Fix NPE searching including removed templates

Steps to reproduce if you have this issue:
- Create a VM's volume snapshot
- Remove VM's template and mark the template as removed with timestamp in DB
- Restart mgmt server and create a volume out of snapshot you should get NPE

Fix: In `storagePoolHasEnoughSpace`, we're only searching for a VM's volume's
snapshot's template by Id and not including removed templates. This is a corner
case and NPE hits when template has been marked removed for a VM's volume's
template so we should search including removed templates.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit f189c105d8dde5491697b171b969e757f8f15858)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/4.4
Commit: 3b286d77ca2084fdde8176e2fd3e27a2c7227ea1
Parents: 5bc2d06
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Dec 10 19:08:26 2014 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Dec 10 19:27:20 2014 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3b286d77/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index a1f4cd6..1cdf54e 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1558,8 +1558,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
         long totalAskingSize = 0;
         for (Volume volume : volumes) {
             if (volume.getTemplateId() != null) {
-                VMTemplateVO tmpl = _templateDao.findById(volume.getTemplateId());
-                if (tmpl.getFormat() != ImageFormat.ISO) {
+                VMTemplateVO tmpl = _templateDao.findByIdIncludingRemoved(volume.getTemplateId());
+                if (tmpl != null && tmpl.getFormat() != ImageFormat.ISO) {
                     allocatedSizeWithtemplate = _capacityMgr.getAllocatedPoolCapacity(poolVO,
tmpl);
                 }
             }


Mime
View raw message