Revert "bug 13379: throw exception, if master cannot connect to slave"

This reverts commit 01768176fcd4b0dfe72baf16039e073d18344578.
This commit is contained in:
anthony 2012-02-03 15:22:16 -08:00
parent 38ada9c585
commit 6d0bb6d585

View File

@ -531,12 +531,13 @@ public class XenServerConnectionPool {
s_logger.debug(msg); s_logger.debug(msg);
throw new CloudRuntimeException(msg); throw new CloudRuntimeException(msg);
} }
Host host = null;
synchronized (poolUuid.intern()) { synchronized (poolUuid.intern()) {
// Let's see if it is an existing connection. // Let's see if it is an existing connection.
mConn = getConnect(poolUuid); mConn = getConnect(poolUuid);
if (mConn != null){ if (mConn != null){
try{ try{
Host.getByUuid(mConn, hostUuid); host = Host.getByUuid(mConn, hostUuid);
} catch (Types.SessionInvalid e) { } catch (Types.SessionInvalid e) {
s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString()); s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString());
try { try {
@ -635,6 +636,39 @@ public class XenServerConnectionPool {
} }
} }
} }
if ( mConn != null ) {
if (s_managePool) {
try {
Map<String, String> args = new HashMap<String, String>();
host.callPlugin(mConn, "vmops", "pingxenserver", args);
} catch (Types.CannotContactHost e ) {
if (s_logger.isDebugEnabled()) {
String msg = "Catch Exception: " + e.getClass().getName() + " Can't connect host " + ipAddress + " due to " + e.toString();
s_logger.debug(msg);
}
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
} catch (Types.HostOffline e ) {
if (s_logger.isDebugEnabled()) {
String msg = "Catch Exception: " + e.getClass().getName() + " Host is offline " + ipAddress + " due to " + e.toString();
s_logger.debug(msg);
}
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
} catch (Types.HostNotLive e ) {
String msg = "Catch Exception: " + e.getClass().getName() + " Host Not Live " + ipAddress + " due to " + e.toString();
if (s_logger.isDebugEnabled()) {
s_logger.debug(msg);
}
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
} catch (Exception e) {
String msg = "Master can not talk to Slave " + hostUuid + " IP " + ipAddress;
if (s_logger.isDebugEnabled()) {
s_logger.debug(msg);
}
throw new CloudRuntimeException(msg);
}
}
}
return mConn; return mConn;
} }
@ -879,24 +913,6 @@ public class XenServerConnectionPool {
} }
loginWithPassword(this, _username, _password, APIVersion.latest().toString()); loginWithPassword(this, _username, _password, APIVersion.latest().toString());
method_params[0] = getSessionReference(); method_params[0] = getSessionReference();
} catch (Types.CannotContactHost e ) {
if (s_logger.isDebugEnabled()) {
String msg = "Cannot Contact Host for method: " + method_call + " due to " + e.toString();
s_logger.debug(msg);
}
throw e;
} catch (Types.HostOffline e ) {
if (s_logger.isDebugEnabled()) {
String msg = "Host Offline for method: " + method_call + " due to " + e.toString();
s_logger.debug(msg);
}
throw e;
} catch (Types.HostNotLive e ) {
if (s_logger.isDebugEnabled()) {
String msg = "Host is Not alive for method: " + method_call + " due to " + e.toString();
s_logger.debug(msg);
}
throw e;
} catch (XmlRpcClientException e) { } catch (XmlRpcClientException e) {
s_logger.debug("XmlRpcClientException for method: " + method_call + " due to " + e.getMessage()); s_logger.debug("XmlRpcClientException for method: " + method_call + " due to " + e.getMessage());
removeConnect(_poolUuid); removeConnect(_poolUuid);