cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: updated refs/heads/4.2 to b21de40
Date Sat, 27 Jul 2013 14:28:16 GMT
Updated Branches:
  refs/heads/4.2 b39d30288 -> b21de4006


CLOUDSTACK-3703: change service offering of stopped vm on


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

Branch: refs/heads/4.2
Commit: b21de4006abd61512b027af2dd9e8b07df1dd06f
Parents: b39d302
Author: Harikrishna Patnala <harikrishna.patnala@citrix.com>
Authored: Sat Jul 27 19:51:02 2013 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Sat Jul 27 19:57:59 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b21de400/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 a60412d..3831f88 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1144,15 +1144,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
 
         // Verify input parameters
         VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
-        if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType()
!= HypervisorType.VMware){
-            throw new InvalidParameterValueException("This operation not permitted for this
hypervisor of the vm");
-        }
 
         if(vmInstance.getState().equals(State.Stopped)){
             upgradeStoppedVirtualMachine(vmId, newServiceOfferingId);
             return true;
         }
 
+        if(vmInstance.getHypervisorType() != HypervisorType.XenServer && vmInstance.getHypervisorType()
!= HypervisorType.VMware){
+            throw new InvalidParameterValueException("This operation not permitted for this
hypervisor of the vm");
+        }
+
         _accountMgr.checkAccess(caller, null, true, vmInstance);
 
         // Check that the specified service offering ID is valid

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b21de400/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 70a3422..2af0e70 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -272,7 +272,8 @@ public class UserVmManagerTest {
        // UserContext.current().setEventDetails("Vm Id: "+getId());
         Account account = (Account) new AccountVO("testaccount", 1L, "networkdomain", (short)
0, "uuid");
         //AccountVO(String accountName, long domainId, String networkDomain, short type,
int regionId)
-       UserContext.registerContext(1, account, null, true);
+        doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
+        UserContext.registerContext(1, account, null, true);
 
         when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 


Mime
View raw message