cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: updated refs/heads/4.4 to 296dc86
Date Wed, 26 Mar 2014 21:22:18 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 4807bc8bd -> 296dc861b


in XenServer, host eject may fail due to diffent reasons, it's hard for CS to handle all failure.
in CS, removing a host means CS will not manage the host, admin needs to eject the host from
XS pool outside of CS


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

Branch: refs/heads/4.4
Commit: 296dc861bc0cd65982fc826962a04b14f0b0f12e
Parents: 4807bc8
Author: Anthony Xu <anthony.xu@citrix.com>
Authored: Wed Mar 26 14:18:17 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Wed Mar 26 14:21:28 2014 -0700

----------------------------------------------------------------------
 .../com/cloud/agent/api/PoolEjectCommand.java   | 44 ----------------
 .../vmware/resource/VmwareResource.java         | 10 ----
 .../xen/discoverer/XcpServerDiscoverer.java     | 29 -----------
 .../xen/resource/CitrixResourceBase.java        | 55 --------------------
 4 files changed, 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/296dc861/core/src/com/cloud/agent/api/PoolEjectCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/PoolEjectCommand.java b/core/src/com/cloud/agent/api/PoolEjectCommand.java
deleted file mode 100644
index fa6b651..0000000
--- a/core/src/com/cloud/agent/api/PoolEjectCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-public class PoolEjectCommand extends Command {
-    private String hostuuid;
-
-    public String getHostuuid() {
-        return hostuuid;
-    }
-
-    public void setHostuuid(String hostuuid) {
-        this.hostuuid = hostuuid;
-    }
-
-    public PoolEjectCommand() {
-        super();
-    }
-
-    public PoolEjectCommand(String hostuuid) {
-        super();
-        setHostuuid(hostuuid);
-    }
-
-    @Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/296dc861/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 4e46c52..f84d682 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -162,7 +162,6 @@ import com.cloud.agent.api.PingRoutingCommand;
 import com.cloud.agent.api.PingTestCommand;
 import com.cloud.agent.api.PlugNicAnswer;
 import com.cloud.agent.api.PlugNicCommand;
-import com.cloud.agent.api.PoolEjectCommand;
 import com.cloud.agent.api.PrepareForMigrationAnswer;
 import com.cloud.agent.api.PrepareForMigrationCommand;
 import com.cloud.agent.api.PvlanSetupCommand;
@@ -465,8 +464,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 answer = execute((CheckOnHostCommand)cmd);
             } else if (clz == ModifySshKeysCommand.class) {
                 answer = execute((ModifySshKeysCommand)cmd);
-            } else if (clz == PoolEjectCommand.class) {
-                answer = execute((PoolEjectCommand)cmd);
             } else if (clz == NetworkUsageCommand.class) {
                 answer = execute((NetworkUsageCommand)cmd);
             } else if (clz == StartCommand.class) {
@@ -4161,13 +4158,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         return new Answer(cmd);
     }
 
-    protected Answer execute(PoolEjectCommand cmd) {
-        if (s_logger.isInfoEnabled()) {
-            s_logger.info("Executing resource PoolEjectCommand: " + _gson.toJson(cmd));
-        }
-
-        return new Answer(cmd, false, "PoolEjectCommand is not available for vmware");
-    }
 
     @Override
     public PrimaryStorageDownloadAnswer execute(PrimaryStorageDownloadCommand cmd) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/296dc861/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index bd0f55c..9852eda 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -40,7 +40,6 @@ import com.cloud.agent.api.AgentControlAnswer;
 import com.cloud.agent.api.AgentControlCommand;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
-import com.cloud.agent.api.PoolEjectCommand;
 import com.cloud.agent.api.SetupAnswer;
 import com.cloud.agent.api.SetupCommand;
 import com.cloud.agent.api.StartupCommand;
@@ -730,34 +729,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer,
L
         }
 
         _resourceMgr.deleteRoutingHost(host, isForced, isForceDeleteStorage);
