fix rackconnect v3 implementation

This commit is contained in:
Daniel Wallace 2015-02-07 20:35:33 -06:00 committed by rallytime
parent 9a1a2db3aa
commit bbab6235e0
2 changed files with 31 additions and 9 deletions

View File

@ -610,13 +610,26 @@ def create(vm_):
# Still not running, trigger another iteration
return
rackconnectv3 = config.get_cloud_config_value(
'rackconnectv3', vm_, __opts__, default='False',
search_global=False
)
if rackconnectv3:
networkname = rackconnectv3
for network in node['addresses'].get(networkname, []):
if network['version'] is 4:
node['extra']['access_ip'] = network['addr']
break
vm_['rackconnect'] = True
if rackconnect(vm_) is True:
extra = node.get('extra', {})
rc_status = extra.get('metadata', {}).get(
'rackconnect_automation_status', '')
access_ip = extra.get('access_ip', '')
if rc_status != 'DEPLOYED':
if rc_status != 'DEPLOYED' and not rackconnectv3:
log.debug('Waiting for Rackconnect automation to complete')
return
@ -663,7 +676,7 @@ def create(vm_):
result.append(private_ip)
if rackconnect(vm_) is True:
if ssh_interface(vm_) != 'private_ips':
if ssh_interface(vm_) != 'private_ips' or rackconnectv3:
data.public_ips = access_ip
return data

View File

@ -57,13 +57,22 @@ class NovaServer(object):
'access_ip': server['accessIPv4']
}
if 'addresses' in server and 'public' in server['addresses']:
self.public_ips = [
ip['addr'] for ip in server['addresses']['public']
]
self.private_ips = [
ip['addr'] for ip in server['addresses']['private']
]
if 'addresses' in server:
if 'public' in server['addresses']:
self.public_ips = [
ip['addr'] for ip in server['addresses']['public']
]
else:
self.public_ips = []
if 'private' in server['addresses']:
self.private_ips = [
ip['addr'] for ip in server['addresses']['private']
]
else:
self.private_ips = []
self.addresses = server['addresses']
if password:
self.extra['password'] = password