Bug 2247268

Summary: test_floatingip_port_details fails when there are custom availability zones
Product: Red Hat OpenStack Reporter: Roman Safronov <rsafrono>
Component: python-neutron-tests-tempestAssignee: Roman Safronov <rsafrono>
Status: POST --- QA Contact: Eran Kuris <ekuris>
Severity: low Docs Contact:
Priority: low    
Version: 17.1 (Wallaby)CC: fyanac, ihrachys, twilson
Target Milestone: z4Keywords: Triaged
Target Release: 17.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Roman Safronov 2023-10-31 15:43:28 UTC
Description of problem:
test_floatingip_port_details checks device_owner port field with a hard-coded default value of 'compute:nova'
In case there are custom availability zones the test fails with something like:

 Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/neutron_tempest_plugin/scenario/test_floatingip.py", line 246, in test_floatingip_port_details
    self._check_port_details(
  File "/usr/lib/python3.9/site-packages/neutron_tempest_plugin/scenario/test_floatingip.py", line 275, in _check_port_details
    self.assertEqual(device_owner, port_details['device_owner'])
  File "/usr/lib/python3.9/site-packages/testtools/testcase.py", line 391, in assertEqual
    self.assertThat(observed, matcher, message)
  File "/usr/lib/python3.9/site-packages/testtools/testcase.py", line 478, in assertThat
    raise mismatch_error
testtools.matchers._impl.MismatchError: 'compute:nova' != 'compute:ovn-migration-zone-1'


Version-Release number of selected component (if applicable):
RHOS-17.1-RHEL-9-20230925.n.1
python3-neutron-tests-tempest-2.1.0-1.20230508090955.el9ost.noarch

How reproducible:
100% in case availability zones have names different from default compute:nova

Steps to Reproduce:
1. Deploy OSP environment
2. Create custom availability zones (see example below) note: my environment had 4 compute nodes but it's possible to reproduce the same issue with 2 compute nodes as well

openstack aggregate create --zone ovn-migration-zone-0 ovn-migration-agg-0
openstack aggregate add host ovn-migration-agg-0 compute-0.redhat.local
openstack aggregate add host ovn-migration-agg-0 compute-1.redhat.local
openstack aggregate create --zone ovn-migration-zone-1 ovn-migration-agg-1
openstack aggregate add host ovn-migration-agg-1 compute-2.redhat.local
openstack aggregate add host ovn-migration-agg-1 compute-3.redhat.local

After this we have this:
(overcloud) [stack@undercloud-0 tempest_17.1]$ openstack host list
+---------------------------+-----------+----------------------+
| Host Name                 | Service   | Zone                 |
+---------------------------+-----------+----------------------+
| controller-2.redhat.local | conductor | internal             |
| controller-2.redhat.local | scheduler | internal             |
| controller-0.redhat.local | scheduler | internal             |
| controller-1.redhat.local | scheduler | internal             |
| controller-0.redhat.local | conductor | internal             |
| controller-1.redhat.local | conductor | internal             |
| compute-0.redhat.local    | compute   | ovn-migration-zone-0 |
| compute-1.redhat.local    | compute   | ovn-migration-zone-0 |
| compute-3.redhat.local    | compute   | ovn-migration-zone-1 |
| compute-2.redhat.local    | compute   | ovn-migration-zone-1 |
+---------------------------+-----------+----------------------+


3. run tempest test neutron_tempest_plugin.scenario.test_floatingip.FloatingIPPortDetailsTest.test_floatingip_port_details



Actual results:
test_floatingip_port_details fails when there are custom availability zones
with MismatchError e.g.
testtools.matchers._impl.MismatchError: 'compute:nova' != 'compute:ovn-migration-zone-1'


Expected results:
test_floatingip_port_details is passing even when custom availability zones are configured

Additional info:

For a reference, without custom availability zones config (i.e. by default) this output is as follows:
(overcloud) [stack@undercloud-0 tempest_17.1]$ openstack host list
+---------------------------+-----------+----------+
| Host Name                 | Service   | Zone     |
+---------------------------+-----------+----------+
| controller-2.redhat.local | conductor | internal |
| controller-2.redhat.local | scheduler | internal |
| controller-0.redhat.local | scheduler | internal |
| controller-1.redhat.local | scheduler | internal |
| controller-0.redhat.local | conductor | internal |
| controller-1.redhat.local | conductor | internal |
| compute-0.redhat.local    | compute   | nova     |
| compute-1.redhat.local    | compute   | nova     |
| compute-3.redhat.local    | compute   | nova     |
| compute-2.redhat.local    | compute   | nova     |
+---------------------------+-----------+----------+

Comment 1 Roman Safronov 2023-10-31 15:58:07 UTC
possible fix https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/899714