Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Howto create VM though API with custom IP and MAC addresses?

Hello,

howto create VM through API with custom IP and MAC addresses?

I have juno release.

The first problem is I can't create VM though curl, I tryied

curl -i http://localhost:8774/v2/{tenant_id}/servers -X POST -H "X-Auth-Project-Id: admin" -H "Accept: application/json" -H "X-Auth-Token: {token_id}" -d '{"server": {"name": "instance1", "imageRef": "{image_id}", "key_name": "test1", "flavorRef": "2", "max_count": 1, "min_count": 1}}' HTTP/1.1 400 Bad Request Content-Length: 68 Content-Type: application/json; charset=UTF-8 X-Compute-Request-Id: req-e73f4f56-9bf9-4b6a-998e-21a09cde5ae1 Date: Thu, 22 Jan 2015 16:04:10 GMT

{"badRequest": {"message": "Unsupported Content-Type", "code": 400}}

curl -i 'http://localhost:8774/v2/{tenant_id}/servers' -X POST \

-H "Accept: application/json" -H "Content-Type: application/json" -H "X-Auth-Token: {token_id}"\ -d '{"server": {"name": "test", "imageRef": "{image_id}", "availability_zone": "nova", "flavorRef": "3", \ "max_count": 1, "min_count": 1, "networks": [{"fixed_ip": "{custom_ip}", "uuid": "{network_id}"}],\ "security_groups": [{"name": "default"}]}}' HTTP/1.1 400 Bad Request Content-Length: 66 Content-Type: application/json; charset=UTF-8 X-Compute-Request-Id: req-00a17355-06cd-4133-ac26-f890f2a2fc29 Date: Thu, 22 Jan 2015 16:04:24 GMT

{"badRequest": {"message": "Malformed request body", "code": 400}}

What I do wrong? How to create VM throught API with custom API and MAC addresses?