You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/03/27 00:28:42 UTC

git commit: updated refs/heads/master to ff1c064

Repository: cloudstack
Updated Branches:
  refs/heads/master c9edb7ecf -> ff1c0647f


in XS, joining a host to a XS pool may not work as expected, especially when there are multiple nics, binding devices.
admin needs to check if the right nics are binded togather, if network are propagated to the new host correctly before adding this host to CS.


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

Branch: refs/heads/master
Commit: ff1c0647fc8cac52b844f688c9e565daa672def7
Parents: c9edb7e
Author: Anthony Xu <an...@citrix.com>
Authored: Wed Mar 26 16:25:26 2014 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Wed Mar 26 16:25:26 2014 -0700

----------------------------------------------------------------------
 .../xen/discoverer/XcpServerDiscoverer.java     | 63 ++------------------
 .../xen/resource/XenServerConnectionPool.java   | 59 ------------------
 2 files changed, 4 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff1c0647/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 9852eda..14e993e 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
@@ -204,17 +204,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
                 List<HostVO> clusterHosts = _resourceMgr.listAllHostsInCluster(clusterId);
                 if (clusterHosts != null && clusterHosts.size() > 0) {
                     if (!clu.getGuid().equals(poolUuid)) {
-                        if (hosts.size() == 1) {
-                            if (!addHostsToPool(conn, hostIp, clusterId)) {
-                                String msg = "Unable to add host(" + hostIp + ") to cluster " + clusterId;
-                                s_logger.warn(msg);
-                                throw new DiscoveryException(msg);
-                            }
-                        } else {
-                            String msg = "Host (" + hostIp + ") is already in pool(" + poolUuid + "), can to join pool(" + clu.getGuid() + ")";
-                            s_logger.warn(msg);
-                            throw new DiscoveryException(msg);
-                        }
+                        String msg = "Please join the host " +  hostIp + " to XS pool  "
+                                       + clu.getGuid() + " through XC/XS before adding it through CS UI";
+                        s_logger.warn(msg);
+                        throw new DiscoveryException(msg);
                     }
                 } else {
                     setClusterGuid(clu, poolUuid);
@@ -370,54 +363,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
         }
     }
 
-    protected boolean addHostsToPool(Connection conn, String hostIp, Long clusterId) throws XenAPIException, XmlRpcException, DiscoveryException {
-
-        List<HostVO> hosts;
-        hosts = _resourceMgr.listAllHostsInCluster(clusterId);
-
-        String masterIp = null;
-        String username = null;
-        String password = null;
-        Queue<String> pass = new LinkedList<String>();
-        for (HostVO host : hosts) {
-            _hostDao.loadDetails(host);
-            username = host.getDetail("username");
-            password = host.getDetail("password");
-            pass.add(password);
-            String address = host.getPrivateIpAddress();
-            Connection hostConn = _connPool.getConnect(address, username, pass);
-            if (hostConn == null) {
-                continue;
-            }
-            try {
-                Set<Pool> pools = Pool.getAll(hostConn);
-                Pool pool = pools.iterator().next();
-                masterIp = pool.getMaster(hostConn).getAddress(hostConn);
-                break;
-
-            } catch (Exception e) {
-                s_logger.warn("Can not get master ip address from host " + address);
-            } finally {
-                try{
-                    Session.logout(hostConn);
-                } catch (Exception e ) {
-                }
-                hostConn.dispose();
-                hostConn = null;
-            }
-        }
-
-        if (masterIp == null) {
-            s_logger.warn("Unable to reach the pool master of the existing cluster");
-            throw new CloudRuntimeException("Unable to reach the pool master of the existing cluster");
-        }
-
-        if (!_connPool.joinPool(conn, hostIp, masterIp, username, pass)) {
-            s_logger.warn("Unable to join the pool");
-            throw new DiscoveryException("Unable to join the pool");
-        }
-        return true;
-    }
 
     protected CitrixResourceBase createServerResource(long dcId, Long podId, Host.Record record) {
         String prodBrand = record.softwareVersion.get("product_brand");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff1c0647/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
index 646d595..6a8d1cd 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java
@@ -148,65 +148,6 @@ public class XenServerConnectionPool {
         }
     }
 
-    public boolean joinPool(Connection conn, String hostIp, String masterIp, String username, Queue<String> password) {
-        try {
-            join(conn, masterIp, username, password);
-            if (s_logger.isDebugEnabled()) {
-                s_logger.debug("Host(" + hostIp + ") Join the pool at " + masterIp);
-            }
-            try {
-                // slave will restart xapi in 10 sec
-                Thread.sleep(10000);
-            } catch (InterruptedException e) {
-            }
-            for (int i = 0; i < 15; i++) {
-                Connection slaveConn = null;
-                Session slaveSession = null;
-                try {
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Logging on as the slave to " + hostIp);
-                    }
-                    slaveConn = new Connection(getURL(hostIp), 10);
-                    slaveSession = slaveLocalLoginWithPassword(slaveConn, username, password);
-                    if (s_logger.isDebugEnabled()) {
-                        s_logger.debug("Slave logon successful. session= " + slaveSession);
-                    }
-                    Pool.Record pr = getPoolRecord(slaveConn);
-                    Host master = pr.master;
-                    String ma = master.getAddress(slaveConn);
-                    if (ma.trim().equals(masterIp.trim())) {
-                        if (s_logger.isDebugEnabled()) {
-                            s_logger.debug("Host(" + hostIp + ") Joined the pool at " + masterIp);
-                        }
-                        return true;
-                    }
-                } catch (Exception e) {
-                } finally {
-                    if (slaveSession != null) {
-                        try {
-                            Session.logout(slaveConn);
-                        } catch (Exception e) {
-                        }
-                        slaveConn.dispose();
-                    }
-                }
-                try {
-                    Thread.sleep(3000);
-                } catch (InterruptedException e) {
-                }
-            }
-
-        } catch (Exception e) {
-            String msg = "Catch " + e.getClass().getName() + " Unable to allow host " + hostIp + " to join pool " + masterIp + " due to " + e.toString();
-            s_logger.warn(msg, e);
-        }
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Host(" + hostIp + ") unable to Join the pool at " + masterIp);
-        }
-        return false;
-    }
-
-
     public Connection getConnect(String ip, String username, Queue<String> password) {
         Connection conn = new Connection(getURL(ip), 10);
         try {