Merge "Fix Octavia fault tests timeouts when SSH"
This commit is contained in:
commit
74538a904c
|
@ -54,6 +54,7 @@ TimeoutException = _exceptions.TimeoutException
|
|||
OctaviaClientException = _exceptions.OctaviaClientException
|
||||
RoundRobinException = _exceptions.RoundRobinException
|
||||
TrafficTimeoutError = _exceptions.TrafficTimeoutError
|
||||
AmphoraMgmtPortNotFound = _exceptions.AmphoraMgmtPortNotFound
|
||||
|
||||
# Constants
|
||||
PROVISIONING_STATUS = _constants.PROVISIONING_STATUS
|
||||
|
|
|
@ -37,3 +37,7 @@ class RoundRobinException(tobiko.TobikoException):
|
|||
|
||||
class TrafficTimeoutError(tobiko.TobikoException):
|
||||
message = "Traffic timeout error: {reason}"
|
||||
|
||||
|
||||
class AmphoraMgmtPortNotFound(tobiko.TobikoException):
|
||||
message = "Amphora's network management port was not found: {reason}"
|
||||
|
|
|
@ -261,6 +261,28 @@ class HttpRoundRobinAmphoraIpv4Listener(heat.HeatStackFixture):
|
|||
username='cloud-user',
|
||||
connection_timeout=10)
|
||||
|
||||
@property
|
||||
def amphora_mgmt_port(self) -> neutron.PortType:
|
||||
""" Get amphora's management network's port
|
||||
|
||||
Attaching a floating ip to the amphora's management port will allow
|
||||
SSHing the amphora.
|
||||
Disabling the amphora's management port will cause a failover.
|
||||
"""
|
||||
# Calling self.amphora in a loop would decrease performance
|
||||
amphora = self.amphora
|
||||
|
||||
for port in neutron.list_ports():
|
||||
for fixed_ip in port['fixed_ips']:
|
||||
if fixed_ip['ip_address'] == amphora['lb_network_ip']:
|
||||
return port
|
||||
|
||||
# This should never happen
|
||||
raise octavia.AmphoraMgmtPortNotFound(
|
||||
reason='Could not find the Network Managment Port of'
|
||||
' amphora {amphora}'.
|
||||
format(amphora=amphora['id']))
|
||||
|
||||
|
||||
class HttpRoundRobinAmphoraIpv6Listener(HttpRoundRobinAmphoraIpv4Listener):
|
||||
ip_version = 6
|
||||
|
|
|
@ -20,6 +20,7 @@ from oslo_log import log
|
|||
import tobiko
|
||||
from tobiko.openstack import keystone
|
||||
from tobiko.openstack import octavia
|
||||
from tobiko.openstack import neutron
|
||||
from tobiko.openstack import stacks
|
||||
from tobiko.shell import ssh
|
||||
from tobiko.shell import sh
|
||||
|
@ -140,6 +141,8 @@ class OctaviaBasicFaultTest(testtools.TestCase):
|
|||
if attempt.is_last:
|
||||
raise
|
||||
|
||||
self._plug_new_amphora_to_existing_fip()
|
||||
|
||||
def test_kill_amphora_agent(self):
|
||||
"""Kill the MASTER amphora agent
|
||||
|
||||
|
@ -229,3 +232,11 @@ class OctaviaBasicFaultTest(testtools.TestCase):
|
|||
lb_algorithm=self.listener_stack.lb_algorithm,
|
||||
protocol=self.listener_stack.lb_protocol,
|
||||
port=self.listener_stack.lb_port)
|
||||
|
||||
self._plug_new_amphora_to_existing_fip()
|
||||
|
||||
def _plug_new_amphora_to_existing_fip(self):
|
||||
old_amphora_fip = self.listener_stack.amphora_floating_ip
|
||||
amphora_mgmt_port = self.listener_stack.amphora_mgmt_port
|
||||
neutron.update_floating_ip(floating_ip=old_amphora_fip['id'],
|
||||
port_id=amphora_mgmt_port['id'])
|
||||
|
|
Loading…
Reference in New Issue