Uploaded image for project: 'CloudStack'
  1. CloudStack
  2. CLOUDSTACK-8855

Improve Error Message for Host Alert State

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.6.0
    • 4.12
    • None
    • Security Level: Public (Anyone can view this level - this is the default.)
    • None

    Attachments

      Activity

        githubbot ASF GitHub Bot added a comment -

        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 <bharat.kumar@citrix.com>
        Date: 2015-04-07T06:15:13Z

        CLOUDSTACK-8855 Improve Error Message for Host Alert State


        githubbot ASF GitHub Bot added a comment - 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 <bharat.kumar@citrix.com> Date: 2015-04-07T06:15:13Z CLOUDSTACK-8855 Improve Error Message for Host Alert State
        githubbot ASF GitHub Bot added a comment -

        GitHub user bvbharatk opened a pull request:

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

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

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

        https://github.com/apache/cloudstack/pull/838.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 #838


        commit 00bc60025e578e223613119690fae62da84ffdbf
        Author: Bharat Kumar <bharat.kumar@citrix.com>
        Date: 2015-02-19T05:10:16Z

        CLOUDSTACK-8857 listProjects doesn't return tags vmstopped or vmrunning when their value is zero


        githubbot ASF GitHub Bot added a comment - GitHub user bvbharatk opened a pull request: https://github.com/apache/cloudstack/pull/838 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-8857 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/838.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 #838 commit 00bc60025e578e223613119690fae62da84ffdbf Author: Bharat Kumar <bharat.kumar@citrix.com> Date: 2015-02-19T05:10:16Z CLOUDSTACK-8857 listProjects doesn't return tags vmstopped or vmrunning when their value is zero
        githubbot ASF GitHub Bot added a comment -

        Github user wilderrodrigues commented on the pull request:

        https://github.com/apache/cloudstack/pull/838#issuecomment-140645555

        Which steps should we follow to test it, @bvbharatk ?

        githubbot ASF GitHub Bot added a comment - Github user wilderrodrigues commented on the pull request: https://github.com/apache/cloudstack/pull/838#issuecomment-140645555 Which steps should we follow to test it, @bvbharatk ?
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        Github user bvbharatk commented on the pull request:

        https://github.com/apache/cloudstack/pull/837#issuecomment-213395917

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

        githubbot ASF GitHub Bot added a comment - 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
        githubbot ASF GitHub Bot added a comment -

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

        githubbot ASF GitHub Bot added a comment - 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...
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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

        githubbot ASF GitHub Bot added a comment - 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
        githubbot ASF GitHub Bot added a comment -

        Github user cloudmonger commented on the issue:

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

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

        githubbot ASF GitHub Bot added a comment - 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
        git@git.apache.org rashmidixit added a comment -

        Github user cloudmonger commented on the issue:

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

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

        git@git.apache.org rashmidixit added a comment - 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. —
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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?

        githubbot ASF GitHub Bot added a comment - 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?
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        Github user sureshanaparti commented on the issue:

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

        Code changes LGTM.

        githubbot ASF GitHub Bot added a comment - Github user sureshanaparti commented on the issue: https://github.com/apache/cloudstack/pull/837 Code changes LGTM.
        githubbot ASF GitHub Bot added a comment -

        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’t 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 “bubble exception up”.

        githubbot ASF GitHub Bot added a comment - 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’t 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 “bubble exception up”.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        Github user cloudmonger commented on the issue:

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

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

        githubbot ASF GitHub Bot added a comment - 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
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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

        githubbot ASF GitHub Bot added a comment - 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
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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 .
        githubbot ASF GitHub Bot added a comment -

        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.

        githubbot ASF GitHub Bot added a comment - 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.
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#issuecomment-354553542

        @rafaelweingartner is this now good to go?
        @marcaurele are you alright with this?
        @bvbharatk sorry, i don't get notified on @-mentions by github since a long time.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#issuecomment-354553542 @rafaelweingartner is this now good to go? @marcaurele are you alright with this? @bvbharatk sorry, i don't get notified on @-mentions by github since a long time. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland opened a new pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380

        this closes #837

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland opened a new pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380 this closes #837 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#issuecomment-354554586

        @rafaelweingartner @marcaurele I don't see the fork this is coming from. Are we ignoring this change or is it still valid? created #2380 to let you work on it!

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#issuecomment-354554586 @rafaelweingartner @marcaurele I don't see the fork this is coming from. Are we ignoring this change or is it still valid? created #2380 to let you work on it! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354554670

        @rafaelweingartner I can't add you as a reviewer. Are you member of the apache organisation?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354554670 @rafaelweingartner I can't add you as a reviewer. Are you member of the apache organisation? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354758853

        @DaanHoogland can you fix the build failures?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354758853 @DaanHoogland can you fix the build failures? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354760130

        @DaanHoogland that is probably because I am not in the Gitbox experiment.
        It is great that you picked this up, I was thinking on doing that myself, but with my current workload I would not have time to do this now.

        I would say that here I see the same problem as in #837. It feels so simple to create a new column in "AlertVO" table to add the content. I am not going to repeat the discussion we had there here. So, as long as others are ok with it.

        With the current state of the PR I give a -0.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354760130 @DaanHoogland that is probably because I am not in the Gitbox experiment. It is great that you picked this up, I was thinking on doing that myself, but with my current workload I would not have time to do this now. I would say that here I see the same problem as in #837. It feels so simple to create a new column in "AlertVO" table to add the content. I am not going to repeat the discussion we had there here. So, as long as others are ok with it. With the current state of the PR I give a -0. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381344

        ##########
        File path: engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
        ##########
        @@ -357,19 +357,12 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
        }

        @Override

        • public boolean reconnect(final long hostId) {
        • Boolean result;
        • try {
        • result = propagateAgentEvent(hostId, Event.ShutdownRequested);
        • if (result != null) { - return result; - }
        • } catch (final AgentUnavailableException e) {
        • s_logger.debug("cannot propagate agent reconnect because agent is not available", e);
        • return false;
          + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException {
          + Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested);
          + if (result!=null && !result) {
          + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId);

        Review comment:
        nitpick, grammar typo: `Failed to propagate agent change....`

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381344 ########## File path: engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java ########## @@ -357,19 +357,12 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A } @Override public boolean reconnect(final long hostId) { Boolean result; try { result = propagateAgentEvent(hostId, Event.ShutdownRequested); if (result != null) { - return result; - } } catch (final AgentUnavailableException e) { s_logger.debug("cannot propagate agent reconnect because agent is not available", e); return false; + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException { + Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested); + if (result!=null && !result) { + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); Review comment: nitpick, grammar typo: `Failed to propagate agent change....` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381276

        ##########
        File path: 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{
          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");

        Review comment:
        It looks pretty wrong to throw an exception when no action should be taken. What are the logic to throw an exception here?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381276 ########## File path: 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{ 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"); Review comment: It looks pretty wrong to throw an exception when no action should be taken. What are the logic to throw an exception here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381585

        ##########
        File path: 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); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e)

          { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + }

          + catch (CloudRuntimeException e)

          { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + }

          catch (AgentUnavailableException e) {

        Review comment:
        nitpick: please indent those catch blocks the same way

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - marcaurele commented on a change in pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#discussion_r159381585 ########## File path: 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); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } + catch (CloudRuntimeException e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } catch (AgentUnavailableException e) { Review comment: nitpick: please indent those catch blocks the same way ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354977686

        @rafaelweingartner @marcaurele @rhtyd I am not picking this up. I just 're-opened' this because there is no movement. Please send me your PR if you want to see anything changed.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-354977686 @rafaelweingartner @marcaurele @rhtyd I am not picking this up. I just 're-opened' this because there is no movement. Please send me your PR if you want to see anything changed. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355001857

        @DaanHoogland ok...
        I will try to squeeze this in next week.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355001857 @DaanHoogland ok... I will try to squeeze this in next week. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355278061

        @DaanHoogland I tried to push these changes to your branch, but it seems that I do not have permissions to do so. Shall I open a PR for your branch?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355278061 @DaanHoogland I tried to push these changes to your branch, but it seems that I do not have permissions to do so. Shall I open a PR for your branch? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355294984

        Hey @rafaelweingartner If I new how i would a few seconds ago have given you access, you know that
        please send PRs so I am forced to look at them.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355294984 Hey @rafaelweingartner If I new how i would a few seconds ago have given you access, you know that please send PRs so I am forced to look at them. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355304111

        @DaanHoogland PR created.
        @marcaurele do you have some other code change suggestion to apply here?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355304111 @DaanHoogland PR created. @marcaurele do you have some other code change suggestion to apply here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        marcaurele commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159676070

        ##########
        File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -994,33 +994,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");

        Review comment:
        This looks wrong to me, why throwing an exception when nothing has to be done?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - marcaurele commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159676070 ########## File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -994,33 +994,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"); Review comment: This looks wrong to me, why throwing an exception when nothing has to be done? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        marcaurele commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159676249

        ##########
        File path: plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
        ##########
        @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
        });
        HostVO host = _hostDao.findById(lbDeviceVo.getHostId());

        • _agentMgr.reconnect(host.getId());
          + try { + _agentMgr.reconnect(host.getId()); + }

          catch (Exception e ) {
          + s_logger.info("failed to reconnect host "+host);

        Review comment:
        `warn`

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - marcaurele commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159676249 ########## File path: plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java ########## @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); HostVO host = _hostDao.findById(lbDeviceVo.getHostId()); _agentMgr.reconnect(host.getId()); + try { + _agentMgr.reconnect(host.getId()); + } catch (Exception e ) { + s_logger.info("failed to reconnect host "+host); Review comment: `warn` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159678158

        ##########
        File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -994,33 +994,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");

        Review comment:
        I agree on this one. And besides that, if we take a closer look, the guy that proposed this change, was replacing the return of boolean values with exceptions to indicate some error. It makes sense that a false return would generate an exception while trying to reconnect as the case at line 1002. This one was returning true, so it feels that we should not throw an exception here.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159678158 ########## File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -994,33 +994,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"); Review comment: I agree on this one. And besides that, if we take a closer look, the guy that proposed this change, was replacing the return of boolean values with exceptions to indicate some error. It makes sense that a false return would generate an exception while trying to reconnect as the case at line 1002. This one was returning true, so it feels that we should not throw an exception here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355311377

        @marcaurele thanks for your feedback here. I already created a PR to Daan's branch.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#issuecomment-355311377 @marcaurele thanks for your feedback here. I already created a PR to Daan's branch. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159683766

        ##########
        File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -994,33 +980,29 @@ public Answer easySend(final Long hostId, final Command cmd) {
        }

        @Override

        • public boolean reconnect(final long hostId) {
        • HostVO host;
          + public void reconnect(final long hostId) throws AgentUnavailableException {
          + HostVO host = _hostDao.findById(hostId);
          + if (host == null) { + throw new CloudRuntimeException("Unable to find host: " + hostId); + }
        • host = _hostDao.findById(hostId);
        • if (host == null || host.getRemoved() != null) {
        • s_logger.warn("Unable to find host " + hostId);
        • return false;
          + if (host.getRemoved() != null) { + throw new CloudRuntimeException("Host has already been removed: " + hostId); }

        if (host.getStatus() == Status.Disconnected) {

        • s_logger.info("Host is already disconnected, no work to be done");
        • return true;
          + s_logger.debug("Host is already disconnected, no work to be done: " + hostId);

        Review comment:
        @DaanHoogland I made a mistake here. Can you fix it for me?
        You need to add a `return;`, right after line 994

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159683766 ########## File path: engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -994,33 +980,29 @@ public Answer easySend(final Long hostId, final Command cmd) { } @Override public boolean reconnect(final long hostId) { HostVO host; + public void reconnect(final long hostId) throws AgentUnavailableException { + HostVO host = _hostDao.findById(hostId); + if (host == null) { + throw new CloudRuntimeException("Unable to find host: " + hostId); + } host = _hostDao.findById(hostId); if (host == null || host.getRemoved() != null) { s_logger.warn("Unable to find host " + hostId); return false; + if (host.getRemoved() != null) { + throw new CloudRuntimeException("Host has already been removed: " + hostId); } if (host.getStatus() == Status.Disconnected) { s_logger.info("Host is already disconnected, no work to be done"); return true; + s_logger.debug("Host is already disconnected, no work to be done: " + hostId); Review comment: @DaanHoogland I made a mistake here. Can you fix it for me? You need to add a `return;`, right after line 994 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159825666

        ##########
        File path: engine/components-api/src/com/cloud/agent/AgentManager.java
        ##########
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        Review comment:
        this change is breaking things. We need to look at it. @rafaelweingartner CAManagerImpl.java needs the boolean. should we take this to 4.12? I'm not taking the time now.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159825666 ########## File path: engine/components-api/src/com/cloud/agent/AgentManager.java ########## @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; Review comment: this change is breaking things. We need to look at it. @rafaelweingartner CAManagerImpl.java needs the boolean. should we take this to 4.12? I'm not taking the time now. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159843830

        ##########
        File path: engine/components-api/src/com/cloud/agent/AgentManager.java
        ##########
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        Review comment:
        Hmm.. Let me try to look into it today...

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159843830 ########## File path: engine/components-api/src/com/cloud/agent/AgentManager.java ########## @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; Review comment: Hmm.. Let me try to look into it today... ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159846245

        ##########
        File path: engine/components-api/src/com/cloud/agent/AgentManager.java
        ##########
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        Review comment:
        Is the problem during compilation or execution?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159846245 ########## File path: engine/components-api/src/com/cloud/agent/AgentManager.java ########## @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; Review comment: Is the problem during compilation or execution? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159852323

        ##########
        File path: engine/components-api/src/com/cloud/agent/AgentManager.java
        ##########
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        Review comment:
        Never mind. Found the problem. I will work on it.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159852323 ########## File path: engine/components-api/src/com/cloud/agent/AgentManager.java ########## @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; Review comment: Never mind. Found the problem. I will work on it. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner opened a new pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387

        @DaanHoogland and @marcaurele I opened a new PR because it gets easier for me to fix problems and conflicts that may appear.

        This closes #2380
        This also closes #837

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner opened a new pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387 @DaanHoogland and @marcaurele I opened a new PR because it gets easier for me to fix problems and conflicts that may appear. This closes #2380 This also closes #837 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159854458

        ##########
        File path: engine/components-api/src/com/cloud/agent/AgentManager.java
        ##########
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        Review comment:
        I fixed the problem and opened a PR to send this whole contribution. This makes things easier for me.
        PR: #2387

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2380: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2380#discussion_r159854458 ########## File path: engine/components-api/src/com/cloud/agent/AgentManager.java ########## @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; Review comment: I fixed the problem and opened a PR to send this whole contribution. This makes things easier for me. PR: #2387 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355533348

        @blueorangutan package

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355533348 @blueorangutan package ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355533512

        @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355533512 @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355539933

        Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1596

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355539933 Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1596 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837#issuecomment-355766865

        Closing this due to two redundant/duplicate PRs that extend/fix over this PR - #2387 and #2380

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on issue #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837#issuecomment-355766865 Closing this due to two redundant/duplicate PRs that extend/fix over this PR - #2387 and #2380 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd closed pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/837

        This is a PR merged from a forked repository.
        As GitHub hides the original diff on merge, it is displayed below for
        the sake of provenance:

        As this is a foreign pull request (from a fork), the diff is supplied
        below (as it won't show otherwise due to GitHub magic):

        diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
        index 7050b97e0fe..8f163864d72 100644
        — a/api/src/com/cloud/resource/ResourceService.java
        +++ b/api/src/com/cloud/resource/ResourceService.java
        @@ -18,6 +18,8 @@

        import java.util.List;

        +import com.cloud.exception.AgentUnavailableException;
        +import com.cloud.utils.exception.CloudRuntimeException;
        import com.cloud.dc.DataCenter;
        import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
        import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
        @@ -50,7 +52,7 @@

        Host cancelMaintenance(CancelMaintenanceCmd cmd);

        • Host reconnectHost(ReconnectHostCmd cmd);
          + Host reconnectHost(ReconnectHostCmd cmd) throws CloudRuntimeException, AgentUnavailableException;

        /**

        • We will automatically create a cloud.com cluster to attach to the external cluster and return a hyper host to perform
          diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
          index 5e156372681..0fd834206cf 100644
            • a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
              +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
              @@ -16,6 +16,9 @@
              // under the License.
              package org.apache.cloudstack.api.command.admin.host;

        +import com.cloud.exception.AgentUnavailableException;
        +import com.cloud.exception.InvalidParameterValueException;
        +import com.cloud.utils.exception.CloudRuntimeException;
        import org.apache.log4j.Logger;

        import org.apache.cloudstack.api.APICommand;
        @@ -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); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e)

          { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + }

          + catch (CloudRuntimeException e)

          { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + }

          catch (AgentUnavailableException e)

          { + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, e.getMessage()); }

          }
          }
          diff --git a/engine/components-api/src/com/cloud/agent/AgentManager.java b/engine/components-api/src/com/cloud/agent/AgentManager.java
          index 244772d67d0..8024210909f 100644

            • a/engine/components-api/src/com/cloud/agent/AgentManager.java
              +++ b/engine/components-api/src/com/cloud/agent/AgentManager.java
              @@ -16,6 +16,7 @@
              // under the License.
              package com.cloud.agent;

        +import com.cloud.utils.exception.CloudRuntimeException;
        import org.apache.cloudstack.framework.config.ConfigKey;

        import com.cloud.agent.api.Answer;
        @@ -141,7 +142,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException;

        void rescan();

        diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
        index aa7068af533..2a37ee2cd66 100644
        — a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
        +++ b/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{
          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;
          }

        @Override
        @@ -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)

          { + return false; + }

          + return true;
          }
          return false;
          }
          diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
          index 9239adc0911..340e0f7bbd5 100644

            • a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
              +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
              @@ -357,19 +357,12 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
              }

        @Override

        • public boolean reconnect(final long hostId) {
        • Boolean result;
        • try {
        • result = propagateAgentEvent(hostId, Event.ShutdownRequested);
        • if (result != null) { - return result; - }
        • } catch (final AgentUnavailableException e) {
        • s_logger.debug("cannot propagate agent reconnect because agent is not available", e);
        • return false;
          + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException {
          + Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested);
          + if (result!=null && !result) { + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); }

          -

        • return super.reconnect(hostId);
          + super.reconnect(hostId);
          }

        public void notifyNodesInCluster(final AgentAttache attache) {
        diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
        index 99db9ee8158..c65a50d3fb5 100644
        — a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
        +++ b/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 )

          { + s_logger.debug("failed to reconnect host "+host); + }

          return lbDeviceVo;
          }

        diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java
        index e18d231e173..4e8eae43d74 100644
        — a/server/src/com/cloud/alert/AlertManagerImpl.java
        +++ b/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);
          newAlert.setClusterId(clusterId);
          newAlert.setPodId(podId);
          newAlert.setDataCenterId(dataCenterId);
          diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
          index 2bb1596ed1c..7ccafc031e1 100644
            • a/server/src/com/cloud/resource/ResourceManagerImpl.java
              +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
              @@ -1157,15 +1157,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{
          + Long hostId = cmd.getId();

        final HostVO host = _hostDao.findById(hostId);
        if (host == null)

        { throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist"); }
        • return _agentMgr.reconnect(hostId) ? host : null;
          + _agentMgr.reconnect(hostId);
          + return host;
          }

        @Override

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd closed pull request #837: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/837 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java index 7050b97e0fe..8f163864d72 100644 — a/api/src/com/cloud/resource/ResourceService.java +++ b/api/src/com/cloud/resource/ResourceService.java @@ -18,6 +18,8 @@ import java.util.List; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.dc.DataCenter; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd; @@ -50,7 +52,7 @@ Host cancelMaintenance(CancelMaintenanceCmd cmd); Host reconnectHost(ReconnectHostCmd cmd); + Host reconnectHost(ReconnectHostCmd cmd) throws CloudRuntimeException, AgentUnavailableException; /** We will automatically create a cloud.com cluster to attach to the external cluster and return a hyper host to perform diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java index 5e156372681..0fd834206cf 100644 a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java @@ -16,6 +16,9 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.utils.exception.CloudRuntimeException; import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; @@ -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); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } + catch (CloudRuntimeException e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } catch (AgentUnavailableException e) { + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, e.getMessage()); } } } diff --git a/engine/components-api/src/com/cloud/agent/AgentManager.java b/engine/components-api/src/com/cloud/agent/AgentManager.java index 244772d67d0..8024210909f 100644 a/engine/components-api/src/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/com/cloud/agent/AgentManager.java @@ -16,6 +16,7 @@ // under the License. package com.cloud.agent; +import com.cloud.utils.exception.CloudRuntimeException; import org.apache.cloudstack.framework.config.ConfigKey; import com.cloud.agent.api.Answer; @@ -141,7 +142,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws CloudRuntimeException, AgentUnavailableException; void rescan(); diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java index aa7068af533..2a37ee2cd66 100644 — a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/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{ 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; } @Override @@ -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) { + return false; + } + return true; } return false; } diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java index 9239adc0911..340e0f7bbd5 100644 a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java +++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java @@ -357,19 +357,12 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A } @Override public boolean reconnect(final long hostId) { Boolean result; try { result = propagateAgentEvent(hostId, Event.ShutdownRequested); if (result != null) { - return result; - } } catch (final AgentUnavailableException e) { s_logger.debug("cannot propagate agent reconnect because agent is not available", e); return false; + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException { + Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested); + if (result!=null && !result) { + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); } - return super.reconnect(hostId); + super.reconnect(hostId); } public void notifyNodesInCluster(final AgentAttache attache) { diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java index 99db9ee8158..c65a50d3fb5 100644 — a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java +++ b/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 ) { + s_logger.debug("failed to reconnect host "+host); + } return lbDeviceVo; } diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java index e18d231e173..4e8eae43d74 100644 — a/server/src/com/cloud/alert/AlertManagerImpl.java +++ b/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); newAlert.setClusterId(clusterId); newAlert.setPodId(podId); newAlert.setDataCenterId(dataCenterId); diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 2bb1596ed1c..7ccafc031e1 100644 a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -1157,15 +1157,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{ + Long hostId = cmd.getId(); final HostVO host = _hostDao.findById(hostId); if (host == null) { throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist"); } return _agentMgr.reconnect(hostId) ? host : null; + _agentMgr.reconnect(hostId); + return host; } @Override ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857552

        ##########
        File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
        ##########
        @@ -101,16 +104,17 @@ public Long getInstanceId() {
        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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e) {

        Review comment:
        Space between catch and closing brace?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857552 ########## File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ########## @@ -101,16 +104,17 @@ public Long getInstanceId() { 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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { Review comment: Space between catch and closing brace? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857611

        ##########
        File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
        ##########
        @@ -101,16 +104,17 @@ public Long getInstanceId() {
        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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e)

          { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + }

          + catch (CloudRuntimeException e)

          { Review comment: Fix this to be one same line as closing brace `}

          `

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857611 ########## File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ########## @@ -101,16 +104,17 @@ public Long getInstanceId() { 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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } + catch (CloudRuntimeException e) { Review comment: Fix this to be one same line as closing brace `} ` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857677

        ##########
        File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
        ##########
        @@ -101,16 +104,17 @@ public Long getInstanceId() {
        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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e)

          { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + }

          + catch (CloudRuntimeException e)

          { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + }

          catch (AgentUnavailableException e) {

        Review comment:
        Same as above^^

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rhtyd commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r159857677 ########## File path: api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java ########## @@ -101,16 +104,17 @@ public Long getInstanceId() { 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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } + catch (CloudRuntimeException e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } catch (AgentUnavailableException e) { Review comment: Same as above^^ ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355854202

        @rhtyd thanks for spotting that!
        Changes applied and conflicts solved.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-355854202 @rhtyd thanks for spotting that! Changes applied and conflicts solved. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-360980209

        @DaanHoogland and @marcaurele these last two days I have been working to fix all conflicts and rebase my PRs against the new master. However, this one that we were working together I did not understand why one of the travis tests are failing. Could you guys lend me your fresh eyes here?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-360980209 @DaanHoogland and @marcaurele these last two days I have been working to fix all conflicts and rebase my PRs against the new master. However, this one that we were working together I did not understand why one of the travis tests are failing. Could you guys lend me your fresh eyes here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-361006147

        I restarted the travis run. I don't see any reason but there is some link; the test is a certificate error and the changes are involving reconnects , might be a travis error, though.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-361006147 I restarted the travis run. I don't see any reason but there is some link; the test is a certificate error and the changes are involving reconnects , might be a travis error, though. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-363711508

        @bvbharatk care to review this?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-363711508 @bvbharatk care to review this? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-369641394

        @DaanHoogland I fixed that test that was not working. I isolated it, and then everything started working just fine. I think it was a concurrency problem.

        @marcaurele would you mind finish the review here?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-369641394 @DaanHoogland I fixed that test that was not working. I isolated it, and then everything started working just fine. I think it was a concurrency problem. @marcaurele would you mind finish the review here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370789719

        @borisstoyanov could you run tests here?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370789719 @borisstoyanov could you run tests here? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370791497

        @blueorangutan package

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370791497 @blueorangutan package ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370791841

        @borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370791841 @borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370819925

        Packaging result: ✔centos6 ✔centos7 ✖debian. JID-1760

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370819925 Packaging result: ✔centos6 ✔centos7 ✖debian. JID-1760 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370900271

        @blueorangutan test

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370900271 @blueorangutan test ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370900489

        @borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-370900489 @borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371014155

        <b>Trillian test result (tid-2327)</b>
        Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
        Total time taken: 28075 seconds
        Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2387-t2327-kvm-centos7.zip
        Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
        Intermitten failure detected: /marvin/tests/smoke/test_public_ip_range.py
        Intermitten failure detected: /marvin/tests/smoke/test_templates.py
        Intermitten failure detected: /marvin/tests/smoke/test_usage.py
        Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
        Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
        Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
        Smoke tests completed. 63 look OK, 4 have error(s)
        Only failed tests results shown below:

        Test | Result | Time (s) | Test File
        — | — | — | —
        test_04_extract_template | `Failure` | 128.29 | test_templates.py
        ContextSuite context=TestISOUsage>:setup | `Error` | 0.00 | test_usage.py
        test_06_download_detached_volume | `Failure` | 137.84 | test_volumes.py
        test_01_redundant_vpc_site2site_vpn | `Failure` | 324.51 | test_vpc_vpn.py

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371014155 <b>Trillian test result (tid-2327)</b> Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 28075 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2387-t2327-kvm-centos7.zip Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py Intermitten failure detected: /marvin/tests/smoke/test_public_ip_range.py Intermitten failure detected: /marvin/tests/smoke/test_templates.py Intermitten failure detected: /marvin/tests/smoke/test_usage.py Intermitten failure detected: /marvin/tests/smoke/test_volumes.py Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py Smoke tests completed. 63 look OK, 4 have error(s) Only failed tests results shown below: Test | Result | Time (s) | Test File — | — | — | — test_04_extract_template | `Failure` | 128.29 | test_templates.py ContextSuite context=TestISOUsage>:setup | `Error` | 0.00 | test_usage.py test_06_download_detached_volume | `Failure` | 137.84 | test_volumes.py test_01_redundant_vpc_site2site_vpn | `Failure` | 324.51 | test_vpc_vpn.py ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371117317

        @borisroman are those errors/failures ok?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371117317 @borisroman are those errors/failures ok? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118121

        Let me run smoke tests again, but I think we've seen them quite frequently on random PRs.
        @blueorangutan test

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - borisstoyanov commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118121 Let me run smoke tests again, but I think we've seen them quite frequently on random PRs. @blueorangutan test ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118309

        @borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118309 @borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118779

        ok, thanks.
        @DaanHoogland have you approaved this PR?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371118779 ok, thanks. @DaanHoogland have you approaved this PR? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371420710

        @rafaelweingartner i did i think but my approval is kind of stale. Let me find time to revisit it, please

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371420710 @rafaelweingartner i did i think but my approval is kind of stale. Let me find time to revisit it, please ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371439724

        Sure, no problem.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-371439724 Sure, no problem. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372255160

        @DaanHoogland since your approval the code did not change. I only isolated a smoke test case that was causing problems.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372255160 @DaanHoogland since your approval the code did not change. I only isolated a smoke test case that was causing problems. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372733816

        @rafaelweingartner sorry for sickness and €dayjob preventing me to review again, can you resolve conflicts?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372733816 @rafaelweingartner sorry for sickness and €dayjob preventing me to review again, can you resolve conflicts? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372736483

        @DaanHoogland done.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-372736483 @DaanHoogland done. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174250100

        ##########
        File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -122,7 +122,6 @@
        **/
        public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable {
        protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);

        • protected static final Logger status_logger = Logger.getLogger(Status.class);

        Review comment:
        this seems a functional backwards incompatible change. Did you considder that?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174250100 ########## File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -122,7 +122,6 @@ **/ public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable { protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); Review comment: this seems a functional backwards incompatible change. Did you considder that? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174251431

        ##########
        File path: server/src/main/java/com/cloud/alert/AlertManagerImpl.java
        ##########
        @@ -85,10 +80,12 @@
        import com.cloud.utils.component.ManagerBase;
        import com.cloud.utils.concurrency.NamedThreadFactory;
        import com.cloud.utils.db.SearchCriteria;
        +import com.sun.mail.smtp.SMTPMessage;
        +import com.sun.mail.smtp.SMTPSSLTransport;
        +import com.sun.mail.smtp.SMTPTransport;

        public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable {
        private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());

        • private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");

        Review comment:
        another interface change! Please realise that this is incompatible!

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174251431 ########## File path: server/src/main/java/com/cloud/alert/AlertManagerImpl.java ########## @@ -85,10 +80,12 @@ import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.SearchCriteria; +import com.sun.mail.smtp.SMTPMessage; +import com.sun.mail.smtp.SMTPSSLTransport; +import com.sun.mail.smtp.SMTPTransport; public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable { private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName()); private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts"); Review comment: another interface change! Please realise that this is incompatible! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174248061

        ##########
        File path: plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java
        ##########
        @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
        });
        HostVO host = _hostDao.findById(lbDeviceVo.getHostId());

        • _agentMgr.reconnect(host.getId());
          + try { + _agentMgr.reconnect(host.getId()); + }

          catch (Exception e ) {

        Review comment:
        Pokemon?

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174248061 ########## File path: plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java ########## @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); HostVO host = _hostDao.findById(lbDeviceVo.getHostId()); _agentMgr.reconnect(host.getId()); + try { + _agentMgr.reconnect(host.getId()); + } catch (Exception e ) { Review comment: Pokemon? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174436501

        ##########
        File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -122,7 +122,6 @@
        **/
        public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable {
        protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);

        • protected static final Logger status_logger = Logger.getLogger(Status.class);

        Review comment:
        Yes, I did. It is a change in the logging class that is used on the left side of the log message in the log file. People normally lock down their log parse in the message per se, but for sure if they are considering the class as well, this can break things.
        I changed this for a simple reason. It is misleading. It will show as if the “Status” class is generating that message, which is not true. I see no reason for this type of code.

        I can revert this change, but my position is that it does not make sense. It is not used consistently. The same type of message is being logged also with the other logger.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174436501 ########## File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -122,7 +122,6 @@ **/ public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable { protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); Review comment: Yes, I did. It is a change in the logging class that is used on the left side of the log message in the log file. People normally lock down their log parse in the message per se, but for sure if they are considering the class as well, this can break things. I changed this for a simple reason. It is misleading. It will show as if the “Status” class is generating that message, which is not true. I see no reason for this type of code. I can revert this change, but my position is that it does not make sense. It is not used consistently. The same type of message is being logged also with the other logger. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174436688

        ##########
        File path: server/src/main/java/com/cloud/alert/AlertManagerImpl.java
        ##########
        @@ -85,10 +80,12 @@
        import com.cloud.utils.component.ManagerBase;
        import com.cloud.utils.concurrency.NamedThreadFactory;
        import com.cloud.utils.db.SearchCriteria;
        +import com.sun.mail.smtp.SMTPMessage;
        +import com.sun.mail.smtp.SMTPSSLTransport;
        +import com.sun.mail.smtp.SMTPTransport;

        public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable {
        private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());

        • private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");

        Review comment:
        I do not consider this as an interface, explanation is above.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174436688 ########## File path: server/src/main/java/com/cloud/alert/AlertManagerImpl.java ########## @@ -85,10 +80,12 @@ import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.SearchCriteria; +import com.sun.mail.smtp.SMTPMessage; +import com.sun.mail.smtp.SMTPSSLTransport; +import com.sun.mail.smtp.SMTPTransport; public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable { private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName()); private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts"); Review comment: I do not consider this as an interface, explanation is above. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174437190

        ##########
        File path: plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java
        ##########
        @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
        });
        HostVO host = _hostDao.findById(lbDeviceVo.getHostId());

        • _agentMgr.reconnect(host.getId());
          + try { + _agentMgr.reconnect(host.getId()); + }

          catch (Exception e ) {

        Review comment:
        This pokemon was caught with the next commit

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174437190 ########## File path: plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java ########## @@ -759,7 +759,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); HostVO host = _hostDao.findById(lbDeviceVo.getHostId()); _agentMgr.reconnect(host.getId()); + try { + _agentMgr.reconnect(host.getId()); + } catch (Exception e ) { Review comment: This pokemon was caught with the next commit ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174560563

        ##########
        File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -122,7 +122,6 @@
        **/
        public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable {
        protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);

        • protected static final Logger status_logger = Logger.getLogger(Status.class);

        Review comment:
        I agree it is a corner case and we can revert that if someone complains but it is an interface of the system, through the log configuration.
        I am fine with it, juat wanted to be sure you realised.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174560563 ########## File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -122,7 +122,6 @@ **/ public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable { protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); Review comment: I agree it is a corner case and we can revert that if someone complains but it is an interface of the system, through the log configuration. I am fine with it, juat wanted to be sure you realised. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174560563

        ##########
        File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        ##########
        @@ -122,7 +122,6 @@
        **/
        public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable {
        protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);

        • protected static final Logger status_logger = Logger.getLogger(Status.class);

        Review comment:
        I agree it is a corner case and we can revert that if someone complains but it is an interface of the system, through the log configuration.
        I am fine with it, just wanted to be sure you realised. Also so we have a placeholder to easily find where to fix if someone complains

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - DaanHoogland commented on a change in pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#discussion_r174560563 ########## File path: engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java ########## @@ -122,7 +122,6 @@ **/ public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable { protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); Review comment: I agree it is a corner case and we can revert that if someone complains but it is an interface of the system, through the log configuration. I am fine with it, just wanted to be sure you realised. Also so we have a placeholder to easily find where to fix if someone complains ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-373124425

        @DaanHoogland thank you very much!

        We will finally push this PR forward.

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-373124425 @DaanHoogland thank you very much! We will finally push this PR forward. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org
        githubbot ASF GitHub Bot added a comment -

        rafaelweingartner closed pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387

        This is a PR merged from a forked repository.
        As GitHub hides the original diff on merge, it is displayed below for
        the sake of provenance:

        As this is a foreign pull request (from a fork), the diff is supplied
        below (as it won't show otherwise due to GitHub magic):

        diff --git a/.travis.yml b/.travis.yml
        index be0bfb12210..f4b52bae945 100644
        — a/.travis.yml
        +++ b/.travis.yml
        @@ -33,10 +33,11 @@ env:

        • PATH=$HOME/.local/bin:$PATH
          matrix:
        1. Keep the TESTS sorted by name and grouped by type
          + - TESTS="smoke/test_certauthority_root"
          +
        • TESTS="smoke/test_accounts
          smoke/test_affinity_groups
          smoke/test_affinity_groups_projects
        • smoke/test_certauthority_root
          smoke/test_deploy_vgpu_enabled_vm
          smoke/test_deploy_vm_iso
          smoke/test_deploy_vm_root_resize
          diff --git a/api/src/main/java/com/cloud/alert/Alert.java b/api/src/main/java/com/cloud/alert/Alert.java
          index f77442068d6..d85dca5b7b0 100644
            • a/api/src/main/java/com/cloud/alert/Alert.java
              +++ b/api/src/main/java/com/cloud/alert/Alert.java
              @@ -41,4 +41,6 @@
              boolean getArchived();

        String getName();
        +
        + String getContent();
        }
        diff --git a/api/src/main/java/com/cloud/resource/ResourceService.java b/api/src/main/java/com/cloud/resource/ResourceService.java
        index 854b53591d6..70823084d84 100644
        — a/api/src/main/java/com/cloud/resource/ResourceService.java
        +++ b/api/src/main/java/com/cloud/resource/ResourceService.java
        @@ -18,7 +18,6 @@

        import java.util.List;

        -import com.cloud.dc.DataCenter;
        import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
        import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
        import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
        @@ -29,6 +28,8 @@
        import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
        import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;

        +import com.cloud.dc.DataCenter;
        +import com.cloud.exception.AgentUnavailableException;
        import com.cloud.exception.DiscoveryException;
        import com.cloud.exception.InvalidParameterValueException;
        import com.cloud.exception.ResourceInUseException;
        @@ -41,25 +42,17 @@
        /**

        • Updates a host
          *
        • * @param cmd
        • * - the command specifying hostId
        • * @return hostObject
        • * @throws NoTransitionException
          + * @param cmd - the command specifying hostId
          */
          Host updateHost(UpdateHostCmd cmd) throws NoTransitionException;

        Host cancelMaintenance(CancelMaintenanceCmd cmd);

        • Host reconnectHost(ReconnectHostCmd cmd);
          + Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException;

        /**

        • We will automatically create an Apache CloudStack cluster to attach to the external cluster and return a hyper host to perform
        • host related operation within the cluster
        • *
        • * @param cmd
        • * @return
        • * @throws IllegalArgumentException
        • * @throws DiscoveryException
          */
          List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, ResourceInUseException;

        @@ -75,12 +68,6 @@

        /**

        • Deletes a host
        • *
        • * @param hostId
        • * TODO
        • * @param isForced
        • * TODO
        • *
        • @param true if deleted, false otherwise
          */
          boolean deleteHost(long hostId, boolean isForced, boolean isForceDeleteStorage);
          diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
          index 5e156372681..34e439f3a37 100644
            • a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
              +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
              @@ -16,8 +16,6 @@
              // under the License.
              package org.apache.cloudstack.api.command.admin.host;

        -import org.apache.log4j.Logger;
        -
        import org.apache.cloudstack.api.APICommand;
        import org.apache.cloudstack.api.ApiCommandJobType;
        import org.apache.cloudstack.api.ApiConstants;
        @@ -27,13 +25,16 @@
        import org.apache.cloudstack.api.ServerApiException;
        import org.apache.cloudstack.api.response.HostResponse;
        import org.apache.cloudstack.context.CallContext;
        +import org.apache.log4j.Logger;

        import com.cloud.event.EventTypes;
        +import com.cloud.exception.AgentUnavailableException;
        +import com.cloud.exception.InvalidParameterValueException;
        import com.cloud.host.Host;
        import com.cloud.user.Account;
        +import com.cloud.utils.exception.CloudRuntimeException;

        -@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class,

        • requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
          +@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
          public class ReconnectHostCmd extends BaseAsyncCmd {
          public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName());

        @@ -101,16 +102,15 @@ public Long getInstanceId() {
        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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + }

          catch (InvalidParameterValueException e)

          { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + }

          catch (CloudRuntimeException e)

          { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + }

          catch (AgentUnavailableException e)

          { + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, e.getMessage()); }

          }
          }
          diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
          index 933c3eaef99..c51970c85f7 100644

            • a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
              +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java
              @@ -36,7 +36,7 @@
              */
              public interface AgentManager {
              static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return",
        • true);
          + true);

        public enum TapAgentsAction {
        Add, Del, Contains,
        @@ -143,7 +143,7 @@

        public void pullAgentOutMaintenance(long hostId);

        • boolean reconnect(long hostId);
          + void reconnect(long hostId) throws AgentUnavailableException;

        void rescan();

        diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        index b7357756c4c..4b80fb1bc11 100644
        — a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java
        @@ -38,7 +38,6 @@
        import javax.naming.ConfigurationException;

        import org.apache.cloudstack.ca.CAManager;
        -import com.cloud.configuration.ManagementServiceConfiguration;
        import org.apache.cloudstack.framework.config.ConfigKey;
        import org.apache.cloudstack.framework.config.Configurable;
        import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
        @@ -75,6 +74,7 @@
        import com.cloud.agent.transport.Request;
        import com.cloud.agent.transport.Response;
        import com.cloud.alert.AlertManager;
        +import com.cloud.configuration.ManagementServiceConfiguration;
        import com.cloud.dc.ClusterVO;
        import com.cloud.dc.DataCenterVO;
        import com.cloud.dc.HostPodVO;
        @@ -122,7 +122,6 @@
        **/
        public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable {
        protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);

        • protected static final Logger status_logger = Logger.getLogger(Status.class);

        /**

        • _agents is a ConcurrentHashMap, but it is used from within a synchronized block. This will be reported by findbugs as JLM_JSR166_UTILCONCURRENT_MONITORENTER. Maybe a
          @@ -133,7 +132,7 @@
          protected List<Pair<Integer, Listener>> _cmdMonitors = new ArrayList<Pair<Integer, Listener>>(17);
          protected List<Pair<Integer, StartupCommandProcessor>> _creationMonitors = new ArrayList<Pair<Integer, StartupCommandProcessor>>(17);
          protected List<Long> _loadingAgents = new ArrayList<Long>();
        • protected int _monitorId = 0;
          + private int _monitorId = 0;
          private final Lock _agentStatusLock = new ReentrantLock();

        @Inject
        @@ -180,28 +179,22 @@

        @Inject
        ResourceManager _resourceMgr;
        -
        @Inject
        ManagementServiceConfiguration mgmtServiceConf;

        protected final ConfigKey<Integer> Workers = new ConfigKey<Integer>("Advanced", Integer.class, "workers", "5",

        • "Number of worker threads handling remote agent connections.", false);
          + "Number of worker threads handling remote agent connections.", false);
          protected final ConfigKey<Integer> Port = new ConfigKey<Integer>("Advanced", Integer.class, "port", "8250", "Port to listen on for remote agent connections.", false);
          protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>("Advanced", Integer.class, "alert.wait", "1800",
        • "Seconds to wait before alerting on a disconnected agent", true);
          + "Seconds to wait before alerting on a disconnected agent", true);
          protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>("Advanced", Integer.class, "direct.agent.load.size", "16",
        • "The number of direct agents to load each time", false);
          + "The number of direct agents to load each time", false);
          protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>("Advanced", Integer.class, "direct.agent.pool.size", "500",
        • "Default size for DirectAgentPool", false);
          + "Default size for DirectAgentPool", false);
          protected final ConfigKey<Float> DirectAgentThreadCap = new ConfigKey<Float>("Advanced", Float.class, "direct.agent.thread.cap", "1",
        • "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false);
        • protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<Boolean>(
        • "Developer",
        • Boolean.class,
        • "check.txn.before.sending.agent.commands",
        • "false",
        • "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.",
        • true);
          + "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false);
          + protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<Boolean>("Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false",
          + "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true);

        @Override
        public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException

        { @@ -241,7 +234,6 @@ public boolean configure(final String name, final Map<String, Object> params) th return true; }

        -
        @Override
        public Task create(final Task.Type type, final Link link, final byte[] data) {
        return new AgentHandler(type, link, data);
        @@ -436,8 +428,7 @@ private void setEmptyAnswers(final Commands commands, final Command[] cmds) {
        if (CheckTxnBeforeSending.value()) {
        if (!noDbTxn())

        { throw new CloudRuntimeException("We do not allow transactions to be wrapped around commands sent to be executed on remote agents. " - + "We cannot predict how long it takes a command to complete. " - + "The transaction may be rolled back because the connection took too long."); + + "We cannot predict how long it takes a command to complete. " + "The transaction may be rolled back because the connection took too long."); }

        } else

        { assert noDbTxn() : "I know, I know. Why are we so strict as to not allow txn across an agent call? ... Why are we so cruel ... Why are we such a dictator .... Too bad... Sorry...but NO AGENT COMMANDS WRAPPED WITHIN DB TRANSACTIONS!"; @@ -564,15 +555,13 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi monitor.second().processConnect(host, cmd[i], forRebalance); }

        catch (final Exception e) {
        if (e instanceof ConnectionException) {

        • final ConnectionException ce = (ConnectionException) e;
          + final ConnectionException ce = (ConnectionException)e;
          if (ce.isSetupError()) { - s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage()); + s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw ce; }

          else

          { - s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + - " due to " + e.getMessage()); + s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); return attache; }

          @@ -580,8 +569,7 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi
          handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true);
          throw new CloudRuntimeException("Unable to connect " + attache.getId(), e);
          } else

          { - s_logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage(), e); + s_logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage(), e); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); }

          @@ -634,7 +622,7 @@ private ServerResource loadResourcesWithoutHypervisor(final HostVO host) {
          try

          { final Class<?> clazz = Class.forName(resourceName); final Constructor<?> constructor = clazz.getConstructor(); - resource = (ServerResource) constructor.newInstance(); + resource = (ServerResource)constructor.newInstance(); }

          catch (final ClassNotFoundException e)

          { s_logger.warn("Unable to find class " + host.getResource(), e); }

          catch (final InstantiationException e)

          Unknown macro: {@@ -888,7 +876,7 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, final String hostDesc = "name}

          @@ -899,7 +887,7 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache,
          final String podName = podVO != null ? podVO.getName() : "NO POD";
          final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podName;
          _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host in ALERT state, " + hostDesc,

        • "In availability zone " + host.getDataCenterId() + ", host is in alert state: " + host.getId() + "-" + host.getName());
          + "In availability zone " + host.getDataCenterId() + ", host is in alert state: " + host.getId() + "-" + host.getName());
          }
          } else {
          s_logger.debug("The next status of agent " + host.getId() + " is not Alert, no need to investigate what happened");
          @@ -987,33 +975,30 @@ public Answer easySend(final Long hostId, final Command cmd) {
          }

        @Override

        • public boolean reconnect(final long hostId) {
        • HostVO host;
          + public void reconnect(final long hostId) throws AgentUnavailableException {
          + HostVO host = _hostDao.findById(hostId);
          + if (host == null) { + throw new CloudRuntimeException("Unable to find host: " + hostId); + }
        • host = _hostDao.findById(hostId);
        • if (host == null || host.getRemoved() != null) {
        • s_logger.warn("Unable to find host " + hostId);
        • return false;
          + if (host.getRemoved() != null) { + throw new CloudRuntimeException("Host has already been removed: " + hostId); }

        if (host.getStatus() == Status.Disconnected)

        { - s_logger.info("Host is already disconnected, no work to be done"); - return true; + s_logger.debug("Host is already disconnected, no work to be done: " + hostId); + return; }

        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);
          + 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;
          }

        @Override
        @@ -1049,8 +1034,15 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
        handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true);
        }
        return true;

        • } else if (event == Event.ShutdownRequested) { - return reconnect(hostId); + }

          + if (event == Event.ShutdownRequested)

          Unknown macro: {+ try { + reconnect(hostId); + } catch (CloudRuntimeException e) { + s_logger.debug("Error on shutdown request for hostID: " + hostId, e); + return false; + }+ return true; }

          return false;
          }
          @@ -1166,7 +1158,7 @@ protected void runInContext() {
          _request.logD("Processing the first command ");
          final StartupCommand[] startups = new StartupCommand[_cmds.length];
          for (int i = 0; i < _cmds.length; i++)

          { - startups[i] = (StartupCommand) _cmds[i]; + startups[i] = (StartupCommand)_cmds[i]; }

        final AgentAttache attache = handleConnectedAgent(_link, startups, _request);
        @@ -1184,7 +1176,7 @@ protected void connectAgent(final Link link, final Command[] cmds, final Request
        for (int i = 0; i < cmds.length; i++) {
        cmd = cmds[i];
        if (cmd instanceof StartupRoutingCommand || cmd instanceof StartupProxyCommand || cmd instanceof StartupSecondaryStorageCommand ||

        • cmd instanceof StartupStorageCommand) {
          + cmd instanceof StartupStorageCommand) { answers[i] = new StartupAnswer((StartupCommand) cmds[i], 0, mgmtServiceConf.getPingInterval()); break; }

          @@ -1205,7 +1197,7 @@ public AgentHandler(final Task.Type type, final Link link, final byte[] data) {
          }

        protected void processRequest(final Link link, final Request request) {

        • final AgentAttache attache = (AgentAttache) link.attachment();
          + final AgentAttache attache = (AgentAttache)link.attachment();
          final Command[] cmds = request.getCommands();
          Command cmd = cmds[0];
          boolean logD = true;
          @@ -1256,10 +1248,9 @@ protected void processRequest(final Link link, final Request request) { final StartupStorageCommand startup = (StartupStorageCommand) cmd; answer = new StartupAnswer(startup, attache.getId(), mgmtServiceConf.getPingInterval()); }

          else if (cmd instanceof ShutdownCommand) {

        • final ShutdownCommand shutdown = (ShutdownCommand) cmd;
          + final ShutdownCommand shutdown = (ShutdownCommand)cmd;
          final String reason = shutdown.getReason();
        • s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " +
        • shutdown.getDetail());
          + s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " + shutdown.getDetail());
          if (reason.equals(ShutdownCommand.Update)) {
          // disconnectWithoutInvestigation(attache, Event.UpdateNeeded);
          throw new CloudRuntimeException("Agent update not implemented");
          @@ -1268,16 +1259,16 @@ protected void processRequest(final Link link, final Request request) {
          }
          return;
          } else if (cmd instanceof AgentControlCommand) { - answer = handleControlCommand(attache, (AgentControlCommand) cmd); + answer = handleControlCommand(attache, (AgentControlCommand)cmd); }

          else {

        • handleCommands(attache, request.getSequence(), new Command[] { cmd }

          );
          + handleCommands(attache, request.getSequence(), new Command[]

          {cmd}

          );
          if (cmd instanceof PingCommand) {

        • final long cmdHostId = ((PingCommand) cmd).getHostId();
          + final long cmdHostId = ((PingCommand)cmd).getHostId();

        // if the router is sending a ping, verify the
        // gateway was pingable
        if (cmd instanceof PingRoutingCommand) {

        • final boolean gatewayAccessible = ((PingRoutingCommand) cmd).isGatewayAccessible();
          + final boolean gatewayAccessible = ((PingRoutingCommand)cmd).isGatewayAccessible();
          final HostVO host = _hostDao.findById(Long.valueOf(cmdHostId));

        if (host != null) {
        @@ -1286,22 +1277,18 @@ protected void processRequest(final Link link, final Request request)

        { // gateway (cannot ping the default route) final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); final HostPodVO podVO = _podDao.findById(host.getPodId()); - final String hostDesc = - "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " - + podVO.getName(); + final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId(), - "Host lost connection to gateway, " + hostDesc, "Host [" + hostDesc + - "] lost connection to gateway (default route) and is possibly having network connection issues."); + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId(), "Host lost connection to gateway, " + hostDesc, + "Host [" + hostDesc + "] lost connection to gateway (default route) and is possibly having network connection issues."); }

        else

        { _alertMgr.clearAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId()); }

        } else

        { - s_logger.debug("Not processing " + PingRoutingCommand.class.getSimpleName() + " for agent id=" + cmdHostId + - "; can't find the host in the DB"); + s_logger.debug("Not processing " + PingRoutingCommand.class.getSimpleName() + " for agent id=" + cmdHostId + "; can't find the host in the DB"); }

        }

        • answer = new PingAnswer((PingCommand) cmd);
          + answer = new PingAnswer((PingCommand)cmd);
          } else if (cmd instanceof ReadyAnswer) {
          final HostVO host = _hostDao.findById(attache.getId());
          if (host == null) {
          @@ -1337,7 +1324,7 @@ protected void processRequest(final Link link, final Request request) {
          }

        protected void processResponse(final Link link, final Response response) {

        • final AgentAttache attache = (AgentAttache) link.attachment();
          + final AgentAttache attache = (AgentAttache)link.attachment();
          if (attache == null) { s_logger.warn("Unable to process: " + response); }

          else if (!attache.processAnswers(response.getSequence(), response)) {
          @@ -1355,7 +1342,7 @@ protected void doTask(final Task task) throws TaskExecutionException {
          try {
          final Request event = Request.parse(data);
          if (event instanceof Response)

          { - processResponse(task.getLink(), (Response) event); + processResponse(task.getLink(), (Response)event); }

          else

          { processRequest(task.getLink(), event); }

          @@ -1370,7 +1357,7 @@ protected void doTask(final Task task) throws TaskExecutionException {
          } else if (type == Task.Type.CONNECT) {
          } else if (type == Task.Type.DISCONNECT) {
          final Link link = task.getLink();

        • final AgentAttache attache = (AgentAttache) link.attachment();
          + final AgentAttache attache = (AgentAttache)link.attachment();
          if (attache != null) { disconnectWithInvestigation(attache, Event.AgentDisconnected); }

          else {
          @@ -1411,23 +1398,21 @@ public boolean tapLoadingAgents(final Long hostId, final TapAgentsAction action)
          public boolean agentStatusTransitTo(final HostVO host, final Status.Event e, final long msId) {
          try {
          _agentStatusLock.lock();

        • if (status_logger.isDebugEnabled()) {
          + if (s_logger.isDebugEnabled()) { final ResourceState state = host.getResourceState(); final StringBuilder msg = new StringBuilder("Transition:"); msg.append("[Resource state = ").append(state); msg.append(", Agent event = ").append(e.toString()); msg.append(", Host id = ").append(host.getId()).append(", name = " + host.getName()).append("]"); - status_logger.debug(msg); + s_logger.debug(msg); }

        host.setManagementServerId(msId);
        try

        { return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao); }

        catch (final NoTransitionException e1)

        { - status_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + - ", mangement server id is " + msId); - throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + - e1.getMessage()); + s_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + ", mangement server id is " + msId); + throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + e1.getMessage()); }

        } finally

        { _agentStatusLock.unlock(); @@ -1491,6 +1476,7 @@ private void disconnectInternal(final long hostId, final Status.Event event, fin }

        }

        + @Override
        public void disconnectWithInvestigation(final long hostId, final Status.Event event)

        { disconnectInternal(hostId, event, true); }

        @@ -1501,8 +1487,7 @@ public void disconnectWithoutInvestigation(final long hostId, final Status.Event
        }

        @Override

        • public boolean handleDirectConnectAgent(final Host host, final StartupCommand[] cmds, final ServerResource resource,
        • final boolean forRebalance, boolean newHost) throws ConnectionException {
          + public boolean handleDirectConnectAgent(final Host host, final StartupCommand[] cmds, final ServerResource resource, final boolean forRebalance, boolean newHost) throws ConnectionException {
          AgentAttache attache;

        attache = createAttacheForDirectConnect(host, resource);
        @@ -1579,17 +1564,17 @@ protected void runInContext()

        { /* * Host is in non-operation state, so no investigation and direct put agent to Disconnected */ - status_logger.debug("Ping timeout but agent " + agentId + " is in resource state of " + resourceState + ", so no investigation"); + s_logger.debug("Ping timeout but agent " + agentId + " is in resource state of " + resourceState + ", so no investigation"); disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); }

        else {
        final HostVO host = _hostDao.findById(agentId);

        • if (host != null && (host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorageVM
        • host.getType() == Host.Type.SecondaryStorageCmdExecutor))
          Unknown macro: {+ if (host != null+ && (host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorageVM || host.getType() == Host.Type.SecondaryStorageCmdExecutor)) { s_logger.warn("Disconnect agent for CPVM/SSVM due to physical connection close. host: " + host.getId()); disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); } else { - status_logger.debug("Ping timeout for agent " + agentId + ", do invstigation"); + s_logger.debug("Ping timeout for agent " + agentId + ", do invstigation"); disconnectWithInvestigation(agentId, Event.PingTimeout); } }

          @@ -1605,8 +1590,8 @@ protected void runInContext()

          { final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); final HostPodVO podVO = _podDao.findById(host.getPodId()); final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc, "Host [" - + hostDesc + "] is ready for maintenance"); + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc, + "Host [" + hostDesc + "] is ready for maintenance"); }

          }
          } catch (final Throwable th) {
          @@ -1708,7 +1693,7 @@ public String getConfigComponentName()

          Unknown macro: { @Override public ConfigKey<?>[] getConfigKeys()
          Unknown macro: { return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, DirectAgentPoolSize, - DirectAgentThreadCap };+ DirectAgentThreadCap }
          ; }

        protected class SetHostParamsListener implements Listener {
        @@ -1738,20 +1723,20 @@ public void processHostAdded(long hostId) {

        @Override
        public void processConnect(final Host host, final StartupCommand cmd, final boolean forRebalance) {

        • if (cmd instanceof StartupRoutingCommand) {
        • if (((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.LXC) {
        • Map<String, String> params = new HashMap<String, String>();
        • params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout"));
          + if (cmd instanceof StartupRoutingCommand) {
          + if (((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.LXC) {
          + Map<String, String> params = new HashMap<String, String>();
          + params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout"));
        • try { - SetHostParamsCommand cmds = new SetHostParamsCommand(params); - Commands c = new Commands(cmds); - send(host.getId(), c, this); - }

          catch (AgentUnavailableException e) {

        • s_logger.debug("Failed to send host params on host: " + host.getId());
          + try { + SetHostParamsCommand cmds = new SetHostParamsCommand(params); + Commands c = new Commands(cmds); + send(host.getId(), c, this); + }

          catch (AgentUnavailableException e)

          { + s_logger.debug("Failed to send host params on host: " + host.getId()); + }

          }
          }

        • }

        }

        diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
        index 7a9678e6a4a..38822cba16b 100644
        — a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
        +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
        @@ -46,12 +46,12 @@
        import org.apache.cloudstack.framework.config.ConfigDepot;
        import org.apache.cloudstack.framework.config.ConfigKey;
        import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
        +import org.apache.cloudstack.ha.dao.HAConfigDao;
        import org.apache.cloudstack.managed.context.ManagedContextRunnable;
        import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
        +import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
        import org.apache.cloudstack.utils.identity.ManagementServerNode;
        import org.apache.cloudstack.utils.security.SSLUtils;
        -import org.apache.cloudstack.ha.dao.HAConfigDao;
        -import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
        import org.apache.log4j.Logger;

        import com.cloud.agent.api.Answer;
        @@ -134,14 +134,12 @@ protected ClusteredAgentManagerImpl()

        { super(); }
        • protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", "false",
        • "Enable agent load balancing between management server nodes", true);
          + protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", "false", "Enable agent load balancing between management server nodes", true);
          protected final ConfigKey<Double> ConnectedAgentThreshold = new ConfigKey<Double>(Double.class, "agent.load.threshold", "Advanced", "0.7",
          "What percentage of the agents can be held by one management server before load balancing happens", true);
        • protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", "16",
        • "How many agents to connect to in each round", true);
        • protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", "90",
        • "Interval between scans to load agents", false, ConfigKey.Scope.Global, 1000);
          + protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", "16", "How many agents to connect to in each round", true);
          + protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", "90", "Interval between scans to load agents", false,
          + ConfigKey.Scope.Global, 1000);

        @Override
        public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException {
        @@ -342,8 +340,7 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
        final HostTransferMapVO transferVO = _hostTransferDao.findById(hostId);
        if (transferVO != null) {
        if (transferVO.getFutureOwner() == _nodeId && transferVO.getState() == HostTransferState.TransferStarted)

        { - s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is being connected to " + - _nodeId); + s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is being connected to " + _nodeId); return true; }

        }
        @@ -352,8 +349,7 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
        // don't process disconnect if the disconnect came for the host via delayed cluster notification,
        // but the host has already reconnected to the current management server
        if (!attache.forForward())

        { - s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + - " as the host is directly connected to the current management server " + _nodeId); + s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is directly connected to the current management server " + _nodeId); return true; }

        @@ -367,19 +363,15 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A
        }

        @Override

        • public boolean reconnect(final long hostId) {
        • Boolean result;
        • try {
        • result = propagateAgentEvent(hostId, Event.ShutdownRequested);
        • if (result != null) { - return result; - }
        • } catch (final AgentUnavailableException e) { - s_logger.debug("cannot propagate agent reconnect because agent is not available", e); - return false; - }

          + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException

          Unknown macro: {+ Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested);+ if (result == null) { + super.reconnect(hostId); - return super.reconnect(hostId); + }+ if (!result) { + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); + } }

        public void notifyNodesInCluster(final AgentAttache attache) {
        @@ -398,18 +390,18 @@ public void notifyNodesInClusterToScheduleHostScanTask() {
        }

        protected static void logT(final byte[] bytes, final String msg)

        { - s_logger.trace("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.trace("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); }

        protected static void logD(final byte[] bytes, final String msg)

        { - s_logger.debug("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.debug("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); }

        protected static void logI(final byte[] bytes, final String msg)

        { - s_logger.info("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.info("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); }

        public boolean routeToPeer(final String peer, final byte[] bytes) {
        @@ -443,8 +435,7 @@ public boolean routeToPeer(final String peer, final byte[] bytes)

        { logI(bytes, "Unable to route to peer: " + Request.parse(bytes).toString() + " due to " + e.getMessage()); }

        catch (ClassNotFoundException | UnsupportedVersionException ex)

        { // Request.parse thrown exception when we try to log it, log as much as we can - logI(bytes, "Unable to route to peer due to" + e.getMessage() - + ". Also caught exception when parsing request: " + ex.getMessage()); + logI(bytes, "Unable to route to peer due to" + e.getMessage() + ". Also caught exception when parsing request: " + ex.getMessage()); }

        }
        }
        @@ -489,8 +480,7 @@ public SocketChannel connectToPeer(final String peerName, final SocketChannel pr
        try

        { prevCh.close(); }

        catch (final Exception e)

        { - s_logger.info("[ignored]" - + "failed to get close resource for previous channel Socket: " + e.getLocalizedMessage()); + s_logger.info("[ignored]" + "failed to get close resource for previous channel Socket: " + e.getLocalizedMessage()); }

        }
        if (ch == null || ch == prevCh) {
        @@ -597,7 +587,7 @@ public boolean stop()

        { s_logger.info("Closing: " + ch.toString()); ch.close(); }

        catch (final IOException e)

        { - s_logger.info("[ignored] error on closing channel: " +ch.toString(), e); + s_logger.info("[ignored] error on closing channel: " + ch.toString(), e); }

        }
        }
        @@ -770,8 +760,7 @@ public void removeAgent(final AgentAttache attache, final Status nextState) {
        }

        @Override

        • public boolean executeRebalanceRequest(final long agentId, final long currentOwnerId, final long futureOwnerId, final Event event) throws AgentUnavailableException,
        • OperationTimedoutException {
          + public boolean executeRebalanceRequest(final long agentId, final long currentOwnerId, final long futureOwnerId, final Event event) throws AgentUnavailableException, OperationTimedoutException {
          boolean result = false;
          if (event == Event.RequestAgentRebalance) {
          return setToWaitForRebalance(agentId, currentOwnerId, futureOwnerId);
          @@ -837,8 +826,8 @@ public void startRebalanceAgents() { avLoad = allManagedAgents.size() / allMS.size(); }

          else

          Unknown macro: { if (s_logger.isDebugEnabled()) { - s_logger.debug("There are no hosts to rebalance in the system. Current number of active management server nodes in the system is " + allMS.size() + - "; number of managed agents is " + allManagedAgents.size()); + s_logger.debug("There are no hosts to rebalance in the system. Current number of active management server nodes in the system is " + allMS.size() + "; number of managed agents is " + + allManagedAgents.size()); } return; }

          @@ -991,8 +980,7 @@ protected void runInContext() {
          // remove the host from re-balance list and delete from op_host_transfer DB
          // no need to do anything with the real attache as we haven't modified it yet
          final Date cutTime = DateUtil.currentGMTTime();

        • final HostTransferMapVO transferMap =
        • _hostTransferDao.findActiveHostTransferMapByHostId(hostId, new Date(cutTime.getTime() - rebalanceTimeOut));
          + final HostTransferMapVO transferMap = _hostTransferDao.findActiveHostTransferMapByHostId(hostId, new Date(cutTime.getTime() - rebalanceTimeOut));

        if (transferMap == null) {
        s_logger.debug("Timed out waiting for the host id=" + hostId + " to be ready to transfer, skipping rebalance for the host");
        @@ -1010,8 +998,7 @@ protected void runInContext() {

        final ManagementServerHostVO ms = _mshostDao.findByMsid(transferMap.getFutureOwner());
        if (ms != null && ms.getState() != ManagementServerHost.State.Up) {

        • s_logger.debug("Can't transfer host " + hostId + " as it's future owner is not in UP state: " + ms +
        • ", skipping rebalance for the host");
          + s_logger.debug("Can't transfer host " + hostId + " as it's future owner is not in UP state: " + ms + ", skipping rebalance for the host");
          iterator.remove();
          _hostTransferDao.completeAgentTransfer(hostId);
          continue;
          @@ -1027,8 +1014,8 @@ protected void runInContext() {
          }

        } else

        { - s_logger.debug("Agent " + hostId + " can't be transfered yet as its request queue size is " + attache.getQueueSize() + - " and listener queue size is " + attache.getNonRecurringListenersSize()); + s_logger.debug("Agent " + hostId + " can't be transfered yet as its request queue size is " + attache.getQueueSize() + " and listener queue size is " + + attache.getNonRecurringListenersSize()); }

        }
        } else {
        @@ -1094,8 +1081,7 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi

        if (result) {
        if (s_logger.isDebugEnabled())

        { - s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); }

        result = loadDirectlyConnectedHost(host, true);
        } else

        { @@ -1103,17 +1089,15 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi }

        } catch (final Exception ex)

        { - s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process due to:", ex); + s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process due to:", + ex); result = false; }

        if (result)

        { - s_logger.debug("Successfully loaded directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.debug("Successfully loaded directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); }

        else

        { - s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); }

        }

        @@ -1144,8 +1128,7 @@ protected void finishRebalance(final long hostId, final long futureOwnerId, fina
        // 2) Get all transfer requests and route them to peer
        Request requestToTransfer = forwardAttache.getRequestToTransfer();
        while (requestToTransfer != null) {

        • s_logger.debug("Forwarding request " + requestToTransfer.getSequence() + " held in transfer attache " + hostId + " from the management server " +
        • _nodeId + " to " + futureOwnerId);
          + s_logger.debug("Forwarding request " + requestToTransfer.getSequence() + " held in transfer attache " + hostId + " from the management server " + _nodeId + " to " + futureOwnerId);
          final boolean routeResult = routeToPeer(Long.toString(futureOwnerId), requestToTransfer.getBytes());
          if (!routeResult) {
          logD(requestToTransfer.getBytes(), "Failed to route request to peer");
          @@ -1198,8 +1181,8 @@ protected boolean startRebalance(final long hostId)
          Unknown macro: { if (attache == null) { s_logger.warn("Attache for the agent " + hostId + " no longer exists on management server " + _nodeId + ", can't start host rebalancing"); } else { - s_logger.warn("Attache for the agent " + hostId + " has request queue size= " + attache.getQueueSize() + " and listener queue size " + - attache.getNonRecurringListenersSize() + ", can't start host rebalancing"); + s_logger.warn("Attache for the agent " + hostId + " has request queue size= " + attache.getQueueSize() + " and listener queue size " + attache.getNonRecurringListenersSize() + + ", can't start host rebalancing"); } return false; }

          @@ -1255,8 +1238,9 @@ private String handleScheduleHostScanTaskCommand(final ScheduleHostScanTaskComma
          } catch (final Exception e)

          { // Scheduling host scan task in peer MS is a best effort operation during host add, regular host scan // happens at fixed intervals anyways. So handling any exceptions that may be thrown - s_logger.warn("Exception happened while trying to schedule host scan task on mgmt server " + _clusterMgr.getSelfPeerName() + - ", ignoring as regular host scan happens at fixed interval anyways", e); + s_logger.warn( + "Exception happened while trying to schedule host scan task on mgmt server " + _clusterMgr.getSelfPeerName() + ", ignoring as regular host scan happens at fixed interval anyways", + e); return null; }

        @@ -1372,15 +1356,15 @@ public String dispatch(final ClusterServicePdu pdu) {
        final String jsonReturn = _gson.toJson(answers);

        if (s_logger.isDebugEnabled())

        { - s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + - (System.currentTimeMillis() - startTick) + " ms, return result: " + jsonReturn); + s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + (System.currentTimeMillis() - startTick) + " ms, return result: " + + jsonReturn); }

        return jsonReturn;
        } else {
        if (s_logger.isDebugEnabled())

        { - s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + - (System.currentTimeMillis() - startTick) + " ms, return null result"); + s_logger.debug( + "Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + (System.currentTimeMillis() - startTick) + " ms, return null result"); }

        }
        } catch (final AgentUnavailableException e) {
        diff --git a/engine/schema/src/main/java/com/cloud/alert/AlertVO.java b/engine/schema/src/main/java/com/cloud/alert/AlertVO.java
        index 70ef469f52b..1f2cd9d8c60 100644
        — a/engine/schema/src/main/java/com/cloud/alert/AlertVO.java
        +++ b/engine/schema/src/main/java/com/cloud/alert/AlertVO.java
        @@ -53,6 +53,9 @@
        @Column(name = "subject", length = 999)
        private String subject;

        + @Column(name = "content", length = 5000)
        + private String content;
        +
        @Column(name = "sent_count")
        private int sentCount = 0;

        @@ -191,4 +194,13 @@ public String getName() {
        public void setName(String name)

        { this.name = name; }

        +
        + @Override
        + public String getContent()

        { + return content; + }

        +
        + public void setContent(String content)

        { + this.content = content; + }

        }
        diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
        index e48bfd58a6a..5af099d4e32 100644
        — a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
        +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java
        @@ -80,7 +80,6 @@

        private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?";

        -
        protected SearchBuilder<HostVO> TypePodDcStatusSearch;

        protected SearchBuilder<HostVO> IdStatusSearch;
        diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql
        index d7a080efd16..f8d9ce9b73b 100644
        — a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql
        +++ b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql
        @@ -66,4 +66,4 @@ CREATE VIEW `cloud`.`user_view` AS
        left join
        `cloud`.`async_job` ON async_job.instance_id = user.id
        and async_job.instance_type = 'User'

        • and async_job.job_status = 0;
          + and async_job.job_status = 0;
          \ No newline at end of file
          diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql
          index 2e7f9e9fe9c..70a76d98d86 100644
            • a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql
              +++ b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql
              @@ -566,4 +566,4 @@ CREATE TABLE IF NOT EXISTS `cloud`.`external_netscaler_controlcenter` (
              ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

        ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate';
        -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package';
        +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package';
        \ No newline at end of file
        diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql b/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql
        index 5667c5b3dab..97bd5ae7aae 100644
        — a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql
        +++ b/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql
        @@ -20,4 +20,7 @@
        --;

        – CLOUDSTACK-10314 Add reason column to ACL rule table
        -ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500) AFTER `display`;
        \ No newline at end of file
        +ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500) AFTER `display`;
        +
        +--CLOUDSTACK-9846 Make provision to store content and subject for Alerts in separate columns.
        +ALTER TABLE `cloud`.`alert` ADD COLUMN `content` VARCHAR(5000);
        diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
        index 30cba4d6c71..c6003afee57 100644
        — a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
        +++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
        @@ -266,20 +266,16 @@ public void pullAgentOutMaintenance(long hostId) {
        }

        @Override

        • public boolean reconnect(long hostId) {
        • // TODO Auto-generated method stub
        • return false;
          + public void reconnect(long hostId) {
          }

        @Override
        public boolean isAgentAttached(long hostId)

        { - // TODO Auto-generated method stub return false; }

        @Override
        public boolean handleDirectConnectAgent(Host host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance, boolean newHost) throws ConnectionException {- // TODO Auto-generated method stub return false; }

        diff --git a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java
        index 38a836d2d6d..1df16404d39 100644
        — a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java
        +++ b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java
        @@ -28,12 +28,6 @@
        import javax.inject.Inject;
        import javax.naming.ConfigurationException;

        -import org.apache.log4j.Logger;
        -import org.json.JSONException;
        -import org.json.JSONObject;
        -
        -import com.google.gson.Gson;
        -
        import org.apache.cloudstack.api.ApiConstants;
        import org.apache.cloudstack.api.ApiErrorCode;
        import org.apache.cloudstack.api.ServerApiException;
        @@ -41,6 +35,9 @@
        import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
        import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
        import org.apache.cloudstack.region.gslb.GslbServiceProvider;
        +import org.apache.log4j.Logger;
        +import org.json.JSONException;
        +import org.json.JSONObject;

        import com.cloud.agent.AgentManager;
        import com.cloud.agent.api.Answer;
        @@ -84,6 +81,7 @@
        import com.cloud.deploy.DeploymentPlan;
        import com.cloud.event.ActionEvent;
        import com.cloud.event.EventTypes;
        +import com.cloud.exception.AgentUnavailableException;
        import com.cloud.exception.ConcurrentOperationException;
        import com.cloud.exception.InsufficientCapacityException;
        import com.cloud.exception.InsufficientNetworkCapacityException;
        @@ -154,10 +152,11 @@
        import com.cloud.vm.NicProfile;
        import com.cloud.vm.ReservationContext;
        import com.cloud.vm.VirtualMachineProfile;
        +import com.google.gson.Gson;

        public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl

        • implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager,
        • IpDeployer, StaticNatServiceProvider, GslbServiceProvider {
          +implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager,
          +IpDeployer, StaticNatServiceProvider, GslbServiceProvider {

        private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
        public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp");
        @@ -218,7 +217,7 @@ private boolean canHandle(Network config, Service service) {

        boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced
        && (config.getGuestType() == Network.GuestType.Isolated

        • config.getGuestType() == Network.GuestType.Shared)
          +
          config.getGuestType() == Network.GuestType.Shared)
          && config.getTrafficType() == TrafficType.Guest);
          boolean handleInBasicZone = (zone.getNetworkType() == NetworkType.Basic
          && config.getGuestType() == Network.GuestType.Shared && config.getTrafficType() == TrafficType.Guest);
          @@ -242,7 +241,7 @@ private boolean isBasicZoneNetwok(Network config) {
          @Override
          public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest,
          ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException,
        • InsufficientNetworkCapacityException {
          + InsufficientNetworkCapacityException {

        if (!canHandle(guestConfig, Service.Lb))

        { return false; @@ -271,7 +270,7 @@ public boolean implement(Network guestConfig, NetworkOffering offering, DeployDe throw new ResourceUnavailableException( "There are no NetScaler load balancer devices with the free capacity for implementing this network : " + e.getMessage(), - DataCenter.class, guestConfig.getDataCenterId()); + DataCenter.class, guestConfig.getDataCenterId()); }

        }

        @@ -286,7 +285,6 @@ public HostVO allocateNCCResourceForNetwork(Network guestConfig) throws Configur
        Map<String, String> _configs;
        List<NetScalerControlCenterVO> ncc = _netscalerControlCenterDao.listAll();
        HostVO hostVO = null;

        • Map<String, Object> params;
          if (ncc.size() > 0) {
          NetScalerControlCenterVO nccVO = ncc.get(0);
          String ipAddress = nccVO.getNccip();
          @@ -414,7 +412,7 @@ public boolean manageGuestNetworkWithNetscalerControlCenter(boolean add, Network
          @Override
          public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest,
          ReservationContext context) throws ConcurrentOperationException, InsufficientNetworkCapacityException,
        • ResourceUnavailableException {
          + ResourceUnavailableException { return true; }

        @@ -593,45 +591,45 @@ public ExternalLoadBalancerDeviceVO addNetscalerLoadBalancer(AddNetscalerLoadBal
        boolean dedicatedUse = (configParams.get(ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED) != null)
        ? Boolean.parseBoolean(configParams.get(ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED)) : false;

        • if (dedicatedUse && !deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName())) { - String msg = "Only Netscaler VPX load balancers can be specified for dedicated use"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - }

          + if (dedicatedUse && !deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName()))

          { + String msg = "Only Netscaler VPX load balancers can be specified for dedicated use"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + }
        • if (cmd.isGslbProvider()) {
          + if (cmd.isGslbProvider()) {
        • if (!deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName())
        • && !deviceName.equals(NetworkDevice.NetscalerMPXLoadBalancer.getName())) { - String msg = "Only Netscaler VPX or MPX load balancers can be specified as GSLB service provider"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - }

          + if (!deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName())
          + && !deviceName.equals(NetworkDevice.NetscalerMPXLoadBalancer.getName()))

          { + String msg = "Only Netscaler VPX or MPX load balancers can be specified as GSLB service provider"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + }
        • if (cmd.getSitePublicIp() == null || cmd.getSitePrivateIp() == null) { - String msg = "Public and Privae IP needs to provided for NetScaler that will be GSLB provider"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - }

          + if (cmd.getSitePublicIp() == null || cmd.getSitePrivateIp() == null)

          { + String msg = "Public and Privae IP needs to provided for NetScaler that will be GSLB provider"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + }
        • if (dedicatedUse) { - throw new InvalidParameterValueException( - "NetScaler provisioned to be GSLB service provider can only be configured for shared usage."); - }

          + if (dedicatedUse)

          { + throw new InvalidParameterValueException( + "NetScaler provisioned to be GSLB service provider can only be configured for shared usage."); + }
        • }
          + }
        • if (cmd.isExclusiveGslbProvider() && !cmd.isGslbProvider()) { - throw new InvalidParameterValueException( - "NetScaler can be provisioned to be exclusive GSLB service provider" - + " only if its being configured as GSLB service provider also."); - }

          + if (cmd.isExclusiveGslbProvider() && !cmd.isGslbProvider())

          { + throw new InvalidParameterValueException( + "NetScaler can be provisioned to be exclusive GSLB service provider" + + " only if its being configured as GSLB service provider also."); + }
        • ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(),
        • cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(), cmd.isGslbProvider(),
        • cmd.isExclusiveGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp());
          + ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(),
          + cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(), cmd.isGslbProvider(),
          + cmd.isExclusiveGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp());
        • return lbDeviceVO;
          + return lbDeviceVO;
          }

        @Override
        @@ -759,7 +757,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
        });
        HostVO host = _hostDao.findById(lbDeviceVo.getHostId());

        • _agentMgr.reconnect(host.getId());
          + try { + _agentMgr.reconnect(host.getId()); + }

          catch (AgentUnavailableException e)

          { + s_logger.warn("failed to reconnect host " + host, e); + }

          return lbDeviceVo;
          }

        @@ -858,8 +860,9 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd)
        boolean flag=false;
        try {
        result = _netscalerServicePackageDao.findByUuid(cmd.getId());

        • if (result == null)
          + if (result == null) { throw new CloudRuntimeException("Record does not Exists in the Table"); + }

        if(_networkOfferingDao.isUsingServicePackage(result.getUuid()))

        { @@ -869,10 +872,11 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) flag = _netscalerServicePackageDao.remove(result.getId()); }

        catch (Exception e) {

        • if (e instanceof InvalidParameterValueException)
          + if (e instanceof InvalidParameterValueException) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); - else - throw e; + }

          else

          { + throw e; + }

        }
        return flag;
        @@ -884,18 +888,19 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd)
        public boolean deleteNetscalerControlCenter(DeleteNetscalerControlCenterCmd cmd) throws CloudRuntimeException {

        NetScalerControlCenterVO result = _netscalerControlCenterDao.findByUuid(cmd.getId());

        • if (result == null)
          + if (result == null) {
          throw new CloudRuntimeException("External Netscaler Control Center Table does not contain record with this ID");
        • else { + }

          else {
          //ID list of Network Offering which are not removed and have service Package Uuid field not null.
          List<Long> servicePackageId_list = _networkOfferingDao.listNetworkOfferingID();

        if (servicePackageId_list.size() != 0) {
        //VO list of Networks which are using Network Offering.
        List<NetworkVO> networkVO_list = _networkDao.listNetworkVO(servicePackageId_list);

        • if (networkVO_list != null && networkVO_list.size() != 0)
          + if (networkVO_list != null && networkVO_list.size() != 0) { throw new CloudRuntimeException( "ServicePackages published by NetScalerControlCenter are being used by NetworkOfferings. Try deleting NetworkOffering with ServicePackages and then delete NetScalerControlCenter."); + }

          }
          }
          try {
          @@ -1466,8 +1471,9 @@ public NetScalerServicePackageResponse registerNetscalerServicePackage(RegisterS
          @DB
          public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd cmd) {

        • if (_netscalerControlCenterDao.listAll() != null && _netscalerControlCenterDao.listAll().size() != 0)
          + if (_netscalerControlCenterDao.listAll() != null && _netscalerControlCenterDao.listAll().size() != 0) { throw new CloudRuntimeException("One Netscaler Control Center already exist in the DataBase. At a time only one Netscaler Control Center is allowed"); + }

        final RegisterNetscalerControlCenterCmd cmdinfo = cmd;
        String ipAddress = cmd.getIpaddress();
        @@ -1511,7 +1517,7 @@ public NetScalerControlCenterVO doInTransaction(TransactionStatus status) {
        Long serviceOfferingId = cmd.getServiceOfferingId();
        DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId());
        try

        { - resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId); + resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId); }

        catch (InsufficientCapacityException e)

        { e.printStackTrace(); }

        @@ -1520,7 +1526,7 @@ public NetScalerControlCenterVO doInTransaction(TransactionStatus status) {

        @Override
        public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException,

        • ResourceUnavailableException
          Unknown macro: {+ ResourceUnavailableException { return _netScalerVMManager.stopNetScalerVm(id, forced, callingAccount, callingUserId); } }

          \ No newline at end of file
          diff --git a/requirements.txt b/requirements.txt
          index 5f2551e9f4f..4485f5d73f9 100644

            • a/requirements.txt
              +++ b/requirements.txt
              @@ -21,5 +21,4 @@ cloudmonkey
        1. Marvin dependencies are installed via its bundle
        1. Install the SolidFire SDK for Python
          -solidfire-sdk-python
          -
          +solidfire-sdk-python
          \ No newline at end of file
          diff --git a/server/src/main/java/com/cloud/alert/AlertManagerImpl.java b/server/src/main/java/com/cloud/alert/AlertManagerImpl.java
          index a58a4f8b0f9..5a7a8b436e0 100644
            • a/server/src/main/java/com/cloud/alert/AlertManagerImpl.java
              +++ b/server/src/main/java/com/cloud/alert/AlertManagerImpl.java
              @@ -39,12 +39,6 @@
              import javax.mail.internet.InternetAddress;
              import javax.naming.ConfigurationException;

        -import org.apache.log4j.Logger;
        -
        -import com.sun.mail.smtp.SMTPMessage;
        -import com.sun.mail.smtp.SMTPSSLTransport;
        -import com.sun.mail.smtp.SMTPTransport;
        -
        import org.apache.cloudstack.framework.config.ConfigDepot;
        import org.apache.cloudstack.framework.config.ConfigKey;
        import org.apache.cloudstack.framework.config.Configurable;
        @@ -52,6 +46,7 @@
        import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
        import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
        import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
        +import org.apache.log4j.Logger;

        import com.cloud.alert.dao.AlertDao;
        import com.cloud.api.ApiDBUtils;
        @@ -85,10 +80,12 @@
        import com.cloud.utils.component.ManagerBase;
        import com.cloud.utils.concurrency.NamedThreadFactory;
        import com.cloud.utils.db.SearchCriteria;
        +import com.sun.mail.smtp.SMTPMessage;
        +import com.sun.mail.smtp.SMTPSSLTransport;
        +import com.sun.mail.smtp.SMTPTransport;

        public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable {
        private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());

        • private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");

        private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // Thirty seconds expressed in milliseconds.

        @@ -205,8 +202,9 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
        String capacityCheckPeriodStr = configs.get("capacity.check.period");
        if (capacityCheckPeriodStr != null) {
        _capacityCheckPeriod = Long.parseLong(capacityCheckPeriodStr);

        • if (_capacityCheckPeriod <= 0)
          + if (_capacityCheckPeriod <= 0) { _capacityCheckPeriod = Long.parseLong(Config.CapacityCheckPeriod.getDefaultValue()); + }

          }

        _timer = new Timer("CapacityChecker");
        @@ -249,7 +247,7 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, String
        if (_emailAlert != null)

        { _emailAlert.sendAlert(alertType, dataCenterId, podId, null, subject, body); }

        else

        { - s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId + + s_logger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId + " | message:: " + subject + " | body:: " + body); }

        } catch (Exception ex) {
        @@ -589,7 +587,7 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste
        alertType = AlertManager.AlertType.ALERT_TYPE_LOCAL_STORAGE;
        break;

        • //Pod Level
          + //Pod Level
          case Capacity.CAPACITY_TYPE_PRIVATE_IP:
          msgSubject = "System Alert: Number of unallocated private IPs is low in pod " + pod.getName() + " of availability zone " + dc.getName();
          totalStr = Double.toString(totalCapacity);
          @@ -598,7 +596,7 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste
          alertType = AlertManager.AlertType.ALERT_TYPE_PRIVATE_IP;
          break;
        • //Zone Level
          + //Zone Level
          case Capacity.CAPACITY_TYPE_SECONDARY_STORAGE:
          msgSubject = "System Alert: Low Available Secondary Storage in availability zone " + dc.getName();
          totalStr = formatBytesToMegabytes(totalCapacity);
          @@ -746,22 +744,22 @@ protected PasswordAuthentication getPasswordAuthentication() {

        // TODO: make sure this handles SSL transport (useAuth is true) and regular
        public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException,

        • UnsupportedEncodingException {
        • s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " +
          + UnsupportedEncodingException {
          + s_logger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " +
          podId + " | clusterId:: " + clusterId + " | message:: " + subject);
          AlertVO alert = null;
          if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) &&
        • (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) {
          + (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) &&
          + (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) { alert = _alertDao.getLastAlert(alertType.getType(), dataCenterId, podId, clusterId); }

        @@ -770,6 +768,7 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
        AlertVO newAlert = new AlertVO();
        newAlert.setType(alertType.getType());
        newAlert.setSubject(subject);
        + newAlert.setContent(content);
        newAlert.setClusterId(clusterId);
        newAlert.setPodId(podId);
        newAlert.setDataCenterId(dataCenterId);
        diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
        index 2966d41d8bf..195543686cb 100755
        — a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
        +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
        @@ -30,10 +30,6 @@
        import javax.inject.Inject;
        import javax.naming.ConfigurationException;

        -import org.apache.commons.lang.ObjectUtils;
        -import org.apache.log4j.Logger;
        -import org.springframework.stereotype.Component;
        -
        import org.apache.cloudstack.api.ApiConstants;
        import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
        import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
        @@ -50,6 +46,9 @@
        import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
        import org.apache.cloudstack.utils.identity.ManagementServerNode;
        import org.apache.commons.collections.CollectionUtils;
        +import org.apache.commons.lang.ObjectUtils;
        +import org.apache.log4j.Logger;
        +import org.springframework.stereotype.Component;

        import com.cloud.agent.AgentManager;
        import com.cloud.agent.api.Answer;
        @@ -75,7 +74,6 @@
        import com.cloud.capacity.dao.CapacityDao;
        import com.cloud.cluster.ClusterManager;
        import com.cloud.configuration.Config;
        -import com.cloud.configuration.ConfigurationManager;
        import com.cloud.dc.ClusterDetailsDao;
        import com.cloud.dc.ClusterDetailsVO;
        import com.cloud.dc.ClusterVO;
        @@ -249,8 +247,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) {
        @Inject
        private VMTemplateDao _templateDao;
        @Inject

        • private ConfigurationManager _configMgr;
        • @Inject
          private ClusterVSMMapDao _clusterVSMMapDao;

        private final long _nodeId = ManagementServerNode.getManagementServerId();
        @@ -610,7 +606,7 @@ public Discoverer getMatchingDiscover(final Hypervisor.HypervisorType hypervisor

        private List<HostVO> discoverHostsFull(final Long dcId, final Long podId, Long clusterId, final String clusterName, String url, String username, String password,
        final String hypervisorType, final List<String> hostTags, final Map<String, String> params, final boolean deferAgentCreation) throws IllegalArgumentException, DiscoveryException,

        • InvalidParameterValueException {
          + InvalidParameterValueException { URI uri = null; // Check if the zone exists in the system @@ -836,7 +832,6 @@ protected boolean doDeleteHost(final long hostId, final boolean isForced, final }

          // Get storage pool host mappings here because they can be removed as a
          // part of handleDisconnect later

        • // TODO: find out the bad boy, what's a buggy logic!
          final List<StoragePoolHostVO> pools = _storagePoolHostDao.listByHostIdIncludingRemoved(hostId);

        final ResourceStateAdapter.DeleteHostAnswer answer =
        @@ -1166,15 +1161,15 @@ public Host cancelMaintenance(final CancelMaintenanceCmd cmd) {
        }

        @Override

        • public Host reconnectHost(final ReconnectHostCmd cmd) {
        • final Long hostId = cmd.getId();
          + public Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException {
          + Long hostId = cmd.getId();
        • final HostVO host = _hostDao.findById(hostId);
          + HostVO host = _hostDao.findById(hostId);
          if (host == null) { throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist"); }

          -

        • return _agentMgr.reconnect(hostId) ? host : null;
          + _agentMgr.reconnect(hostId);
          + return host;
          }

        @Override
        @@ -2310,7 +2305,6 @@ public boolean executeUserRequest(final long hostId, final ResourceState.Event e
        } else if (event == ResourceState.Event.AdminCancelMaintenance)

        { return doCancelMaintenance(hostId); }

        else if (event == ResourceState.Event.DeleteHost)

        { - /* TODO: Ask alex why we assume the last two parameters are false */ return doDeleteHost(hostId, false, false); }

        else if (event == ResourceState.Event.Unmanaged) {
        return doUmanageHost(hostId);
        @@ -2329,7 +2323,7 @@ private boolean doUmanageHost(final long hostId) {
        }

        if (host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC)

        { - final MaintainAnswer answer = (MaintainAnswer)_agentMgr.easySend(hostId, new MaintainCommand()); + _agentMgr.easySend(hostId, new MaintainCommand()); }

        _agentMgr.disconnectWithoutInvestigation(hostId, Event.ShutdownRequested);
        @@ -2379,10 +2373,6 @@ public boolean updateClusterPassword(final UpdateHostPasswordCmd command) {
        final List<HostVO> hosts = listAllHostsInCluster(command.getClusterId());
        for (final HostVO host : hosts) {
        try {

        • /*
        • * FIXME: this is a buggy logic, check with alex. Shouldn't
        • * return if propagation return non null
        • */
          final Boolean result = propagateResourceEvent(host.getId(), ResourceState.Event.UpdatePassword);
          if (result != null)
          Unknown macro: { return result;@@ -2852,11 +2842,4 @@ public Boolean doInTransaction(final TransactionStatus status) { return false; } }

          -

        • @Override
        • public boolean start() { - // TODO Auto-generated method stub - return super.start(); - }

          -
          }
          diff --git a/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java b/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java
          index 3a904315fe1..02e7a4231a4 100644

            • a/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java
              +++ b/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java
              @@ -191,7 +191,8 @@ public boolean provisionCertificate(final Host host, final Boolean reconnect, fi
              if (Strings.isNullOrEmpty(csr)) { return false; }
        • final Certificate certificate = issueCertificate(csr, Collections.singletonList(host.getName()), Arrays.asList(host.getPrivateIpAddress(), host.getPublicIpAddress(), host.getStorageIpAddress()), CAManager.CertValidityPeriod.value(), caProvider);
          + final Certificate certificate = issueCertificate(csr, Collections.singletonList(host.getName()),
          + Arrays.asList(host.getPrivateIpAddress(), host.getPublicIpAddress(), host.getStorageIpAddress()), CAManager.CertValidityPeriod.value(), caProvider);
          return deployCertificate(host, certificate, reconnect, null);
          } catch (final AgentUnavailableException | OperationTimedoutException e) { LOG.error("Host/agent is not available or operation timed out, failed to setup keystore and generate CSR for host/agent id=" + host.getId() + ", due to: ", e); @@ -206,18 +207,19 @@ public String generateKeyStoreAndCsr(final Host host, final Map<String, String> cmd.setAccessDetail(sshAccessDetails); }

          CallContext.current().setEventDetails("generating keystore and CSR for host id: " + host.getId());

        • final SetupKeystoreAnswer answer = (SetupKeystoreAnswer) agentManager.send(host.getId(), cmd);
          + final SetupKeystoreAnswer answer = (SetupKeystoreAnswer)agentManager.send(host.getId(), cmd);
          return answer.getCsr();
          }

        @Override

        • public boolean deployCertificate(final Host host, final Certificate certificate, final Boolean reconnect, final Map<String, String> sshAccessDetails) throws AgentUnavailableException, OperationTimedoutException {
          + public boolean deployCertificate(final Host host, final Certificate certificate, final Boolean reconnect, final Map<String, String> sshAccessDetails)
          + throws AgentUnavailableException, OperationTimedoutException {
          final SetupCertificateCommand cmd = new SetupCertificateCommand(certificate);
          if (sshAccessDetails != null && !sshAccessDetails.isEmpty()) { cmd.setAccessDetail(sshAccessDetails); }

          CallContext.current().setEventDetails("deploying certificate for host id: " + host.getId());

        • final SetupCertificateAnswer answer = (SetupCertificateAnswer) agentManager.send(host.getId(), cmd);
          + final SetupCertificateAnswer answer = (SetupCertificateAnswer)agentManager.send(host.getId(), cmd);
          if (answer.getResult()) { CallContext.current().setEventDetails("successfully deployed certificate for host id: " + host.getId()); }

          else {
          @@ -227,9 +229,12 @@ public boolean deployCertificate(final Host host, final Certificate certificate,
          if (answer.getResult()) {
          getActiveCertificatesMap().put(host.getPrivateIpAddress(), certificate.getClientCertificate());
          if (sshAccessDetails == null && reconnect != null && reconnect) {

        • LOG.info(String.format("Successfully setup certificate on host, reconnecting with agent with id=%d, name=%s, address=%s",
        • host.getId(), host.getName(), host.getPublicIpAddress()));
        • return agentManager.reconnect(host.getId());
          + LOG.info(String.format("Successfully setup certificate on host, reconnecting with agent with id=%d, name=%s, address=%s", host.getId(), host.getName(), host.getPublicIpAddress()));
          + try { + agentManager.reconnect(host.getId()); + }

          catch (AgentUnavailableException | CloudRuntimeException e)

          { + LOG.debug("Error when reconnecting to host: " + host.getUuid(), e); + }

          }
          return true;
          }
          @@ -257,8 +262,7 @@ public void sendAlert(final Host host, final String subject, final String messag
          if (host == null)

          { return; }
        • alertManager.sendAlert(AlertManager.AlertType.ALERT_TYPE_CA_CERT,
        • host.getDataCenterId(), host.getPodId(), subject, message);
          + alertManager.sendAlert(AlertManager.AlertType.ALERT_TYPE_CA_CERT, host.getDataCenterId(), host.getPodId(), subject, message);
          }

        @Override
        @@ -303,7 +307,7 @@ protected void runInContext() {
        }
        final DateTime now = DateTime.now(DateTimeZone.UTC);
        final Map<String, X509Certificate> certsMap = caManager.getActiveCertificatesMap();

        • for (final Iterator<Map.Entry<String, X509Certificate>> it = certsMap.entrySet().iterator(); it.hasNext(); ) {
          + for (final Iterator<Map.Entry<String, X509Certificate>> it = certsMap.entrySet().iterator(); it.hasNext() {
          final Map.Entry<String, X509Certificate> entry = it.next();
          if (entry == null) {
          continue;
          @@ -315,19 +319,14 @@ protected void runInContext() { continue; }

          final Host host = hostDao.findByIp(hostIp);

        • if (host == null || host.getManagementServerId() == null ||
        • host.getManagementServerId() != ManagementServerNode.getManagementServerId() ||
        • host.getStatus() != Status.Up) {
        • if (host == null ||
        • (host.getManagementServerId() != null &&
        • host.getManagementServerId() != ManagementServerNode.getManagementServerId())) {
          + if (host == null || host.getManagementServerId() == null || host.getManagementServerId() != ManagementServerNode.getManagementServerId() || host.getStatus() != Status.Up)
          Unknown macro: {+ if (host == null || (host.getManagementServerId() != null && host.getManagementServerId() != ManagementServerNode.getManagementServerId())) { it.remove(); } continue; }
        • final String hostDescription = String.format("host id=%d, uuid=%s, name=%s, ip=%s, zone id=%d",
        • host.getId(), host.getUuid(), host.getName(), hostIp, host.getDataCenterId());
          + final String hostDescription = String.format("host id=%d, uuid=%s, name=%s, ip=%s, zone id=%d", host.getId(), host.getUuid(), host.getName(), hostIp, host.getDataCenterId());

        try {
        certificate.checkValidity(now.plusDays(CertExpiryAlertPeriod.valueIn(host.getClusterId())).toDate());
        @@ -345,7 +344,8 @@ protected void runInContext() {
        } catch (final Throwable ex)

        { LOG.warn("Failed to auto-renew certificate for " + hostDescription + ", with error=", ex); caManager.sendAlert(host, "Certificate auto-renewal failed for " + hostDescription, - String.format("Certificate is going to expire for %s. Auto-renewal failed to renew the certificate, please renew it manually. It is not valid after %s.", hostDescription, certificate.getNotAfter())); + String.format("Certificate is going to expire for %s. Auto-renewal failed to renew the certificate, please renew it manually. It is not valid after %s.", + hostDescription, certificate.getNotAfter())); }

        } else {
        if (alertMap.containsKey(hostIp)) {
        @@ -355,8 +355,7 @@ protected void runInContext() {
        }
        }
        caManager.sendAlert(host, "Certificate expiring soon for " + hostDescription,

        • String.format("Certificate is going to expire for %s. Please renew it, it is not valid after %s.",
        • hostDescription, certificate.getNotAfter()));
          + String.format("Certificate is going to expire for %s. Please renew it, it is not valid after %s.", hostDescription, certificate.getNotAfter()));
          alertMap.put(hostIp, new Date());
          }
          }
          @@ -427,14 +426,6 @@ public String getConfigComponentName() {

        @Override
        public ConfigKey<?>[] getConfigKeys() {

        • return new ConfigKey<?>[] { - CAProviderPlugin, - CertKeySize, - CertSignatureAlgorithm, - CertValidityPeriod, - AutomaticCertRenewal, - CABackgroundJobDelay, - CertExpiryAlertPeriod - }

          ;
          + return new ConfigKey<?>[]

          {CAProviderPlugin, CertKeySize, CertSignatureAlgorithm, CertValidityPeriod, AutomaticCertRenewal, CABackgroundJobDelay, CertExpiryAlertPeriod}

          ;
          }
          }
          diff --git a/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java b/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java
          index 14ecc971d5f..64cbf205812 100644

            • a/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java
              +++ b/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java
              @@ -113,7 +113,7 @@ public void testProvisionCertificate() throws Exception {
              final X509Certificate certificate = CertUtils.generateV3Certificate(null, keyPair, keyPair.getPublic(), "CN=ca", "SHA256withRSA", 365, null, null);
              Mockito.when(caProvider.issueCertificate(Mockito.anyString(), Mockito.anyList(), Mockito.anyList(), Mockito.anyInt())).thenReturn(new Certificate(certificate, null, Collections.singletonList(certificate)));
              Mockito.when(agentManager.send(Mockito.anyLong(), Mockito.any(SetupKeyStoreCommand.class))).thenReturn(new SetupKeystoreAnswer("someCsr"));
        • Mockito.when(agentManager.reconnect(Mockito.anyLong())).thenReturn(true);
          + Mockito.doNothing().when(agentManager).reconnect(Mockito.anyLong());
          Assert.assertTrue(caManager.provisionCertificate(host, true, null));
          Mockito.verify(agentManager, Mockito.times(2)).send(Mockito.anyLong(), Mockito.any(Answer.class));
          Mockito.verify(agentManager, Mockito.times(1)).reconnect(Mockito.anyLong());

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - rafaelweingartner closed pull request #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/.travis.yml b/.travis.yml index be0bfb12210..f4b52bae945 100644 — a/.travis.yml +++ b/.travis.yml @@ -33,10 +33,11 @@ env: PATH=$HOME/.local/bin:$PATH matrix: Keep the TESTS sorted by name and grouped by type + - TESTS="smoke/test_certauthority_root" + TESTS="smoke/test_accounts smoke/test_affinity_groups smoke/test_affinity_groups_projects smoke/test_certauthority_root smoke/test_deploy_vgpu_enabled_vm smoke/test_deploy_vm_iso smoke/test_deploy_vm_root_resize diff --git a/api/src/main/java/com/cloud/alert/Alert.java b/api/src/main/java/com/cloud/alert/Alert.java index f77442068d6..d85dca5b7b0 100644 a/api/src/main/java/com/cloud/alert/Alert.java +++ b/api/src/main/java/com/cloud/alert/Alert.java @@ -41,4 +41,6 @@ boolean getArchived(); String getName(); + + String getContent(); } diff --git a/api/src/main/java/com/cloud/resource/ResourceService.java b/api/src/main/java/com/cloud/resource/ResourceService.java index 854b53591d6..70823084d84 100644 — a/api/src/main/java/com/cloud/resource/ResourceService.java +++ b/api/src/main/java/com/cloud/resource/ResourceService.java @@ -18,7 +18,6 @@ import java.util.List; -import com.cloud.dc.DataCenter; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd; import org.apache.cloudstack.api.command.admin.host.AddHostCmd; @@ -29,6 +28,8 @@ import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd; import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd; +import com.cloud.dc.DataCenter; +import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceInUseException; @@ -41,25 +42,17 @@ /** Updates a host * * @param cmd * - the command specifying hostId * @return hostObject * @throws NoTransitionException + * @param cmd - the command specifying hostId */ Host updateHost(UpdateHostCmd cmd) throws NoTransitionException; Host cancelMaintenance(CancelMaintenanceCmd cmd); Host reconnectHost(ReconnectHostCmd cmd); + Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException; /** We will automatically create an Apache CloudStack cluster to attach to the external cluster and return a hyper host to perform host related operation within the cluster * * @param cmd * @return * @throws IllegalArgumentException * @throws DiscoveryException */ List<? extends Cluster> discoverCluster(AddClusterCmd cmd) throws IllegalArgumentException, DiscoveryException, ResourceInUseException; @@ -75,12 +68,6 @@ /** Deletes a host * * @param hostId * TODO * @param isForced * TODO * @param true if deleted, false otherwise */ boolean deleteHost(long hostId, boolean isForced, boolean isForceDeleteStorage); diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java index 5e156372681..34e439f3a37 100644 a/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java +++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java @@ -16,8 +16,6 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiConstants; @@ -27,13 +25,16 @@ import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.context.CallContext; +import org.apache.log4j.Logger; import com.cloud.event.EventTypes; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; import com.cloud.user.Account; +import com.cloud.utils.exception.CloudRuntimeException; -@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) +@APICommand(name = "reconnectHost", description = "Reconnects a host.", responseObject = HostResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) public class ReconnectHostCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ReconnectHostCmd.class.getName()); @@ -101,16 +102,15 @@ public Long getInstanceId() { 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()); + HostResponse response = _responseGenerator.createHostResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); + } catch (CloudRuntimeException e) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } catch (AgentUnavailableException e) { + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, e.getMessage()); } } } diff --git a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java index 933c3eaef99..c51970c85f7 100644 a/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java +++ b/engine/components-api/src/main/java/com/cloud/agent/AgentManager.java @@ -36,7 +36,7 @@ */ public interface AgentManager { static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", true); + true); public enum TapAgentsAction { Add, Del, Contains, @@ -143,7 +143,7 @@ public void pullAgentOutMaintenance(long hostId); boolean reconnect(long hostId); + void reconnect(long hostId) throws AgentUnavailableException; void rescan(); diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java index b7357756c4c..4b80fb1bc11 100644 — a/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java @@ -38,7 +38,6 @@ import javax.naming.ConfigurationException; import org.apache.cloudstack.ca.CAManager; -import com.cloud.configuration.ManagementServiceConfiguration; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; @@ -75,6 +74,7 @@ import com.cloud.agent.transport.Request; import com.cloud.agent.transport.Response; import com.cloud.alert.AlertManager; +import com.cloud.configuration.ManagementServiceConfiguration; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenterVO; import com.cloud.dc.HostPodVO; @@ -122,7 +122,6 @@ **/ public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory, Configurable { protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class); protected static final Logger status_logger = Logger.getLogger(Status.class); /** _agents is a ConcurrentHashMap, but it is used from within a synchronized block. This will be reported by findbugs as JLM_JSR166_UTILCONCURRENT_MONITORENTER. Maybe a @@ -133,7 +132,7 @@ protected List<Pair<Integer, Listener>> _cmdMonitors = new ArrayList<Pair<Integer, Listener>>(17); protected List<Pair<Integer, StartupCommandProcessor>> _creationMonitors = new ArrayList<Pair<Integer, StartupCommandProcessor>>(17); protected List<Long> _loadingAgents = new ArrayList<Long>(); protected int _monitorId = 0; + private int _monitorId = 0; private final Lock _agentStatusLock = new ReentrantLock(); @Inject @@ -180,28 +179,22 @@ @Inject ResourceManager _resourceMgr; - @Inject ManagementServiceConfiguration mgmtServiceConf; protected final ConfigKey<Integer> Workers = new ConfigKey<Integer>("Advanced", Integer.class, "workers", "5", "Number of worker threads handling remote agent connections.", false); + "Number of worker threads handling remote agent connections.", false); protected final ConfigKey<Integer> Port = new ConfigKey<Integer>("Advanced", Integer.class, "port", "8250", "Port to listen on for remote agent connections.", false); protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>("Advanced", Integer.class, "alert.wait", "1800", "Seconds to wait before alerting on a disconnected agent", true); + "Seconds to wait before alerting on a disconnected agent", true); protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>("Advanced", Integer.class, "direct.agent.load.size", "16", "The number of direct agents to load each time", false); + "The number of direct agents to load each time", false); protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>("Advanced", Integer.class, "direct.agent.pool.size", "500", "Default size for DirectAgentPool", false); + "Default size for DirectAgentPool", false); protected final ConfigKey<Float> DirectAgentThreadCap = new ConfigKey<Float>("Advanced", Float.class, "direct.agent.thread.cap", "1", "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false); protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<Boolean>( "Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false", "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true); + "Percentage (as a value between 0 and 1) of direct.agent.pool.size to be used as upper thread cap for a single direct agent to process requests", false); + protected final ConfigKey<Boolean> CheckTxnBeforeSending = new ConfigKey<Boolean>("Developer", Boolean.class, "check.txn.before.sending.agent.commands", "false", + "This parameter allows developers to enable a check to see if a transaction wraps commands that are sent to the resource. This is not to be enabled on production systems.", true); @Override public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { @@ -241,7 +234,6 @@ public boolean configure(final String name, final Map<String, Object> params) th return true; } - @Override public Task create(final Task.Type type, final Link link, final byte[] data) { return new AgentHandler(type, link, data); @@ -436,8 +428,7 @@ private void setEmptyAnswers(final Commands commands, final Command[] cmds) { if (CheckTxnBeforeSending.value()) { if (!noDbTxn()) { throw new CloudRuntimeException("We do not allow transactions to be wrapped around commands sent to be executed on remote agents. " - + "We cannot predict how long it takes a command to complete. " - + "The transaction may be rolled back because the connection took too long."); + + "We cannot predict how long it takes a command to complete. " + "The transaction may be rolled back because the connection took too long."); } } else { assert noDbTxn() : "I know, I know. Why are we so strict as to not allow txn across an agent call? ... Why are we so cruel ... Why are we such a dictator .... Too bad... Sorry...but NO AGENT COMMANDS WRAPPED WITHIN DB TRANSACTIONS!"; @@ -564,15 +555,13 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi monitor.second().processConnect(host, cmd[i], forRebalance); } catch (final Exception e) { if (e instanceof ConnectionException) { final ConnectionException ce = (ConnectionException) e; + final ConnectionException ce = (ConnectionException)e; if (ce.isSetupError()) { - s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage()); + s_logger.warn("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw ce; } else { - s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + - " due to " + e.getMessage()); + s_logger.info("Monitor " + monitor.second().getClass().getSimpleName() + " says not to continue the connect process for " + hostId + " due to " + e.getMessage()); handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); return attache; } @@ -580,8 +569,7 @@ protected AgentAttache notifyMonitorsOfConnection(final AgentAttache attache, fi handleDisconnectWithoutInvestigation(attache, Event.ShutdownRequested, true, true); throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); } else { - s_logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + - " due to " + e.getMessage(), e); + s_logger.error("Monitor " + monitor.second().getClass().getSimpleName() + " says there is an error in the connect process for " + hostId + " due to " + e.getMessage(), e); handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); throw new CloudRuntimeException("Unable to connect " + attache.getId(), e); } @@ -634,7 +622,7 @@ private ServerResource loadResourcesWithoutHypervisor(final HostVO host) { try { final Class<?> clazz = Class.forName(resourceName); final Constructor<?> constructor = clazz.getConstructor(); - resource = (ServerResource) constructor.newInstance(); + resource = (ServerResource)constructor.newInstance(); } catch (final ClassNotFoundException e) { s_logger.warn("Unable to find class " + host.getResource(), e); } catch (final InstantiationException e) Unknown macro: {@@ -888,7 +876,7 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, final String hostDesc = "name} @@ -899,7 +887,7 @@ protected boolean handleDisconnectWithInvestigation(final AgentAttache attache, final String podName = podVO != null ? podVO.getName() : "NO POD"; final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podName; _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host in ALERT state, " + hostDesc, "In availability zone " + host.getDataCenterId() + ", host is in alert state: " + host.getId() + "-" + host.getName()); + "In availability zone " + host.getDataCenterId() + ", host is in alert state: " + host.getId() + "-" + host.getName()); } } else { s_logger.debug("The next status of agent " + host.getId() + " is not Alert, no need to investigate what happened"); @@ -987,33 +975,30 @@ public Answer easySend(final Long hostId, final Command cmd) { } @Override public boolean reconnect(final long hostId) { HostVO host; + public void reconnect(final long hostId) throws AgentUnavailableException { + HostVO host = _hostDao.findById(hostId); + if (host == null) { + throw new CloudRuntimeException("Unable to find host: " + hostId); + } host = _hostDao.findById(hostId); if (host == null || host.getRemoved() != null) { s_logger.warn("Unable to find host " + hostId); return false; + if (host.getRemoved() != null) { + throw new CloudRuntimeException("Host has already been removed: " + hostId); } if (host.getStatus() == Status.Disconnected) { - s_logger.info("Host is already disconnected, no work to be done"); - return true; + s_logger.debug("Host is already disconnected, no work to be done: " + hostId); + return; } 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); + 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; } @Override @@ -1049,8 +1034,15 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A handleDisconnectWithoutInvestigation(attache, Event.AgentDisconnected, true, true); } return true; } else if (event == Event.ShutdownRequested) { - return reconnect(hostId); + } + if (event == Event.ShutdownRequested) Unknown macro: {+ try { + reconnect(hostId); + } catch (CloudRuntimeException e) { + s_logger.debug("Error on shutdown request for hostID: " + hostId, e); + return false; + }+ return true; } return false; } @@ -1166,7 +1158,7 @@ protected void runInContext() { _request.logD("Processing the first command "); final StartupCommand[] startups = new StartupCommand [_cmds.length] ; for (int i = 0; i < _cmds.length; i++) { - startups[i] = (StartupCommand) _cmds[i]; + startups[i] = (StartupCommand)_cmds[i]; } final AgentAttache attache = handleConnectedAgent(_link, startups, _request); @@ -1184,7 +1176,7 @@ protected void connectAgent(final Link link, final Command[] cmds, final Request for (int i = 0; i < cmds.length; i++) { cmd = cmds [i] ; if (cmd instanceof StartupRoutingCommand || cmd instanceof StartupProxyCommand || cmd instanceof StartupSecondaryStorageCommand || cmd instanceof StartupStorageCommand) { + cmd instanceof StartupStorageCommand) { answers[i] = new StartupAnswer((StartupCommand) cmds[i], 0, mgmtServiceConf.getPingInterval()); break; } @@ -1205,7 +1197,7 @@ public AgentHandler(final Task.Type type, final Link link, final byte[] data) { } protected void processRequest(final Link link, final Request request) { final AgentAttache attache = (AgentAttache) link.attachment(); + final AgentAttache attache = (AgentAttache)link.attachment(); final Command[] cmds = request.getCommands(); Command cmd = cmds [0] ; boolean logD = true; @@ -1256,10 +1248,9 @@ protected void processRequest(final Link link, final Request request) { final StartupStorageCommand startup = (StartupStorageCommand) cmd; answer = new StartupAnswer(startup, attache.getId(), mgmtServiceConf.getPingInterval()); } else if (cmd instanceof ShutdownCommand) { final ShutdownCommand shutdown = (ShutdownCommand) cmd; + final ShutdownCommand shutdown = (ShutdownCommand)cmd; final String reason = shutdown.getReason(); s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " + shutdown.getDetail()); + s_logger.info("Host " + attache.getId() + " has informed us that it is shutting down with reason " + reason + " and detail " + shutdown.getDetail()); if (reason.equals(ShutdownCommand.Update)) { // disconnectWithoutInvestigation(attache, Event.UpdateNeeded); throw new CloudRuntimeException("Agent update not implemented"); @@ -1268,16 +1259,16 @@ protected void processRequest(final Link link, final Request request) { } return; } else if (cmd instanceof AgentControlCommand) { - answer = handleControlCommand(attache, (AgentControlCommand) cmd); + answer = handleControlCommand(attache, (AgentControlCommand)cmd); } else { handleCommands(attache, request.getSequence(), new Command[] { cmd } ); + handleCommands(attache, request.getSequence(), new Command[] {cmd} ); if (cmd instanceof PingCommand) { final long cmdHostId = ((PingCommand) cmd).getHostId(); + final long cmdHostId = ((PingCommand)cmd).getHostId(); // if the router is sending a ping, verify the // gateway was pingable if (cmd instanceof PingRoutingCommand) { final boolean gatewayAccessible = ((PingRoutingCommand) cmd).isGatewayAccessible(); + final boolean gatewayAccessible = ((PingRoutingCommand)cmd).isGatewayAccessible(); final HostVO host = _hostDao.findById(Long.valueOf(cmdHostId)); if (host != null) { @@ -1286,22 +1277,18 @@ protected void processRequest(final Link link, final Request request) { // gateway (cannot ping the default route) final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); final HostPodVO podVO = _podDao.findById(host.getPodId()); - final String hostDesc = - "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " - + podVO.getName(); + final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId(), - "Host lost connection to gateway, " + hostDesc, "Host [" + hostDesc + - "] lost connection to gateway (default route) and is possibly having network connection issues."); + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId(), "Host lost connection to gateway, " + hostDesc, + "Host [" + hostDesc + "] lost connection to gateway (default route) and is possibly having network connection issues."); } else { _alertMgr.clearAlert(AlertManager.AlertType.ALERT_TYPE_ROUTING, host.getDataCenterId(), host.getPodId()); } } else { - s_logger.debug("Not processing " + PingRoutingCommand.class.getSimpleName() + " for agent id=" + cmdHostId + - "; can't find the host in the DB"); + s_logger.debug("Not processing " + PingRoutingCommand.class.getSimpleName() + " for agent id=" + cmdHostId + "; can't find the host in the DB"); } } answer = new PingAnswer((PingCommand) cmd); + answer = new PingAnswer((PingCommand)cmd); } else if (cmd instanceof ReadyAnswer) { final HostVO host = _hostDao.findById(attache.getId()); if (host == null) { @@ -1337,7 +1324,7 @@ protected void processRequest(final Link link, final Request request) { } protected void processResponse(final Link link, final Response response) { final AgentAttache attache = (AgentAttache) link.attachment(); + final AgentAttache attache = (AgentAttache)link.attachment(); if (attache == null) { s_logger.warn("Unable to process: " + response); } else if (!attache.processAnswers(response.getSequence(), response)) { @@ -1355,7 +1342,7 @@ protected void doTask(final Task task) throws TaskExecutionException { try { final Request event = Request.parse(data); if (event instanceof Response) { - processResponse(task.getLink(), (Response) event); + processResponse(task.getLink(), (Response)event); } else { processRequest(task.getLink(), event); } @@ -1370,7 +1357,7 @@ protected void doTask(final Task task) throws TaskExecutionException { } else if (type == Task.Type.CONNECT) { } else if (type == Task.Type.DISCONNECT) { final Link link = task.getLink(); final AgentAttache attache = (AgentAttache) link.attachment(); + final AgentAttache attache = (AgentAttache)link.attachment(); if (attache != null) { disconnectWithInvestigation(attache, Event.AgentDisconnected); } else { @@ -1411,23 +1398,21 @@ public boolean tapLoadingAgents(final Long hostId, final TapAgentsAction action) public boolean agentStatusTransitTo(final HostVO host, final Status.Event e, final long msId) { try { _agentStatusLock.lock(); if (status_logger.isDebugEnabled()) { + if (s_logger.isDebugEnabled()) { final ResourceState state = host.getResourceState(); final StringBuilder msg = new StringBuilder("Transition:"); msg.append("[Resource state = ").append(state); msg.append(", Agent event = ").append(e.toString()); msg.append(", Host id = ").append(host.getId()).append(", name = " + host.getName()).append("]"); - status_logger.debug(msg); + s_logger.debug(msg); } host.setManagementServerId(msId); try { return _statusStateMachine.transitTo(host, e, host.getId(), _hostDao); } catch (final NoTransitionException e1) { - status_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + - ", mangement server id is " + msId); - throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + - e1.getMessage()); + s_logger.debug("Cannot transit agent status with event " + e + " for host " + host.getId() + ", name=" + host.getName() + ", mangement server id is " + msId); + throw new CloudRuntimeException("Cannot transit agent status with event " + e + " for host " + host.getId() + ", mangement server id is " + msId + "," + e1.getMessage()); } } finally { _agentStatusLock.unlock(); @@ -1491,6 +1476,7 @@ private void disconnectInternal(final long hostId, final Status.Event event, fin } } + @Override public void disconnectWithInvestigation(final long hostId, final Status.Event event) { disconnectInternal(hostId, event, true); } @@ -1501,8 +1487,7 @@ public void disconnectWithoutInvestigation(final long hostId, final Status.Event } @Override public boolean handleDirectConnectAgent(final Host host, final StartupCommand[] cmds, final ServerResource resource, final boolean forRebalance, boolean newHost) throws ConnectionException { + public boolean handleDirectConnectAgent(final Host host, final StartupCommand[] cmds, final ServerResource resource, final boolean forRebalance, boolean newHost) throws ConnectionException { AgentAttache attache; attache = createAttacheForDirectConnect(host, resource); @@ -1579,17 +1564,17 @@ protected void runInContext() { /* * Host is in non-operation state, so no investigation and direct put agent to Disconnected */ - status_logger.debug("Ping timeout but agent " + agentId + " is in resource state of " + resourceState + ", so no investigation"); + s_logger.debug("Ping timeout but agent " + agentId + " is in resource state of " + resourceState + ", so no investigation"); disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); } else { final HostVO host = _hostDao.findById(agentId); if (host != null && (host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorageVM host.getType() == Host.Type.SecondaryStorageCmdExecutor)) Unknown macro: {+ if (host != null+ && (host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorageVM || host.getType() == Host.Type.SecondaryStorageCmdExecutor)) { s_logger.warn("Disconnect agent for CPVM/SSVM due to physical connection close. host: " + host.getId()); disconnectWithoutInvestigation(agentId, Event.ShutdownRequested); } else { - status_logger.debug("Ping timeout for agent " + agentId + ", do invstigation"); + s_logger.debug("Ping timeout for agent " + agentId + ", do invstigation"); disconnectWithInvestigation(agentId, Event.PingTimeout); } } @@ -1605,8 +1590,8 @@ protected void runInContext() { final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); final HostPodVO podVO = _podDao.findById(host.getPodId()); final String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); - _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc, "Host [" - + hostDesc + "] is ready for maintenance"); + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Migration Complete for host " + hostDesc, + "Host [" + hostDesc + "] is ready for maintenance"); } } } catch (final Throwable th) { @@ -1708,7 +1693,7 @@ public String getConfigComponentName() Unknown macro: { @Override public ConfigKey<?>[] getConfigKeys() Unknown macro: { return new ConfigKey<?>[] { CheckTxnBeforeSending, Workers, Port, Wait, AlertWait, DirectAgentLoadSize, DirectAgentPoolSize, - DirectAgentThreadCap };+ DirectAgentThreadCap } ; } protected class SetHostParamsListener implements Listener { @@ -1738,20 +1723,20 @@ public void processHostAdded(long hostId) { @Override public void processConnect(final Host host, final StartupCommand cmd, final boolean forRebalance) { if (cmd instanceof StartupRoutingCommand) { if (((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.LXC) { Map<String, String> params = new HashMap<String, String>(); params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout")); + if (cmd instanceof StartupRoutingCommand) { + if (((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.KVM || ((StartupRoutingCommand)cmd).getHypervisorType() == HypervisorType.LXC) { + Map<String, String> params = new HashMap<String, String>(); + params.put("router.aggregation.command.each.timeout", _configDao.getValue("router.aggregation.command.each.timeout")); try { - SetHostParamsCommand cmds = new SetHostParamsCommand(params); - Commands c = new Commands(cmds); - send(host.getId(), c, this); - } catch (AgentUnavailableException e) { s_logger.debug("Failed to send host params on host: " + host.getId()); + try { + SetHostParamsCommand cmds = new SetHostParamsCommand(params); + Commands c = new Commands(cmds); + send(host.getId(), c, this); + } catch (AgentUnavailableException e) { + s_logger.debug("Failed to send host params on host: " + host.getId()); + } } } } } diff --git a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java index 7a9678e6a4a..38822cba16b 100644 — a/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java +++ b/engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java @@ -46,12 +46,12 @@ import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; +import org.apache.cloudstack.ha.dao.HAConfigDao; import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.managed.context.ManagedContextTimerTask; +import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao; import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.cloudstack.utils.security.SSLUtils; -import org.apache.cloudstack.ha.dao.HAConfigDao; -import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao; import org.apache.log4j.Logger; import com.cloud.agent.api.Answer; @@ -134,14 +134,12 @@ protected ClusteredAgentManagerImpl() { super(); } protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", "false", "Enable agent load balancing between management server nodes", true); + protected final ConfigKey<Boolean> EnableLB = new ConfigKey<Boolean>(Boolean.class, "agent.lb.enabled", "Advanced", "false", "Enable agent load balancing between management server nodes", true); protected final ConfigKey<Double> ConnectedAgentThreshold = new ConfigKey<Double>(Double.class, "agent.load.threshold", "Advanced", "0.7", "What percentage of the agents can be held by one management server before load balancing happens", true); protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", "16", "How many agents to connect to in each round", true); protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", "90", "Interval between scans to load agents", false, ConfigKey.Scope.Global, 1000); + protected final ConfigKey<Integer> LoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advanced", "16", "How many agents to connect to in each round", true); + protected final ConfigKey<Integer> ScanInterval = new ConfigKey<Integer>(Integer.class, "direct.agent.scan.interval", "Advanced", "90", "Interval between scans to load agents", false, + ConfigKey.Scope.Global, 1000); @Override public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException { @@ -342,8 +340,7 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A final HostTransferMapVO transferVO = _hostTransferDao.findById(hostId); if (transferVO != null) { if (transferVO.getFutureOwner() == _nodeId && transferVO.getState() == HostTransferState.TransferStarted) { - s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is being connected to " + - _nodeId); + s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is being connected to " + _nodeId); return true; } } @@ -352,8 +349,7 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A // don't process disconnect if the disconnect came for the host via delayed cluster notification, // but the host has already reconnected to the current management server if (!attache.forForward()) { - s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + - " as the host is directly connected to the current management server " + _nodeId); + s_logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is directly connected to the current management server " + _nodeId); return true; } @@ -367,19 +363,15 @@ public boolean executeUserRequest(final long hostId, final Event event) throws A } @Override public boolean reconnect(final long hostId) { Boolean result; try { result = propagateAgentEvent(hostId, Event.ShutdownRequested); if (result != null) { - return result; - } } catch (final AgentUnavailableException e) { - s_logger.debug("cannot propagate agent reconnect because agent is not available", e); - return false; - } + public void reconnect(final long hostId) throws CloudRuntimeException, AgentUnavailableException Unknown macro: {+ Boolean result = propagateAgentEvent(hostId, Event.ShutdownRequested);+ if (result == null) { + super.reconnect(hostId); - return super.reconnect(hostId); + }+ if (!result) { + throw new CloudRuntimeException("Failed to propagating agent change request event:" + Event.ShutdownRequested + " to host:" + hostId); + } } public void notifyNodesInCluster(final AgentAttache attache) { @@ -398,18 +390,18 @@ public void notifyNodesInClusterToScheduleHostScanTask() { } protected static void logT(final byte[] bytes, final String msg) { - s_logger.trace("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.trace("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); } protected static void logD(final byte[] bytes, final String msg) { - s_logger.debug("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.debug("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); } protected static void logI(final byte[] bytes, final String msg) { - s_logger.info("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + - (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); + s_logger.info("Seq " + Request.getAgentId(bytes) + "-" + Request.getSequence(bytes) + ": MgmtId " + Request.getManagementServerId(bytes) + ": " + + (Request.isRequest(bytes) ? "Req: " : "Resp: ") + msg); } public boolean routeToPeer(final String peer, final byte[] bytes) { @@ -443,8 +435,7 @@ public boolean routeToPeer(final String peer, final byte[] bytes) { logI(bytes, "Unable to route to peer: " + Request.parse(bytes).toString() + " due to " + e.getMessage()); } catch (ClassNotFoundException | UnsupportedVersionException ex) { // Request.parse thrown exception when we try to log it, log as much as we can - logI(bytes, "Unable to route to peer due to" + e.getMessage() - + ". Also caught exception when parsing request: " + ex.getMessage()); + logI(bytes, "Unable to route to peer due to" + e.getMessage() + ". Also caught exception when parsing request: " + ex.getMessage()); } } } @@ -489,8 +480,7 @@ public SocketChannel connectToPeer(final String peerName, final SocketChannel pr try { prevCh.close(); } catch (final Exception e) { - s_logger.info("[ignored]" - + "failed to get close resource for previous channel Socket: " + e.getLocalizedMessage()); + s_logger.info("[ignored]" + "failed to get close resource for previous channel Socket: " + e.getLocalizedMessage()); } } if (ch == null || ch == prevCh) { @@ -597,7 +587,7 @@ public boolean stop() { s_logger.info("Closing: " + ch.toString()); ch.close(); } catch (final IOException e) { - s_logger.info("[ignored] error on closing channel: " +ch.toString(), e); + s_logger.info("[ignored] error on closing channel: " + ch.toString(), e); } } } @@ -770,8 +760,7 @@ public void removeAgent(final AgentAttache attache, final Status nextState) { } @Override public boolean executeRebalanceRequest(final long agentId, final long currentOwnerId, final long futureOwnerId, final Event event) throws AgentUnavailableException, OperationTimedoutException { + public boolean executeRebalanceRequest(final long agentId, final long currentOwnerId, final long futureOwnerId, final Event event) throws AgentUnavailableException, OperationTimedoutException { boolean result = false; if (event == Event.RequestAgentRebalance) { return setToWaitForRebalance(agentId, currentOwnerId, futureOwnerId); @@ -837,8 +826,8 @@ public void startRebalanceAgents() { avLoad = allManagedAgents.size() / allMS.size(); } else Unknown macro: { if (s_logger.isDebugEnabled()) { - s_logger.debug("There are no hosts to rebalance in the system. Current number of active management server nodes in the system is " + allMS.size() + - "; number of managed agents is " + allManagedAgents.size()); + s_logger.debug("There are no hosts to rebalance in the system. Current number of active management server nodes in the system is " + allMS.size() + "; number of managed agents is " + + allManagedAgents.size()); } return; } @@ -991,8 +980,7 @@ protected void runInContext() { // remove the host from re-balance list and delete from op_host_transfer DB // no need to do anything with the real attache as we haven't modified it yet final Date cutTime = DateUtil.currentGMTTime(); final HostTransferMapVO transferMap = _hostTransferDao.findActiveHostTransferMapByHostId(hostId, new Date(cutTime.getTime() - rebalanceTimeOut)); + final HostTransferMapVO transferMap = _hostTransferDao.findActiveHostTransferMapByHostId(hostId, new Date(cutTime.getTime() - rebalanceTimeOut)); if (transferMap == null) { s_logger.debug("Timed out waiting for the host id=" + hostId + " to be ready to transfer, skipping rebalance for the host"); @@ -1010,8 +998,7 @@ protected void runInContext() { final ManagementServerHostVO ms = _mshostDao.findByMsid(transferMap.getFutureOwner()); if (ms != null && ms.getState() != ManagementServerHost.State.Up) { s_logger.debug("Can't transfer host " + hostId + " as it's future owner is not in UP state: " + ms + ", skipping rebalance for the host"); + s_logger.debug("Can't transfer host " + hostId + " as it's future owner is not in UP state: " + ms + ", skipping rebalance for the host"); iterator.remove(); _hostTransferDao.completeAgentTransfer(hostId); continue; @@ -1027,8 +1014,8 @@ protected void runInContext() { } } else { - s_logger.debug("Agent " + hostId + " can't be transfered yet as its request queue size is " + attache.getQueueSize() + - " and listener queue size is " + attache.getNonRecurringListenersSize()); + s_logger.debug("Agent " + hostId + " can't be transfered yet as its request queue size is " + attache.getQueueSize() + " and listener queue size is " + + attache.getNonRecurringListenersSize()); } } } else { @@ -1094,8 +1081,7 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi if (result) { if (s_logger.isDebugEnabled()) { - s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.debug("Loading directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); } result = loadDirectlyConnectedHost(host, true); } else { @@ -1103,17 +1089,15 @@ protected boolean rebalanceHost(final long hostId, final long currentOwnerId, fi } } catch (final Exception ex) { - s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process due to:", ex); + s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process due to:", + ex); result = false; } if (result) { - s_logger.debug("Successfully loaded directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.debug("Successfully loaded directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); } else { - s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + - " as a part of rebalance process"); + s_logger.warn("Failed to load directly connected host " + host.getId() + "(" + host.getName() + ") to the management server " + _nodeId + " as a part of rebalance process"); } } @@ -1144,8 +1128,7 @@ protected void finishRebalance(final long hostId, final long futureOwnerId, fina // 2) Get all transfer requests and route them to peer Request requestToTransfer = forwardAttache.getRequestToTransfer(); while (requestToTransfer != null) { s_logger.debug("Forwarding request " + requestToTransfer.getSequence() + " held in transfer attache " + hostId + " from the management server " + _nodeId + " to " + futureOwnerId); + s_logger.debug("Forwarding request " + requestToTransfer.getSequence() + " held in transfer attache " + hostId + " from the management server " + _nodeId + " to " + futureOwnerId); final boolean routeResult = routeToPeer(Long.toString(futureOwnerId), requestToTransfer.getBytes()); if (!routeResult) { logD(requestToTransfer.getBytes(), "Failed to route request to peer"); @@ -1198,8 +1181,8 @@ protected boolean startRebalance(final long hostId) Unknown macro: { if (attache == null) { s_logger.warn("Attache for the agent " + hostId + " no longer exists on management server " + _nodeId + ", can't start host rebalancing"); } else { - s_logger.warn("Attache for the agent " + hostId + " has request queue size= " + attache.getQueueSize() + " and listener queue size " + - attache.getNonRecurringListenersSize() + ", can't start host rebalancing"); + s_logger.warn("Attache for the agent " + hostId + " has request queue size= " + attache.getQueueSize() + " and listener queue size " + attache.getNonRecurringListenersSize() + + ", can't start host rebalancing"); } return false; } @@ -1255,8 +1238,9 @@ private String handleScheduleHostScanTaskCommand(final ScheduleHostScanTaskComma } catch (final Exception e) { // Scheduling host scan task in peer MS is a best effort operation during host add, regular host scan // happens at fixed intervals anyways. So handling any exceptions that may be thrown - s_logger.warn("Exception happened while trying to schedule host scan task on mgmt server " + _clusterMgr.getSelfPeerName() + - ", ignoring as regular host scan happens at fixed interval anyways", e); + s_logger.warn( + "Exception happened while trying to schedule host scan task on mgmt server " + _clusterMgr.getSelfPeerName() + ", ignoring as regular host scan happens at fixed interval anyways", + e); return null; } @@ -1372,15 +1356,15 @@ public String dispatch(final ClusterServicePdu pdu) { final String jsonReturn = _gson.toJson(answers); if (s_logger.isDebugEnabled()) { - s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + - (System.currentTimeMillis() - startTick) + " ms, return result: " + jsonReturn); + s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + (System.currentTimeMillis() - startTick) + " ms, return result: " + + jsonReturn); } return jsonReturn; } else { if (s_logger.isDebugEnabled()) { - s_logger.debug("Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + - (System.currentTimeMillis() - startTick) + " ms, return null result"); + s_logger.debug( + "Completed dispatching -> " + pdu.getAgentId() + ", json: " + pdu.getJsonPackage() + " in " + (System.currentTimeMillis() - startTick) + " ms, return null result"); } } } catch (final AgentUnavailableException e) { diff --git a/engine/schema/src/main/java/com/cloud/alert/AlertVO.java b/engine/schema/src/main/java/com/cloud/alert/AlertVO.java index 70ef469f52b..1f2cd9d8c60 100644 — a/engine/schema/src/main/java/com/cloud/alert/AlertVO.java +++ b/engine/schema/src/main/java/com/cloud/alert/AlertVO.java @@ -53,6 +53,9 @@ @Column(name = "subject", length = 999) private String subject; + @Column(name = "content", length = 5000) + private String content; + @Column(name = "sent_count") private int sentCount = 0; @@ -191,4 +194,13 @@ public String getName() { public void setName(String name) { this.name = name; } + + @Override + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } } diff --git a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java index e48bfd58a6a..5af099d4e32 100644 — a/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java +++ b/engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java @@ -80,7 +80,6 @@ private static final String LIST_CLUSTERID_FOR_HOST_TAG = "select distinct cluster_id from host join host_tags on host.id = host_tags.host_id and host_tags.tag = ?"; - protected SearchBuilder<HostVO> TypePodDcStatusSearch; protected SearchBuilder<HostVO> IdStatusSearch; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql index d7a080efd16..f8d9ce9b73b 100644 — a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100-cleanup.sql @@ -66,4 +66,4 @@ CREATE VIEW `cloud`.`user_view` AS left join `cloud`.`async_job` ON async_job.instance_id = user.id and async_job.instance_type = 'User' and async_job.job_status = 0; + and async_job.job_status = 0; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql index 2e7f9e9fe9c..70a76d98d86 100644 a/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41000to41100.sql @@ -566,4 +566,4 @@ CREATE TABLE IF NOT EXISTS `cloud`.`external_netscaler_controlcenter` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `cloud`.`sslcerts` ADD COLUMN `name` varchar(255) NULL default NULL COMMENT 'Name of the Certificate'; -ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package'; +ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `service_package_id` varchar(255) NULL default NULL COMMENT 'Netscaler ControlCenter Service Package'; \ No newline at end of file diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql b/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql index 5667c5b3dab..97bd5ae7aae 100644 — a/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41100to41200.sql @@ -20,4 +20,7 @@ --; – CLOUDSTACK-10314 Add reason column to ACL rule table -ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500) AFTER `display`; \ No newline at end of file +ALTER TABLE `cloud`.`network_acl_item` ADD COLUMN `reason` VARCHAR(2500) AFTER `display`; + +-- CLOUDSTACK-9846 Make provision to store content and subject for Alerts in separate columns. +ALTER TABLE `cloud`.`alert` ADD COLUMN `content` VARCHAR(5000); diff --git a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java index 30cba4d6c71..c6003afee57 100644 — a/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java +++ b/engine/storage/integration-test/src/test/java/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java @@ -266,20 +266,16 @@ public void pullAgentOutMaintenance(long hostId) { } @Override public boolean reconnect(long hostId) { // TODO Auto-generated method stub return false; + public void reconnect(long hostId) { } @Override public boolean isAgentAttached(long hostId) { - // TODO Auto-generated method stub return false; } @Override public boolean handleDirectConnectAgent(Host host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance, boolean newHost) throws ConnectionException {- // TODO Auto-generated method stub return false; } diff --git a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java index 38a836d2d6d..1df16404d39 100644 — a/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java +++ b/plugins/network-elements/netscaler/src/main/java/com/cloud/network/element/NetscalerElement.java @@ -28,12 +28,6 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; -import org.json.JSONException; -import org.json.JSONObject; - -import com.google.gson.Gson; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ServerApiException; @@ -41,6 +35,9 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import org.apache.cloudstack.region.gslb.GslbServiceProvider; +import org.apache.log4j.Logger; +import org.json.JSONException; +import org.json.JSONObject; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -84,6 +81,7 @@ import com.cloud.deploy.DeploymentPlan; import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; +import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientNetworkCapacityException; @@ -154,10 +152,11 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachineProfile; +import com.google.gson.Gson; public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider, GslbServiceProvider { +implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, +IpDeployer, StaticNatServiceProvider, GslbServiceProvider { private static final Logger s_logger = Logger.getLogger(NetscalerElement.class); public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp"); @@ -218,7 +217,7 @@ private boolean canHandle(Network config, Service service) { boolean handleInAdvanceZone = (zone.getNetworkType() == NetworkType.Advanced && (config.getGuestType() == Network.GuestType.Isolated config.getGuestType() == Network.GuestType.Shared) + config.getGuestType() == Network.GuestType.Shared) && config.getTrafficType() == TrafficType.Guest); boolean handleInBasicZone = (zone.getNetworkType() == NetworkType.Basic && config.getGuestType() == Network.GuestType.Shared && config.getTrafficType() == TrafficType.Guest); @@ -242,7 +241,7 @@ private boolean isBasicZoneNetwok(Network config) { @Override public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, InsufficientNetworkCapacityException { + InsufficientNetworkCapacityException { if (!canHandle(guestConfig, Service.Lb)) { return false; @@ -271,7 +270,7 @@ public boolean implement(Network guestConfig, NetworkOffering offering, DeployDe throw new ResourceUnavailableException( "There are no NetScaler load balancer devices with the free capacity for implementing this network : " + e.getMessage(), - DataCenter.class, guestConfig.getDataCenterId()); + DataCenter.class, guestConfig.getDataCenterId()); } } @@ -286,7 +285,6 @@ public HostVO allocateNCCResourceForNetwork(Network guestConfig) throws Configur Map<String, String> _configs; List<NetScalerControlCenterVO> ncc = _netscalerControlCenterDao.listAll(); HostVO hostVO = null; Map<String, Object> params; if (ncc.size() > 0) { NetScalerControlCenterVO nccVO = ncc.get(0); String ipAddress = nccVO.getNccip(); @@ -414,7 +412,7 @@ public boolean manageGuestNetworkWithNetscalerControlCenter(boolean add, Network @Override public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientNetworkCapacityException, ResourceUnavailableException { + ResourceUnavailableException { return true; } @@ -593,45 +591,45 @@ public ExternalLoadBalancerDeviceVO addNetscalerLoadBalancer(AddNetscalerLoadBal boolean dedicatedUse = (configParams.get(ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED) != null) ? Boolean.parseBoolean(configParams.get(ApiConstants.LOAD_BALANCER_DEVICE_DEDICATED)) : false; if (dedicatedUse && !deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName())) { - String msg = "Only Netscaler VPX load balancers can be specified for dedicated use"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - } + if (dedicatedUse && !deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName())) { + String msg = "Only Netscaler VPX load balancers can be specified for dedicated use"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + } if (cmd.isGslbProvider()) { + if (cmd.isGslbProvider()) { if (!deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName()) && !deviceName.equals(NetworkDevice.NetscalerMPXLoadBalancer.getName())) { - String msg = "Only Netscaler VPX or MPX load balancers can be specified as GSLB service provider"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - } + if (!deviceName.equals(NetworkDevice.NetscalerVPXLoadBalancer.getName()) + && !deviceName.equals(NetworkDevice.NetscalerMPXLoadBalancer.getName())) { + String msg = "Only Netscaler VPX or MPX load balancers can be specified as GSLB service provider"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + } if (cmd.getSitePublicIp() == null || cmd.getSitePrivateIp() == null) { - String msg = "Public and Privae IP needs to provided for NetScaler that will be GSLB provider"; - s_logger.debug(msg); - throw new InvalidParameterValueException(msg); - } + if (cmd.getSitePublicIp() == null || cmd.getSitePrivateIp() == null) { + String msg = "Public and Privae IP needs to provided for NetScaler that will be GSLB provider"; + s_logger.debug(msg); + throw new InvalidParameterValueException(msg); + } if (dedicatedUse) { - throw new InvalidParameterValueException( - "NetScaler provisioned to be GSLB service provider can only be configured for shared usage."); - } + if (dedicatedUse) { + throw new InvalidParameterValueException( + "NetScaler provisioned to be GSLB service provider can only be configured for shared usage."); + } } + } if (cmd.isExclusiveGslbProvider() && !cmd.isGslbProvider()) { - throw new InvalidParameterValueException( - "NetScaler can be provisioned to be exclusive GSLB service provider" - + " only if its being configured as GSLB service provider also."); - } + if (cmd.isExclusiveGslbProvider() && !cmd.isGslbProvider()) { + throw new InvalidParameterValueException( + "NetScaler can be provisioned to be exclusive GSLB service provider" + + " only if its being configured as GSLB service provider also."); + } ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(), cmd.isGslbProvider(), cmd.isExclusiveGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp()); + ExternalLoadBalancerDeviceVO lbDeviceVO = addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), + cmd.getUsername(), cmd.getPassword(), deviceName, new NetscalerResource(), cmd.isGslbProvider(), + cmd.isExclusiveGslbProvider(), cmd.getSitePublicIp(), cmd.getSitePrivateIp()); return lbDeviceVO; + return lbDeviceVO; } @Override @@ -759,7 +757,11 @@ public void doInTransactionWithoutResult(TransactionStatus status) { }); HostVO host = _hostDao.findById(lbDeviceVo.getHostId()); _agentMgr.reconnect(host.getId()); + try { + _agentMgr.reconnect(host.getId()); + } catch (AgentUnavailableException e) { + s_logger.warn("failed to reconnect host " + host, e); + } return lbDeviceVo; } @@ -858,8 +860,9 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) boolean flag=false; try { result = _netscalerServicePackageDao.findByUuid(cmd.getId()); if (result == null) + if (result == null) { throw new CloudRuntimeException("Record does not Exists in the Table"); + } if(_networkOfferingDao.isUsingServicePackage(result.getUuid())) { @@ -869,10 +872,11 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) flag = _netscalerServicePackageDao.remove(result.getId()); } catch (Exception e) { if (e instanceof InvalidParameterValueException) + if (e instanceof InvalidParameterValueException) { throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage()); - else - throw e; + } else { + throw e; + } } return flag; @@ -884,18 +888,19 @@ public boolean deleteServicePackageOffering(DeleteServicePackageOfferingCmd cmd) public boolean deleteNetscalerControlCenter(DeleteNetscalerControlCenterCmd cmd) throws CloudRuntimeException { NetScalerControlCenterVO result = _netscalerControlCenterDao.findByUuid(cmd.getId()); if (result == null) + if (result == null) { throw new CloudRuntimeException("External Netscaler Control Center Table does not contain record with this ID"); else { + } else { //ID list of Network Offering which are not removed and have service Package Uuid field not null. List<Long> servicePackageId_list = _networkOfferingDao.listNetworkOfferingID(); if (servicePackageId_list.size() != 0) { //VO list of Networks which are using Network Offering. List<NetworkVO> networkVO_list = _networkDao.listNetworkVO(servicePackageId_list); if (networkVO_list != null && networkVO_list.size() != 0) + if (networkVO_list != null && networkVO_list.size() != 0) { throw new CloudRuntimeException( "ServicePackages published by NetScalerControlCenter are being used by NetworkOfferings. Try deleting NetworkOffering with ServicePackages and then delete NetScalerControlCenter."); + } } } try { @@ -1466,8 +1471,9 @@ public NetScalerServicePackageResponse registerNetscalerServicePackage(RegisterS @DB public NetScalerControlCenterVO registerNetscalerControlCenter(RegisterNetscalerControlCenterCmd cmd) { if (_netscalerControlCenterDao.listAll() != null && _netscalerControlCenterDao.listAll().size() != 0) + if (_netscalerControlCenterDao.listAll() != null && _netscalerControlCenterDao.listAll().size() != 0) { throw new CloudRuntimeException("One Netscaler Control Center already exist in the DataBase. At a time only one Netscaler Control Center is allowed"); + } final RegisterNetscalerControlCenterCmd cmdinfo = cmd; String ipAddress = cmd.getIpaddress(); @@ -1511,7 +1517,7 @@ public NetScalerControlCenterVO doInTransaction(TransactionStatus status) { Long serviceOfferingId = cmd.getServiceOfferingId(); DeploymentPlan plan = new DataCenterDeployment(dest.getDataCenter().getId()); try { - resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId); + resp = _netScalerVMManager.deployNsVpx(cmd.getAccount(), dest, plan, serviceOfferingId, templateId); } catch (InsufficientCapacityException e) { e.printStackTrace(); } @@ -1520,7 +1526,7 @@ public NetScalerControlCenterVO doInTransaction(TransactionStatus status) { @Override public VirtualRouter stopNetscalerServiceVm(Long id, boolean forced, Account callingAccount, long callingUserId) throws ConcurrentOperationException, ResourceUnavailableException Unknown macro: {+ ResourceUnavailableException { return _netScalerVMManager.stopNetScalerVm(id, forced, callingAccount, callingUserId); } } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5f2551e9f4f..4485f5d73f9 100644 a/requirements.txt +++ b/requirements.txt @@ -21,5 +21,4 @@ cloudmonkey Marvin dependencies are installed via its bundle Install the SolidFire SDK for Python -solidfire-sdk-python - +solidfire-sdk-python \ No newline at end of file diff --git a/server/src/main/java/com/cloud/alert/AlertManagerImpl.java b/server/src/main/java/com/cloud/alert/AlertManagerImpl.java index a58a4f8b0f9..5a7a8b436e0 100644 a/server/src/main/java/com/cloud/alert/AlertManagerImpl.java +++ b/server/src/main/java/com/cloud/alert/AlertManagerImpl.java @@ -39,12 +39,6 @@ import javax.mail.internet.InternetAddress; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; - -import com.sun.mail.smtp.SMTPMessage; -import com.sun.mail.smtp.SMTPSSLTransport; -import com.sun.mail.smtp.SMTPTransport; - import org.apache.cloudstack.framework.config.ConfigDepot; import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; @@ -52,6 +46,7 @@ import org.apache.cloudstack.managed.context.ManagedContextTimerTask; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; import com.cloud.alert.dao.AlertDao; import com.cloud.api.ApiDBUtils; @@ -85,10 +80,12 @@ import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.SearchCriteria; +import com.sun.mail.smtp.SMTPMessage; +import com.sun.mail.smtp.SMTPSSLTransport; +import com.sun.mail.smtp.SMTPTransport; public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable { private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName()); private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts"); private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L; // Thirty seconds expressed in milliseconds. @@ -205,8 +202,9 @@ public boolean configure(String name, Map<String, Object> params) throws Configu String capacityCheckPeriodStr = configs.get("capacity.check.period"); if (capacityCheckPeriodStr != null) { _capacityCheckPeriod = Long.parseLong(capacityCheckPeriodStr); if (_capacityCheckPeriod <= 0) + if (_capacityCheckPeriod <= 0) { _capacityCheckPeriod = Long.parseLong(Config.CapacityCheckPeriod.getDefaultValue()); + } } _timer = new Timer("CapacityChecker"); @@ -249,7 +247,7 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, String if (_emailAlert != null) { _emailAlert.sendAlert(alertType, dataCenterId, podId, null, subject, body); } else { - s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId + + s_logger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId + " | message:: " + subject + " | body:: " + body); } } catch (Exception ex) { @@ -589,7 +587,7 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste alertType = AlertManager.AlertType.ALERT_TYPE_LOCAL_STORAGE; break; //Pod Level + //Pod Level case Capacity.CAPACITY_TYPE_PRIVATE_IP: msgSubject = "System Alert: Number of unallocated private IPs is low in pod " + pod.getName() + " of availability zone " + dc.getName(); totalStr = Double.toString(totalCapacity); @@ -598,7 +596,7 @@ private void generateEmailAlert(DataCenterVO dc, HostPodVO pod, ClusterVO cluste alertType = AlertManager.AlertType.ALERT_TYPE_PRIVATE_IP; break; //Zone Level + //Zone Level case Capacity.CAPACITY_TYPE_SECONDARY_STORAGE: msgSubject = "System Alert: Low Available Secondary Storage in availability zone " + dc.getName(); totalStr = formatBytesToMegabytes(totalCapacity); @@ -746,22 +744,22 @@ protected PasswordAuthentication getPasswordAuthentication() { // TODO: make sure this handles SSL transport (useAuth is true) and regular public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long clusterId, String subject, String content) throws MessagingException, UnsupportedEncodingException { s_alertsLogger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + + UnsupportedEncodingException { + s_logger.warn("AlertType:: " + alertType + " | dataCenterId:: " + dataCenterId + " | podId:: " + podId + " | clusterId:: " + clusterId + " | message:: " + subject); AlertVO alert = null; if ((alertType != AlertManager.AlertType.ALERT_TYPE_HOST) && (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) && (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) && (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) && (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) && (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) && (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) && (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED) && (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) && (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR) && (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) && (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) { + (alertType != AlertManager.AlertType.ALERT_TYPE_USERVM) && + (alertType != AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER) && + (alertType != AlertManager.AlertType.ALERT_TYPE_CONSOLE_PROXY) && + (alertType != AlertManager.AlertType.ALERT_TYPE_SSVM) && + (alertType != AlertManager.AlertType.ALERT_TYPE_STORAGE_MISC) && + (alertType != AlertManager.AlertType.ALERT_TYPE_MANAGMENT_NODE) && + (alertType != AlertManager.AlertType.ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED) && + (alertType != AlertManager.AlertType.ALERT_TYPE_UPLOAD_FAILED) && + (alertType != AlertManager.AlertType.ALERT_TYPE_OOBM_AUTH_ERROR) && + (alertType != AlertManager.AlertType.ALERT_TYPE_HA_ACTION) && + (alertType != AlertManager.AlertType.ALERT_TYPE_CA_CERT)) { alert = _alertDao.getLastAlert(alertType.getType(), dataCenterId, podId, clusterId); } @@ -770,6 +768,7 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c AlertVO newAlert = new AlertVO(); newAlert.setType(alertType.getType()); newAlert.setSubject(subject); + newAlert.setContent(content); newAlert.setClusterId(clusterId); newAlert.setPodId(podId); newAlert.setDataCenterId(dataCenterId); diff --git a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java index 2966d41d8bf..195543686cb 100755 — a/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/main/java/com/cloud/resource/ResourceManagerImpl.java @@ -30,10 +30,6 @@ import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.commons.lang.ObjectUtils; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd; @@ -50,6 +46,9 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.ObjectUtils; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -75,7 +74,6 @@ import com.cloud.capacity.dao.CapacityDao; import com.cloud.cluster.ClusterManager; import com.cloud.configuration.Config; -import com.cloud.configuration.ConfigurationManager; import com.cloud.dc.ClusterDetailsDao; import com.cloud.dc.ClusterDetailsVO; import com.cloud.dc.ClusterVO; @@ -249,8 +247,6 @@ public void setDiscoverers(final List<? extends Discoverer> discoverers) { @Inject private VMTemplateDao _templateDao; @Inject private ConfigurationManager _configMgr; @Inject private ClusterVSMMapDao _clusterVSMMapDao; private final long _nodeId = ManagementServerNode.getManagementServerId(); @@ -610,7 +606,7 @@ public Discoverer getMatchingDiscover(final Hypervisor.HypervisorType hypervisor private List<HostVO> discoverHostsFull(final Long dcId, final Long podId, Long clusterId, final String clusterName, String url, String username, String password, final String hypervisorType, final List<String> hostTags, final Map<String, String> params, final boolean deferAgentCreation) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException { + InvalidParameterValueException { URI uri = null; // Check if the zone exists in the system @@ -836,7 +832,6 @@ protected boolean doDeleteHost(final long hostId, final boolean isForced, final } // Get storage pool host mappings here because they can be removed as a // part of handleDisconnect later // TODO: find out the bad boy, what's a buggy logic! final List<StoragePoolHostVO> pools = _storagePoolHostDao.listByHostIdIncludingRemoved(hostId); final ResourceStateAdapter.DeleteHostAnswer answer = @@ -1166,15 +1161,15 @@ public Host cancelMaintenance(final CancelMaintenanceCmd cmd) { } @Override public Host reconnectHost(final ReconnectHostCmd cmd) { final Long hostId = cmd.getId(); + public Host reconnectHost(ReconnectHostCmd cmd) throws AgentUnavailableException { + Long hostId = cmd.getId(); final HostVO host = _hostDao.findById(hostId); + HostVO host = _hostDao.findById(hostId); if (host == null) { throw new InvalidParameterValueException("Host with id " + hostId.toString() + " doesn't exist"); } - return _agentMgr.reconnect(hostId) ? host : null; + _agentMgr.reconnect(hostId); + return host; } @Override @@ -2310,7 +2305,6 @@ public boolean executeUserRequest(final long hostId, final ResourceState.Event e } else if (event == ResourceState.Event.AdminCancelMaintenance) { return doCancelMaintenance(hostId); } else if (event == ResourceState.Event.DeleteHost) { - /* TODO: Ask alex why we assume the last two parameters are false */ return doDeleteHost(hostId, false, false); } else if (event == ResourceState.Event.Unmanaged) { return doUmanageHost(hostId); @@ -2329,7 +2323,7 @@ private boolean doUmanageHost(final long hostId) { } if (host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC) { - final MaintainAnswer answer = (MaintainAnswer)_agentMgr.easySend(hostId, new MaintainCommand()); + _agentMgr.easySend(hostId, new MaintainCommand()); } _agentMgr.disconnectWithoutInvestigation(hostId, Event.ShutdownRequested); @@ -2379,10 +2373,6 @@ public boolean updateClusterPassword(final UpdateHostPasswordCmd command) { final List<HostVO> hosts = listAllHostsInCluster(command.getClusterId()); for (final HostVO host : hosts) { try { /* * FIXME: this is a buggy logic, check with alex. Shouldn't * return if propagation return non null */ final Boolean result = propagateResourceEvent(host.getId(), ResourceState.Event.UpdatePassword); if (result != null) Unknown macro: { return result;@@ -2852,11 +2842,4 @@ public Boolean doInTransaction(final TransactionStatus status) { return false; } } - @Override public boolean start() { - // TODO Auto-generated method stub - return super.start(); - } - } diff --git a/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java b/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java index 3a904315fe1..02e7a4231a4 100644 a/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java +++ b/server/src/main/java/org/apache/cloudstack/ca/CAManagerImpl.java @@ -191,7 +191,8 @@ public boolean provisionCertificate(final Host host, final Boolean reconnect, fi if (Strings.isNullOrEmpty(csr)) { return false; } final Certificate certificate = issueCertificate(csr, Collections.singletonList(host.getName()), Arrays.asList(host.getPrivateIpAddress(), host.getPublicIpAddress(), host.getStorageIpAddress()), CAManager.CertValidityPeriod.value(), caProvider); + final Certificate certificate = issueCertificate(csr, Collections.singletonList(host.getName()), + Arrays.asList(host.getPrivateIpAddress(), host.getPublicIpAddress(), host.getStorageIpAddress()), CAManager.CertValidityPeriod.value(), caProvider); return deployCertificate(host, certificate, reconnect, null); } catch (final AgentUnavailableException | OperationTimedoutException e) { LOG.error("Host/agent is not available or operation timed out, failed to setup keystore and generate CSR for host/agent id=" + host.getId() + ", due to: ", e); @@ -206,18 +207,19 @@ public String generateKeyStoreAndCsr(final Host host, final Map<String, String> cmd.setAccessDetail(sshAccessDetails); } CallContext.current().setEventDetails("generating keystore and CSR for host id: " + host.getId()); final SetupKeystoreAnswer answer = (SetupKeystoreAnswer) agentManager.send(host.getId(), cmd); + final SetupKeystoreAnswer answer = (SetupKeystoreAnswer)agentManager.send(host.getId(), cmd); return answer.getCsr(); } @Override public boolean deployCertificate(final Host host, final Certificate certificate, final Boolean reconnect, final Map<String, String> sshAccessDetails) throws AgentUnavailableException, OperationTimedoutException { + public boolean deployCertificate(final Host host, final Certificate certificate, final Boolean reconnect, final Map<String, String> sshAccessDetails) + throws AgentUnavailableException, OperationTimedoutException { final SetupCertificateCommand cmd = new SetupCertificateCommand(certificate); if (sshAccessDetails != null && !sshAccessDetails.isEmpty()) { cmd.setAccessDetail(sshAccessDetails); } CallContext.current().setEventDetails("deploying certificate for host id: " + host.getId()); final SetupCertificateAnswer answer = (SetupCertificateAnswer) agentManager.send(host.getId(), cmd); + final SetupCertificateAnswer answer = (SetupCertificateAnswer)agentManager.send(host.getId(), cmd); if (answer.getResult()) { CallContext.current().setEventDetails("successfully deployed certificate for host id: " + host.getId()); } else { @@ -227,9 +229,12 @@ public boolean deployCertificate(final Host host, final Certificate certificate, if (answer.getResult()) { getActiveCertificatesMap().put(host.getPrivateIpAddress(), certificate.getClientCertificate()); if (sshAccessDetails == null && reconnect != null && reconnect) { LOG.info(String.format("Successfully setup certificate on host, reconnecting with agent with id=%d, name=%s, address=%s", host.getId(), host.getName(), host.getPublicIpAddress())); return agentManager.reconnect(host.getId()); + LOG.info(String.format("Successfully setup certificate on host, reconnecting with agent with id=%d, name=%s, address=%s", host.getId(), host.getName(), host.getPublicIpAddress())); + try { + agentManager.reconnect(host.getId()); + } catch (AgentUnavailableException | CloudRuntimeException e) { + LOG.debug("Error when reconnecting to host: " + host.getUuid(), e); + } } return true; } @@ -257,8 +262,7 @@ public void sendAlert(final Host host, final String subject, final String messag if (host == null) { return; } alertManager.sendAlert(AlertManager.AlertType.ALERT_TYPE_CA_CERT, host.getDataCenterId(), host.getPodId(), subject, message); + alertManager.sendAlert(AlertManager.AlertType.ALERT_TYPE_CA_CERT, host.getDataCenterId(), host.getPodId(), subject, message); } @Override @@ -303,7 +307,7 @@ protected void runInContext() { } final DateTime now = DateTime.now(DateTimeZone.UTC); final Map<String, X509Certificate> certsMap = caManager.getActiveCertificatesMap(); for (final Iterator<Map.Entry<String, X509Certificate>> it = certsMap.entrySet().iterator(); it.hasNext(); ) { + for (final Iterator<Map.Entry<String, X509Certificate>> it = certsMap.entrySet().iterator(); it.hasNext() { final Map.Entry<String, X509Certificate> entry = it.next(); if (entry == null) { continue; @@ -315,19 +319,14 @@ protected void runInContext() { continue; } final Host host = hostDao.findByIp(hostIp); if (host == null || host.getManagementServerId() == null || host.getManagementServerId() != ManagementServerNode.getManagementServerId() || host.getStatus() != Status.Up) { if (host == null || (host.getManagementServerId() != null && host.getManagementServerId() != ManagementServerNode.getManagementServerId())) { + if (host == null || host.getManagementServerId() == null || host.getManagementServerId() != ManagementServerNode.getManagementServerId() || host.getStatus() != Status.Up) Unknown macro: {+ if (host == null || (host.getManagementServerId() != null && host.getManagementServerId() != ManagementServerNode.getManagementServerId())) { it.remove(); } continue; } final String hostDescription = String.format("host id=%d, uuid=%s, name=%s, ip=%s, zone id=%d", host.getId(), host.getUuid(), host.getName(), hostIp, host.getDataCenterId()); + final String hostDescription = String.format("host id=%d, uuid=%s, name=%s, ip=%s, zone id=%d", host.getId(), host.getUuid(), host.getName(), hostIp, host.getDataCenterId()); try { certificate.checkValidity(now.plusDays(CertExpiryAlertPeriod.valueIn(host.getClusterId())).toDate()); @@ -345,7 +344,8 @@ protected void runInContext() { } catch (final Throwable ex) { LOG.warn("Failed to auto-renew certificate for " + hostDescription + ", with error=", ex); caManager.sendAlert(host, "Certificate auto-renewal failed for " + hostDescription, - String.format("Certificate is going to expire for %s. Auto-renewal failed to renew the certificate, please renew it manually. It is not valid after %s.", hostDescription, certificate.getNotAfter())); + String.format("Certificate is going to expire for %s. Auto-renewal failed to renew the certificate, please renew it manually. It is not valid after %s.", + hostDescription, certificate.getNotAfter())); } } else { if (alertMap.containsKey(hostIp)) { @@ -355,8 +355,7 @@ protected void runInContext() { } } caManager.sendAlert(host, "Certificate expiring soon for " + hostDescription, String.format("Certificate is going to expire for %s. Please renew it, it is not valid after %s.", hostDescription, certificate.getNotAfter())); + String.format("Certificate is going to expire for %s. Please renew it, it is not valid after %s.", hostDescription, certificate.getNotAfter())); alertMap.put(hostIp, new Date()); } } @@ -427,14 +426,6 @@ public String getConfigComponentName() { @Override public ConfigKey<?>[] getConfigKeys() { return new ConfigKey<?>[] { - CAProviderPlugin, - CertKeySize, - CertSignatureAlgorithm, - CertValidityPeriod, - AutomaticCertRenewal, - CABackgroundJobDelay, - CertExpiryAlertPeriod - } ; + return new ConfigKey<?>[] {CAProviderPlugin, CertKeySize, CertSignatureAlgorithm, CertValidityPeriod, AutomaticCertRenewal, CABackgroundJobDelay, CertExpiryAlertPeriod} ; } } diff --git a/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java b/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java index 14ecc971d5f..64cbf205812 100644 a/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java +++ b/server/src/test/java/org/apache/cloudstack/ca/CAManagerImplTest.java @@ -113,7 +113,7 @@ public void testProvisionCertificate() throws Exception { final X509Certificate certificate = CertUtils.generateV3Certificate(null, keyPair, keyPair.getPublic(), "CN=ca", "SHA256withRSA", 365, null, null); Mockito.when(caProvider.issueCertificate(Mockito.anyString(), Mockito.anyList(), Mockito.anyList(), Mockito.anyInt())).thenReturn(new Certificate(certificate, null, Collections.singletonList(certificate))); Mockito.when(agentManager.send(Mockito.anyLong(), Mockito.any(SetupKeyStoreCommand.class))).thenReturn(new SetupKeystoreAnswer("someCsr")); Mockito.when(agentManager.reconnect(Mockito.anyLong())).thenReturn(true); + Mockito.doNothing().when(agentManager).reconnect(Mockito.anyLong()); Assert.assertTrue(caManager.provisionCertificate(host, true, null)); Mockito.verify(agentManager, Mockito.times(2)).send(Mockito.anyLong(), Mockito.any(Answer.class)); Mockito.verify(agentManager, Mockito.times(1)).reconnect(Mockito.anyLong()); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org

        Commit 972b8b71d7fb60a64e8a05e7555f9f92ede7ff40 in cloudstack's branch refs/heads/master from rafaelweingartner
        [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=972b8b7 ]

        CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. (#2387)

        Remove declaration of throws CloudRuntimeException
        I also removed some unused variables and comments left behind

        This closes #837

        • Isolate a problematic test "smoke/test_certauthority_root"
        jira-bot ASF subversion and git services added a comment - Commit 972b8b71d7fb60a64e8a05e7555f9f92ede7ff40 in cloudstack's branch refs/heads/master from rafaelweingartner [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=972b8b7 ] CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. (#2387) CLOUDSTACK-8855 Improve Error Message for Host Alert State CLOUDSTACK-9846 create column to save the content of alert messages Remove declaration of throws CloudRuntimeException I also removed some unused variables and comments left behind This closes #837 Isolate a problematic test "smoke/test_certauthority_root"

        Commit 972b8b71d7fb60a64e8a05e7555f9f92ede7ff40 in cloudstack's branch refs/heads/master from rafaelweingartner
        [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=972b8b7 ]

        CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. (#2387)

        Remove declaration of throws CloudRuntimeException
        I also removed some unused variables and comments left behind

        This closes #837

        • Isolate a problematic test "smoke/test_certauthority_root"
        jira-bot ASF subversion and git services added a comment - Commit 972b8b71d7fb60a64e8a05e7555f9f92ede7ff40 in cloudstack's branch refs/heads/master from rafaelweingartner [ https://gitbox.apache.org/repos/asf?p=cloudstack.git;h=972b8b7 ] CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. (#2387) CLOUDSTACK-8855 Improve Error Message for Host Alert State CLOUDSTACK-9846 create column to save the content of alert messages Remove declaration of throws CloudRuntimeException I also removed some unused variables and comments left behind This closes #837 Isolate a problematic test "smoke/test_certauthority_root"
        githubbot ASF GitHub Bot added a comment -

        blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API.
        URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-373480133

        <b>Trillian test result (tid-2373)</b>
        Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
        Total time taken: 19887 seconds
        Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2387-t2373-kvm-centos7.zip
        Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
        Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
        Smoke tests completed. 66 look OK, 1 have error(s)
        Only failed tests results shown below:

        Test | Result | Time (s) | Test File
        — | — | — | —
        test_hostha_enable_ha_when_host_in_maintenance | `Error` | 0.93 | test_hostha_kvm.py

        ----------------------------------------------------------------
        This is an automated message from the Apache Git Service.
        To respond to the message, please log on GitHub and use the
        URL above to go to the specific comment.

        For queries about this service, please contact Infrastructure at:
        users@infra.apache.org

        githubbot ASF GitHub Bot added a comment - blueorangutan commented on issue #2387: CLOUDSTACK-8855 Improve Error Message for Host Alert State and reconnect host API. URL: https://github.com/apache/cloudstack/pull/2387#issuecomment-373480133 <b>Trillian test result (tid-2373)</b> Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7 Total time taken: 19887 seconds Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2387-t2373-kvm-centos7.zip Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py Smoke tests completed. 66 look OK, 1 have error(s) Only failed tests results shown below: Test | Result | Time (s) | Test File — | — | — | — test_hostha_enable_ha_when_host_in_maintenance | `Error` | 0.93 | test_hostha_kvm.py ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org

        People

          rafaelweingartner Rafael Weingärtner
          bharat.kumar Bharat Kumar
          Votes:
          0 Vote for this issue
          Watchers:
          4 Start watching this issue

          Dates

            Created:
            Updated:
            Resolved: