Skip to end of metadata
Go to start of metadata

When you have created a custom workflow or configuration on the API side, you can create a snapshot for your own use. In OpenStack, an instance snapshot is an image. The only difference between an image that has been uploaded directly to glance and an image you create by snapshot is that an image created by snapshot has additional properties in the glance database and defaults to being private.

You can create an snapshot from a running server instance, but if you want to preserve data, you must shut down the source VM and verify the instance status is SHUTOFF before creating the snapshot. 

Before creating the snapshot and/or image, you'll want to make sure that cloudinit is installed on your instance as well as qemu-guest-agent

To create the snapshot from the command line:

openstack server image create --name snapshot-image-name instance-name

(e.g. openstack server image create --name MyCustomCentos7Image-Feb-7-2017 my-CentOS7-instance)

Snapshots won't show in Horizon (this has been submitted as a bug and may be fixed real soon now) but for now, to make it visible you'll need to export it and bring it back as a Glance image. If you just plan to use this within your project and from the command line only, the rest of the steps aren't necessary. 

openstack image save --file whatever_file_name_you_like.raw UID

(e.g. openstack image save --file c7custom-image.raw 569677d8-c7b0-4606-86d8-7673a5ecd5cf )

Then bring it into Glance - e.g.

openstack image create --public --disk-format raw --container-format bare --property skip_atmosphere=yes --property hw_disk_bus=scsi --property hw_scsi_model=virtio-scsi --property hw_qemu_guest_agent=yes --property os_require_quiesce=yes --file c7custom-image.raw My-Custom-Image-Name

There are a lot of metadata tags there but those are important to insure that your instances will create properly from the stored image. You definitely want to make sure you get them all.



Boot the new image. Test it. Make sure it works. 
Do this before deleting. Please. Once it's gone, it's really gone. Be sure. 

Delete your snapshot if you no longer need it. For example:

openstack image delete 569677d8-c7b0-4606-86d8-7673a5ecd5cf

  • No labels