Fix compability issue for adding floating ip to VM
Change-Id: I4dd7603f044499185c5d870f4dc7771c8fdf6769
This commit is contained in:
parent
1d7e405274
commit
de38fad996
@ -35,17 +35,18 @@ class KBGetExtNetException(Exception):
|
|||||||
class KBGetProvNetException(Exception):
|
class KBGetProvNetException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def create_floating_ip(neutron_client, ext_net):
|
def create_floating_ip(neutron_client, ext_net, port_id):
|
||||||
"""
|
"""
|
||||||
Function that creates a floating ip and returns it
|
Function that creates a floating ip and returns it
|
||||||
Accepts the neutron client and ext_net
|
Accepts the neutron client, ext_net, and port_id
|
||||||
|
|
||||||
Module level function since this is not associated with a
|
Module level function since this is not associated with a
|
||||||
specific network instance
|
specific network instance
|
||||||
"""
|
"""
|
||||||
body = {
|
body = {
|
||||||
"floatingip": {
|
"floatingip": {
|
||||||
"floating_network_id": ext_net['id']
|
"floating_network_id": ext_net['id'],
|
||||||
|
"port_id": port_id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fip = neutron_client.create_floatingip(body)
|
fip = neutron_client.create_floatingip(body)
|
||||||
|
@ -62,7 +62,7 @@ vm_creation_concurrency: 5
|
|||||||
public_key_file:
|
public_key_file:
|
||||||
|
|
||||||
# Name of Provider network used for multicast tests or storage tests.
|
# Name of Provider network used for multicast tests or storage tests.
|
||||||
provider_network_name:
|
provider_network:
|
||||||
|
|
||||||
# TSDB connectors are optional and can be used to retrieve CPU usage information and attach them
|
# TSDB connectors are optional and can be used to retrieve CPU usage information and attach them
|
||||||
# to the results.
|
# to the results.
|
||||||
|
@ -255,20 +255,16 @@ class Kloud(object):
|
|||||||
instance.fip = None
|
instance.fip = None
|
||||||
elif instance.vm_name == "KB-PROXY" and not u_fip and not self.multicast_mode:
|
elif instance.vm_name == "KB-PROXY" and not u_fip and not self.multicast_mode:
|
||||||
neutron_client = instance.network.router.user.neutron_client
|
neutron_client = instance.network.router.user.neutron_client
|
||||||
external_network = base_network.find_external_network(neutron_client)
|
ext_net = base_network.find_external_network(neutron_client)
|
||||||
instance.fip = base_network.create_floating_ip(neutron_client, external_network)
|
port_id = instance.instance.interface_list()[0].id
|
||||||
|
# Associate the floating ip with this instance
|
||||||
|
instance.fip = base_network.create_floating_ip(neutron_client, ext_net, port_id)
|
||||||
instance.fip_ip = instance.fip['floatingip']['floating_ip_address']
|
instance.fip_ip = instance.fip['floatingip']['floating_ip_address']
|
||||||
self.res_logger.log('floating_ips',
|
self.res_logger.log('floating_ips',
|
||||||
instance.fip['floatingip']['floating_ip_address'],
|
instance.fip['floatingip']['floating_ip_address'],
|
||||||
instance.fip['floatingip']['id'])
|
instance.fip['floatingip']['id'])
|
||||||
|
|
||||||
if instance.fip:
|
instance.ssh_ip = instance.fip_ip if instance.fip else instance.fixed_ip
|
||||||
# Associate the floating ip with this instance
|
|
||||||
instance.instance.add_floating_ip(instance.fip_ip)
|
|
||||||
instance.ssh_ip = instance.fip_ip
|
|
||||||
else:
|
|
||||||
# Store the fixed ip as ssh ip since there is no floating ip
|
|
||||||
instance.ssh_ip = instance.fixed_ip
|
|
||||||
|
|
||||||
if not instance.vm_name == "KB-PROXY" and self.multicast_mode:
|
if not instance.vm_name == "KB-PROXY" and self.multicast_mode:
|
||||||
nc = instance.network.router.user.neutron_client
|
nc = instance.network.router.user.neutron_client
|
||||||
|
@ -146,7 +146,7 @@ class User(object):
|
|||||||
if self.tenant.kloud.multicast_mode or (
|
if self.tenant.kloud.multicast_mode or (
|
||||||
self.tenant.kloud.storage_mode and config_scale.provider_network):
|
self.tenant.kloud.storage_mode and config_scale.provider_network):
|
||||||
router_instance = base_network.Router(
|
router_instance = base_network.Router(
|
||||||
self, provider_network=config_scale.provider_network_name)
|
self, provider_network=config_scale.provider_network)
|
||||||
self.router_list.append(router_instance)
|
self.router_list.append(router_instance)
|
||||||
router_instance.create_network_resources(config_scale)
|
router_instance.create_network_resources(config_scale)
|
||||||
else:
|
else:
|
||||||
|
@ -7,7 +7,7 @@ hacking<0.11,>=0.10.0
|
|||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
discover
|
discover
|
||||||
python-subunit>=0.0.18
|
python-subunit>=0.0.18
|
||||||
sphinx>=1.4.0
|
sphinx>=1.4.0,<2.0
|
||||||
sphinx_rtd_theme>=0.1.9
|
sphinx_rtd_theme>=0.1.9
|
||||||
oslosphinx>=2.5.0 # Apache-2.0
|
oslosphinx>=2.5.0 # Apache-2.0
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user