VMware Plugin: Backup and Restore of VMs using multiple datastores#1473
Merged
VMware Plugin: Backup and Restore of VMs using multiple datastores#1473
Conversation
pstorz
requested changes
May 30, 2023
Member
pstorz
left a comment
There was a problem hiding this comment.
Good work! Please see comments and change suggestions.
| else: | ||
| # if vcthumbprint is not given in options, retrieve it | ||
| if not self.vadp.retrieve_vcthumbprint(): | ||
| return bareosfd.bRC_Error |
Member
There was a problem hiding this comment.
Is the automatically retrieved thumbprint of interest? Would it make sense to also put it into the joblog?
| self.vm = create_vm_task.info.result | ||
|
|
||
| # If transformer.disk_device_change_delayed is not empty, there are disks in other | ||
| # datastores that must be added one-by-one here after VM was created. |
Member
There was a problem hiding this comment.
Suggested change
| # datastores that must be added one-by-one here after VM was created. | |
| # datastores which must be added one-by-one here after VM was created. |
| bareosfd.JobMessage( | ||
| bareosfd.M_FATAL, | ||
| "Disk %s not found in previous backup, migrating disks is not yet supported for " | ||
| "incremental or differential. A new full level backup of this job is required.\n" |
Member
There was a problem hiding this comment.
Suggested change
| "incremental or differential. A new full level backup of this job is required.\n" | |
| "incremental or differential backups. A new full level backup of this job is required.\n" |
| # which is fixed now. So now try to transform the VM metadata as it | ||
| # would be done when recreating the VM for restore. Note that a job | ||
| # message with level M_ERROR will cause the backup job to terminate | ||
| # as Backup OK -- with warnings |
Member
There was a problem hiding this comment.
Suggested change
| # as Backup OK -- with warnings | |
| # as "Backup OK -- with warnings" |
| return backing_ds_match.group(1) | ||
| else: | ||
| raise RuntimeError( | ||
| "Error getting datastore name from backing path: %s" % (backing_path) |
Member
There was a problem hiding this comment.
Suggested change
| "Error getting datastore name from backing path: %s" % (backing_path) | |
| "Error getting datastore name from backing path %s" % (backing_path) |
| ) | ||
| add_device = self._transform_virtual_disk(device) | ||
| # As _transform_virtual_disk() will only change the backing datastore | ||
| # for disks which were in same datastore than VM, The backing datastore |
Member
There was a problem hiding this comment.
Suggested change
| # for disks which were in same datastore than VM, The backing datastore | |
| # for disks which were in same datastore as the VM, The backing datastore |
| orig_disk_backing_path | ||
| ) | ||
|
|
||
| # When datastore is not changed, restore disk path will be the same as backed up |
Member
There was a problem hiding this comment.
Suggested change
| # When datastore is not changed, restore disk path will be the same as backed up | |
| # When datastore is not changed, restore disk path will be the same as backed up disk path |
| ":vcthumbprint=AABBCCDDEEFF11223344556677889900AABBCCDD" | ||
| ... | ||
|
|
||
| If the **vcthumbprint** option is used and the thumbprint on the server changes, for example by renewing or replacing the SSL certificate but not adapting the vcthumbprint parameter in the Bareos configuration, backup jobs will fail and the API will only return an "unknown" error. Since :sinceVersion:`22.1.0: VMware Plugin:` the plugin will compare the configured with the server thumbprint and emit an appropriate error message and advice to update vcthumbprint parameter. |
Member
There was a problem hiding this comment.
Suggested change
| If the **vcthumbprint** option is used and the thumbprint on the server changes, for example by renewing or replacing the SSL certificate but not adapting the vcthumbprint parameter in the Bareos configuration, backup jobs will fail and the API will only return an "unknown" error. Since :sinceVersion:`22.1.0: VMware Plugin:` the plugin will compare the configured with the server thumbprint and emit an appropriate error message and advice to update vcthumbprint parameter. | |
| If the **vcthumbprint** option is used and the thumbprint on the server changes, for example by renewing or replacing the SSL certificate but not adapting the vcthumbprint parameter in the Bareos configuration, backup jobs will fail and the API will only return an "unknown" error. Since :sinceVersion:`22.1.0: VMware Plugin:` the plugin will compare the configured thumbprint with the server thumbprint and emit an appropriate error message and advice to update vcthumbprint parameter. |
|
|
||
| restore_datastore (optional) | ||
| By default, if a VM to be restored does not exist, it will be recreated in the same datastore where it was stored at backup time. Use this option to restore on the given datastore. Since :sinceVersion:`22.0.0: VMware Plugin` | ||
| By default, if a VM to be restored does not exist, it will be recreated in the same datastore where it was stored at backup time. Use this option to restore on the given datastore. Since :sinceVersion:`22.0.0: VMware Plugin`. As :sinceVersion:`22.1.0: VMware Plugin` it is possible to backup and restore VMs with disks on multiple datastores, when using this option, it will only change the datastore of the disks which were stored in the same datastore than the VM, the other disks will be recreated on the same datastore they were backed up from. |
Member
There was a problem hiding this comment.
Suggested change
| By default, if a VM to be restored does not exist, it will be recreated in the same datastore where it was stored at backup time. Use this option to restore on the given datastore. Since :sinceVersion:`22.0.0: VMware Plugin`. As :sinceVersion:`22.1.0: VMware Plugin` it is possible to backup and restore VMs with disks on multiple datastores, when using this option, it will only change the datastore of the disks which were stored in the same datastore than the VM, the other disks will be recreated on the same datastore they were backed up from. | |
| By default, if a VM to be restored does not exist, it will be recreated in the same datastore where it was stored at backup time. Use this option to restore on the given datastore. Since :sinceVersion:`22.0.0: VMware Plugin`. As :sinceVersion:`22.1.0: VMware Plugin` it is possible to backup and restore VMs with disks on multiple datastores, when using this option, it will only change the datastore of the disks which were stored in the same datastore as the VM, the other disks will be recreated on the same datastore they were backed up from. |
| By **default**, after restore a VM will be set to its **previous powerstate** which means the powerstate at backup time. When specifying ``restore_powerstate=off`` the VM will stay powered off after restore. Also can be forced to on with ``restore_powerstate=on``. Note that this will only work if DRS is configured to **fully automated**, otherwise the API request to power on a VM will be ignored. Since :sinceVersion:`22.0.0: VMware Plugin` | ||
|
|
||
| snapshot_retries (optional) | ||
| Number of retries when taking a snapshot fails (default: 3). The most common cause of snapshot failure is error while quiescing the virtual machine. Mostly retrying helps. If not also check if a pre-freeze script is used on the VM, a non-zero exit code will cause a quiescing error. The pre-freeze and post-thaw scripts are executed by VMwareTools. Since :sinceVersion:`22.1.0: VMware Plugin` |
Member
There was a problem hiding this comment.
Suggested change
| Number of retries when taking a snapshot fails (default: 3). The most common cause of snapshot failure is error while quiescing the virtual machine. Mostly retrying helps. If not also check if a pre-freeze script is used on the VM, a non-zero exit code will cause a quiescing error. The pre-freeze and post-thaw scripts are executed by VMwareTools. Since :sinceVersion:`22.1.0: VMware Plugin` | |
| Number of retries when taking a snapshot fails (default: 3). The most common cause of snapshot failure is "error while quiescing the virtual machine". In this case usually retrying helps. If not, check if a pre-freeze script is used on the VM, as a non-zero exit code will cause a quiescing error. The pre-freeze and post-thaw scripts are executed by VMwareTools. Since :sinceVersion:`22.1.0: VMware Plugin` |
sduehr
added a commit
that referenced
this pull request
May 31, 2023
pstorz
pushed a commit
that referenced
this pull request
Jun 1, 2023
(cherry picked from commit c89a58c)
8 tasks
The plugin can now backup and restore VMs which use multiple disks on different datastores. Other enhancements: Configurable snapshot retries to mitigate quiescing errors, detection of server thumbprint changes and appropriate warning when a fallback to full CBT occurs.
When a snapshot existed at backup time, properly adapt the disk path on restore.
faee1a2 to
e806212
Compare
pstorz
pushed a commit
that referenced
this pull request
Jun 7, 2023
(cherry picked from commit c89a58c)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for contributing to the Bareos Project!
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality