tobiko/tobiko/common/_utils.py
Slawek Kaplonski 4ee3dced06 Fix looking for ovs agent based on compute node name
In neutron agents faults tests module, there is test which looks
for neutron-ovs-agent which runs on same host as VM is spawned to
stop this neutron-ovs-agent.
This usually worked fine, but in case e.g. of TripleO hostname
given in neutron agents list contained full domain name and
hostname from nova's output containes short name.
Because of this missmatch there was no neutron-ovs-agent found to
stop and test was failing.
This patch fixes this issue by changing comparison of hostnames
of vm's host and agent's host.

Additionally this patch adds proper handling of the case when
neutron-ovs-agent isn't found.

Change-Id: If240188392feb6067af4f9a4a82e8ed95b4b99ee
2020-04-27 13:50:16 +02:00

19 lines
719 B
Python

# Copyright 2020 Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from __future__ import absolute_import
def get_short_hostname(hostname):
return hostname.lower().split('.', 1)[0]