Add configurable hostname pattern to filter hosts
Currently when aggregating potential target hosts via get_host_other_than, it's hostname filtering only addresses the suffix '-ironic'. In the event that pattern is located within the hostname e.g. nova-cell1-compute-ironic-compute-0, then it will still be used as a target candidate. Update tempest to allow for a configurable hostname pattern to filter on when searching for candidates. Also updated additional testcases that are still using the suffix only check when removing guests with ironic in the name. Change-Id: If5bab817e04412512186be2195cd2437bd310980
This commit is contained in:
parent
1af21705c5
commit
9d8d631bdd
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add a new config option `[compute]/target_hosts_to_avoid` which will
|
||||
filter out any hypervisor candidates with a hostname that matches the
|
||||
provided pattern when determining target hosts for migration.
|
@ -14,8 +14,11 @@
|
||||
|
||||
from tempest.api.compute import base
|
||||
from tempest.common import tempest_fixtures as fixtures
|
||||
from tempest import config
|
||||
from tempest.lib import decorators
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
"""Tests nova hosts API using admin privileges."""
|
||||
@ -70,7 +73,7 @@ class HostsAdminTestJSON(base.BaseV2ComputeAdminTest):
|
||||
|
||||
hosts = [host for host in hosts if (
|
||||
host['service'] == 'compute' and
|
||||
not host['host_name'].endswith('-ironic'))]
|
||||
CONF.compute.target_hosts_to_avoid not in host['host_name'])]
|
||||
self.assertNotEmpty(hosts)
|
||||
|
||||
for host in hosts:
|
||||
|
@ -720,7 +720,7 @@ class BaseV2ComputeAdminTest(BaseV2ComputeTest):
|
||||
binary='nova-compute')['services']
|
||||
hosts = []
|
||||
for svc in svcs:
|
||||
if svc['host'].endswith('-ironic'):
|
||||
if CONF.compute.target_hosts_to_avoid in svc['host']:
|
||||
continue
|
||||
if svc['state'] == 'up' and svc['status'] == 'enabled':
|
||||
if CONF.compute.compute_volume_common_az:
|
||||
|
@ -418,7 +418,11 @@ ComputeGroup = [
|
||||
help="Specify destination host for live-migration and cold"
|
||||
" migration. If option is not set tests will use host"
|
||||
" automatically."),
|
||||
|
||||
cfg.StrOpt('target_hosts_to_avoid',
|
||||
default='-ironic',
|
||||
help="When aggregating available hypervisors for testing,"
|
||||
" avoid migrating to and booting any test VM on hosts with"
|
||||
" a name that matches the provided pattern"),
|
||||
]
|
||||
|
||||
placement_group = cfg.OptGroup(name='placement',
|
||||
|
@ -80,7 +80,7 @@ class TestInstancesWithCinderVolumes(manager.ScenarioTest):
|
||||
for host in zone['hosts']:
|
||||
if 'nova-compute' in zone['hosts'][host] and \
|
||||
zone['hosts'][host]['nova-compute']['available'] and \
|
||||
not host.endswith('-ironic'):
|
||||
CONF.compute.target_hosts_to_avoid not in host:
|
||||
hosts.append({'zone': zone['zoneName'],
|
||||
'host_name': host})
|
||||
|
||||
|
@ -48,7 +48,7 @@ class TestServerMultinode(manager.ScenarioTest):
|
||||
for host in zone['hosts']:
|
||||
if 'nova-compute' in zone['hosts'][host] and \
|
||||
zone['hosts'][host]['nova-compute']['available'] and \
|
||||
not host.endswith('-ironic'):
|
||||
CONF.compute.target_hosts_to_avoid not in host:
|
||||
hosts.append({'zone': zone['zoneName'],
|
||||
'host_name': host})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user