You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Problem Statement

A. Ability to restore a backup to a new Instance.

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.

B. Ability to restore a backup to another zone in the same or in a different CloudStack deployment.

The above functionality can be extended to allow a backup to be restored to another zone in the same or in a different CloudStack deployment.

Prerequisite: The backup repository need to be connected to both the zones. The backup provider need to be configured as a backup offering in the restore Zone as well.

The restore Zone will not have the backup entry in the backups table. So this will be done in two steps:

  1. Import backup using the backup external id : This will get the metadata from the backup repository and create a new backup entry in the backups table
  2. Restore backup to a new instance : By reusing part A. of this feature.

Design

Metadata

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

  1. Instance metadata
    1. networks
    2. ip addresses
    3. compute offering
    4. host
  2. Volume metadata
    1. uuid
    2. size
    3. type
    4. path
    5. disk offering

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.

When restoring to different zone, the database entry might not be present. Most of these settings are irrelevant anyways on a new zone. It can be argued that only the volume uuid, size, type and path are required. A new entry in the backupstable containing the volume metadata can be created by getting the information directly from the backup repository during Import Backup. And then actual restore can be done to a new Instance.

Getting volume metadata from the backup provider

Volume metadata can be queried in Veeam using the /api/v1/vmRestorePoints/{restorePointId}/disks api.

On NAS provider qemu-img info /path/to/disk.qcow2 can be done to get the same.

A new method in the backup provider plugin needs to be written to populate Backup.VolumeInfo from backup external id.

API changes

New Apis

  1. ImportBackup (Only for cross zone restore) :

    Parameters

    1. backupExternalId
    2. backupOffering
    3. zoneId
    4. accountName
    5. domainId
    6. projectId

    Result: Creates a database entry in the backups table with the backed up volume metadata.


  2. restoreBackupToNewInstance :

    Parameters

    1. backupId

    2. zoneId

    3. name

    4. hostId

    5. displayName

    6. accountName

    7. domainId

    8. projectId

    9. networkIds

    10. ip addresses

    11. computeOffering

    12. diskOfferings (for all volumes in the backed up volume list)
      Note : Ensure that volume size should not be less than the backed up volume virtual size

    Result: A new instance is created with the given config with all data volumes present in the backup.

Schema Changes

  1. New columns in the backups table

    ColumnTypeDescription
    host_namevarchar(255)last host name of the instance
    computeoffering_uuidvarchar(40)compute offering of the instance
    network_uuidstextlist of attached network uuids
    ip_addressestextlist of ip addresses corresponding to the networks.

    In addition, the backed_volumes column will also store the diskoffering_uuid for each volume.

  • No labels