Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VMware] Enable unmanaging guest VMs #4103

Merged
merged 6 commits into from Jun 26, 2020

Conversation

nvazquez
Copy link
Contributor

@nvazquez nvazquez commented May 27, 2020

Description

This feature allows administrators to unmanage guest virtual machines from CloudStack. Once unmanaged, CloudStack can no longer monitor, control or administer the provisioning and orchestration related operations on a virtual machine.

A new API method has been added: unmanageVirtualMachine, accepting the virtual machine UUID as parameter The execution of this API method performs the unmanaging of a guest virtual machine. It has the following pre-conditions:

  • The virtual machine must not be destroyed
  • The virtual machine state must be 'Running’ or ‘Stopped’
  • The virtual machine must be a VMware virtual machine

Assuming these pre-conditions are met, the API execution will perform the following pre-checks, failing if they are not met:

  • There are no volume snapshots associated with any of the virtual machine volumes
  • There is no ISO attached to the virtual machine

An additional check is performed prior to unmanaging the virtual machine from CloudStack: the hypervisor returns checks that the virtual machine exists, searching the virtual machine by its instance name. If it is not found, then the operation fails.

Global setting

A new boolean zone setting has been added: unmanage.vm.preserve.nics, with default value = ‘false’. If set to true, the virtual machine NICs (and their MAC addresses) are preserved when unmanaging it. Otherwise, NICs are removed and MAC addresses can be reassigned.

Unmanaging virtual machine actions:

  • Clean up virtual machine NICs and deallocate network resources used such as IP addresses and DHCP entries on virtual routers.
    • If ‘unmanage.vm.preserve.nics’ = ‘false’ then the NICs are deallocated and removed from CloudStack
    • If ‘unmanage.vm.preserve.nics’ = ‘true’ then the NICs remain allocated and are not removed from the database. The NIC’s MAC addresses remain preserved and therefore cannot be assigned to any new NIC.
  • Clean up virtual machine volumes in the CloudStack database
  • Clean up virtual machine snapshots in the CloudStack database (if any) · Revoke host access to any managed volumes attached to the VM
  • Clean up the virtual machine from the following:
    • Remove the virtual machine from security groups (if any)
    • Remove the virtual machine from instance groups (if any)
    • Remove firewall rules for the virtual machine (if any)
    • Remove forwarding rules for the virtual machine (if any)
    • Remove load balancing rules for the virtual machine (if any)
    • Disable static NAT (if the virtual machine is assigned to it)
    • Remove the virtual machine from affinity groups (if any)
  • Set VM details as removed in the CloudStack database
  • Decrement the account resources count for volumes and virtual machines
  • Generate usage events:
    • For volumes destroyed, with type: ‘VOLUME.DELETE’
    • For virtual machine snapshots destroyed (if any), with type: ‘VMSNAPSHOT.DELETE’
    • For virtual machine NICs destroyed: with type: ‘NETWORK.OFFERING.REMOVE’
    • For the virtual machine being unmanaged: stopped and destroyed usage events (similar as the generated usage events when expunging a virtual machine), with types: ‘VM.STOP’ and ‘VM.DESTROY

Changes on the VM import functionality

A new parameter has been added to the importUnmanagedInstances API:

  • forced: booolean (false by default): If true, a VM is imported despite some of its NIC's MAC addresses being already present. The forced parameter is false by default and prevents importing a VM which has a NIC containing a MAC address that has been previously assigned by CloudStack. If it is set to true, the NICs with MAC addresses which already exist in the CloudStack database have the existing MAC addresses reassigned to its NICs.

The usage events generated when importing unmanaged instances have been refactored:

  • The usage event with type: ‘VM.IMPORT’ has been replaced by the usage event with type: ‘VM.CREATE’.
  • If the imported VM is powered on, then the VM import feture generates the usage event with type: ‘VM.START’

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)

Screenshots (if appropriate):

How Has This Been Tested?

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✖centos7 ✖debian. JID-1244

@nvazquez
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1247

@nvazquez
Copy link
Contributor Author

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-1577)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 41899 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4103-t1577-vmware-67u3.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@nvazquez
Copy link
Contributor Author

nvazquez commented Jun 2, 2020

@blueorangutan package

@nvazquez nvazquez marked this pull request as ready for review June 2, 2020 05:17
@nvazquez nvazquez added this to the 4.15.0.0 milestone Jun 2, 2020
@blueorangutan
Copy link

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

@nvazquez nvazquez changed the title Enable unmanaging guest VMs [VMware] Enable unmanaging guest VMs Jun 2, 2020
@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1264

@nvazquez
Copy link
Contributor Author

