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: do not tear down vm disks if deploy-as-is vm has vm snapshots #9243

Conversation

weizhouapache
Copy link
Member

Description

This PR fixes #9180

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)
  • build/CI

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@weizhouapache
Copy link
Member Author

@blueorangutan package

@weizhouapache
Copy link
Member Author

@nvazquez @harikrishna-patnala
I have no idea why the data disks are tear down when start a deploy-as-is vm.
Anyway, this change seems to be working.

Copy link

codecov bot commented Jun 13, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 14.96%. Comparing base (19e9020) to head (f4d95fc).
Report is 2 commits behind head on 4.19.

Files Patch % Lines
...oud/hypervisor/vmware/resource/VmwareResource.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.19    #9243      +/-   ##
============================================
- Coverage     14.96%   14.96%   -0.01%     
  Complexity    11015    11015              
============================================
  Files          5377     5377              
  Lines        469605   469605              
  Branches      60258    58877    -1381     
============================================
- Hits          70296    70292       -4     
- Misses       391523   391528       +5     
+ Partials       7786     7785       -1     
Flag Coverage Δ
uitests 4.29% <ø> (ø)
unittests 15.68% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm, not tested

@weizhouapache
Copy link
Member Author

@blueorangutan package

@blueorangutan
Copy link

@weizhouapache a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@vladimirpetrov vladimirpetrov self-assigned this Jun 13, 2024
@blueorangutan
Copy link

Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9924

@@ -2203,7 +2203,7 @@ protected StartAnswer execute(StartCommand cmd) {
throw new Exception("Failed to find the newly create or relocated VM. vmName: " + vmInternalCSName);
}
}
if (deployAsIs) {
if (deployAsIs && !vmMo.hasSnapshot()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems right to me as I see some other calls of tearDownVmDevices() method before this call which does handle snapshot existance.
https://github.com/shapeblue/cloudstack/blob/78e07cff62dd98d9b88852a47407e80fa57537d2/plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java#L2826-L2834

private void tearDownVmDevices(VirtualMachineMO vmMo, boolean hasSnapshot, boolean deployAsIs) throws Exception {
    if (deployAsIs) {
        vmMo.tearDownDevices(new Class<?>[]{VirtualEthernetCard.class});
    } else if (!hasSnapshot) {
        vmMo.tearDownDevices(new Class<?>[]{VirtualDisk.class, VirtualEthernetCard.class});
    } else {
        vmMo.tearDownDevices(new Class<?>[]{VirtualEthernetCard.class});
    }
}

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @harikrishna-patnala
It looks consistent with this pr.

I got the error on vcenter: " Invalid configuration for device '0'. Cannot remove virtual disk from the virtual machine because it or one of its parent disks is part of a snapshot of the virtual machine."
it seems to be a known restriction that disk cannot be removed from vm with snapshot.

Copy link
Contributor

@harikrishna-patnala harikrishna-patnala left a comment

Choose a reason for hiding this comment

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

Code LGTM, needs testing though

Copy link
Contributor

@nvazquez nvazquez left a comment

Choose a reason for hiding this comment

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

Code LGTM - subject to testing

@weizhouapache
Copy link
Member Author

Thanks @harikrishna-patnala @nvazquez

@blueorangutan test rocky8 vmware-80

@blueorangutan
Copy link

@weizhouapache a [SL] Trillian-Jenkins test job (rocky8 mgmt + vmware-80) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian Build Failed (tid-10434)

@blueorangutan
Copy link

[SF] Trillian test result (tid-10436)
Environment: vmware-80 (x2), Advanced Networking with Mgmt server r8
Total time taken: 54822 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr9243-t10436-vmware-80.zip
Smoke tests completed. 128 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_02_balanced_drs_algorithm Failure 139.48 test_cluster_drs.py
test_01_create_lb_rule_src_nat Error 118.97 test_loadbalance.py
test_02_create_lb_rule_non_nat Error 223.67 test_loadbalance.py
test_02_create_lb_rule_non_nat Error 223.68 test_loadbalance.py
test_assign_and_removal_lb Error 0.12 test_loadbalance.py
test_01_redundant_vpc_site2site_vpn Error 628.24 test_vpc_vpn.py

@weizhouapache weizhouapache marked this pull request as ready for review June 14, 2024 07:39
Copy link

@rajujith rajujith left a comment

Choose a reason for hiding this comment

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

LGTM.
Followed the repro steps in the corresponding issue and the PR fixes it. I can start an instance with data volume having instance snapshots.

@DaanHoogland DaanHoogland merged commit f360f70 into apache:4.19 Jun 18, 2024
24 of 25 checks passed
@DaanHoogland DaanHoogland deleted the 4.19-fix-vmware-deploy-as-is-vm-start-with-snapshot branch June 18, 2024 06:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Unable to start instances with DATA volumes of deploy-as-is template having instance snapshots
8 participants