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

status 13379: resolved fixed

reviewed-by : edison
This commit is contained in:
anthony 2012-01-30 16:05:31 -08:00
parent 606708e0a3
commit ae31f362db
1 changed files with 19 additions and 35 deletions

View File

@ -531,13 +531,12 @@ public class XenServerConnectionPool {
s_logger.debug(msg);
throw new CloudRuntimeException(msg);
}
Host host = null;
synchronized (poolUuid.intern()) {
// Let's see if it is an existing connection.
mConn = getConnect(poolUuid);
if (mConn != null){
try{
host = Host.getByUuid(mConn, hostUuid);
Host.getByUuid(mConn, hostUuid);
} catch (Types.SessionInvalid e) {
s_logger.debug("Session thgrough ip " + mConn.getIp() + " is invalid for pool(" + poolUuid + ") due to " + e.toString());
try {
@ -636,39 +635,6 @@ 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;
}
@ -913,6 +879,24 @@ public class XenServerConnectionPool {
}
loginWithPassword(this, _username, _password, APIVersion.latest().toString());
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) {
s_logger.debug("XmlRpcClientException for method: " + method_call + " due to " + e.getMessage());
removeConnect(_poolUuid);