← Back to team overview

openstack team mailing list archive

Re: [Nova] Query regarding REST API for VM creation for any tenant

 

In nova source code for unit testing, i saw that you can specify networks
in following manner

{
"server": {
                "name": "new-server-test",
                "imageRef": "1",
                "flavorRef": "1",
                "networks": [
{"uuid": "<network-id of the first network"},
                             {"uuid": "<network-id of the second network"}
],
}
}
Will also do the test you mentioned, to confirm the same. Thanks!!

Anil


On Thu, Apr 11, 2013 at 1:38 AM, Vishvananda Ishaya
<vishvananda@xxxxxxxxx>wrote:

> Novaclient uses the rest api. Try running the command with --debug and it
> will show you the REST command it is using
>
> nova --debug boot --image ed8b2a37-5535-4a5f-a615-443513036d71
> --flavor 1
> --nic net-id= <id of first network>
> --nic net-id= <id of second network>  test-vm1
>
> Vish
>
> On Apr 10, 2013, at 12:50 PM, Anil Vishnoi <vishnoianil@xxxxxxxxx> wrote:
>
>
> Hi,
>
> To attach a VM to specific network (owned by same tenant) user can specify
> --nic option in the command line with the network-id to which VM needs to
> be attached
>
> --nic <net-id=net-uuid,v4-fixed-ip=ip-addr>
>                         Create a NIC on the server. Specify option multiple
>                         times to create multiple NICs. net-id: attach NIC
> to
>                         network with this UUID (optional) v4-fixed-ip: IPv4
>                         fixed address for NIC (optional). port-id: attach
> NIC
>                         to port with this UUID (optional)
>
> e.g
> nova boot --image ed8b2a37-5535-4a5f-a615-443513036d71
> --flavor 1
> --nic net-id= <id of first network>
>  --nic net-id= <id of second network>  test-vm1
>
> But looks like same can not be done using the REST API call.I didn't not
> find any key where i can provide the networks detail where VM need to be
> attached.
>
>
> {
>  "server" : {
>  "name" : "new-server-test",
>  "imageRef" : "http://servers.api.openstack.org/1234/images/52415800-8b69-
> 11e0-9b19-734f6f006e54",
>  "flavorRef" : "52415800-8b69-11e0-9b19-734f1195ff37",
>  "metadata" : {
>  "My Server Name" : "Apache1"
>  },
>  "personality" : [
>  {
>  "path" : "/etc/banner.txt",
>  "contents" : ""
>  }
>  ]
>  }
>  }
>
>  Does that mean we can't accomplish this using REST API? Or is there any
> alternate way we can accomplish this using REST?
>
> --
> Thanks
> Anil
>  _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>
>
>


-- 
Thanks
Anil

References