mirror of https://github.com/apache/cloudstack.git
first host doesn't need to switch master
This commit is contained in:
parent
f2e020cb5b
commit
0755c86304
|
|
@ -161,8 +161,6 @@ public class XenServerConnectionPool {
|
|||
protected synchronized void cleanup(String poolUuid) {
|
||||
ConnectionInfo info = _infos.remove(poolUuid);
|
||||
if (info == null) {
|
||||
s_logger.debug("Unable to find any information for pool "
|
||||
+ poolUuid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -573,6 +571,22 @@ public class XenServerConnectionPool {
|
|||
masterConn = null;
|
||||
masterIp = null;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Pool.Record pr = getPoolRecord(slaveConn);
|
||||
masterIp = pr.master.getAddress(slaveConn);
|
||||
masterUrl = new URL("http://" + masterIp);;
|
||||
masterConn = new XenServerConnection(masterUrl, username,
|
||||
password, _retries, _interval, wait);
|
||||
Session.loginWithPassword(masterConn, username, password,
|
||||
APIVersion.latest().toString());
|
||||
create_new_session = false;
|
||||
|
||||
} catch (Exception e) {
|
||||
cleanup(poolUuid);
|
||||
masterConn = null;
|
||||
masterIp = null;
|
||||
}
|
||||
}
|
||||
if (create_new_session) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -159,16 +159,8 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
}
|
||||
}
|
||||
}
|
||||
for( int i = 0; i < 2; i++ ) {
|
||||
|
||||
for (Map.Entry<Host, Host.Record> entry : hosts.entrySet()) {
|
||||
Host host = entry.getKey();
|
||||
if( i== 0 ) {
|
||||
if(!host.equals(master)) {
|
||||
continue;
|
||||
} else {
|
||||
hosts.remove(host);
|
||||
}
|
||||
}
|
||||
Host.Record record = entry.getValue();
|
||||
String hostAddr = record.address;
|
||||
|
||||
|
|
@ -247,7 +239,6 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
resource.start();
|
||||
resources.put(resource, details);
|
||||
}
|
||||
}
|
||||
|
||||
if (!addHostsToPool(url, conn, dcId, podId, clusterId, resources)) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue