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

Veeam: Support Veeam 11 and 12 #8241

Merged
merged 41 commits into from
Jan 19, 2024
Merged

Conversation

weizhouapache
Copy link
Member

@weizhouapache weizhouapache commented Nov 16, 2023

Description

This PR fixes several issues in the testing of Veeam 11 and Veeam12

  • Import Veeam.Backup.PowerShell and silently ignore the warning messages
  • Fix issue when assign vm to backup offerings, which caused by separator (\r\n)
  • Fix authorization failure in veeam 12a, which is because v1_4 is not supported in veeam 12a any more
  • Fix exception if backup name has space
  • Fix backup metrics in veeam12, which is because powershell command does not return the values needed
  • Fix Incorrect datetime value, which is because powershell command returns a datetime which is not supported in Java
  • Fix issue during backup restoration if VM has both ROOT and DATA disks.

This PR also has the following update

  • Add integration test test/integration/smoke/test_backup_recovery_veeam.py
  • Make some UI changes
  • Add zone setting backup.plugin.veeam.version. If it is not set, CloudStack will get veeam version via powershell commands.
  • Add zone setting backup.plugin.veeam.task.poll.interval and backup.plugin.veeam.task.poll.max.retry

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?

The following comes from Veeam release note
```
Mods: please move to the PowerShell forum.

Yes, this is known change to a PowerShell module from a snap-in, it was made during a beta stage for v11. The requirements for PowerShell 5.1 (up from 2) are covered in the Release Notes, and the details about the PowerShell module are covered in the "What's New" documentation.

Details are here:

PowerShell
• PowerShell module — By popular demand, we switched from the PowerShell snap-in to the PowerShell module, which can be used on any machine with the backup console installed. We also no longer require PowerShell 2.0 installed on the backup server, which is something many customers had problems with.
• New PowerShell cmdlet — Version 11 adds 184 new cmdlets for both newly added functionality and expanded coverage of the existing features with a particular focus on restore functionality.
```

This fixes the error message when assign VM to backup offering
```
2023-10-25 12:35:11,032 DEBUG [o.a.c.b.v.VeeamClient] (API-Job-Executor-5:ctx-5f068dbb job-42 ctx-3fbfe1a2) (logid:5840110c) Veeam response for PowerShell commands [PowerShell Add-PSSnapin VeeamPSSnapin;$Job = Get-VBRJob -name "template_job_zone1_default";$Job.GetBackupTargetRepository() ^| select Name ^| Format-List] is: [^M
^M
Name : Default Backup Repository^M
^M
^M
^M
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 5.^M
At line:1 char:1^M
+ Add-PSSnapin VeeamPSSnapin;$Job = Get-VBRJob -name template_job_zone1 ...^M
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~^M
    + CategoryInfo          : InvalidArgument: (VeeamPSSnapin:String) [Add-PSSnapin], PSArgumentException^M
    + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand^M
 ^M
].
```
2023-10-25 13:30:15,357 DEBUG [o.a.c.b.v.VeeamClient] (API-Job-Executor-1:ctx-8fff2101 job-46 ctx-e7b5b953) (logid:1c585ee5) Veeam response for PowerShell commands [PowerShell Import-Module Veeam.Backup.PowerShell;$Job = Get-VBRJob -name "template_job_zone1_default";$Job.GetBackupTargetRepository() ^| select Name ^| Format-List] is: [WARNING: The names of some imported commands from the module 'Veeam.Backup.PowerShell' include unapproved verbs that
might make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with
 the Verbose parameter. For a list of approved verbs, type Get-Verb.

Name : Default Backup Repository

].
2023-10-25 13:30:15,357 WARN  [o.a.c.b.v.VeeamClient] (API-Job-Executor-1:ctx-8fff2101 job-46 ctx-e7b5b953) (logid:1c585ee5) Exception caught while trying to clone Veeam job:
com.cloud.utils.exception.CloudRuntimeException: Can't find any repository name for Job [name: template_job_zone1_default].
2023-10-25 13:37:28,343 DEBUG [o.a.c.b.v.VeeamClient] (API-Job-Executor-1:ctx-92428196 job-49 ctx-4c5c5364) (logid:0271069c) Veeam response for PowerShell commands [PowerShell Import-Module Veeam.Backup.PowerShell -WarningAction SilentlyContinue;$Job = Get-VBRJob -name "template_job_zone1_default";$Job.GetBackupTargetRepository() ^| select Name ^| Format-List] is: [^M
^M
Name : Default Backup Repository^M
^M
^M
^M
].
2023-10-25 13:37:28,344 WARN  [o.a.c.b.v.VeeamClient] (API-Job-Executor-1:ctx-92428196 job-49 ctx-4c5c5364) (logid:0271069c) Exception caught while trying to clone Veeam job:
com.cloud.utils.exception.CloudRuntimeException: Can't find any repository name for Job [name: template_job_zone1_default].
        at org.apache.cloudstack.backup.veeam.VeeamClient.getRepositoryNameFromJob(VeeamClient.java:384)
