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 E762A101DD for ; Fri, 12 Jul 2013 07:51:33 +0000 (UTC) Received: (qmail 16322 invoked by uid 500); 12 Jul 2013 07:51:08 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 16060 invoked by uid 500); 12 Jul 2013 07:51:05 -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 15628 invoked by uid 99); 12 Jul 2013 07:50:58 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jul 2013 07:50:58 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 52E56894ABF; Fri, 12 Jul 2013 07:50:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sebgoa@apache.org To: commits@cloudstack.apache.org Date: Fri, 12 Jul 2013 07:51:27 -0000 Message-Id: <133e001ab58c4b639da711dcb8578a69@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [32/50] git commit: updated refs/heads/sdnextensions to bcfb4e6 CLOUDSTACK-3248: XenServer Host got removed successfully inspite of running VMs on the host In UI there is a restriction to first put a host in maintenance and only then deletion is allowed. But there is no such restriction in the deleteHost API. Added a validation in deleteHost API to prevent deletion if the host is not in maintenance. In case of a forced deletion the restriction doesn't apply. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5c3013a6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5c3013a6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5c3013a6 Branch: refs/heads/sdnextensions Commit: 5c3013a694666adc0466f88ab138f211f33038df Parents: 535903f Author: Koushik Das Authored: Thu Jul 11 17:25:42 2013 +0530 Committer: Koushik Das Committed: Thu Jul 11 17:25:42 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/resource/ResourceManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5c3013a6/server/src/com/cloud/resource/ResourceManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 41c6ad7..b009e63 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -859,6 +859,9 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager, } _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), host.getDataCenterId()); + if (!isForced && host.getResourceState() != ResourceState.Maintenance) { + throw new CloudRuntimeException("Host " + host.getUuid() + " cannot be deleted as it is not in maintenance mode. Either put the host into maintenance or perform a forced deletion."); + } /* * TODO: check current agent status and updateAgentStatus to removed. If * it was already removed, that means someone is deleting host