Somewhat unique to OpenStack Nova is the ability to shelve an instance. Instance shelving allows you to stop an instance without having it consume resources. A shelved instance will be retained as a bootable instance, as well as its resources assigned such as IP address, for a configurable amount of time, then deleted. This is useful as part of an instance life cycle process or to conserve resources.
Stopping versus shelving?
Stopping an instance does not free up the amount of resources still available as part of your quota as the assumption is that you will be starting that instance back up again after a short period of time. You would not be able to start a stopped instance if you didn't have any free CPUs or GBs of RAM left of your assigned quota. A stopped instance's resources are still considered used resources to the OpenStack Compute scheduler.
Shelving, however, frees up these resources, but still allows you, at a later date, to access the shelved instance. Quota rules and restrictions still apply when unshelving an instance, but shelving an instance will allow you to work within your allotted resource quotas while preserving your instance data.
To shelve an instance, the following information is required:
openstack
command-line clientopenrc
file containing appropriate credentialsTo shelve an instance, the following commands are used:
openstack server show cookbook.test -c name -c status
Ensure that your instance has status
of ACTIVE
:
openstack server shelve cookbook.test
openstack server show cookbook.test -c name -c addresses -c status
The status
value has changed to SHELVED_OFFLOADED
:
ACTIVE
state, simply issue the following command:openstack server unshelve cookbook.test
openstack server show cookbook.test -c name -c addresses -c status
The status
value has returned to ACTIVE
:
When told to shelve an instance, OpenStack Compute will first stop the instance. It then creates an instance snapshot to retain the state of the instance. The runtime details, such as number of vCPUs, memory, and IP addresses, are retained so that the instance can be unshelved and rescheduled at a later time.
This differs from shutting down an instance, in that the resources of a shutdown instance are still reserved on the host on which it resided, so that it can be powered back on quickly. A shelved instance however, will still show in openstack server list
, while the resources that were assigned will remain available. Additionally, as the shelved instance will need to be restored from an image, OpenStack Compute will perform placement as if the instance were new, and starting it will take some time.
18.219.220.22