Skip to content

api: Introducing a new diagnostics API command for system VMs for CloudStack admins - #2721

Merged
yadvr merged 6 commits into
apache:masterfrom
shapeblue:remote-diagnostics-api
Jul 13, 2018
Merged

api: Introducing a new diagnostics API command for system VMs for CloudStack admins#2721
yadvr merged 6 commits into
apache:masterfrom
shapeblue:remote-diagnostics-api

Conversation

@dhlaluku

Copy link
Copy Markdown
Contributor

This feature introduces a new API command that will improve troubleshooting of network issues on CloudStack hosted networks by executing network-utility commands (ping, traceroute, arping) remotely on system VMs.

Description

For troubleshooting purposes, CloudStack administrators may wish to execute network utility commands remotely on system VMs, or request system VMs to ping/traceroute/arping to specific addresses over specific interfaces. An API command to provide such functionalities is being developed without altering any existing APIs. The targeted system VMs for this feature are the Virtual Router (VR), Secondary Storage VM (SSVM) and the Console Proxy VM (CPVM).

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+Remote+Diagnostics+API
ML discussion: https://markmail.org/message/xt7owmb2c6iw7tva

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

GitHub Issue/PRs

Screenshots (if appropriate):

image

How Has This Been Tested?

Log on to the CloudStack management server as root admin and start cloudmonkey. Sync APIs and then execute the run diagnostics command as follows:
run diganostics ipaddress=www.shapeblue.com type=arping targetid=uuid params="-I eth0 -c 4"

Where;

  • ipaddress is the destination IP/Domain address to test connection to;
  • type is the diagnostics command type to execute from remote target
  • targetid is the uuid of the system VM from which to test
  • params are optional command line arguments that apply to each diagnostics command type

Dev environment components:

  • Platform: ACS-4.12
  • Management OS: Ubuntu 18.04 LTS
  • Hypervisor: 1 Host running KVM with CentOS 7

This command does not run with the CloudStack simulator and has only been tested on real hardware environments.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
    Testing
  • I have added tests to cover my changes.
  • All relevant new and existing integration tests have passed.
  • A full integration testsuite with all test that can run on my environment has passed.

@dhlalukudhlaluku changed the title Introducing a new diagnostics API command for system VMs for CloudStack adminsapi:Introducing a new diagnostics API command for system VMs for CloudStack adminsJun 25, 2018
@dhlalukudhlaluku changed the title api:Introducing a new diagnostics API command for system VMs for CloudStack adminsapi: Introducing a new diagnostics API command for system VMs for CloudStack adminsJun 25, 2018
@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@borisstoyanovborisstoyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've executed the following manual tests:

Test NameSteps
Run against CPVMWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[CPVM-id] params="-I eth1 -c 8"
Run against SSVMWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[SSVM-id] params="-I eth1 -c 8"
Run against VRWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-I eth1 -c 8"
Run a ping typeWith cloudmonkey execute: run diagnostics type=ping ipaddress=www.shapeblue.com id=[vr-id]
Run an arping typeWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-I eth1 -c 8"
Run a traceroute typeWith cloudmonkey execute: run diagnostics type=traceroute ipaddress=www.shapeblue.com id=[vr-id]
Run against VR with argumentsWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-I eth1 -c 8"
Run a ping type with argumentsWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-I eth1 -c 8"
Run an traceroute type with argumentsWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-I eth1 -c 8"
Run an type with invalid argumentsWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.shapeblue.com id=[vr-id] params="-H eth1 -c 8"
Run type to unreachable desctinationWith cloudmonkey execute: run diagnostics type=arping ipaddress=www.something-not-readchable.com id=[vr-id] params="-H eth1 -c 8"
Run with invalid typerun diagnostics type=netstat ipaddress=www.shapeblue.com id=[vr-id]
Run with invalid target id.run diagnostics type=ping ipaddress=www.shapeblue.com id=[invalid-id]

LGTM, lets wait for the automated results

@blueorangutan

