← Back to team overview

openstack team mailing list archive

[nova-network] add-network-to-project

 

hello everyone:

i have a very simple question which confuses me for a long time:
how should i add a network to a project via rest api?

1) i'm admin of the whole cloud env essex, (i think the folsom is same in
this case)
2) using nova-network:vlan (if using flatdhcp, the associate action is
meanless)
3) a user project "user-project" is created, and the admin:admin is not
that project's admin (and even not a member of it)
4) a network "user-network" is created, but not associated with
"user-project"
5) how to associate the "user-network" with "user-project" ?

i know i can use "nova-manage" via nova-client in the control node,
but what i need to know is how to do this operation via rest api, like curl
or in horizon?

the rest api is: http://api.openstack.org/api-ref.html
POST
v2/{tenant_id}/os-networks/add
with a body identifier the network's id

the problem is that, even i have admin:admin token, i *cannot* associate
the "user-network" with "user-project",
because from the source code of folsom(and essex) nova, in the
nova.api.openstack.wsgi.py of line 931, i find this:

        project_id = action_args.pop("project_id", None)
        context = request.environ.get('nova.context')
        if (context and project_id and (project_id != context.project_id)):
            msg = _("Malformed request url")
            return Fault(webob.exc.HTTPBadRequest(explanation=msg))

since nova.context.project_id is the project admin_id, and the project_id
is extract from the url,
so the webob.exc is returned.

please help me, i read a lot, (both document and source code, i just cannot
understand or just miss something important)
but still don't know how to do it.

ps: i have sent a mail to openstack-dev on mar 8, but no one reply me. is
my question nonsense?
Note this mail is not the exactly same as previous one since i've more
knowledge of it but the main problem is same

Follow ups