You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by rodrigo93 <gi...@git.apache.org> on 2016/02/06 02:12:03 UTC

[GitHub] cloudstack pull request: CLOUDSTACK-8855 Improve Error Message for...

Github user rodrigo93 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r52093680
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -971,33 +971,28 @@ public Answer easySend(final Long hostId, final Command cmd) {
         }
     
         @Override
    -    public boolean reconnect(final long hostId) {
    +    public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException{
             HostVO host;
     
             host = _hostDao.findById(hostId);
             if (host == null || host.getRemoved() != null) {
    -            s_logger.warn("Unable to find host " + hostId);
    -            return false;
    +            throw new CloudRuntimeException("Unable to find host " + hostId);
             }
     
             if (host.getStatus() == Status.Disconnected) {
    -            s_logger.info("Host is already disconnected, no work to be done");
    -            return true;
    +            throw new CloudRuntimeException("Host is already disconnected, no work to be done");
             }
     
             if (host.getStatus() != Status.Up && host.getStatus() != Status.Alert && host.getStatus() != Status.Rebalancing) {
    -            s_logger.info("Unable to disconnect host because it is not in the correct state: host=" + hostId + "; Status=" + host.getStatus());
    -            return false;
    +            throw  new CloudRuntimeException("Unable to disconnect host because it is not in the correct state: host=" + hostId + "; Status=" + host.getStatus());
             }
     
             final AgentAttache attache = findAttache(hostId);
             if (attache == null) {
    -            s_logger.info("Unable to disconnect host because it is not connected to this server: " + hostId);
    -            return false;
    +            throw new CloudRuntimeException("Unable to disconnect host because it is not connected to this server: " + hostId);
             }
     
             disconnectWithoutInvestigation(attache, Event.ShutdownRequested);
    -        return true;
         }
     
         public boolean executeUserRequest(final long hostId, final Event event) throws AgentUnavailableException {
    --- End diff --
    
    Couldn't this method be void as well and throw an exception if the execution fails?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---