nvazquez commented Jun 2, 2020

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-1600)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 43724 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4103-t1600-vmware-67u3.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@rohityadavcloud
Copy link
Member

@nvazquez to avoid confusion, can you add either [WIP] in the PR title or open the PR as a draft? Thanks.

@DaanHoogland DaanHoogland marked this pull request as draft June 8, 2020 08:01
@nvazquez nvazquez force-pushed the unmanageinstances branch 2 times, most recently from a7582d6 to a0c88ae Compare June 8, 2020 13:00
@nvazquez
Copy link
Contributor Author

nvazquez commented Jun 8, 2020

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1316

@nvazquez
Copy link
Contributor Author

nvazquez commented Jun 8, 2020

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

@apache apache deleted a comment from blueorangutan Jun 16, 2020
@apache apache deleted a comment from blueorangutan Jun 16, 2020
@apache apache deleted a comment from blueorangutan Jun 16, 2020
@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1400

@nvazquez
Copy link
Contributor Author

@blueorangutan test centos7 vmware-67u3

@blueorangutan
Copy link

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + vmware-67u3) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-1743)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 62333 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4103-t1743-vmware-67u3.zip
Intermittent failure detected: /marvin/tests/smoke/test_deploy_vm_root_resize.py
Intermittent failure detected: /marvin/tests/smoke/test_diagnostics.py
Intermittent failure detected: /marvin/tests/smoke/test_kubernetes_clusters.py
Intermittent failure detected: /marvin/tests/smoke/test_router_dns.py
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_ssvm.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_router_nics.py
Smoke tests completed. 74 look OK, 5 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_00_deploy_vm_root_resize Failure 258.65 test_deploy_vm_root_resize.py
test_10_traceroute_in_vr Failure 60.49 test_diagnostics.py
test_01_deploy_kubernetes_cluster Error 3614.51 test_kubernetes_clusters.py
test_02_deploy_kubernetes_ha_cluster Error 0.06 test_kubernetes_clusters.py
test_04_deploy_and_upgrade_kubernetes_cluster Error 3607.63 test_kubernetes_clusters.py
test_05_deploy_and_upgrade_kubernetes_ha_cluster Error 0.03 test_kubernetes_clusters.py
test_06_deploy_and_invalid_upgrade_kubernetes_cluster Error 0.06 test_kubernetes_clusters.py
test_07_deploy_and_scale_kubernetes_cluster Error 0.03 test_kubernetes_clusters.py
ContextSuite context=TestKubernetesCluster>:teardown Error 35.26 test_kubernetes_clusters.py
test_router_dns_guestipquery Failure 213.69 test_router_dns.py
test_01_isolate_network_FW_PF_default_routes_egress_true Failure 205.09 test_routers_network_ops.py
test_02_isolate_network_FW_PF_default_routes_egress_false Failure 199.70 test_routers_network_ops.py
test_01_RVR_Network_FW_PF_SSH_default_routes_egress_true Failure 296.24 test_routers_network_ops.py
test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false Failure 377.10 test_routers_network_ops.py

@andrijapanicsb
Copy link
Contributor

@blueorangutan test centos7 vmware-67u3

@andrijapanicsb
Copy link
Contributor

This one needs to be tested explicitly (besides the internal tests we've done so far)

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1411

@rohityadavcloud
Copy link
Member

@blueorangutan package

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1439

@rohityadavcloud
Copy link
Member

@blueorangutan test

@blueorangutan
Copy link

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

@blueorangutan
Copy link

Trillian test result (tid-1826)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 35940 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4103-t1826-kvm-centos7.zip
Smoke tests completed. 83 look OK, 0 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File

@nvazquez
Copy link
Contributor Author

@andrijapanicsb @borisstoyanov @rhtyd tests are looking good, are you ok to merge this one?

@andrijapanicsb
Copy link
Contributor

This one needs to be tested explicitly (besides the internal tests we've done so far)

cc @borisstoyanov @nvazquez

Copy link
Contributor

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

@andrijapanicsb I've tested, LGTM

Copy link
Contributor

@andrijapanicsb andrijapanicsb left a comment

Choose a reason for hiding this comment

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

LGMT

(I've tested the internal branch, based on 4.11 - and everything looks good)

@nvazquez nvazquez merged commit 8c1d749 into apache:master Jun 26, 2020
@nvazquez nvazquez deleted the unmanageinstances branch June 26, 2020 13:09
weizhouapache pushed a commit to apache/cloudstack-primate that referenced this pull request Jan 19, 2021
UI changes for apache/cloudstack#4103

Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
rohityadavcloud added a commit that referenced this pull request Jan 20, 2021
UI changes for #4103

Co-authored-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants