Clean up nova/conf/scheduler.py
Originally this patchset had moved the handling of the config options
from nova/scheduler/opts.py, but commit
627fde8832
incorporated that change,
leaving this smallish patch that cleans up some of the naming in the
nova/conf/scheduler.py file.
Blueprint centralize-config-options
Change-Id: Ibc29e00b8412ad8a2250a840afe789b29335e74b
This commit is contained in:
parent
806113e4f4
commit
cbe9174db1
|
@ -13,10 +13,14 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import itertools
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
|
||||||
|
DEFAULT_GROUP_NAME = "DEFAULT"
|
||||||
|
# The scheduler has options in several groups
|
||||||
|
METRICS_GROUP_NAME = "metrics"
|
||||||
|
TRUSTED_GROUP_NAME = "trusted_computing"
|
||||||
|
UPGRADE_GROUP_NAME = "upgrade_levels"
|
||||||
|
|
||||||
|
|
||||||
host_subset_size_opt = cfg.IntOpt("scheduler_host_subset_size",
|
host_subset_size_opt = cfg.IntOpt("scheduler_host_subset_size",
|
||||||
default=1,
|
default=1,
|
||||||
|
@ -81,10 +85,6 @@ rpc_sched_topic_opt = cfg.StrOpt("scheduler_topic",
|
||||||
default="scheduler",
|
default="scheduler",
|
||||||
help="The topic scheduler nodes listen on")
|
help="The topic scheduler nodes listen on")
|
||||||
|
|
||||||
# This option specifies an option group, so register separately
|
|
||||||
rpcapi_cap_opt = cfg.StrOpt("scheduler",
|
|
||||||
help="Set a version cap for messages sent to scheduler services")
|
|
||||||
|
|
||||||
scheduler_json_config_location_opt = cfg.StrOpt(
|
scheduler_json_config_location_opt = cfg.StrOpt(
|
||||||
"scheduler_json_config_location",
|
"scheduler_json_config_location",
|
||||||
default="",
|
default="",
|
||||||
|
@ -122,6 +122,10 @@ restrict_iso_host_img_opt = cfg.BoolOpt(
|
||||||
default=True,
|
default=True,
|
||||||
help="Whether to force isolated hosts to run only isolated images")
|
help="Whether to force isolated hosts to run only isolated images")
|
||||||
|
|
||||||
|
# This option specifies an option group, so register separately
|
||||||
|
rpcapi_cap_opt = cfg.StrOpt("scheduler",
|
||||||
|
help="Set a version cap for messages sent to scheduler services")
|
||||||
|
|
||||||
# These opts are registered as a separate OptGroup
|
# These opts are registered as a separate OptGroup
|
||||||
trusted_opts = [
|
trusted_opts = [
|
||||||
cfg.StrOpt("attestation_server",
|
cfg.StrOpt("attestation_server",
|
||||||
|
@ -227,7 +231,7 @@ soft_anti_affinity_weight_opt = cfg.FloatOpt(
|
||||||
'the opposite, which is soft-affinity.')
|
'the opposite, which is soft-affinity.')
|
||||||
|
|
||||||
|
|
||||||
SIMPLE_OPTS = [host_subset_size_opt,
|
default_opts = [host_subset_size_opt,
|
||||||
bm_default_filter_opt,
|
bm_default_filter_opt,
|
||||||
use_bm_filters_opt,
|
use_bm_filters_opt,
|
||||||
host_mgr_avail_filt_opt,
|
host_mgr_avail_filt_opt,
|
||||||
|
@ -254,27 +258,20 @@ SIMPLE_OPTS = [host_subset_size_opt,
|
||||||
soft_anti_affinity_weight_opt,
|
soft_anti_affinity_weight_opt,
|
||||||
]
|
]
|
||||||
|
|
||||||
ALL_OPTS = itertools.chain(
|
|
||||||
SIMPLE_OPTS,
|
|
||||||
[rpcapi_cap_opt],
|
|
||||||
trusted_opts,
|
|
||||||
metrics_weight_opts,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def register_opts(conf):
|
def register_opts(conf):
|
||||||
conf.register_opts(SIMPLE_OPTS)
|
conf.register_opts(default_opts)
|
||||||
conf.register_opt(rpcapi_cap_opt, "upgrade_levels")
|
conf.register_opt(rpcapi_cap_opt, UPGRADE_GROUP_NAME)
|
||||||
trust_group = cfg.OptGroup(name="trusted_computing",
|
trust_group = cfg.OptGroup(name=TRUSTED_GROUP_NAME,
|
||||||
title="Trust parameters")
|
title="Trust parameters")
|
||||||
conf.register_group(trust_group)
|
conf.register_group(trust_group)
|
||||||
conf.register_opts(trusted_opts, group=trust_group)
|
conf.register_opts(trusted_opts, group=trust_group)
|
||||||
conf.register_opts(metrics_weight_opts, group="metrics")
|
conf.register_opts(metrics_weight_opts, group=METRICS_GROUP_NAME)
|
||||||
|
|
||||||
|
|
||||||
def list_opts():
|
def list_opts():
|
||||||
return {"DEFAULT": SIMPLE_OPTS,
|
return {DEFAULT_GROUP_NAME: default_opts,
|
||||||
"upgrade_levels": [rpcapi_cap_opt],
|
UPGRADE_GROUP_NAME: [rpcapi_cap_opt],
|
||||||
"trusted_computing": trusted_opts,
|
TRUSTED_GROUP_NAME: trusted_opts,
|
||||||
"metrics": metrics_weight_opts,
|
METRICS_GROUP_NAME: metrics_weight_opts,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue