cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/4.2 to c6e2e46
Date Fri, 16 Aug 2013 09:42:28 GMT
Updated Branches:
  refs/heads/4.2 81b4966a7 -> c6e2e465e


CLOUDSTACK-4068 scaling up user vm and system vm is failing with NPE if current service offering
is deleted
Nitin Mehta <nitin.mehta@citrix.com>


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

Branch: refs/heads/4.2
Commit: c6e2e465ed8d4524f79d00b8d283337b2d26e8a7
Parents: 81b4966
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Fri Aug 16 15:09:56 2013 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Fri Aug 16 15:10:36 2013 +0530

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 2 +-
 server/test/com/cloud/vm/UserVmManagerTest.java | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6e2e465/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index ca93ef7..ce77630 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1242,7 +1242,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
 
         //Check if its a scale "up"
         ServiceOffering newServiceOffering = _configMgr.getServiceOffering(newServiceOfferingId);
-        ServiceOffering currentServiceOffering = _configMgr.getServiceOffering(vmInstance.getServiceOfferingId());
+        ServiceOffering currentServiceOffering = _offeringDao.findByIdIncludingRemoved(vmInstance.getServiceOfferingId());
         int newCpu = newServiceOffering.getCpu();
         int newMemory = newServiceOffering.getRamSize();
         int newSpeed = newServiceOffering.getSpeed();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c6e2e465/server/test/com/cloud/vm/UserVmManagerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/UserVmManagerTest.java b/server/test/com/cloud/vm/UserVmManagerTest.java
index 2af0e70..973b8bc 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -31,6 +31,7 @@ import java.lang.reflect.Field;
 import java.util.List;
 import java.util.UUID;
 
+import com.cloud.service.dao.ServiceOfferingDao;
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.api.ServerApiException;
@@ -102,6 +103,7 @@ public class UserVmManagerTest {
     @Mock VolumeVO _volumeMock;
     @Mock List<VolumeVO> _rootVols;
     @Mock Account _accountMock2;
+    @Mock ServiceOfferingDao _offeringDao;
     @Before
     public void setup(){
         MockitoAnnotations.initMocks(this);
@@ -117,6 +119,7 @@ public class UserVmManagerTest {
         _userVmMgr._userDao = _userDao;
         _userVmMgr._accountMgr = _accountMgr;
         _userVmMgr._configMgr = _configMgr;
+        _userVmMgr._offeringDao= _offeringDao;
         _userVmMgr._capacityMgr = _capacityMgr;
         _userVmMgr._scaleRetry = 2;
 
@@ -309,10 +312,8 @@ public class UserVmManagerTest {
 
         ServiceOffering so1 =  (ServiceOffering) getSvcoffering(512);
         ServiceOffering so2 =  (ServiceOffering) getSvcoffering(256);
-
         when(_configMgr.getServiceOffering(anyLong())).thenReturn(so1);
-        when(_configMgr.getServiceOffering(1L)).thenReturn(so1);
-
+        when(_offeringDao.findByIdIncludingRemoved(anyLong())).thenReturn((ServiceOfferingVO)
so1);
         _userVmMgr.upgradeVirtualMachine(cmd);
 
     }


Mime
View raw message