Copy link
Copy Markdown

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

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2825)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 26692 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2721-t2825-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_accounts.py
Intermitten failure detected: /marvin/tests/smoke/test_affinity_groups_projects.py
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_primary_storage.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py
Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 58 look OK, 10 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
ContextSuite context=TestAccounts>:setupError0.00test_accounts.py
ContextSuite context=TestAddVmToSubDomain>:setupError0.00test_accounts.py
test_DeleteDomainError0.92test_accounts.py
test_forceDeleteDomainError0.94test_accounts.py
ContextSuite context=TestRemoveUserFromAccount>:setupError5.14test_accounts.py
ContextSuite context=TestDeployVmWithAffinityGroup>:setupError0.00test_affinity_groups_projects.py
test_provision_certificateError17.38test_certauthority_root.py
ContextSuite context=TestDeployVirtioSCSIVM>:setupError0.00test_deploy_virtio_scsi_vm.py
test_01_add_primary_storage_disabled_hostError0.73test_primary_storage.py
test_01_primary_storage_nfsError0.10test_primary_storage.py
ContextSuite context=TestStorageTags>:setupError0.18test_primary_storage.py
test_03_vpc_privategw_restart_vpc_cleanupFailure148.40test_privategw_acl.py
test_04_rvpc_privategw_static_routesFailure249.85test_privategw_acl.py
test_02_list_snapshots_with_removed_data_storeError1.13test_snapshots.py
test_01_secure_vm_migrationError5.16test_vm_life_cycle.py
test_02_unsecure_vm_migrationError5.62test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migrationError1.14test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migrationError4.59test_vm_life_cycle.py
ContextSuite context=TestVMLifeCycle>:setupError7.35test_vm_life_cycle.py
test_01_cancel_host_maintenace_with_no_migration_jobsFailure0.09test_host_maintenance.py
test_02_cancel_host_maintenace_with_migration_jobsError2.25test_host_maintenance.py
test_hostha_enable_ha_when_host_in_maintenanceError2.46test_hostha_kvm.py

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2830)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 29372 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2721-t2830-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py
Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 62 look OK, 6 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_provision_certificateError8.21test_certauthority_root.py
ContextSuite context=TestDeployVirtioSCSIVM>:setupError0.00test_deploy_virtio_scsi_vm.py
test_03_vpc_privategw_restart_vpc_cleanupFailure1213.03test_privategw_acl.py
test_01_secure_vm_migrationError5.16test_vm_life_cycle.py
test_02_unsecure_vm_migrationError1.08test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migrationError1.08test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migrationError3.12test_vm_life_cycle.py
test_11_migrate_volume_and_change_offeringError129.66test_volumes.py
test_hostha_enable_ha_when_host_in_maintenanceError3.46test_hostha_kvm.py
test_hostha_kvm_host_recoveringError7.56test_hostha_kvm.py

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2831)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 28543 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2721-t2831-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 62 look OK, 6 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_provision_certificateError7.25test_certauthority_root.py
ContextSuite context=TestDeployVirtioSCSIVM>:setupError0.00test_deploy_virtio_scsi_vm.py
test_03_vpc_privategw_restart_vpc_cleanupFailure1157.31test_privategw_acl.py
test_01_secure_vm_migrationError3.15test_vm_life_cycle.py
test_02_unsecure_vm_migrationError1.10test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migrationError1.10test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migrationError3.19test_vm_life_cycle.py
test_11_migrate_volume_and_change_offeringError128.27test_volumes.py
test_02_redundant_VPC_default_routesFailure990.47test_vpc_redundant.py

@DaanHooglandDaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the niche of this new feature we might find aspects we would like slightly different. The code looks good and contains unit - and integration tests. Let's run with it.

from nose.plugins.attrib import attr


class TestRemoteDiagnostics(cloudstackTestCase):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhlaluku can you add this to .travis.yml, fix it to make it work/skip against simulator?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests has been added to Travis file in the section that contains tests for routers and system VMs

@yadvryadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhlaluku for simulator see if you add some mocks to get this APIs work against simulator i.e. with Travis to test business logic. Please see if you can fix that.

@yadvr

yadvr commented Jul 6, 2018

Copy link
Copy Markdown
Member

Please hold merging, while everything is LGTM -- @dhlaluku will add support for simulator with his work to make the business logic test-able and add his new marvin test with .travis.yml

Dingane Hlaluku added 2 commits July 6, 2018 12:15
@yadvr

Copy link
Copy Markdown
Member

ping @dhlaluku

@dhlaluku
dhlalukuforce-pushed the remote-diagnostics-api branch from bbe835d to d2d0698CompareJuly 10, 2018 10:43
@dhlaluku

Copy link
Copy Markdown
ContributorAuthor

