From 6d0bb6d58592e8400fd70030934eedf97ca2c290 Mon Sep 17 00:00:00 2001 From: anthony Date: Fri, 3 Feb 2012 15:22:16 -0800 Subject: [PATCH] Revert "bug 13379: throw exception, if master cannot connect to slave" This reverts commit 01768176fcd4b0dfe72baf16039e073d18344578. --- .../xen/resource/XenServerConnectionPool.java | 54 ++++++++++++------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/core/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java b/core/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java index 98b9eab694b..ccac8c341a5 100644 --- a/core/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java +++ b/core/src/com/cloud/hypervisor/xen/resource/XenServerConnectionPool.java @@ -531,12 +531,13 @@ 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.getByUuid(mConn, hostUuid); + host = 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 { @@ -635,6 +636,39 @@ public class XenServerConnectionPool { } } } + + if ( mConn != null ) { + if (s_managePool) { + try { + Map args = new HashMap(); + 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; } @@ -879,24 +913,6 @@ 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);