Ask Your Question
1

How to assign a floating IP using Openstack Python SDK and nova network?

asked 2016-02-14 17:22:35 -0600

Bart gravatar image

updated 2016-02-15 05:04:44 -0600

smaffulli gravatar image

Hi, I have been trying my hand at the OpenstackPythonSDK and could create an instance on a running Openstack deployment. This deployment only has nova-networking, no Neutron as this adds complexity that I do not need. Is there a way for me to assign a floating IP from the nova-network to my instance through the SDK or through an API? Thanks, Bart

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-15 06:29:43 -0600

dbaxps gravatar image

You can try this ( actually tested with Neutron )
http://dbaxps.blogspot.com/2016/02/py...

#!/usr/bin/env python
import os
import time
from novaclient.v2.client import Client
from credentials import get_nova_creds

# Assign floating IP for active instance

creds = get_nova_creds()
nova = Client(**creds)
nova.floating_ip_pools.list()
floating_ip = nova.floating_ips.create(nova.floating_ip_pools.list()[0].name)
instance = nova.servers.find(name="Ubuntu1510Devs")
instance.add_floating_ip(floating_ip)
edit flag offensive delete link more

Comments

Hi - thx for your quick answer - it has sent me along the right direction to get this working. I have changed my code to only rely on the Python nova-client, no ton the OpenstackPythonSDK. Regards, Bart.

Bart gravatar imageBart ( 2016-02-15 17:05:53 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2016-02-14 17:22:35 -0600

Seen: 1,365 times

Last updated: Feb 15 '16