|
54 | 54 | import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao; |
55 | 55 | import org.apache.cloudstack.utils.identity.ManagementServerNode; |
56 | 56 | import org.apache.commons.collections.MapUtils; |
| 57 | +import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; |
57 | 58 | import org.apache.commons.lang3.BooleanUtils; |
58 | 59 |
|
59 | 60 | import com.cloud.agent.AgentManager; |
@@ -618,30 +619,27 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi |
618 | 619 | logger.debug("Sending Connect to listener: {}", monitor.second().getClass().getSimpleName()); |
619 | 620 | for (int i = 0; i < cmd.length; i++) { |
620 | 621 | try { |
| 622 | + if (logger.isDebugEnabled()) { |
| 623 | + logger.debug("process connection to issue " + ReflectionToStringBuilderUtils.reflectCollection(cmd[i]) + " forRebalance == " + forRebalance); |
| 624 | + } |
621 | 625 | monitor.second().processConnect(host, cmd[i], forRebalance); |
622 | | - } catch (final Exception e) { |
623 | | - if (e instanceof ConnectionException) { |
624 | | - final ConnectionException ce = (ConnectionException)e; |
625 | | - if (ce.isSetupError()) { |
626 | | - logger.warn("Monitor {} says there is an error in the connect process for {} due to {}", |
627 | | - monitor.second().getClass().getSimpleName(), host, e.getMessage()); |
628 | | - handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); |
629 | | - throw ce; |
630 | | - } else { |
631 | | - logger.info("Monitor {} says not to continue the connect process for {} due to {}", |
632 | | - monitor.second().getClass().getSimpleName(), host, e.getMessage()); |
633 | | - handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); |
634 | | - return attache; |
635 | | - } |
636 | | - } else if (e instanceof HypervisorVersionChangedException) { |
637 | | - handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); |
638 | | - throw new CloudRuntimeException(String.format("Unable to connect %s", attache), e); |
639 | | - } else { |
640 | | - logger.error("Monitor {} says there is an error in the connect process for {} due to {}", |
641 | | - monitor.second().getClass().getSimpleName(), host, e.getMessage(), e); |
| 626 | + } catch (final ConnectionException ce) { |
| 627 | + if (ce.isSetupError()) { |
| 628 | + logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + ce.getMessage()); |
642 | 629 | handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); |
643 | | - throw new CloudRuntimeException(String.format("Unable to connect %s", attache), e); |
| 630 | + throw ce; |
| 631 | + } else { |
| 632 | + logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + " due to " + ce.getMessage()); |
| 633 | + handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); |
| 634 | + return attache; |
644 | 635 | } |
| 636 | + } catch (final HypervisorVersionChangedException hvce) { |
| 637 | + handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); |
| 638 | + throw new CloudRuntimeException("Unable to connect " + attache.getId(), hvce); |
| 639 | + } catch (final Exception e) { |
| 640 | + logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage(), e); |
| 641 | + handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); |
| 642 | + throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); |
645 | 643 | } |
646 | 644 | } |
647 | 645 | } |
|
0 commit comments