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

Fix export snapshot and template to secondary storage to export only required disk #5510

Merged
merged 5 commits into from
Sep 30, 2021

Conversation

harikrishna-patnala
Copy link
Contributor

@harikrishna-patnala harikrishna-patnala commented Sep 24, 2021

Description

This PR fixes issue #5498 where multiple volumes of a VM are exported to secondary storage upon taking snapshot of a single volume in case of VMware

Fixes: #5498

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)

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?

  1. Created a VM with multiple disks
  2. Created snapshot of one disk (also a recurring snapshot). (before creating a snapshot, add some data to the disk)
  3. Check secondary storage snapshot folder to have only one disk
  4. Created a volume from the snapshot above (to check subsequent operations on that snapshot are working fine)
  5. Attached the above volume to a VM and made sure it is the proper disk by checking the data created before in Step 2

@harikrishna-patnala harikrishna-patnala added this to the 4.16.0.0 milestone Sep 24, 2021
@harikrishna-patnala harikrishna-patnala changed the title Fix export snapshot and export template to secondary storage in VMwar… Fix export snapshot and template to secondary storage to export only required disk. Sep 24, 2021
@harikrishna-patnala harikrishna-patnala changed the title Fix export snapshot and template to secondary storage to export only required disk. Fix export snapshot and template to secondary storage to export only required disk Sep 24, 2021
@apache apache deleted a comment from blueorangutan Sep 24, 2021
if (vmDisks.length != 1) {
String baseName = VmwareHelper.getDiskDeviceFileName(requiredDisk);
s_logger.info(String.format("Detaching all disks for the cloned VM: %s except disk with base name: %s, key=%d", clonedVm.getName(), baseName, requiredDisk.getKey()));
clonedVm.detachAllDisksExcept(VmwareHelper.getDiskDeviceFileName(requiredDisk), null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to include this process, as part of creating full clone with specific disk (which ensures it detaches/destroys the additional disks), instead checking this separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll try to keep it in same method. Thanks Suresh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the process to virtualMachineMO class.

@rohityadavcloud
Copy link
Member

@harikrishna-patnala does the sdk/api behave differently in different vmware versions?
@blueorangutan test centos7 vmware-67u3

@harikrishna-patnala
Copy link
Contributor Author

@harikrishna-patnala does the sdk/api behave differently in different vmware versions?

Ideally it should not differ, I'll test all versions.

@rohityadavcloud
Copy link
Member

This needs a manual test confirmation cc @borisstoyanov @vladimirpetrov @NuxRo thanks

@borisstoyanov borisstoyanov self-assigned this Sep 27, 2021
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.

LGTM, manually tested it.

@borisstoyanov borisstoyanov removed their assignment Sep 28, 2021
@blueorangutan
Copy link

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

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.

code LGTM

@blueorangutan
Copy link

Trillian test result (tid-2239)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 36756 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5510-t2239-vmware-67u3.zip
Smoke tests completed. 89 look OK, 1 have errors
Only failed tests results shown below:

Test Result Time (s) Test File
test_03_live_migrate_VM_with_two_data_disks Error 61.81 test_vm_life_cycle.py

@nvazquez
Copy link
Contributor

@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-2243)
Environment: vmware-67u3 (x2), Advanced Networking with Mgmt server 7
Total time taken: 39958 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5510-t2243-vmware-67u3.zip
Smoke tests completed. 89 look OK, 1 have errors
Only failed tests results shown below:

Test Result Time (s) Test File
test_03_live_migrate_VM_with_two_data_disks Error 63.73 test_vm_life_cycle.py

@nvazquez
Copy link
Contributor

nvazquez commented Sep 30, 2021

Edit: smoke test failure also seen on the health checks PR, merging this PR - test needs fixing on stabilisation phase

@nvazquez nvazquez merged commit df0c004 into main Sep 30, 2021
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from rohityadavcloud Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from rohityadavcloud Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from harikrishna-patnala Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from blueorangutan Jan 11, 2022
@apache apache deleted a comment from harikrishna-patnala Jan 11, 2022
nvazquez pushed a commit to shapeblue/cloudstack that referenced this pull request Feb 22, 2022
…required disk (apache#5510)

* Fix export snapshot and export template to secondary storage in VMware to export only one required disk

* Move clone operation into virtual machine mo

* Code refactored for readability

* Added disk key check even for successful clone operation

* Delete dettached disks from cloned VM and added few logs
rohityadavcloud pushed a commit to shapeblue/cloudstack that referenced this pull request May 18, 2022
…required disk (apache#5510)

* Fix export snapshot and export template to secondary storage in VMware to export only one required disk

* Move clone operation into virtual machine mo

* Code refactored for readability

* Added disk key check even for successful clone operation

* Delete dettached disks from cloned VM and added few logs

(cherry picked from commit df0c004)
Signed-off-by: Rohit Yadav <[email protected]>
rohityadavcloud pushed a commit to shapeblue/cloudstack that referenced this pull request May 18, 2022
…required disk (apache#5510)

* Fix export snapshot and export template to secondary storage in VMware to export only one required disk

* Move clone operation into virtual machine mo

* Code refactored for readability

* Added disk key check even for successful clone operation

* Delete dettached disks from cloned VM and added few logs

(cherry picked from commit df0c004)
Signed-off-by: Rohit Yadav <[email protected]>
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.

Single volume snapshot operation exports all volumes of the VM to the secondary storage
8 participants