Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CC827101EC for ; Sat, 27 Jul 2013 14:28:17 +0000 (UTC) Received: (qmail 48321 invoked by uid 500); 27 Jul 2013 14:28:17 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 48283 invoked by uid 500); 27 Jul 2013 14:28:17 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 48271 invoked by uid 99); 27 Jul 2013 14:28:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 27 Jul 2013 14:28:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0D575F59C; Sat, 27 Jul 2013 14:28:16 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kishan@apache.org To: commits@cloudstack.apache.org Message-Id: <1799609399dc4631972caa57ea4beb5c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to b21de40 Date: Sat, 27 Jul 2013 14:28:16 +0000 (UTC) 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 Authored: Sat Jul 27 19:51:02 2013 +0530 Committer: Kishan Kavala 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);