marvin.cloudstackException.CloudstackAPIException: Execute cmd: listbackupproviderofferings failed, due to: errorCode: 530, errorText:Veeam B&R API call unauthorized, please ask your administrator to fix integration issues.

v1_4 is not supported in veeam 12a, refer to https://helpcenter.veeam.com/docs/backup/em_rest/http_authentication.html?ver=120
administrator@VEEAM12A C:\Users\Administrator>PowerShell Import-Module Veeam.Backup.P
owerShell -WarningAction SilentlyContinue;$Job = Get-VBRJob -name "Backup Job Automat
ic"
Get-VBRJob : A positional parameter cannot be found that accepts argument 'Job'.
At line:1 char:78
+ ... gAction SilentlyContinue;$Job = Get-VBRJob -name Backup Job Automatic
+                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-VBRJob], ParameterBindingEx
   ception
    + FullyQualifiedErrorId : PositionalParameterNotFound,Veeam.Backup.PowerShell.C
   mdlets.GetVBRJob

administrator@VEEAM12A C:\Users\Administrator>PowerShell Import-Module Veeam.Backup.P
owerShell -WarningAction SilentlyContinue;$Job = Get-VBRJob -name 'Backup Job Automat
ic'
(1) get backup metrics via Veeam API

on veeam11, it works
```
administrator@VEEAM11A C:\Users\Administrator>PowerShell Import-Module Veeam.Backup.P
owerShell -WarningAction SilentlyContinue;$backups = Get-VBRBackup;foreach ($backup i
n $backups) {$backup.JobName;$storageGroups = $backup.GetStorageGroups();foreach ($gr
oup in $storageGroups) {$usedSize = 0;$dataSize = 0;$sizePerStorage = $group.GetStora
ges().Stats.BackupSize;$dataPerStorage = $group.GetStorages().Stats.DataSize;foreach
($size in $sizePerStorage) {$usedSize += $size;}foreach ($size in $dataPerStorage) {$
dataSize += $size;}$usedSize;$dataSize;}echo "====="}
i-13-22-VM-CSBKP-b3b3cb75-cfbf-4496-9c63-a08a93347276
=====
backup-job-based-on-sla
=====
i-12-20-VM-CSBKP-9f292f11-00ec-4915-84f0-e3895828640e
=====
i-2-5-VM-CSBKP-0d752ca6-d628-4d85-a739-75275e4661e6
1268682752
15624049921
=====
i-32-56-VM-CSBKP-b374b20e-9e8f-427a-a02f-1cd740bce044
569131008
2147506678
=====
```

on veeam12, the powershell command does not return datasize and usedsize.
```
administrator@VEEAM12A C:\Users\Administrator>PowerShell Import-Module Veeam.Backup.P
owerShell -WarningAction SilentlyContinue;$backups = Get-VBRBackup;foreach ($backup i
n $backups) {$backup.JobName;$storageGroups = $backup.GetStorageGroups();foreach ($gr
oup in $storageGroups) {$usedSize = 0;$dataSize = 0;$sizePerStorage = $group.GetStora
ges().Stats.BackupSize;$dataPerStorage = $group.GetStorages().Stats.DataSize;foreach
($size in $sizePerStorage) {$usedSize += $size;}foreach ($size in $dataPerStorage) {$
dataSize += $size;}$usedSize;$dataSize;}echo "====="}
Backup Job Automatic
=====
Backup Job Manual
=====
i-2-4-VM-CSBKP-506760dc-ed77-40d6-a91d-e0914e7a1ad8
=====
Backup Job Automatic
=====
```

(2) get VM RestorePoints via Veeam API

Currently cannot insert BackupVO to database
```
Caused by: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '03/11/2023 16:26:12' for column 'date' at row 1
```

fixed by getting date from CreateTimeUtc in API response instead of powershell output

```
administrator@VEEAM12A C:\Users\Administrator>PowerShell Import-Module Veeam.Backup.P
owerShell -WarningAction SilentlyContinue;$restore = (Get-VBRRestorePoint -Name "i-2-
4-VM" ^| Where-Object {$_.IsConsistent -eq $true});if ($restore) { $restore ^| Format
-List }
...
Id                    : f6d504cf-eafe-4cd2-8dfc-e9cfe2f1e977
...
PointId               : c030b23e-d7fa-45b6-a5a7-feb8525d2563
...
CreationTime          : 03/11/2023 16:26:12
CreationTimeUtc       : 03/11/2023 16:26:12
Type                  : Full
Algorithm             : Full
...
IsConsistent          : True
...
CompletionTimeUtc     : 03/11/2023 16:26:59
...
```

(3) format Date to new format accepted by database

It fixes the issue below
Caused by: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Incorrect datetime value: '2023-11-03T16:26:12.209913Z' for column 'date' at row 1

The new date is '2023-11-03 16:26:12'.
If user uses a older version (e.g 9.x), please update the backup.plugin.veeam.version (zone setting) to 9
@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.

@blueorangutan
Copy link

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

@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.

@weizhouapache
Copy link
Member Author

