You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ki...@apache.org on 2013/07/27 16:27:45 UTC

git commit: updated refs/heads/master to a8ad908

Updated Branches:
  refs/heads/master 996059ce9 -> a8ad90866


CLOUDSTACK-3703: change service offering of stopped vm on

Conflicts:
	server/test/com/cloud/vm/UserVmManagerTest.java


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

Branch: refs/heads/master
Commit: a8ad908666b963bfd152b508fcec7259cf3a545f
Parents: 996059c
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Sat Jul 27 19:51:02 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Sat Jul 27 19:52:30 2013 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8ad9086/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 e4d1c78..34f3de2 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1139,15 +1139,16 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
 
         // 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/a8ad9086/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 1356324..a6b8daf 100755
--- a/server/test/com/cloud/vm/UserVmManagerTest.java
+++ b/server/test/com/cloud/vm/UserVmManagerTest.java
@@ -313,6 +313,8 @@ public class UserVmManagerTest {
        // UserContext.current().setEventDetails("Vm Id: "+getId());
         Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
         UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString());
+        //AccountVO(String accountName, long domainId, String networkDomain, short type, int regionId)
+        doReturn(VirtualMachine.State.Running).when(_vmInstance).getState();
 
         CallContext.register(user, account);
         try {