-        if (host.getClusterId() != null) {
-            List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(com.cloud.host.Host.Type.Routing,
host.getClusterId(), host.getPodId(), host.getDataCenterId());
-            boolean success = true;
-            for (HostVO thost : hosts) {
-                if (thost.getId() == host.getId()) {
-                    continue;
-                }
-
-                long thostId = thost.getId();
-                PoolEjectCommand eject = new PoolEjectCommand(host.getGuid());
-                Answer answer = _agentMgr.easySend(thostId, eject);
-                if (answer != null && answer.getResult()) {
-                    s_logger.debug("Eject Host: " + host.getId() + " from " + thostId + "
Succeed");
-                    success = true;
-                    break;
-                } else {
-                    success = false;
-                    s_logger.warn("Eject Host: " + host.getId() + " from " + thostId + "
failed due to " + (answer != null ? answer.getDetails() : "no answer"));
-                }
-            }
-            if (!success) {
-                String msg =
-                        "Unable to eject host " + host.getGuid() + " due to there is no host
up in this cluster, please execute xe pool-eject host-uuid=" + host.getGuid() +
-                        "in this host " + host.getPrivateIpAddress();
-                s_logger.warn(msg);
-                _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(),
host.getPodId(), "Unable to eject host " + host.getGuid(), msg);
-            }
-        }
         return new DeleteHostAnswer(true);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/296dc861/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index d3fdb19..a57b606 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -87,7 +87,6 @@ import com.cloud.agent.api.PingRoutingWithOvsCommand;
 import com.cloud.agent.api.PingTestCommand;
 import com.cloud.agent.api.PlugNicAnswer;
 import com.cloud.agent.api.PlugNicCommand;
-import com.cloud.agent.api.PoolEjectCommand;
 import com.cloud.agent.api.PrepareForMigrationAnswer;
 import com.cloud.agent.api.PrepareForMigrationCommand;
 import com.cloud.agent.api.PvlanSetupCommand;
@@ -499,8 +498,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             return execute((CheckOnHostCommand)cmd);
         } else if (clazz == ModifySshKeysCommand.class) {
             return execute((ModifySshKeysCommand)cmd);
-        } else if (clazz == PoolEjectCommand.class) {
-            return execute((PoolEjectCommand)cmd);
         } else if (clazz == StartCommand.class) {
             return execute((StartCommand)cmd);
         } else if (clazz == CheckSshCommand.class) {
@@ -7055,58 +7052,6 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         _agentControl = agentControl;
     }
 
-    protected Answer execute(PoolEjectCommand cmd) {
-        Connection conn = getConnection();
-        String hostuuid = cmd.getHostuuid();
-        try {
-            Host host = Host.getByUuid(conn, hostuuid);
-            if (isRefNull(host)) {
-                s_logger.debug("host " + hostuuid + " has already been ejected from pool
" + _host.pool);
-                return new Answer(cmd);
-            }
-            // remove all tags cloud stack add before eject
-            Host.Record hr = host.getRecord(conn);
-            Iterator<String> it = hr.tags.iterator();
-            while (it.hasNext()) {
-                String tag = it.next();
-                if (tag.contains("cloud")) {
-                    it.remove();
-                }
-            }
-            host.setTags(conn, hr.tags);
-            Pool pool = Pool.getByUuid(conn, _host.pool);
-            Pool.Record poolr = pool.getRecord(conn);
-
-            Host.Record hostr = poolr.master.getRecord(conn);
-            if (_host.uuid.equals(hostr.uuid)) {
-                Map<Host, Host.Record> hostMap = Host.getAllRecords(conn);
-                if (hostMap.size() > 1) {
-                    String msg = "This host is XS master, please designate a new XS master
throught XenCenter before you delete this host from CS";
-                    s_logger.debug(msg);
-                    return new Answer(cmd, false, msg);
-                }
-            }
-
-            // eject from pool
-            try {
-                Pool.eject(conn, host);
-                try {
-                    Thread.sleep(10 * 1000);
-                } catch (InterruptedException e) {
-                }
-            } catch (XenAPIException e) {
-                String msg = "Unable to eject host " + _host.uuid + " due to " + e.toString();
-                s_logger.warn(msg);
-                host.destroy(conn);
-            }
-            return new Answer(cmd);
-        } catch (Exception e) {
-            String msg = "Exception Unable to destroy host " + _host.uuid + " in xenserver
database due to " + e.toString();
-            s_logger.warn(msg, e);
-            return new Answer(cmd, false, msg);
-        }
-    }
-
     private Answer execute(CleanupNetworkRulesCmd cmd) {
         if (!_canBridgeFirewall) {
             return new Answer(cmd, true, null);


Mime
View raw message