I tried to spawn a cirros instance using nova python client with below api call,
server = nova.servers.create(name = "cirros_vm",
image = image.id,
flavor = flavor.id )
I am getting the following error:
novaclient.exceptions.BadRequest: Multiple possible networks
found, use a Network ID to be more specific. (HTTP 400)
(Request-ID: req-c3aba1d2-23e9-4751-badc-60142286232e)
This is because I an having multiple networks inside my tenant.The help documentation shows that the optional nics
argument should be used.
:param nics: (optional extension) an ordered list of nics to be
added to this server, with information about
connected networks, fixed ips, port etc.
But I am not able to figure out how to pass network ids to this api. When I give network ids as an ordered list,
server = nova.servers.create(name = "api_cir_test",
image = image.id,
flavor = flavor.id,
nics=[ network1.id, network2.id])
I am getting the following error:
AttributeError: 'unicode' object has no attribute 'get'
Below are the details of variables used:
nova is an object of Client in module novaclient.v1_1.client
image = nova.images.find(name="cirros")
flavor =nova.flavors.find(name="m1.small")
network =nova.networks.find(label="test_net")