hello everyone:<br><br>i have a very simple question which confuses me for a long time:<br>how should i add a network to a project via rest api?<br><br>1) i'm admin of the whole cloud env essex, (i think the folsom is same in this case)<br>
2) using nova-network:vlan (if using flatdhcp, the associate action is meanless)<br>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)<br>
4) a network "user-network" is created, but not associated with "user-project"<br>5) how to associate the "user-network" with "user-project" ?<br><br>i know i can use "nova-manage" via nova-client in the control node, <br>
but what i need to know is how to do this operation via rest api, like curl or in horizon?<br><br>the rest api is: <a href="http://api.openstack.org/api-ref.html">http://api.openstack.org/api-ref.html</a><br><div class="span1">
<span class="label success">POST</span></div>
                        <div class="span5">v2/{tenant_id}/os-networks/add <br>with a body identifier the network's id<br><br>the problem is that, even i have admin:admin token, i *cannot* associate the "user-network" with "user-project", <br>
because from the source code of folsom(and essex) nova, in the <a href="http://nova.api.openstack.wsgi.py">nova.api.openstack.wsgi.py</a> of line 931, i find this:<br></div><div class="line" id="LC931"><span class="n"><br>
        project_id</span> <span class="o">=</span> <span class="n">action_args</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s">"project_id"</span><span class="p">,</span> <span class="bp">None</span><span class="p">)</span></div>
<div class="line" id="LC932">        <span class="n">context</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'nova.context'</span><span class="p">)</span></div>
<div class="line" id="LC933">        <span class="k">if</span> <span class="p">(</span><span class="n">context</span> <span class="ow">and</span> <span class="n">project_id</span> <span class="ow">and</span> <span class="p">(</span><span class="n">project_id</span> <span class="o">!=</span> <span class="n">context</span><span class="o">.</span><span class="n">project_id</span><span class="p">)):</span></div>
<div class="line" id="LC934">            <span class="n">msg</span> <span class="o">=</span> <span class="n">_</span><span class="p">(</span><span class="s">"Malformed request url"</span><span class="p">)</span></div>
<div class="line" id="LC935">            <span class="k">return</span> <span class="n">Fault</span><span class="p">(</span><span class="n">webob</span><span class="o">.</span><span class="n">exc</span><span class="o">.</span><span class="n">HTTPBadRequest</span><span class="p">(</span><span class="n">explanation</span><span class="o">=</span><span class="n">msg</span><span class="p">))<br>
<br>since nova.context.project_id is the project admin_id, and the project_id is extract from the url, <br>so the webob.exc is returned.<br><br>please help me, i read a lot, (both document and source code, i just cannot understand or just miss something important)<br>
but still don't know how to do it.<br></span></div><br>ps: i have sent a mail to openstack-dev on mar 8, but no one reply me. is my question nonsense?<br>Note this mail is not the exactly same as previous one since i've more knowledge of it but the main problem is same<br>