'Suspend the given instance.'

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

    context = context.elevated()
    instance.system_metadata['old_vm_state'] = instance.vm_state
    self._notify_about_instance_usage(context, instance, 'suspend.start')
    compute_utils.notify_about_instance_action(context, instance, self.host, action=fields.NotificationAction.SUSPEND, phase=fields.NotificationPhase.START)
    with self._error_out_instance_on_exception(context, instance, instance_state=instance.vm_state):
        self.driver.suspend(context, instance)
    instance.power_state = self._get_power_state(context, instance)
    instance.vm_state = vm_states.SUSPENDED
    instance.task_state = None
    instance.save(expected_task_state=task_states.SUSPENDING)
    self._notify_about_instance_usage(context, instance, 'suspend.end')
    compute_utils.notify_about_instance_action(context, instance, self.host, action=fields.NotificationAction.SUSPEND, phase=fields.NotificationPhase.END)
