nova quantum integration rest api to attach port to a vm

Asked by Ritesh Shetty on 2013-03-27

I have created a port using the /ports rest api
I am trying to send the port_id while provisioning using /servers, i want to know the REST API request body for doing so, i have searched extensively but haven't found any example

Is there a nova REST API sample for attaching the port_id ??

nova boot shows for examples but i need rest api

Question information

Language:
English Edit question
Status:
Solved
For:
neutron Edit question
Assignee:
No assignee Edit question
Solved by:
yong sheng gong
Solved:
2013-03-27
Last query:
2013-03-27
Last reply:
2013-03-27
Best yong sheng gong (gongysh) said : #1

the client command is:
nova boot --image xx --flavor 1 --nic port-id=<your portid> myserver
you can use nova --debug boot --image xx --flavor 1 --nic port-id=<your portid> myserver to watch what URL it is using.

Thanks yong sheng gong, that solved my question.

Here is the way to send the port while povisioning

{
    "server" : {
        "name" : "new-server-test",
        "imageRef" : "fa4284a0-bcc3-4256-b15f-1cd5e31f0695",
       "key_name" : "secondkeypair",
 "networks": [{"port": "93d4cbf7-c7a6-4a24-8f8b-5165adfd590a"}] ,
        "flavorRef":"1",
        "metadata" : {
            "My Server Name" : "Apache1"
        },
        "personality" : [
            {
                "path" : "/etc/banner.txt",
                "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6 b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
            }
        ]
    }
}