Move get_server_ip into tempest.common.compute
This will be required by the new wait_until={PINGABLE|SSHABLE} logic within the module so move this down from tempest.api.compute.base.BaseV2ComputeTest. A version of this is also present in tempest.scenario.manager however unifying that with this version is left for another change. Change-Id: Iddfdf48da58320844e265fb1209e25a53d501f93
This commit is contained in:
parent
1a76c2c1c5
commit
20556df7ab
|
@ -487,21 +487,8 @@ class BaseV2ComputeTest(api_version_utils.BaseMicroversionTest,
|
||||||
:param validation_resources: The dict of validation resources
|
:param validation_resources: The dict of validation resources
|
||||||
provisioned for the server.
|
provisioned for the server.
|
||||||
"""
|
"""
|
||||||
if CONF.validation.connect_method == 'floating':
|
return compute.get_server_ip(
|
||||||
if validation_resources:
|
server, validation_resources=validation_resources)
|
||||||
return validation_resources['floating_ip']['ip']
|
|
||||||
else:
|
|
||||||
msg = ('When validation.connect_method equals floating, '
|
|
||||||
'validation_resources cannot be None')
|
|
||||||
raise lib_exc.InvalidParam(invalid_param=msg)
|
|
||||||
elif CONF.validation.connect_method == 'fixed':
|
|
||||||
addresses = server['addresses'][CONF.validation.network_for_ssh]
|
|
||||||
for address in addresses:
|
|
||||||
if address['version'] == CONF.validation.ip_version_for_ssh:
|
|
||||||
return address['addr']
|
|
||||||
raise exceptions.ServerUnreachable(server_id=server['id'])
|
|
||||||
else:
|
|
||||||
raise lib_exc.InvalidConfiguration()
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_volume(cls, image_ref=None, **kwargs):
|
def create_volume(cls, image_ref=None, **kwargs):
|
||||||
|
|
|
@ -25,9 +25,11 @@ from oslo_utils import excutils
|
||||||
|
|
||||||
from tempest.common import waiters
|
from tempest.common import waiters
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
from tempest import exceptions
|
||||||
from tempest.lib.common import fixed_network
|
from tempest.lib.common import fixed_network
|
||||||
from tempest.lib.common import rest_client
|
from tempest.lib.common import rest_client
|
||||||
from tempest.lib.common.utils import data_utils
|
from tempest.lib.common.utils import data_utils
|
||||||
|
from tempest.lib import exceptions as lib_exc
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
@ -54,6 +56,33 @@ def is_scheduler_filter_enabled(filter_name):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_server_ip(server, validation_resources=None):
|
||||||
|
"""Get the server fixed or floating IP.
|
||||||
|
|
||||||
|
Based on the configuration we're in, return a correct ip
|
||||||
|
address for validating that a guest is up.
|
||||||
|
|
||||||
|
:param server: The server dict as returned by the API
|
||||||
|
:param validation_resources: The dict of validation resources
|
||||||
|
provisioned for the server.
|
||||||
|
"""
|
||||||
|
if CONF.validation.connect_method == 'floating':
|
||||||
|
if validation_resources:
|
||||||
|
return validation_resources['floating_ip']['ip']
|
||||||
|
else:
|
||||||
|
msg = ('When validation.connect_method equals floating, '
|
||||||
|
'validation_resources cannot be None')
|
||||||
|
raise lib_exc.InvalidParam(invalid_param=msg)
|
||||||
|
elif CONF.validation.connect_method == 'fixed':
|
||||||
|
addresses = server['addresses'][CONF.validation.network_for_ssh]
|
||||||
|
for address in addresses:
|
||||||
|
if address['version'] == CONF.validation.ip_version_for_ssh:
|
||||||
|
return address['addr']
|
||||||
|
raise exceptions.ServerUnreachable(server_id=server['id'])
|
||||||
|
else:
|
||||||
|
raise lib_exc.InvalidConfiguration()
|
||||||
|
|
||||||
|
|
||||||
def create_test_server(clients, validatable=False, validation_resources=None,
|
def create_test_server(clients, validatable=False, validation_resources=None,
|
||||||
tenant_network=None, wait_until=None,
|
tenant_network=None, wait_until=None,
|
||||||
volume_backed=False, name=None, flavor=None,
|
volume_backed=False, name=None, flavor=None,
|
||||||
|
|
Loading…
Reference in New Issue