Shelving an instance

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.

Tip

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.

Getting ready

To shelve an instance, the following information is required:

  • The openstack command-line client
  • The openrc file containing appropriate credentials
  • The name or ID of the instance

How to do it…

To shelve an instance, the following commands are used:

  1. First, we check the status of the instance:
    openstack server show cookbook.test -c name -c status
    

    Ensure that your instance has status of ACTIVE:

    How to do it…
  2. To shelve the instance, issue the following command:
    openstack server shelve cookbook.test
    

    Tip

    This command produces no output when successful. Shelving an instance may take a few moments depending on your environment.

  3. To check the status of the instance, issue the following command, noting the new status:
    openstack server show cookbook.test -c name -c addresses -c status
    

    The status value has changed to SHELVED_OFFLOADED:

    How to do it…

    Tip

    A shelved instance will retain the addresses it has been assigned.

  4. To unshelve the instance and return it back to an ACTIVE state, simply issue the following command:
    openstack server unshelve cookbook.test
    

    Tip

    This command produces no output when successful. As with shelving, the instance may take a few moments to become active, depending on your environment.

  5. We can verify the state by checking the status:
    openstack server show cookbook.test -c name -c addresses -c status
    

    The status value has returned to ACTIVE:

    How to do it…

How it works…

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.

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

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