Skip to content

[Veeam] Restore only a specified volume #7221

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

SadiJr
Copy link
Contributor

@SadiJr SadiJr commented Feb 14, 2023

Description

Using VMWare with Veeam on ACS, when restoring a volume from a backup, ACS creates a new VM from the backup, detaches all volumes, and attaches the selected volume to the original VM.

Veeam allows restoring only the selected volume, which is faster and more performant than the current approach. This PR aims to improve the volume restore process using this native option of Veeam.

Also, when restoring and attaching one volume to one VM, the target VM needs to be stopped and then started. However, the entire process is manual; even Veeam allows the VM to be started automatically if the restore is successful. A new parameter, startvm, has been added to the API restoreVolumeFromBackupAndAttachToVM, allowing operators to specify whether or not the VM should be started automatically when volume restoration is complete.

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

How Has This Been Tested?

It was tested in a local lab:

  1. I created a new VM and attached this VM to a Backup Offering;
  2. I made some manual backups;
  3. I restore some volume of this backups, without using the parameter startvm, and check if, in Veeam and vCenter, only the selected volume are restored, which results in success, but i had to start the VM manually;
  4. Via cmk, I indicate the parameter startvm as true, and the VM is automatically started by Veeam when restore finishes.

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 4.18%. Comparing base (8806e44) to head (5120402).
Report is 58 commits behind head on main.

Current head 5120402 differs from pull request most recent head cda1c45

Please upload reports for the commit cda1c45 to get more accurate results.

❗ There is a different number of reports uploaded between BASE (8806e44) and HEAD (5120402). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (8806e44) HEAD (5120402)
unittests 1 0
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #7221       +/-   ##
============================================
- Coverage     15.42%   4.18%   -11.24%     
============================================
  Files          5469     369     -5100     
  Lines        478292   30284   -448008     
  Branches      58134    5359    -52775     
============================================
- Hits          73775    1268    -72507     
+ Misses       396389   28872   -367517     
+ Partials       8128     144     -7984     
Flag Coverage Δ
uitests 4.18% <ø> (ø)
unittests ?

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.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 6 Code Smells

16.7% 16.7% Coverage
0.0% 0.0% Duplication

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland DaanHoogland added this to the 4.19.0.0 milestone Jun 22, 2023
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.

Thanks @SadiJr, except the suggested few changes, the remaining code LGTM.

Comment on lines 77 to 80
@Parameter(name = ApiConstants.START_VM,
type = CommandType.BOOLEAN,
required = false,
description = "start VM after the restore is finished")
Copy link
Contributor

@DaanHoogland DaanHoogland Jul 3, 2023

Choose a reason for hiding this comment

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

Suggested change
@Parameter(name = ApiConstants.START_VM,
type = CommandType.BOOLEAN,
required = false,
description = "start VM after the restore is finished")
@Parameter(name = ApiConstants.START_VM,
type = CommandType.BOOLEAN,
required = false,
description = "start VM after the restore is finished",
since = "4.19.0")

Copy link
Member

Choose a reason for hiding this comment

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

this will power on the vm from veeam, looks like a out-of-band operation (the power state, host_id, etc are not managed by cloudstack).

@SadiJr
I think we should avoid it. cc @DaanHoogland

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@weizhouapache when using the option to power on VM from Veeam, it will only start the VM in the last host the VM was allocated to. Also, there is a process in ACS that updates the VM state from time to time, according to what is collected from vCenter. Additionally, the HA process in VMWare is also not managed by ACS. Having said all that, I believe that if Veeam has this option, we should leave it up to the user to decide, not us.

Copy link
Member

@weizhouapache weizhouapache Dec 15, 2023

Choose a reason for hiding this comment

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

@SadiJr
You can do lots of operations on vcenter or veeam, but cloudstack does not support OOB operations perfectly.

We should avoid the OOB operations as much as possible, unless it is really neccessary.
I think it is unnecessary to add the option. If you insist to support, I would rather starting the vm by invoking cloudstack methods/API (as cloudstack will check the proper host by available resources, affinity groups, and apply network rules, etc), than starting the vm via veeam.

Let me give you an example, if you stop a vm, and the network is shutdown (VR is stopped), when you start the vm in vcenter or veeam, the vm has no internet connection as the VR is still stopped.
We have actually faced several issues caused by OOB operations (start/migration), or DRS.

Copy link
Contributor

Choose a reason for hiding this comment

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

@weizhouapache I have removed this feature from this PR as it is not in the core of it. In the future I might open a PR to add it separately and we can discuss it further on that PR.

@shwstppr
Copy link
Contributor

shwstppr commented Oct 9, 2023

@SadiJr can you please check the review comments?

@DaanHoogland
Copy link
Contributor

@SadiJr are you still looking to get this merged?

@SadiJr
Copy link
Contributor Author

SadiJr commented Nov 21, 2023

@shwstppr @DaanHoogland Sorry for the delay, I will check the suggestions and respond/work on this PR

@SadiJr
Copy link
Contributor Author

SadiJr commented Dec 15, 2023

@SadiJr can you please add some integration test cases ?

@weizhouapache sure, I'll try to add some integration tests

@SadiJr SadiJr marked this pull request as draft December 19, 2023 16:36
@weizhouapache
Copy link
Member

I tested this PR with veeam 12.
The integration test added in #8241 has some failures, some functionalities are broken by this .

Copy link

github-actions bot commented Feb 5, 2024

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@JoaoJandre
Copy link
Contributor

@blueorangutan package

@JoaoJandre
Copy link
Contributor

@weizhouapache could we run the integration tests here so I can take a look at the errors you reported?

@weizhouapache
Copy link
Member

@weizhouapache could we run the integration tests here so I can take a look at the errors you reported?

sure
@blueorangutan test rocky8 vmware-80

@weizhouapache
Copy link
Member

weizhouapache commented Jun 20, 2024

@weizhouapache could we run the integration tests here so I can take a look at the errors you reported?

@JoaoJandre
#8241 requires a vmware/veeam environment. It will be skipped in the trillian test

@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 test result (tid-10542)
Environment: vmware-80 (x2), Advanced Networking with Mgmt server r8
Total time taken: 50658 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr7221-t10542-vmware-80.zip
Smoke tests completed. 118 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 Error 422.24 test_cluster_drs.py
test_01_browser_migrate_template Failure 5.47 test_image_store_object_migration.py
test_01_unmanage_vm_cycle Error 128.04 test_vm_lifecycle_unmanage_import.py

@JoaoJandre
Copy link
Contributor

@weizhouapache could we run the integration tests here so I can take a look at the errors you reported?

@JoaoJandre #8241 requires a vmware/veeam environment. It will be skipped in the trillian test

@weizhouapache Ok, I'll try to test this and see if everything still looks good after merging with main.

@sureshanaparti sureshanaparti modified the milestones: 4.19.1.0, 4.19.2, 4.20.0.0 Jun 24, 2024
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@sureshanaparti
Copy link
Contributor

hi @SadiJr please check and resolve any conflicts in the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

8 participants