'Lock a server instance.'

@wsgi.response(202)
@extensions.expected_errors(404)
@wsgi.action('lock')
def _lock(self, req, id, body):

    context = req.environ['nova.context']
    instance = common.get_instance(self.compute_api, context, id)
    context.can((ls_policies.POLICY_ROOT % 'lock'), target={'user_id': instance.user_id, 'project_id': instance.project_id})
    self.compute_api.lock(context, instance)
