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/master to 15c93ba
Date Fri, 16 Aug 2013 12:01:18 GMT
Updated Branches:
  refs/heads/master 3f79a6730 -> 15c93ba9b


=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/15c93ba9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/15c93ba9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/15c93ba9

Branch: refs/heads/master
Commit: 15c93ba9b77b15a268dfe618277a21331edfe0d0
Parents: 3f79a67
Author: Bharat Kumar <bharat.kumar@citrix.com>
Authored: Fri Aug 16 17:26:57 2013 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Fri Aug 16 17:27:00 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15c93ba9/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 dc33d76..b710c08 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1237,7 +1237,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
 
         //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/15c93ba9/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 ec61975..e74188f 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -35,6 +35,7 @@ import java.lang.reflect.Field;
 import java.util.List;
 import java.util.UUID;
 
+import com.cloud.service.dao.ServiceOfferingDao;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -107,6 +108,7 @@ public class UserVmManagerTest {
     @Mock VolumeVO _volumeMock;
     @Mock List<VolumeVO> _rootVols;
     @Mock Account _accountMock2;
+    @Mock ServiceOfferingDao _offeringDao;
     @Before
     public void setup(){
         MockitoAnnotations.initMocks(this);
@@ -122,6 +124,7 @@ public class UserVmManagerTest {
         _userVmMgr._userDao = _userDao;
         _userVmMgr._accountMgr = _accountMgr;
         _userVmMgr._configMgr = _configMgr;
+        _userVmMgr._offeringDao= _offeringDao;
         _userVmMgr._capacityMgr = _capacityMgr;
         _userVmMgr._scaleRetry = 2;
 
@@ -356,7 +359,7 @@ public class UserVmManagerTest {
         ServiceOffering so2 =  getSvcoffering(256);
 
         when(_configMgr.getServiceOffering(anyLong())).thenReturn(so1);
-        when(_configMgr.getServiceOffering(1L)).thenReturn(so1);
+        when(_offeringDao.findByIdIncludingRemoved(anyLong())).thenReturn((ServiceOfferingVO)
so1);
 
         Account account = new AccountVO("testaccount", 1L, "networkdomain", (short)0, UUID.randomUUID().toString());
         UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email",
"timezone", UUID.randomUUID().toString());


Mime
View raw message