DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.

DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
This feature adds the ability to create a new instance from a VM backup for dummy, NAS and Veeam backup providers. It works even if the original instance used to create the backup was expunged or unmanaged. There are two parts to this functionality:
Currently, it is not possible to expunge a VM with backups because the backup offering cannot be removed while backups exist. This feature addresses that gap.
The process flow is as follows:
...
The following details are needed for creating the new Instance:
backup_details tablebacked_volumes column in the backup table. It has details like Disk Offering UUID, size and type. It is enhanced to also store deviceId, minIOPS and maxIOPS. This information is stored for all the volumes.The rest of the Instance properties are not stored and retrieved from backup. Users have to set them explicitly if needed.
The UI form is pre-populated with backup metadata.
Users may override configurations.
Restrictions:
These are already enforced in the UI, and will return an error if called directly from API.
The option to reuse original IP and MAC is available only if the original VM is expunged and the addresses are still available in the network.
Some properties are not fetched from backup but still needs special handling.
attached while creating the instance and detached before restore, so that the new instance doesn't boot with ISO, but still has the metadata that it was created using that ISO.A new api createVmFromBackup is added.
The CreateVmFromBackup API needs parameters similar to DeployVmCmd because it internally creates a new VM instance. However, some of these parameters, like serviceOfferingId and templateId, are mandatory in DeployVmCmd, but in the context of creating a VM from a backup, they can be derived from the backup metadata. To avoid modifying DeployVmCmd and breaking backward compatibility, a new abstract base class was introduced which consolidates common parameters used in both APIs.
BaseVmDeployCmd based on DeployVmCmd is created.CreateVmFromBackupCmd and DeployVmCmd extend this new abstract class.CreateVmFromBackupCmd allows serviceOfferingId and templateId to be optional.backupId and preserveip are additional parameters introduced in CreateVmFromBackupCmd.This abstraction ensures:
| Parameter | Type | Required | Description |
|---|---|---|---|
backupid | UUID | Yes | Backup ID to restore from |
preserveip | Boolean | No | Use original IP/MAC. Applicable only if the original Instance is expunged |
zoneid | UUID | Yes | Zone to deploy the instance |
datadiskdetails | List | Yes | Disk details for data volumes (Disk offering, size, minIops, maxIops) |
serviceofferingid | UUID | No | Optional override |
templateid | UUID | No | Optional override |
Other parameters are similar | - | - | - |
The existing DeployVmCmd only supports creating a single data volume during instance deployment. However, backups can contain multiple data volumes, and to restore such backups, the CreateVmFromBackup API needs to support the creation of multiple data volumes.
To enable this, a new parameter named dataDiskDetails has been added to BaseDeployVirtualMachineCmd. This enhancement allows both CreateVmFromBackupCmd and DeployVmCmd to support multiple data volumes.
dataDiskDetails contains:The instance orchestration framework has been updated to support creating and attaching multiple data volumes as part of the VM creation process.
Although this functionality is technically available in DeployVmCmd, it has not been integrated into the UI.
...
Currently, backup offering can not be removed from an Instance which has backups. This has been changed so that backup offering can be removed and the VM can be expunged even with backups
backup.backed_volumes instead of vm_instance.backup_volumes as vm_instance.backup_volumes is cleared when the backup offering is removed.backup table, not from the vm_instance table.Backup usage tracking has undergone major changes to support the new flexibility around backup offerings.
The backup and recovery infrastructure retrieves usage metrics (backup size, number of backups, retention) from all providers. These metrics were previously returned consolidated for all backups per VM.
All current backup providers — NAS, Dummy, Networker, and Veeam — have been updated to return usage metrics per (VMId, Backup Offering) tuple.
Usage is also tracked for backups of Expunged Instances. Pre-requisite for this is that the Database entry for the expunged VM is present. It is made sure that the db entry for expunged Instances with Backups are not auto-purged by the system itself. Users should make sure not to manually purge DB entries for such VMs.
The design given below is obsolete, but the functionality is implemented.
Github PR has the latest details : https://github.com/apache/cloudstack/pull/10140/
Currently Backups are tightly coupled with Instances. Restore can only be done on the same instance from which the backup was taken. If the instance is deleted, backup is not usable and restoring the full backup or individual volumes lead to random exceptions.
This limitation is mostly because of how CloudStacks Backup and Recovery framework code is written. Backup providers usually don’t care if restore is being done to the same VM from which the backup was taken. So there is an opportunity to enhance the BnR framework so that user can create a new Instance and restore from a backup is done on that instance. This will also be useful in cases where the original instance is expunged or unmanaged but the backup is still present.
Support for Dummy, NAS and Veeam Backup Providers will be provided for this feature.
When restoring a backup to a new instance, or restoring an expunged instance, the user might want to reuse the state and configuration of the original VM. The metadata can be classified into two types
Volume’s uuid, size, type and path are already stored in the backups table (backed_volumes : Backup.VolumeInfo). Remaining metadata can be added as well at the time of backup. And then during restore the fields can be auto-populated in the deploy VM form. The user can choose to use different settings or use the auto-populated ones.
createInstanceFromBackup extends deployVMCmd :
Parameters
backupId
Result: A new instance is created with the given config with all data volumes present in the backup.
New columns in the backups table
| Column | Type | Description |
|---|---|---|
| template_id | varchar(40) | template |
| computeoffering_uuid | varchar(40) | compute offering of the instance |
| network_uuids | text | list of attached network uuids |
| ip_addresses | text | list of ip addresses corresponding to the networks. |
...
...
...