@blueorangutan test rocky8 vmware-70u3

@blueorangutan
Copy link

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

@weizhouapache
Copy link
Member Author

@blueorangutan test ubuntu22 vmware-80

@blueorangutan
Copy link

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

@blueorangutan
Copy link

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

Test Result Time (s) Test File

@weizhouapache
Copy link
Member Author

@blueorangutan test ubuntu22 vmware-80

test results

Smoke tests completed. 107 look OK, 3 have errors, 0 did not run
Only failed and skipped tests results shown below:


Test | Result | Time (s) | Test File
--- | --- | --- | ---
test_list_vms_metrics_admin | `Error` | 3624.48 | test_metrics_api.py
test_list_vms_metrics_history | `Error` | 5.83 | test_metrics_api.py
test_list_volumes_metrics_history | `Error` | 3603.50 | test_metrics_api.py
test_01_deploy_vm_on_specific_host | `Error` | 18.96 | test_vm_deployment_planner.py
test_02_deploy_vm_on_specific_cluster | `Error` | 3602.58 | test_vm_deployment_planner.py
test_03_deploy_vm_on_specific_pod | `Error` | 1.44 | test_vm_deployment_planner.py
test_04_deploy_vm_on_host_override_pod_and_cluster | `Error` | 2.48 | test_vm_deployment_planner.py
test_05_deploy_vm_on_cluster_override_pod | `Error` | 1.36 | test_vm_deployment_planner.py
test_09_expunge_vm | `Failure` | 424.61 | test_vm_life_cycle.py

@blueorangutan
Copy link

@weizhouapache [SL] unsupported parameters provided. Supported mgmt server os are: centos7, centos6, suse15, alma8, ubuntu18, ubuntu22, ubuntu20, rocky8, alma9. Supported hypervisors are: kvm-centos6, kvm-centos7, kvm-rocky8, kvm-alma8, kvm-alma9, kvm-ubuntu18, kvm-ubuntu20, kvm-ubuntu22, kvm-suse15, vmware-55u3, vmware-60u2, vmware-65u2, vmware-67u3, vmware-70u1, vmware-70u2, vmware-70u3, vmware-80, vmware-80u1, xenserver-65sp1, xenserver-71, xenserver-74, xcpng74, xcpng76, xcpng80, xcpng81, xcpng82

@weizhouapache weizhouapache marked this pull request as ready for review January 19, 2024 17:36
@weizhouapache
Copy link
Member Author

this PR has been reviewed by @rohityadavcloud @DaanHoogland
and verified by @borisstoyanov
thanks !

merging

@weizhouapache weizhouapache merged commit 33bb92a into apache:4.18 Jan 19, 2024
24 of 25 checks passed
@shwstppr
Copy link
Contributor

@weizhouapache @DaanHoogland do we need to forward merge 4.18 branch now to cut 4.19 RC3 or can it wait for later?

@weizhouapache
Copy link
Member Author

@weizhouapache @DaanHoogland do we need to forward merge 4.18 branch now to cut 4.19 RC3 or can it wait for later?

I can wait. 4.18.2/4.19.1 is good to me.
(@rohityadavcloud might be the same)
So it is up to you.

@rohityadavcloud
Copy link
Member

Thanks @weizhouapache - looks like this has made into 4.18 branch; but as it also forward merged for main/4.19 branch (ie. RC3) @shwstppr ?

@weizhouapache
Copy link
Member Author

Thanks @weizhouapache - looks like this has made into 4.18 branch; but as it also forward merged for main/4.19 branch (ie. RC3) @shwstppr ?

@rohityadavcloud
there are some conflicts (4.18 and main) with the UI part, so it is not forward-merged yet.

@weizhouapache weizhouapache linked an issue Jan 25, 2024 that may be closed by this pull request
weizhouapache added a commit to weizhouapache/cloudstack that referenced this pull request Jan 25, 2024
This PR fixes several issues in the testing of Veeam 11 and Veeam12
- Import Veeam.Backup.PowerShell and silently ignore the warning messages
- Fix issue when assign vm to backup offerings, which caused by separator (\r\n)
- Fix authorization failure in veeam 12a, which is because v1_4 is not supported in veeam 12a any more
- Fix exception if backup name has space
- Fix backup metrics in veeam12, which is because powershell command does not return the values needed
- Fix Incorrect datetime value, which is because powershell command returns a datetime which is not supported in Java
- Fix issue during backup restoration if VM has both ROOT and DATA disks.

This PR also has the following update
- Add integration test test/integration/smoke/test_backup_recovery_veeam.py
- Make some UI changes
- Add zone setting backup.plugin.veeam.version. If it is not set, CloudStack will get veeam version via powershell commands.
- Add zone setting backup.plugin.veeam.task.poll.interval and backup.plugin.veeam.task.poll.max.retry
@weizhouapache weizhouapache deleted the 4.18.1.0-veeam branch February 2, 2024 15:02
@weizhouapache weizhouapache mentioned this pull request Feb 28, 2024
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.

Veeam Compatibility issue
7 participants