'Shelve an instance.
This should be used when you want to take a snapshot of the instance.
It also adds system_metadata that can be used by a periodic task to
offload the shelved instance after a period of time.
:param context: request context
:param instance: an Instance object
:param image_id: an image id to snapshot to.
:param clean_shutdown: give the GuestOS a chance to stop'

@wrap_exception()
@reverts_task_state
@wrap_instance_event(prefix='compute')
@wrap_instance_fault
def shelve_instance(self, context, instance, image_id, clean_shutdown):

    @utils.synchronized(instance.uuid)
    def do_shelve_instance():
        self._shelve_instance(context, instance, image_id, clean_shutdown)
    do_shelve_instance()
