Using image snapshots

In OpenStack, a snapshot is an image that reflects the state of an instance at a point in time. Snapshots are often used to backup instances or migrate instances from one cloud to another, and can even be shared with other projects like regular images.

Creating snapshots

Snapshots in OpenStack can be created using the openstack server image create command.

Getting ready

When creating a snapshot, ensure that you are authenticated as an administrator or are the owner of the instance. You will need the following details:

  • Instance name or ID
  • Image name

For our example, the following will be used:

  • Instance name: COOKBOOK_TEST_INSTANCE
  • Image: COOKBOOK_TEST_SNAPSHOT_20170824

How to do it…

With the OpenStack client installed on our system, we are now able to create a snapshot with the following command:

openstack server image create 
--name COOKBOOK_TEST_SNAPSHOT_20171016 
COOKBOOK_TEST_INSTANCE

The output will resemble the following:

How to do it…

How it works…

Images snapshots are created with the following syntax:

openstack server image create [--name <image-name>] 
[--wait] 
<server>

The creation of a snapshot results in the system writing the instance's disk to a temporary file on the compute node and uploading it to the OpenStack Image service as a new image. When an instance's disk is located on a Ceph backend, the snapshot occurs on the backend itself and the compute node filesystem is not involved. The resulting snapshot/image can then be used to boot new instances within the same cloud, or it can be downloaded and copied to an offline storage system or another cloud.

The name parameter defines the name of the image when stored in the image repository.

The <server> parameter defines the name or ID of the instance from which the snapshot is taken.

When specified, the --wait option forces OpenStack to perform the snapshot in the foreground, meaning the CLI will be unavailable until the task is complete.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.128.255.24