You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by bvbharatk <gi...@git.apache.org> on 2015/09/16 08:37:52 UTC

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

GitHub user bvbharatk opened a pull request:

    https://github.com/apache/cloudstack/pull/837

    CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.

    earlier we were eating up exceptions from the lower layer which resulted in improper error messages. fixed partially by throwing exceptions and catching them at the appropriate layer.
    
    This also fixes the host alters. Earlier in the host alerts window we are listing only the alters, this dose not tell why the host when to alert state. This is fixed by adding the alert message to the host alerts.
    (changes in AlertManagerImpl.java). 
    
    tested manually.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bvbharatk/cloudstack CLOUDSTACK-8855

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cloudstack/pull/837.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #837
    
----
commit 7920ecfbbb92336bafd0804d1db244d40b9c4852
Author: Bharat Kumar <bh...@citrix.com>
Date:   2015-04-07T06:15:13Z

    CLOUDSTACK-8855 Improve Error Message for Host Alert State

----


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106185108
  
    --- Diff: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ---
    @@ -100,17 +103,18 @@ public Long getInstanceId() {
         @Override
         public void execute() {
             try {
    -            Host result = _resourceService.reconnectHost(this);
    -            if (result != null) {
    -                HostResponse response = _responseGenerator.createHostResponse(result);
    -                response.setResponseName(getCommandName());
    -                this.setResponseObject(response);
    -            } else {
    -                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
    -            }
    -        } catch (Exception ex) {
    -            s_logger.warn("Exception: ", ex);
    -            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
    +            Host result =_resourceService.reconnectHost(this);
    --- End diff --
    
    Great, thanks for the explanation.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105881440
  
    --- Diff: plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java ---
    @@ -512,7 +512,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
             });
             HostVO host = _hostDao.findById(lbDeviceVo.getHostId());
     
    -        _agentMgr.reconnect(host.getId());
    +        try {
    +            _agentMgr.reconnect(host.getId());
    +        } catch (Exception e ) {
    --- End diff --
    
    Using a more specific catch makes sense, I will take this up in a separate PR. This was supposed to be a small improvement to the existing code.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105942978
  
    --- Diff: engine/components-api/src/com/cloud/agent/AgentManager.java ---
    @@ -141,7 +142,7 @@
     
         public void pullAgentOutMaintenance(long hostId);
     
    -    boolean reconnect(long hostId);
    +    void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    @bvbharatk I got your intentions here. However, don\u2019t you think we can work out the places where people are login runtime exceptions, instead of bubbling them up? I believe that instead of creating constraints in the code, we should spot when people are introducing these things, and educate them. For the code that is already doing the things you mentioned, well, we can work to fix them bit by bit. 
    
    It feels a little unusual (at least for me) to declare runtime exceptions. At the end of the day, you may make it more visible, but just because you declare a runtime exception, it does not mean people will be forced to catch it (they will not be forced to catch it).
    
    BTW: I never had a good expression to talk about the re-throw of exceptions. Thanks for the \u201cbubble exception up\u201d.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106188366
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    I agree with you that we should not try to save the world in a single day. However, comments in the code for me mean nothing (comments and documentation are two different things). ACS has a lot of comments saying to improve this or that, and they just stay there for days, months and years. So, adding a comment like that does not bring any value to the code. My point is that this specific case is not a complicated one; it is only a matter of adding a column to a table, then a new property in a POJO, and setting the correct value in the newly created property.
    
    The same way I understand that we should not try to save the planet at once, I also have the philosophy that we should not let to do tomorrow what can be done today.



---
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.
---

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

Posted by sureshanaparti <gi...@git.apache.org>.
Github user sureshanaparti commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105888712
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -1049,7 +1044,13 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
                 }
                 return true;
             } else if (event == Event.ShutdownRequested) {
    -            return reconnect(hostId);
    +            //should throw a exception here as well.instead of eating this up.
    +           try {
    +               reconnect(hostId);
    +           } catch (CloudRuntimeException e) {
    --- End diff --
    
    @bvbharatk Thanks for the clarification.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106089352
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    @rafaelweingartner 
    I agree with you that it is a half measure, And so i commented "appending the message to the subject **for now**."  The idea was just to improve it little by little. We need not do every thing in this PR. We can work on it in a separate one.


---
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.
---

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

Posted by sureshanaparti <gi...@git.apache.org>.
Github user sureshanaparti commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105722036
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -1049,7 +1044,13 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
                 }
                 return true;
             } else if (event == Event.ShutdownRequested) {
    -            return reconnect(hostId);
    +            //should throw a exception here as well.instead of eating this up.
    +           try {
    +               reconnect(hostId);
    +           } catch (CloudRuntimeException e) {
    --- End diff --
    
    @bvbharatk Is it possible to take the failure reason forward?


---
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.
---

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

Posted by rhtyd <gi...@git.apache.org>.
Github user rhtyd commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-216190239
  
    @bvbharat please rebase against latest master and push -f, update on status of your PR
    
    also, how do we test your changes


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-140646781
  
    @wilderrodrigues 
    my bad, something went wrong while creating the pr. fixed this.


---
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.
---

[GitHub] cloudstack issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert ...

Posted by cloudmonger <gi...@git.apache.org>.
Github user cloudmonger commented on the issue:

    https://github.com/apache/cloudstack/pull/837
  
    ### ACS CI BVT Run
     **Sumarry:**
     Build Number 267
     Hypervisor vmware
     NetworkType Advanced
     Passed=24
     Failed=45
     Skipped=4
    
    _Link to logs Folder (search by build_no):_ https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0
    
    
    **Failed tests:**
    * test_deploy_vm_with_userdata.py
    
     * test_deployvm_userdata Failed
    
     * test_deployvm_userdata_post Failed
    
    * test_affinity_groups_projects.py
    
     * test_DeployVmAntiAffinityGroup_in_project Failed
    
    * test_vm_snapshots.py
    
     * ContextSuite context=TestVmSnapshot>:setup Failing since 2 runs
    
    * test_scale_vm.py
    
     * ContextSuite context=TestScaleVm>:setup Failing since 7 runs
    
    * test_service_offerings.py
    
     * ContextSuite context=TestServiceOfferings>:setup Failing since 19 runs
    
    * test_routers_iptables_default_policy.py
    
     * test_02_routervm_iptables_policies Failed
    
     * test_01_single_VPC_iptables_policies Failed
    
    * test_loadbalance.py
    
     * ContextSuite context=TestLoadBalance>:setup Failed
    
    * test_routers.py
    
     * ContextSuite context=TestRouterServices>:setup Failing since 3 runs
    
    * test_reset_vm_on_reboot.py
    
     * ContextSuite context=TestResetVmOnReboot>:setup Failing since 6 runs
    
    * test_deploy_vms_with_varied_deploymentplanners.py
    
     * test_deployvm_firstfit Failed
    
     * test_deployvm_userconcentrated Failed
    
     * test_deployvm_userdispersing Failed
    
    * test_network.py
    
     * test_delete_account Failed
    
     * ContextSuite context=TestPortForwarding>:setup Failed
    
     * test_reboot_router Failed
    
     * test_releaseIP Failed
    
     * ContextSuite context=TestRouterRules>:setup Failed
    
    * test_router_dns.py
    
     * ContextSuite context=TestRouterDns>:setup Failed
    
    * test_deploy_vm_iso.py
    
     * test_deploy_vm_from_iso Failed
    
    * test_list_ids_parameter.py
    
     * ContextSuite context=TestListIdsParams>:setup Failing since 8 runs
    
    * test_multipleips_per_nic.py
    
     * test_nic_secondaryip_add_remove Failed
    
    * test_affinity_groups.py
    
     * test_DeployVmAntiAffinityGroup Failed
    
    * test_network_acl.py
    
     * test_network_acl Failed
    
    * test_volumes.py
    
     * ContextSuite context=TestCreateVolume>:setup Failing since 4 runs
    
     * ContextSuite context=TestVolumes>:setup Failing since 3 runs
    
    * test_ssvm.py
    
     * test_03_ssvm_internals Failed
    
     * test_04_cpvm_internals Failed
    
     * test_05_stop_ssvm Failed
    
     * test_06_stop_cpvm Failed
    
     * test_07_reboot_ssvm Failed
    
     * test_08_reboot_cpvm Failed
    
     * test_09_destroy_ssvm Failed
    
     * test_10_destroy_cpvm Failed
    
    * test_nic.py
    
     * test_01_nic Failed
    
    * test_secondary_storage.py
    
     * test_01_sys_vm_start Failed
    
    * test_nested_virtualization.py
    
     * test_nested_virtualization_vmware Failed
    
    * test_deploy_vgpu_enabled_vm.py
    
     * test_3d_gpu_support Failed
    
    * test_vm_life_cycle.py
    
     * ContextSuite context=TestVMLifeCycle>:setup Failing since 5 runs
    
    * test_routers_network_ops.py
    
     * test_01_isolate_network_FW_PF_default_routes_egress_true Failed
    
     * test_02_isolate_network_FW_PF_default_routes_egress_false Failed
    
     * test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true Failing since 4 runs
    
     * test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Failing since 4 runs
    
     * test_03_RVR_Network_check_router_state Failing since 4 runs
    
    
    **Skipped tests:**
    test_vm_nic_adapter_vmxnet3
    test_static_role_account_acls
    test_11_ss_nfs_version_on_ssvm
    test_deploy_vgpu_enabled_vm
    
    **Passed test suits:**
    test_portable_publicip.py
    test_over_provisioning.py
    test_global_settings.py
    test_non_contigiousvlan.py
    test_login.py
    test_public_ip_range.py
    test_regions.py
    test_pvlan.py
    test_deploy_vm_root_resize.py
    test_resource_detail.py
    test_disk_offerings.py


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105952120
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    I understand that 999 characters may seem a lot, but the `content` may contain some long strings. for instance, in `com.cloud.network.router.VirtualNetworkApplianceManagerImpl.RvRStatusUpdateTask.checkDuplicateMaster(List<DomainRouterVO>)`, it is generated a `subject` and a `content` that together (depending on variable combinations used to create those strings) can go over 500 chars.
    
    What concerns me the most are methods such as `org.apache.cloudstack.storage.image.BaseImageStoreDriverImpl.createVolumeAsyncCallback(AsyncCallbackDispatcher<? extends BaseImageStoreDriverImpl, DownloadAnswer>, CreateContext<CreateCmdResult>)`, where the `subject` and `content` would be the same, and they are created using an error message that may come from the most different places.
    
    The use of `com.cloud.alert.AlertManagerImpl.sendAlert(AlertType, long, Long, String, String)` is quite broad and it would be a lot of work to check every single place it is used. For me, the code that you are adding at line 772 seem like a half-measure that is bug prone. I would like to hear the feedback from others on this topic.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105723252
  
    --- Diff: api/src/com/cloud/resource/ResourceService.java ---
    @@ -50,7 +52,7 @@
     
         Host cancelMaintenance(CancelMaintenanceCmd cmd);
     
    -    Host reconnectHost(ReconnectHostCmd cmd);
    +    Host reconnectHost(ReconnectHostCmd cmd) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    The `CloudRuntimeException` is a `RuntimeException` you do not need to declare it in the method signature.


---
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.
---

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

Posted by remibergsma <gi...@git.apache.org>.
Github user remibergsma commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-140745806
  
    @bvbharatk Any advise on how to test this?


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105881425
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    @rafaelweingartner 
    I think we can live with this for now and take it up in a separate PR.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105725769
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    Are you sure this is a good idea?
    If the column for content does exist, what about creating it with this PR? Thus, we can avoid this type of half measure solution. Especially that the column `subject` has a limitation on its size  `@Column(name = "subject", length = 999)`; this can potentially create problems in certain conditions in runtime.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105881592
  
    --- Diff: engine/components-api/src/com/cloud/agent/AgentManager.java ---
    @@ -141,7 +142,7 @@
     
         public void pullAgentOutMaintenance(long hostId);
     
    -    boolean reconnect(long hostId);
    +    void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    @rafaelweingartner 
    What you said is correct in general. But in case of our code we can see places where we catch runtime exceptions and fail without giving out the actual reason. If we think the reason is of no use to the user, we should simply bubble them up and handle them accordingly in the top most calling method.  If we think the reason is not of importance to the user, we can simply log it and then send appropriate error messages.
    
    In the current code i wanted to force people to bubble up the runtime exceptions as well and then take a call at the top most calling method. This way if something fails we do not see multiple exception messages one for each level at which the failure occurred and with different error messages leading to confusion.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105724153
  
    --- Diff: plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java ---
    @@ -512,7 +512,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
             });
             HostVO host = _hostDao.findById(lbDeviceVo.getHostId());
     
    -        _agentMgr.reconnect(host.getId());
    +        try {
    +            _agentMgr.reconnect(host.getId());
    +        } catch (Exception e ) {
    --- End diff --
    
    Cannot you use a more specific `catch` here?


---
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.
---

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

Posted by rodrigo93 <gi...@git.apache.org>.
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-213424108
  
    @swill 
    
    This is because of a problem with the CI environment. i will fix this and post the results again. Will remove these results for now. 


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106088915
  
    --- Diff: engine/components-api/src/com/cloud/agent/AgentManager.java ---
    @@ -141,7 +142,7 @@
     
         public void pullAgentOutMaintenance(long hostId);
     
    -    boolean reconnect(long hostId);
    +    void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    @rafaelweingartner
    When i said they will have to catch i meant, When a method declaration has one or more exceptions defined using throws clause then the method-call must handle all the defined exceptions. If he wants to handle it he will have to catch it, if he dose not want to handle he can bubble it up.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r60530964
  
    --- Diff: server/src/com/cloud/resource/ResourceManagerImpl.java ---
    @@ -1148,15 +1148,16 @@ public Host cancelMaintenance(final CancelMaintenanceCmd cmd) {
         }
     
         @Override
    -    public Host reconnectHost(final ReconnectHostCmd cmd) {
    -        final Long hostId = cmd.getId();
    +    public Host reconnectHost(ReconnectHostCmd cmd) throws CloudRuntimeException, AgentUnavailableException{
    --- End diff --
    
    @rodrigo93 
    
     The scope of this pr is to improve the exception handling and error messaging. Changing the method signature is not a immediate concern. I will make the suggested changes in another pr if i find time. 


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r107355223
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    @rafaelweingartner 
    I agree with you but "what can be done today" depends on the individuals priorities and bandwidth. Just so that the required improvement dose not get lost in comments i have created a ticket in Jira to track this, CLOUDSTACK-9846.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106088129
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -986,33 +986,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{
    --- End diff --
    
    @rafaelweingartner 
    The reconnect method is a method in the interface AgentManager.java, This interface is also implemented by ClusteredAgentManagerImpl.java in which propagateAgentEvent method throws a AgentUnavailableException.  So i had to add this to the interface and also to the implementing class method.



---
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.
---

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

Posted by swill <gi...@git.apache.org>.
Github user swill commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-213422548
  
    I am a bit concerned about this CI run.  There is a LOT failing which does not usually fail.  We will need to review the CI results and try to understand/fix the problems...


---
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.
---

[GitHub] cloudstack issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert ...

Posted by cloudmonger <gi...@git.apache.org>.
Github user cloudmonger commented on the issue:

    https://github.com/apache/cloudstack/pull/837
  
    ### ACS CI BVT Run
     **Sumarry:**
     Build Number 469
     Hypervisor xenserver
     NetworkType Advanced
     Passed=102
     Failed=3
     Skipped=7
    
    _Link to logs Folder (search by build_no):_ https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0
    
    
    **Failed tests:**
    * test_non_contigiousvlan.py
    
     * test_extendPhysicalNetworkVlan Failed
    
    * test_volumes.py
    
     * test_06_download_detached_volume Failed
    
    * test_routers_network_ops.py
    
     * test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Failed
    
    
    **Skipped tests:**
    test_01_test_vm_volume_snapshot
    test_vm_nic_adapter_vmxnet3
    test_static_role_account_acls
    test_11_ss_nfs_version_on_ssvm
    test_nested_virtualization_vmware
    test_3d_gpu_support
    test_deploy_vgpu_enabled_vm
    
    **Passed test suits:**
    test_deploy_vm_with_userdata.py
    test_affinity_groups_projects.py
    test_portable_publicip.py
    test_over_provisioning.py
    test_global_settings.py
    test_scale_vm.py
    test_service_offerings.py
    test_routers_iptables_default_policy.py
    test_loadbalance.py
    test_routers.py
    test_reset_vm_on_reboot.py
    test_deploy_vms_with_varied_deploymentplanners.py
    test_network.py
    test_router_dns.py
    test_login.py
    test_deploy_vm_iso.py
    test_list_ids_parameter.py
    test_public_ip_range.py
    test_multipleips_per_nic.py
    test_regions.py
    test_affinity_groups.py
    test_network_acl.py
    test_pvlan.py
    test_nic.py
    test_deploy_vm_root_resize.py
    test_resource_detail.py
    test_secondary_storage.py
    test_vm_life_cycle.py
    test_disk_offerings.py


---
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.
---

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

Posted by rodrigo93 <gi...@git.apache.org>.
Github user rodrigo93 commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r52094072
  
    --- Diff: server/src/com/cloud/resource/ResourceManagerImpl.java ---
    @@ -1148,15 +1148,16 @@ public Host cancelMaintenance(final CancelMaintenanceCmd cmd) {
         }
     
         @Override
    -    public Host reconnectHost(final ReconnectHostCmd cmd) {
    -        final Long hostId = cmd.getId();
    +    public Host reconnectHost(ReconnectHostCmd cmd) throws CloudRuntimeException, AgentUnavailableException{
    --- End diff --
    
    Does this method need to return a host? It seems that it just reconnects to a host, if not, throws an exception.
    If so, it could be void as well.


---
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.
---

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

Posted by wilderrodrigues <gi...@git.apache.org>.
Github user wilderrodrigues commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-140645828
  
    Why do we have 2 PR with the same issue/branch/description, @bvbharatk ? I check the PR #838 and that's about something else. Could you please edit the PR description?


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-213395917
  
    ### ACS CI BVT Run
     **Sumarry:**
     Build Number 3
     Hypervisor xenserver
     NetworkType Advanced
     Passed=69
     Failed=19
     Skipped=3
    
    _Link to logs Folder (search by build_no):_ https://www.dropbox.com/sh/yj3wnzbceo9uef2/AAB6u-Iap-xztdm6jHX9SjPja?dl=0
    
    
    **Failed tests:**
    * test_vm_snapshots.py
    
     * test_01_create_vm_snapshots Failed
    
     * test_02_revert_vm_snapshots Failed
    
     * test_03_delete_vm_snapshots Failed
    
    * test_guest_vlan_range.py
    
     * test_dedicateGuestVlanRange Failed
    
    * test_scale_vm.py
    
     * test_02_scale_vm_without_hypervisor_specifics Failed
    
    * test_service_offerings.py
    
     * test_04_change_offering_small Failed
    
    * test_loadbalance.py
    
     * test_01_create_lb_rule_src_nat Failed
    
     * test_02_create_lb_rule_non_nat Failed
    
     * test_assign_and_removal_lb Failed
    
    * test_deploy_vm_iso.py
    
     * test_deploy_vm_from_iso Failed
    
    * test_volumes.py
    
     * test_01_create_volume Failed
    
     * test_02_attach_volume Failed
    
     * test_06_download_detached_volume Failed
    
    * test_internal_lb.py
    
     * test_internallb Failed
    
    * test_vm_life_cycle.py
    
     * test_10_attachAndDetach_iso Failed
    
    * test_templates.py
    
     * test_01_create_template Failed
    
     * test_03_delete_template Failed
    
    * test_iso.py
    
     * test_01_create_iso Failing since 2 runs
    
     * ContextSuite context=TestISO>:setup Failing since 2 runs
    
    
    **Skipped tests:**
    test_vm_nic_adapter_vmxnet3
    test_deploy_vgpu_enabled_vm
    test_06_copy_template
    
    **Passed test suits:**
    test_deploy_vm_with_userdata.py
    test_portable_publicip.py
    test_vpc_vpn.py
    test_over_provisioning.py
    test_global_settings.py
    test_privategw_acl.py
    test_routers.py
    test_reset_vm_on_reboot.py
    test_snapshots.py
    test_deploy_vms_with_varied_deploymentplanners.py
    test_non_contigiousvlan.py
    test_public_ip_range.py
    test_multipleips_per_nic.py
    test_regions.py
    test_affinity_groups.py
    test_network_acl.py
    test_pvlan.py
    test_nic.py
    test_deploy_vm_root_resize.py
    test_resource_detail.py
    test_secondary_storage.py
    test_disk_offerings.py


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r108469206
  
    --- Diff: server/src/com/cloud/alert/AlertManagerImpl.java ---
    @@ -767,7 +767,9 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
                     // set up a new alert
                     AlertVO newAlert = new AlertVO();
                     newAlert.setType(alertType.getType());
    -                newAlert.setSubject(subject);
    +                //do not have a seperate column for content.
    +                //appending the message to the subject for now.
    +                newAlert.setSubject(subject+content);
    --- End diff --
    
    I agree with you regarding the time of contributor. I also find it great that you documented this and opened a Jira ticket. However, for this specific case, I am really not comfortable with the change as it is. As I said before, the code at line 772 is opening the gates for unexpected runtime exceptions (A.K.A. bugs). If others are willing to take the risk of merging and then later dealing with the consequences, I cannot do anything against it. I am only pointing at the problem and making it quite clear what I think.
    
    I really do not see any trouble to do things the right way here. It is only a matter of creating an alter table SQL that adds a field to a table. Then, you have to create this new field in `AlertVO`, and use it; as simple as that. 



---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106185631
  
    --- Diff: engine/components-api/src/com/cloud/agent/AgentManager.java ---
    @@ -141,7 +142,7 @@
     
         public void pullAgentOutMaintenance(long hostId);
     
    -    boolean reconnect(long hostId);
    +    void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    Are you talking in a philosophical/ideological way? Because `CloudRuntimeException` is a runtime exception, so the compiler will not complain if the code calls the method and does not handle the declared exception.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105723986
  
    --- Diff: engine/components-api/src/com/cloud/agent/AgentManager.java ---
    @@ -141,7 +142,7 @@
     
         public void pullAgentOutMaintenance(long hostId);
     
    -    boolean reconnect(long hostId);
    +    void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;
    --- End diff --
    
    the `CloudRuntimeException` is a `RuntimeException` you do not need to declare it in the method signature.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106088086
  
    --- Diff: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ---
    @@ -100,17 +103,18 @@ public Long getInstanceId() {
         @Override
         public void execute() {
             try {
    -            Host result = _resourceService.reconnectHost(this);
    -            if (result != null) {
    -                HostResponse response = _responseGenerator.createHostResponse(result);
    -                response.setResponseName(getCommandName());
    -                this.setResponseObject(response);
    -            } else {
    -                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
    -            }
    -        } catch (Exception ex) {
    -            s_logger.warn("Exception: ", ex);
    -            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
    +            Host result =_resourceService.reconnectHost(this);
    --- End diff --
    
    @rafaelweingartner 
    reconnectHost now throws an exception instead of returning a null. So i have removed the null check.


---
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.
---

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

Posted by swill <gi...@git.apache.org>.
Github user swill commented on the pull request:

    https://github.com/apache/cloudstack/pull/837#issuecomment-213430064
  
    @bvbharatk no problem.  :)  Thanks for the continued effort testing.  I just wanted to make sure we understood what was going on.  


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r106186279
  
    --- Diff: plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java ---
    @@ -512,7 +512,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
             });
             HostVO host = _hostDao.findById(lbDeviceVo.getHostId());
     
    -        _agentMgr.reconnect(host.getId());
    +        try {
    +            _agentMgr.reconnect(host.getId());
    +        } catch (Exception e ) {
    --- End diff --
    
    Got it.
    I miss-looked the call for `propagateAgentEvent` method



---
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.
---

[GitHub] cloudstack issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert ...

Posted by sureshanaparti <gi...@git.apache.org>.
Github user sureshanaparti commented on the issue:

    https://github.com/apache/cloudstack/pull/837
  
    Code changes LGTM.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105723834
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -986,33 +986,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{
    --- End diff --
    
    You added `AgentUnavailableException` to the method signature, but I did not see you throwing this exception anywhere.


---
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.
---

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

Posted by rafaelweingartner <gi...@git.apache.org>.
Github user rafaelweingartner commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105723444
  
    --- Diff: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ---
    @@ -100,17 +103,18 @@ public Long getInstanceId() {
         @Override
         public void execute() {
             try {
    -            Host result = _resourceService.reconnectHost(this);
    -            if (result != null) {
    -                HostResponse response = _responseGenerator.createHostResponse(result);
    -                response.setResponseName(getCommandName());
    -                this.setResponseObject(response);
    -            } else {
    -                throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
    -            }
    -        } catch (Exception ex) {
    -            s_logger.warn("Exception: ", ex);
    -            throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
    +            Host result =_resourceService.reconnectHost(this);
    --- End diff --
    
    Before the `result` was checked for `null`; can the method `_resourceService.reconnectHost(this)` return null?


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r105881247
  
    --- Diff: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---
    @@ -1049,7 +1044,13 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
                 }
                 return true;
             } else if (event == Event.ShutdownRequested) {
    -            return reconnect(hostId);
    +            //should throw a exception here as well.instead of eating this up.
    +           try {
    +               reconnect(hostId);
    +           } catch (CloudRuntimeException e) {
    --- End diff --
    
    @sureshanaparti 
    I agree with you, I have also added a comment in the code indicating the same. We can work on it in a different pr. This is just a small improvement to the existing code. Fixing this will need lot of rework and cause code churn. So the intention was to do this later in a separate PR.


---
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.
---

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

Posted by bvbharatk <gi...@git.apache.org>.
Github user bvbharatk commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/837#discussion_r60529246
  
    --- 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 --
    
    @rodrigo93 
    This method is already a void. 


---
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.
---