From e8eb7ab98d5f406e9ed1784806079e7d11dd682f Mon Sep 17 00:00:00 2001 From: Omer Date: Wed, 3 Aug 2022 18:44:35 +0200 Subject: [PATCH] Refactor Ubuntu image stack So far users could name the Ubuntu interface in any way they wanted. The ability to name Ubuntu interface allowed tobiko to run tests successfully for each OSP version, but it required changing it every time a different version is being run. This issue was fixed by setting the Ubuntu interface name in the tobiko code. This patch removes the unnecessary remaining parts. Change-Id: I0fcb4b9086bf8bbae5d98983971650a2244e52a1 --- infrared_plugin/plugin.spec | 4 ---- roles/tobiko-configure/defaults/main.yaml | 4 ---- tobiko/openstack/glance/config.py | 2 -- tobiko/openstack/stacks/_ubuntu.py | 16 ++++++++-------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/infrared_plugin/plugin.spec b/infrared_plugin/plugin.spec index 55d9cb327..c8dfed24f 100644 --- a/infrared_plugin/plugin.spec +++ b/infrared_plugin/plugin.spec @@ -153,10 +153,6 @@ subparsers: type: Value help: user name to be used to connect to TripleO Overcloud hosts ansible_variable: overcloud_ssh_username - ubuntu-interface-name: - type: Value - help: primary interface name obtained from the ubuntu instances - ansible_variable: ubuntu_interface_name - title: Run stage options: diff --git a/roles/tobiko-configure/defaults/main.yaml b/roles/tobiko-configure/defaults/main.yaml index ecf18ec9b..e3ed2cee1 100644 --- a/roles/tobiko-configure/defaults/main.yaml +++ b/roles/tobiko-configure/defaults/main.yaml @@ -13,8 +13,6 @@ test_default_conf: tripleo: undercloud_ssh_hostname: "{{ undercloud_ssh_hostname }}" overcloud_ssh_username: "{{ overcloud_ssh_username }}" - ubuntu: - interface_name: "{{ ubuntu_interface_name }}" test_log_debug: '' @@ -28,5 +26,3 @@ undercloud_hostname: '{{ groups.get("undercloud", []) | first | default("undercl undercloud_ssh_hostname: '' overcloud_ssh_username: '' - -ubuntu_interface_name: '' diff --git a/tobiko/openstack/glance/config.py b/tobiko/openstack/glance/config.py index a96eef3f8..d30a2aa50 100644 --- a/tobiko/openstack/glance/config.py +++ b/tobiko/openstack/glance/config.py @@ -62,8 +62,6 @@ def get_images_options(): help="Default " + name + " username"), cfg.StrOpt('password', help="Default " + name + " password"), - cfg.StrOpt('interface_name', - help="Default " + name + " image interface name"), cfg.FloatOpt('connection_timeout', default=None, help=("Default " + name + diff --git a/tobiko/openstack/stacks/_ubuntu.py b/tobiko/openstack/stacks/_ubuntu.py index a2e01e964..177eb6e14 100644 --- a/tobiko/openstack/stacks/_ubuntu.py +++ b/tobiko/openstack/stacks/_ubuntu.py @@ -132,14 +132,14 @@ class UbuntuImageFixture(UbuntuMinimalImageFixture, @staticmethod def _get_ethernet_device() -> str: - ethernet_device = CONF.tobiko.ubuntu.interface_name - if ethernet_device is None: - from tobiko import tripleo - if tripleo.has_overcloud(min_version='17.0'): - ethernet_device = 'enp3s0' - else: - ethernet_device = 'ens3' - return ethernet_device + """From OSP17 and above, Ubuntu stack should use a different interface name. + This method returns the interface name, depending on the OSP version. + """ + from tobiko import tripleo + if tripleo.has_overcloud(min_version='17.0'): + return 'enp3s0' + else: + return 'ens3' def _get_customized_suffix(self) -> str: return f'{super()._get_customized_suffix()}-{self.ethernet_device}'