Change the default value for the config blazar_az_prefix

Current default value for the config 'blazar_az_prefix' is 'blazar:'.
However, ':' should not be included in the name of availability zones.

According to the parse_availability_zone() [1] of the API class of Nova,
there is a legacy hack to allow admins to specify hosts via an
availability zone using az:host:node. That means ':' cannot be included
in the name of an availability zone itself. But Nova accepts the
invalid name with ':'. That is reported as a bug [2].

This patch changes the default value for the config blazar_az_prefix
from 'blazar:' to 'blazar_' which does not use ':'.

[1] https://review.openstack.org/gitweb?p=openstack/nova.git;a=blob;f=nova/compute/api.py;h=46ed8e91fcc16f3755fd6a5e2e4a6d54f990cb8b;hb=HEAD#l561
[2] https://bugs.launchpad.net/nova/+bug/1695861

Change-Id: I3ad6f84c783d371d2eca2fc660bd564064df4586
Partial-Bug: #1695862
Depends-On: Iaff0b8e576dbcb56b89384ea236c3f121d4ffad1
This commit is contained in:
Hiroaki Kobayashi 2017-06-07 14:56:24 +09:00
parent 7a6cac0421
commit 9d5265ea82
1 changed files with 6 additions and 3 deletions

View File

@ -36,7 +36,7 @@ opts = [
default='blazar:owner',
help='Aggregate metadata key for knowing owner project_id'),
cfg.StrOpt('blazar_az_prefix',
default='blazar:',
default='blazar_',
help='Prefix for Availability Zones created by Blazar')
]
@ -76,8 +76,11 @@ class BlazarFilter(filters.BaseHostFilter):
aggregates = host_state.aggregates
pools = []
for agg in aggregates:
if str(agg.availability_zone).startswith(
cfg.CONF['blazar:physical:host'].blazar_az_prefix):
if (str(agg.availability_zone).startswith(
cfg.CONF['blazar:physical:host'].blazar_az_prefix)
# NOTE(hiro-kobayashi): following 2 lines are for keeping
# backward compatibility
or str(agg.availability_zone).startswith('blazar:')):
pools.append(agg)
if agg.name == (
cfg.CONF['blazar:physical:host'].aggregate_freepool_name):