

@extensions.expected_errors((400, 403))
@validation.schema(cloudpipe.create)
def create(self, req, body):
    "Create a new cloudpipe instance, if none exists.\n\n        Parameters: {cloudpipe: {'project_id': ''}}\n        "
    context = req.environ['nova.context']
    authorize(context)
    params = body.get('cloudpipe', {
        
    })
    project_id = params.get('project_id', context.project_id)
    context.project_id = project_id
    context.user_id = 'project-vpn'
    context.is_admin = False
    context.roles = []
    instance = self._get_cloudpipe_for_project(context)
    if (not instance):
        try:
            result = self.cloudpipe.launch_vpn_instance(context)
            instance = result[0][0]
        except exception.NoMoreNetworks:
            msg = _("Unable to claim IP for VPN instances, ensure it isn't running, and try again in a few minutes")
            raise exc.HTTPBadRequest(explanation=msg)
    return {
        'instance_id': instance.uuid,
    }

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/api/openstack/compute/cloudpipe.py CloudpipeController.create/original