'Permit admins to reset networking on a server.'

@wsgi.response(202)
@extensions.expected_errors((404, 409))
@wsgi.action('resetNetwork')
def _reset_network(self, req, id, body):

    context = req.environ['nova.context']
    context.can((aa_policies.POLICY_ROOT % 'reset_network'))
    instance = common.get_instance(self.compute_api, context, id)
    try:
        self.compute_api.reset_network(context, instance)
    except exception.InstanceUnknownCell as e:
        raise exc.HTTPNotFound(explanation=e.format_message())
    except exception.InstanceIsLocked as e:
        raise exc.HTTPConflict(explanation=e.format_message())