@rhtyd I have included "test_diagnostics" in the Travis file. Updated the Marvin tests to skip the negative test cases for the Simulator hypervisor.

Also defined some mocks for the positive cases, example below with Cloudmonkey;

(local) 🐵 > run diagnostics targetid=0c04cf04-8222-47fd-a883-6cf335646d64 ipaddress=8.8.8.8 type=traceroute
{
"diagnostics": {
"exitcode": "0",
"stderr": "",
"stdout": "TRACEROUTE 8.8.8.8 executed in v-1-VM"
}
}

@yadvr

Copy link
Copy Markdown
Member

Fantastic @dhlaluku - let's wait for travis to complete/pass.

Comment thread.travis.yml Outdated
# Keep the TESTS sorted by name and grouped by type
- TESTS="smoke/test_certauthority_root"

- TESTS="smoke/test_diagnostics"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the name sorted, include your file under an existing test section/block, don't add a new job/runner.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Included test to the section with routers and ssvm tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you should keep it sorted by name as the file suggests.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- TESTS="smoke/test_accounts
smoke/test_affinity_groups
smoke/test_affinity_groups_projects
smoke/test_deploy_vgpu_enabled_vm
smoke/test_deploy_vm_iso
smoke/test_deploy_vm_root_resize
smoke/test_deploy_vm_with_userdata
smoke/test_deploy_vms_with_varied_deploymentplanners
**smoke/test_diagnostics**
smoke/test_disk_offerings
smoke/test_dynamicroles
smoke/test_global_settings
smoke/test_guest_vlan_range"

} else {
throw new CloudRuntimeException("Command execution failed: " + details);
executionDetailsMap.put(ApiConstants.STDOUT, "");
executionDetailsMap.put(ApiConstants.STDERR, details );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space after details.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

@dhlaluku

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@yadvr

Copy link
Copy Markdown
Member

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

@dhlaluku

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2842)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 35370 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2721-t2842-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_deploy_virtio_scsi_vm.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.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_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py
Smoke tests completed. 60 look OK, 8 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_provision_certificateError9.21test_certauthority_root.py
ContextSuite context=TestDeployVirtioSCSIVM>:setupError0.00test_deploy_virtio_scsi_vm.py
test_03_vpc_privategw_restart_vpc_cleanupFailure1226.87test_privategw_acl.py
test_04_extract_templateFailure128.25test_templates.py
ContextSuite context=TestISOUsage>:setupError0.00test_usage.py
test_01_secure_vm_migrationError5.14test_vm_life_cycle.py
test_02_unsecure_vm_migrationError4.12test_vm_life_cycle.py
test_03_secured_to_nonsecured_vm_migrationError1.09test_vm_life_cycle.py
test_04_nonsecured_to_secured_vm_migrationError0.07test_vm_life_cycle.py
test_06_download_detached_volumeFailure137.56test_volumes.py
test_11_migrate_volume_and_change_offeringError128.44test_volumes.py
test_02_cancel_host_maintenace_with_migration_jobsError2.24test_host_maintenance.py

@yadvryadvr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yadvr

Copy link
Copy Markdown
Member

Merging this based on code reviews and testing. The failures are not related to this PR.

@yadvr
yadvr merged commit 40af32b into apache:masterJul 13, 2018
@dhlaluku
dhlaluku deleted the remote-diagnostics-api branch July 17, 2018 12:00
borisstoyanov pushed a commit to shapeblue/cloudstack that referenced this pull request Jul 23, 2018
This is a new feature for CS that allows Admin users improved
troubleshooting of network issues in CloudStack hosted networks.
Description: For troubleshooting purposes, CloudStack administrators may wish to execute network utility commands remotely on system VMs, or request system VMs to ping/traceroute/arping to specific addresses over specific interfaces. An API command to provide such functionalities is being developed without altering any existing APIs. The targeted system VMs for this feature are the Virtual Router (VR), Secondary Storage VM (SSVM) and the Console Proxy VM (CPVM).
FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/CloudStack+Remote+Diagnostics+API
ML discussion:
https://markmail.org/message/xt7owmb2c6iw7tva
bernardodemarco pushed a commit to scclouds/cloudstack that referenced this pull request Jul 16, 2025
Alteração da quantidade máxima de projetos através da UI
Closesapache#2721
See merge request scclouds/scclouds!1193
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@dhlaluku@borisstoyanov@blueorangutan@yadvr@DaanHoogland