← Back to team overview

openstack team mailing list archive

Re: [OpenStack] Assigning specific networks while creating instances using nova REST API in Folsom - SOLVED

 

Looking in to
/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/servers.py gave
some insights and found that the API can take a parameter 'networks' as
shown below:

curl  -X 'POST'
http://1.1.1.1:8774/v2/4a8c3029619e4afbaa39f85fcd121003/servers -d '{
"server": { "flavorRef": "6", "imageRef":
"dd13a38c-3e1f-49f1-afbe-c6f62cd46ffb", "name": "test4", "*networks*": [{"*
uuid*": "02016649-f9a6-4623-b82f-f5a2c95d2b7a"}, {"*uuid*":
"4784ed46-7f09-4e57-b279-e65529442bd5"}] } }' -H 'Accept: application/json'
-H "X-Auth-Token: 7738bc36849f4b35bd4623e50b249ff3" -H 'Content-type:
application/json'

This associated the desired networks in the order specified, exactly what I
wanted.

Wish this has been documented. I'll file a documentation bug.

Regards,
Balu


On Thu, Mar 21, 2013 at 9:00 PM, Balamurugan V G <balamuruganvg@xxxxxxxxx>wrote:

> Hi,
>
> I have a Folsom 2012.2 with Quantum and trying to create the instances
> using the REST API as below:
>
> curl  -X 'POST'
> http://1.1.1.1:8774/v2/4a8c3029619e4afbaa39f85fcd121003/servers -d '{
> "server": { "flavorRef": "6", "imageRef":
> "dd13a38c-3e1f-49f1-afbe-c6f62cd46ffb", "name": "test" } }' -H 'Accept:
> application/json' -H "X-Auth-Token: 1b5f64418cdf4a99a79aada03621cfa9" -H
> 'Content-type: application/json'
>
> But this assigns the instance to all networks available for the tenant. So
> if I have multiple networks for a tenant, how do I assign the instance to
> specific networks. I am referring to the documentation at
> http://docs.openstack.org/api/openstack-compute/2/content/CreateServers.htmlbut do not see anything for this.
>
> I can achieve this using CLI but I need to use the REST API to achieve the
> same.
>
> Is this not implemented in Folsom? If so, would it be implemented in
> Grizzly?
>
> Thanks,
> Balu
>