You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/07/11 14:04:06 UTC

git commit: updated refs/heads/4.2 to c076ae8

Updated Branches:
  refs/heads/4.2 088c1e2a4 -> c076ae875


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

Branch: refs/heads/4.2
Commit: c076ae875ab85ae20a203db04131925886f5e0cc
Parents: 088c1e2
Author: Koushik Das <ko...@citrix.com>
Authored: Thu Jul 11 17:25:42 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Thu Jul 11 17:33:41 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/c076ae87/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 a0ea54e..34e5b21 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -857,6 +857,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