mirror of https://github.com/apache/cloudstack.git
* veeam: detach only the restored volume during backup restore
Steps to reproduce the issue
1. create a VM (A) with ROOT and DATA disk
2. assign to a backup offering
3. create backup
4. create another VM (B)
5. restore the DATA disk of VM A, and attach to VM B
6. When operation is done, check the datastore
Without this change, the ROOT image is not removed and left over on the datastore.
```
[root@ref-trl-5933-v-Mr8-wei-zhou-esxi2:/vmfs/volumes/5f60667d-18d828eb] ls -l /vmfs/volumes/5f60667d-18d828eb/CS-RSTR-dfb6f21c-a941-49db-9963-4f0286a17dac
total 1784840
-rw------- 1 root root 5242880000 Jan 24 09:23 ROOT-722_2-flat.vmdk
-rw------- 1 root root 499 Jan 24 09:23 ROOT-722_2.vmdk
```
With this change, the whole temporary vm has been destroyed.
```
[root@ref-trl-5933-v-Mr8-wei-zhou-esxi2:/vmfs/volumes/5f60667d-18d828eb] ls -l /vmfs/volumes/5f60667d-18d828eb/CS-RSTR-734bee3b-640c-4ff0-a34b-bc45358565b2
ls: /vmfs/volumes/5f60667d-18d828eb/CS-RSTR-734bee3b-640c-4ff0-a34b-bc45358565b2: No such file or directory
```
* veeam: fix wrong disk size in debug message
* veeam: sync backup repository after operations are done
got exception of some operations which succeeds due to the following error
```
2024-01-19 10:59:52,846 DEBUG [o.a.c.b.v.VeeamClient] (API-Job-Executor-42:ctx-716501bb job-4373 ctx-2359b76d) (logid:b5e19a17) Veeam response for PowerShell commands [PowerShell Import-Module Veeam.Backup.PowerShell -WarningAction SilentlyContinue;$restorePoint = Get-VBRRestorePoint ^| Where-Object { $_.Id -eq '1d99106a-b5c8-4a1e-958d-066a987caa5f' };if ($restorePoint) { Remove-VBRRestorePoint -Oib $restorePoint -Confirm:$false;$repo = Get-VBRBackupRepository;Sync-VBRBackupRepository -Repository $repo;} else { ; Write-Output 'Failed to delete'; Exit 1;}] is: [^M
Restore Type Job Name State Start Time End Time Description ^M
------------ -------- ----- ---------- -------- ----------- ^M
ConfResynchronize Configuration Dat... Starting 19/01/2024 10:59:52 01/01/1900 00:00:00 ^M
^M
^M
Remove-VBRRestorePoint : Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. ^M
Contact Microsoft Customer Support Services.^M
At line:1 char:196^M
+ ... orePoint) { Remove-VBRRestorePoint -Oib $restorePoint -Confirm:$false ...^M
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^M
+ CategoryInfo : ReadError: (:) [Remove-VBRRestorePoint], HostException^M
+ FullyQualifiedErrorId : ReadConsoleOutput,Veeam.Backup.PowerShell.Cmdlets.RemoveVBRRestorePoint^M
^M
].
```
* veeam: fix unable to detach volume when restore backup and attach to vm then detach the volume
It also happened when destroy the original or backup VM
```
2024-01-24 10:10:03,401 ERROR [c.c.s.r.VmwareStorageProcessor] (DirectAgent-74:ctx-95b24ac7 10.0.35.53, job-25995/job-25996, cmd: DettachCommand) (logid:7260ffb8) Failed to detach volume!
java.lang.RuntimeException: Unable to access file [de52fdd3386b3d67b27b3960ecdb08f4] i-2-723-VM/7c2197c129464035bab062edec536a09-flat.vmdk
at com.cloud.hypervisor.vmware.util.VmwareClient.waitForTask(VmwareClient.java:426)
at com.cloud.hypervisor.vmware.mo.DatastoreMO.moveDatastoreFile(DatastoreMO.java:290)
at com.cloud.storage.resource.VmwareStorageLayoutHelper.syncVolumeToRootFolder(VmwareStorageLayoutHelper.java:241)
at com.cloud.storage.resource.VmwareStorageProcessor.attachVolume(VmwareStorageProcessor.java:2150)
at com.cloud.storage.resource.VmwareStorageProcessor.dettachVolume(VmwareStorageProcessor.java:2408)
at com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.execute(StorageSubsystemCommandHandlerBase.java:174)
at com.cloud.storage.resource.StorageSubsystemCommandHandlerBase.handleStorageCommands(StorageSubsystemCommandHandlerBase.java:71)
at com.cloud.hypervisor.vmware.resource.VmwareResource.executeRequest(VmwareResource.java:589)
at com.cloud.agent.manager.DirectAgentAttache$Task.runInContext(DirectAgentAttache.java:315)
at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:48)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:55)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:102)
at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:52)
at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:45)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
2024-01-24 10:10:03,402 INFO [c.c.h.v.u.VmwareHelper] (DirectAgent-74:ctx-95b24ac7 10.0.35.53, job-25995/job-25996, cmd: DettachCommand) (logid:7260ffb8) [ignored]failed to get message for exception: Unable to access file [de52fdd3386b3d67b27b3960ecdb08f4] i-2-723-VM/7c2197c129464035bab062edec536a09-flat.vmdk
```
* vmware: create restored volume with new UUID and attach to VM
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_2fa.py | ||
| test_accounts.py | ||
| test_affinity_groups.py | ||
| test_affinity_groups_projects.py | ||
| test_annotations.py | ||
| test_async_job.py | ||
| test_attach_multiple_volumes.py | ||
| test_backup_recovery_dummy.py | ||
| test_backup_recovery_veeam.py | ||
| test_certauthority_root.py | ||
| test_console_endpoint.py | ||
| test_create_list_domain_account_project.py | ||
| test_create_network.py | ||
| test_deploy_vgpu_enabled_vm.py | ||
| test_deploy_virtio_scsi_vm.py | ||
| test_deploy_vm_extra_config_data.py | ||
| test_deploy_vm_iso.py | ||
| test_deploy_vm_iso_uefi.py | ||
| test_deploy_vm_root_resize.py | ||
| test_deploy_vm_with_userdata.py | ||
| test_deploy_vms_in_parallel.py | ||
| test_deploy_vms_with_varied_deploymentplanners.py | ||
| test_diagnostics.py | ||
| test_direct_download.py | ||
| test_disk_offerings.py | ||
| test_disk_provisioning_types.py | ||
| test_domain_disk_offerings.py | ||
| test_domain_network_offerings.py | ||
| test_domain_service_offerings.py | ||
| test_domain_vpc_offerings.py | ||
| test_dynamicroles.py | ||
| test_enable_account_settings_for_domain.py | ||
| test_enable_role_based_users_in_projects.py | ||
| test_events_resource.py | ||
| test_gateway_on_shared_networks.py | ||
| test_global_settings.py | ||
| test_guest_vlan_range.py | ||
| test_host_control_state.py | ||
| test_host_maintenance.py | ||
| test_host_ping.py | ||
| test_hostha_kvm.py | ||
| test_hostha_simulator.py | ||
| test_human_readable_logs.py | ||
| test_internal_lb.py | ||
| test_ipv6_infra.py | ||
| test_iso.py | ||
| test_kubernetes_clusters.py | ||
| test_kubernetes_supported_versions.py | ||
| test_list_ids_parameter.py | ||
| test_loadbalance.py | ||
| test_login.py | ||
| test_metrics_api.py | ||
| test_migration.py | ||
| test_multipleips_per_nic.py | ||
| test_nested_virtualization.py | ||
| test_network.py | ||
| test_network_acl.py | ||
| test_network_ipv6.py | ||
| test_network_permissions.py | ||
| test_nic.py | ||
| test_nic_adapter_type.py | ||
| test_non_contigiousvlan.py | ||
| test_nonstrict_affinity_group.py | ||
| test_outofbandmanagement.py | ||
| test_outofbandmanagement_nestedplugin.py | ||
| test_over_provisioning.py | ||
| test_password_server.py | ||
| test_persistent_network.py | ||
| test_portable_publicip.py | ||
| test_portforwardingrules.py | ||
| test_primary_storage.py | ||
| test_privategw_acl.py | ||
| test_privategw_acl_ovs_gre.py | ||
| test_projects.py | ||
| test_public_ip_range.py | ||
| test_pvlan.py | ||
| test_regions.py | ||
| test_register_userdata.py | ||
| test_reset_configuration_settings.py | ||
| test_reset_vm_on_reboot.py | ||
| test_resource_accounting.py | ||
| test_resource_detail.py | ||
| test_router_dhcphosts.py | ||
| test_router_dns.py | ||
| test_router_dnsservice.py | ||
| test_routers.py | ||
| test_routers_iptables_default_policy.py | ||
| test_routers_network_ops.py | ||
| test_scale_vm.py | ||
| test_secondary_storage.py | ||
| test_service_offerings.py | ||
| test_snapshots.py | ||
| test_ssvm.py | ||
| test_staticroles.py | ||
| test_storage_policy.py | ||
| test_templates.py | ||
| test_update_security_group.py | ||
| test_usage.py | ||
| test_usage_events.py | ||
| test_vm_autoscaling.py | ||
| test_vm_deployment_planner.py | ||
| test_vm_life_cycle.py | ||
| test_vm_lifecycle_unmanage_import.py | ||
| test_vm_snapshot_kvm.py | ||
| test_vm_snapshots.py | ||
| test_volumes.py | ||
| test_vpc_ipv6.py | ||
| test_vpc_redundant.py | ||
| test_vpc_router_nics.py | ||
| test_vpc_vpn.py | ||