Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Pre-requisite: EWC - OpenStack Command-Line client

Table of Contents

Foreword

OpenStack recognises two types of resources on their clouds:

...

Warning
The restoration of backups or snapshots of VMs  must be run outside from said VMs, specially in the case of in-place restoration, as the existing resource is completely replaced.

Restoration of VMs

Instance Snapshots
Anchor
RestoreInstanceSnapshots
RestoreInstanceSnapshots

Image-backed instances

Info

All instances on EUMETSAT accounts are volume-backed. If you have an EUMETSAT tenancy see the information on volume-backed instances below.

In-place restoration of VM snapshots that are image-backed can be performed with OpenStack by replacing the underlying disk of an existing VM with an image. In this way it is not necessary to create a new VM instance, but rather replace an existing one. This can be achieved by running:

openstack server rebuild <instance> --image <image_snapshot>

where

  • <instance> : The name or id of the existing VM
  • <image_snapshot> : Name or id of the snapshot image of the VM previously created

Instead of performing an in-place restoration, it is possible to create a new VM using the image snapshot. This is done in the same manner as for creating a new instance, see EWC OpenStack API access - How to create a VM using the OpenStack CLI,  using the command

openstack server create --flavor <flavor_name> --image <image_snapshot> --key-name <keyname> --network <network_name> --security-group <security_group_name> <vm_name>

where here the <image_name> is the name or id of the image snapshot. It is worth noting that the image snapshot does not contain information about the flavor, networks or security groups, and therefore these need to be manually provided. Restoring a snapshot onto a flavor of smaller size than the original will result in a failure.

Info
An important consequence of restoring a VM in this manner,  either in-place or not, is that the image snapshot becomes the underlying image of the VM, instead of the original, e.g. Ubuntu or Rocky OS, and therefore the image can no longer be removed from the list of images available in the cloud.

Volume-backed instances

In-place restoration of VM snapshots that are volume-backed cannot be done easily, as the root volumes cannot be detached from the VM while it exists. So full in-place restoration is not possible. The closest alternative is to delete the VM, restore the root disk, and then recreate the VM with the newly restored volume. In order to do that first delete the VM (make sure to store the configuration details first) with

...

and then create a new instance with the volume as its root, as above.

Instance Backups
Anchor
RestoreInstanceBackups
RestoreInstanceBackups

Image-backed instances

Restoring an image-backed instance from a backup follows the same steps as restoring it from a snapshot, since both are stored as images. 

Volume-backed instances

As above, full in-place restoration of volume-backed VMs is not possible, but the closest approach is to delete the VM and then restore the backup of the root volume. This can be done, either to replace an existing volume (with --force ) or onto a new one, with

...

and afterwards, rebuild the instance as specified above.

Restoration of Volumes

Volume Snapshots
Anchor
RestoreVolumeSnapshots
RestoreVolumeSnapshots

In-place restoration of volume snapshots can be performed with OpenStack by replacing the root disk of an existing VM with an snapshot.

...

with <snapshot> the name or id of the snapshot to restore, and <volume_name> the name of the new volume.

Volume Backups
Anchor
RestoreVolumeBackups
RestoreVolumeBackups

The restoration of a volume backup can also be done in-place, or by creating a new volume. Irrespective of the method, one can restore a volume backup with the command

...

In the case of an in-place restoration, it is necessary to detach the volume first and reattach it after the restoration. Detaching and reattaching the volume to an instance can be done in the same way as for Volume Snapshots.

Common use cases

These is a list of common configurations of VMs and volumes in the cloud and the recommened procedure to restoring them

Single VM

The simplest way to restore a single VM is to restore it in-place from a snapshot or backup. To create a copy of the VM, one can restore the snapshot or backup to a new volume, and then launch an instance from that root volume.

Single VM and attached volume(s)

To restore a single VM and it's attached volumes, one must restore the instance itself (the root volume if volume-backed) and all other volumes separately, either from snapshots or backups. If restoring in place, it is necessary to detach all volumes from the VM beforehand, and reattach it later. And if restoring to new copies, specially the root volume of the VM if volume-backed, a new instance must be launched from the new root volume or image,  and then the rest of the volumes must be attached to it.

Single VM and multiple networks and/or security groups

The network configuration and security groups of VMs are not recorded when backing up the instance.  If one is interested in restoring this information, and has stored these values somehwere, e.g. by following the instructions in EWC - How to create backups from VMs, these can be restored simply by adding them to the VM as

...

for each <network> and <security_group> that one wants to restore to the <instance> .

Single VM and SFS

Shared File Services (SFS) cannot be backed up as they are distributed storage solutions that do not live in the same cloud. Thefore one can restore the VM as above, and then mount the SFS into the new VM. Remember that if restoring the VM in-place, the SFS device must be unmounted before restoring it.

...

An alternative to repeating all the steps here multiple times is to use the automation script below, where one can set up a configuration file detailing all the VMs and volumes to be restored, and run the script a single time.

Restore automation
Anchor
RestoreAutomation
RestoreAutomation

The multi-step procedure for restoring VMs can been performed in a single step using the script found in the repository

...