Instance ssh access

asked 2015-04-13 13:16:07 -0500

I159 gravatar image

I'm building my small cmd wrapper around Cinder and Nova clients. I'm using Devstack to deploy OpenStack. I want to have ability to connect via ssh to an instance from a host machine using paramico:

ip_addr = instance.addresses['private'][1]['addr'] # This network exists in 'private' section even I created it as public.
client = paramico.client.SSHClient()  
client.load_system_host_keys()
client.connect(ip_addr)

I have added a floating ip to an instance before I tried to connect to the instance:

self.instance = self.nov_client.servers.create(      
    'inst1',                                     
    self.nov_client.images.find(                 
        name='cirros-0.3.2-x86_64-uec-kernel'),  
    self.nov_client.flavors.find(name='m1.nano'))
self.f_ip = self.nov_client.floating_ips.create('public')
self.instance.add_floating_ip(self.f_ip)

What should I do to enable ssh access to an instance?

edit retag flag offensive close merge delete

Comments

1

Add a rule to allow SSH in the security group

nova secgroup-add-rule default tcp 22 22 0.0.0.0/0
Eduardo Gonzalez gravatar imageEduardo Gonzalez ( 2015-04-14 01:38:28 -0500 )edit