From 5d0904253a05bb15637adbdf75559c2c1e06c9a6 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Mon, 25 Sep 2023 10:20:29 -0300 Subject: [PATCH] [Magnum] Set discoveryserver ip Set the discoveryserver IP address when it's found in the model, this allows to not depend on access to discovery.etcd.io --- zaza/openstack/charm_tests/magnum/setup.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/zaza/openstack/charm_tests/magnum/setup.py b/zaza/openstack/charm_tests/magnum/setup.py index 3baa72a04..c11a61989 100644 --- a/zaza/openstack/charm_tests/magnum/setup.py +++ b/zaza/openstack/charm_tests/magnum/setup.py @@ -26,6 +26,8 @@ TEST_SWIFT_IP = os.environ.get('TEST_SWIFT_IP') IMAGE_NAME = 'fedora-coreos' +DISCOVERYSERVER_APP = "discoveryserver" +DISCOVERYSERVER_FMT = "https://{ip}/new?size=%(size)d" # https://docs.openstack.org/magnum/latest/user/index.html#supported-versions # List of published image available at: # https://builds.coreos.fedoraproject.org/browser?stream=stable&arch=x86_64 @@ -102,3 +104,15 @@ def add_image(image_url=None): } openstack_utils.create_image(glance_client, image_url, IMAGE_NAME, properties=image_properties) + + +def configure_discoveryserver(): + """Configure discoveryserver IP addresss.""" + units = zaza.model.get_units(DISCOVERYSERVER_APP) + if len(units) > 0: + ip = zaza.model.get_unit_public_address(units[0]) + logging.info('Discoveryserver found at %s', ip) + zaza.model.set_application_config( + "magnum", + {'discovery-service': DISCOVERYSERVER_FMT.format(ip=ip)}, + )