The cc-snapshot utility
Overview
The cc-snapshot utility implements snapshotting a bare metal instance from
command line and uploads it to Glance, so that it can be immediately
used to boot a new bare metal instance. The snapshot images created with this
tool are whole disk images.
For ease of use, cc-snapshot has been installed in all the appliances
supported by the Chameleon project. If you would like to use it in a different
setting, it can be downloaded and installed from the github repository.
Tip
cc-snapshot is also a useful tool for preserving an instance before it
expires. See the Tips and Tricks post Extending Your Research Artifacts’
Lifespan
for how default resource retention periods work and other ways to extend
them.
Note
As of the vendordata authentication changes,
cc-snapshot no longer reads credentials from vendordata. You must have
OpenStack credentials in your environment first — for example by running
ccauth openrc --output ~/openrc && source ~/openrc — and then run
cc-snapshot with sudo -E so root inherits them.
To make a snapshot of a bare metal instance, run the following command from inside the instance:
sudo -E cc-snapshot <image_name>
Tip
You may get warnings, such as “image too large”, during snapshotting, and get prompted to confirm. If you are confident about what you are trying to do, you can skip all warnings by using the -f flag.
sudo -E cc-snapshot -f <image_name>
In addition, you can exclude directories by using the -e flag.
sudo -E cc-snapshot -e <dir1> -e <dir2> <image_name>
You can use the faster zstd compression (default is zlib) by using the -z flag. Note that
launching images compressed with zstd won’t work on sites running OpenStack Xena or earlier.
All core sites like CHI@UC and CHI@TACC are up-to-date, but some associate sites, such as
CHI@NU, may fail to launch new instances with a zstd compressed image. If you are using an
associate site, we suggest checking that you can launch a new instance with the image from
your snapshot. You can check the compression type of an image by running
openstack image show <image_uuid> and checking the “compression_type” property. Images
set to zstd are using the new method, and images without a compression_type property
or with it set to zlib are using the old method.
sudo -E cc-snapshot -z <image_name>
To see all available options for cc-snapshot, run sudo -E cc-snapshot -h.
Tip
See Changes to automatic credential setup on instances for how to generate credentials with
ccauth or the The OpenStack RC script before running cc-snapshot.
Note
When using the cc-snapshot, it will create an image within your project with the shared visibility. Anyone with access to your project can access this image.
Note
If you choose an Image name that already exists, the previous one will not be overwritten. A new Image with the same name but a different UUID will be generated.
Note
If you install a custom kernel, make sure the size of your running kernel (/lib/modules/<kernel_version>) is less than 4GB. To find out which kernel version you’re running, run uname -r.
Updating cc-snapshot
Error
If you receive the following error:
public endpoint for image service in regionOne not found Unable to contact Glance, check username and password
it means that you have an outdated copy of cc-snapshot and you will need to update cc-snapshot.
This usually happens when you use an older images that contains an outdated version of cc-snapshot.
You may also want to get new functionalities added to the latest version of cc-snapshot.
Run the following commands from your instance:
curl -O https://raw.githubusercontent.com/ChameleonCloud/cc-snapshot/master/cc-snapshot
sudo mv cc-snapshot /usr/bin/
sudo chmod +x /usr/bin/cc-snapshot