pythonopenstackopenstack-novanovaclient

Cannot create openstack using noveclient python API


I am trying to create openstack instance using novaclient python API. I use following ccommand in Python

 nova.servers.create(name = "xxx", password="xxx", image = "b754996c-45dc-43d4-b2cb-47b6c10beca3",flavor = fl.id,network = "34c6cbf5-5647-4210-8979-67e0b3b1f88a" , key_name = "adikarikey")

I tried several ways and everything gives me a same exception

novaclient.exceptions.Forbidden: It is not allowed to create an interface on external network 0a80d06e-38c9-411d-badf-7a1dde2db2b5 (HTTP 403)

Note :I am not the admin user of the tenant of the openstack account.

What can be the reason for this ?

Regards, Malintha


Solution

  • I found the answer for this. You have to assign the network id and the private ip of the instance properly when you creating the instance. Following example is working for me

    nova.servers.create(name ="xxx",password="xxx",image="xxx",flavor=fl.id ,key_name = "adikarikey",nics = [{'net-id': 'xxx','v4-fixed-ip': ''}])
    

    Note: If you want to manually assign ip to this instance you can give it as v4-fixed-ip or you can leave that field empty to openstack to assign an ip.

    Thanks