Config options: centralize section "scheduler"
This change moves all of the configuration options previously defined in nova/scheduler to the new centralized nova/conf/scheduler directory. A subsequent patch will then improve the help texts. Blueprint centralize-config-options Change-Id: I08d50e873f71601a26ce768feac635243d0570f4
This commit is contained in:
parent
e6408cd380
commit
5dbdd6ed2b
|
@ -18,16 +18,15 @@
|
|||
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
from nova import config
|
||||
from nova import objects
|
||||
from nova import service
|
||||
from nova import utils
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.import_opt('scheduler_topic', 'nova.scheduler.rpcapi')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
|
||||
from oslo_config import cfg
|
||||
|
||||
from nova.conf import scheduler
|
||||
from nova.conf import serial_console
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
scheduler.register_opts(CONF)
|
||||
serial_console.register_opts(CONF)
|
||||
|
|
|
@ -0,0 +1,252 @@
|
|||
# Copyright 2015 OpenStack Foundation
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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.
|
||||
|
||||
import itertools
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
||||
host_subset_size_opt = cfg.IntOpt("scheduler_host_subset_size",
|
||||
default=1,
|
||||
help="New instances will be scheduled on a host chosen randomly from "
|
||||
"a subset of the N best hosts. This property defines the subset "
|
||||
"size that a host is chosen from. A value of 1 chooses the first "
|
||||
"host returned by the weighing functions. This value must be at "
|
||||
"least 1. Any value less than 1 will be ignored, and 1 will be "
|
||||
"used instead")
|
||||
|
||||
bm_default_filter_opt = cfg.ListOpt("baremetal_scheduler_default_filters",
|
||||
default=[
|
||||
"RetryFilter",
|
||||
"AvailabilityZoneFilter",
|
||||
"ComputeFilter",
|
||||
"ComputeCapabilitiesFilter",
|
||||
"ImagePropertiesFilter",
|
||||
"ExactRamFilter",
|
||||
"ExactDiskFilter",
|
||||
"ExactCoreFilter",
|
||||
],
|
||||
help="Which filter class names to use for filtering baremetal hosts "
|
||||
"when not specified in the request.")
|
||||
|
||||
use_bm_filters_opt = cfg.BoolOpt("scheduler_use_baremetal_filters",
|
||||
default=False,
|
||||
help="Flag to decide whether to use "
|
||||
"baremetal_scheduler_default_filters or not.")
|
||||
|
||||
host_mgr_avail_filt_opt = cfg.MultiStrOpt("scheduler_available_filters",
|
||||
default=["nova.scheduler.filters.all_filters"],
|
||||
help="Filter classes available to the scheduler which may be "
|
||||
"specified more than once. An entry of "
|
||||
"'nova.scheduler.filters.all_filters' maps to all filters "
|
||||
"included with nova.")
|
||||
|
||||
host_mgr_default_filt_opt = cfg.ListOpt("scheduler_default_filters",
|
||||
default=[
|
||||
"RetryFilter",
|
||||
"AvailabilityZoneFilter",
|
||||
"RamFilter",
|
||||
"DiskFilter",
|
||||
"ComputeFilter",
|
||||
"ComputeCapabilitiesFilter",
|
||||
"ImagePropertiesFilter",
|
||||
"ServerGroupAntiAffinityFilter",
|
||||
"ServerGroupAffinityFilter",
|
||||
],
|
||||
help="Which filter class names to use for filtering hosts when not "
|
||||
"specified in the request.")
|
||||
|
||||
host_mgr_sched_wgt_cls_opt = cfg.ListOpt("scheduler_weight_classes",
|
||||
default=["nova.scheduler.weights.all_weighers"],
|
||||
help="Which weight class names to use for weighing hosts")
|
||||
|
||||
host_mgr_tracks_inst_chg_opt = cfg.BoolOpt("scheduler_tracks_instance_changes",
|
||||
default=True,
|
||||
help="Determines if the Scheduler tracks changes to instances to help "
|
||||
"with its filtering decisions.")
|
||||
|
||||
rpc_sched_topic_opt = cfg.StrOpt("scheduler_topic",
|
||||
default="scheduler",
|
||||
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",
|
||||
default="",
|
||||
help="Absolute path to scheduler configuration JSON file.")
|
||||
|
||||
sched_driver_host_mgr_opt = cfg.StrOpt("scheduler_host_manager",
|
||||
default="nova.scheduler.host_manager.HostManager",
|
||||
help="The scheduler host manager class to use")
|
||||
|
||||
driver_opt = cfg.StrOpt("scheduler_driver",
|
||||
default="nova.scheduler.filter_scheduler.FilterScheduler",
|
||||
help="Default driver to use for the scheduler")
|
||||
|
||||
driver_period_opt = cfg.IntOpt("scheduler_driver_task_period",
|
||||
default=60,
|
||||
help="How often (in seconds) to run periodic tasks in the scheduler "
|
||||
"driver of your choice. Please note this is likely to interact "
|
||||
"with the value of service_down_time, but exactly how they "
|
||||
"interact will depend on your choice of scheduler driver.")
|
||||
|
||||
disk_allocation_ratio_opt = cfg.FloatOpt("disk_allocation_ratio",
|
||||
default=1.0,
|
||||
help="Virtual disk to physical disk allocation ratio")
|
||||
|
||||
isolated_img_opt = cfg.ListOpt("isolated_images",
|
||||
default=[],
|
||||
help="Images to run on isolated host")
|
||||
|
||||
isolated_host_opt = cfg.ListOpt("isolated_hosts",
|
||||
default=[],
|
||||
help="Host reserved for specific images")
|
||||
|
||||
restrict_iso_host_img_opt = cfg.BoolOpt(
|
||||
"restrict_isolated_hosts_to_isolated_images",
|
||||
default=True,
|
||||
help="Whether to force isolated hosts to run only isolated images")
|
||||
|
||||
# These opts are registered as a separate OptGroup
|
||||
trusted_opts = [
|
||||
cfg.StrOpt("attestation_server",
|
||||
help="Attestation server HTTP"),
|
||||
cfg.StrOpt("attestation_server_ca_file",
|
||||
help="Attestation server Cert file for Identity verification"),
|
||||
cfg.StrOpt("attestation_port",
|
||||
default="8443",
|
||||
help="Attestation server port"),
|
||||
cfg.StrOpt("attestation_api_url",
|
||||
default="/OpenAttestationWebServices/V1.0",
|
||||
help="Attestation web API URL"),
|
||||
cfg.StrOpt("attestation_auth_blob",
|
||||
help="Attestation authorization blob - must change"),
|
||||
cfg.IntOpt("attestation_auth_timeout",
|
||||
default=60,
|
||||
help="Attestation status cache valid period length"),
|
||||
cfg.BoolOpt("attestation_insecure_ssl",
|
||||
default=False,
|
||||
help="Disable SSL cert verification for Attestation service")
|
||||
]
|
||||
|
||||
max_io_ops_per_host_opt = cfg.IntOpt("max_io_ops_per_host",
|
||||
default=8,
|
||||
help="Tells filters to ignore hosts that have this many or more "
|
||||
"instances currently in build, resize, snapshot, migrate, rescue "
|
||||
"or unshelve task states")
|
||||
|
||||
agg_img_prop_iso_namespace_opt = cfg.StrOpt(
|
||||
"aggregate_image_properties_isolation_namespace",
|
||||
help="Force the filter to consider only keys matching the given "
|
||||
"namespace.")
|
||||
|
||||
agg_img_prop_iso_separator_opt = cfg.StrOpt(
|
||||
"aggregate_image_properties_isolation_separator",
|
||||
default=".",
|
||||
help="The separator used between the namespace and keys")
|
||||
|
||||
max_instances_per_host_opt = cfg.IntOpt("max_instances_per_host",
|
||||
default=50,
|
||||
help="Ignore hosts that have too many instances")
|
||||
|
||||
ram_weight_mult_opt = cfg.FloatOpt("ram_weight_multiplier",
|
||||
default=1.0,
|
||||
help="Multiplier used for weighing ram. Negative numbers mean to "
|
||||
"stack vs spread.")
|
||||
|
||||
io_ops_weight_mult_opt = cfg.FloatOpt("io_ops_weight_multiplier",
|
||||
default=-1.0,
|
||||
help="Multiplier used for weighing host io ops. Negative numbers mean "
|
||||
"a preference to choose light workload compute hosts.")
|
||||
|
||||
# These opts are registered as a separate OptGroup
|
||||
metrics_weight_opts = [
|
||||
cfg.FloatOpt("weight_multiplier",
|
||||
default=1.0,
|
||||
help="Multiplier used for weighing metrics."),
|
||||
cfg.ListOpt("weight_setting",
|
||||
default=[],
|
||||
help="How the metrics are going to be weighed. This should be in "
|
||||
"the form of '<name1>=<ratio1>, <name2>=<ratio2>, ...', "
|
||||
"where <nameX> is one of the metrics to be weighed, and "
|
||||
"<ratioX> is the corresponding ratio. So for "
|
||||
"'name1=1.0, name2=-1.0' The final weight would be "
|
||||
"name1.value * 1.0 + name2.value * -1.0."),
|
||||
cfg.BoolOpt("required",
|
||||
default=True,
|
||||
help="How to treat the unavailable metrics. When a metric is NOT "
|
||||
"available for a host, if it is set to be True, it would "
|
||||
"raise an exception, so it is recommended to use the "
|
||||
"scheduler filter MetricFilter to filter out those hosts. If "
|
||||
"it is set to be False, the unavailable metric would be "
|
||||
"treated as a negative factor in weighing process, the "
|
||||
"returned value would be set by the option "
|
||||
"weight_of_unavailable."),
|
||||
cfg.FloatOpt("weight_of_unavailable",
|
||||
default=float(-10000.0),
|
||||
help="The final weight value to be returned if required is set to "
|
||||
"False and any one of the metrics set by weight_setting is "
|
||||
"unavailable."),
|
||||
]
|
||||
|
||||
scheduler_max_att_opt = cfg.IntOpt("scheduler_max_attempts",
|
||||
default=3,
|
||||
help="Maximum number of attempts to schedule an instance")
|
||||
|
||||
|
||||
SIMPLE_OPTS = [host_subset_size_opt,
|
||||
bm_default_filter_opt,
|
||||
use_bm_filters_opt,
|
||||
host_mgr_avail_filt_opt,
|
||||
host_mgr_default_filt_opt,
|
||||
host_mgr_sched_wgt_cls_opt,
|
||||
host_mgr_tracks_inst_chg_opt,
|
||||
rpc_sched_topic_opt,
|
||||
sched_driver_host_mgr_opt,
|
||||
driver_opt,
|
||||
driver_period_opt,
|
||||
scheduler_json_config_location_opt,
|
||||
disk_allocation_ratio_opt,
|
||||
isolated_img_opt,
|
||||
isolated_host_opt,
|
||||
restrict_iso_host_img_opt,
|
||||
max_io_ops_per_host_opt,
|
||||
agg_img_prop_iso_namespace_opt,
|
||||
agg_img_prop_iso_separator_opt,
|
||||
max_instances_per_host_opt,
|
||||
ram_weight_mult_opt,
|
||||
io_ops_weight_mult_opt,
|
||||
scheduler_max_att_opt,
|
||||
]
|
||||
|
||||
ALL_OPTS = itertools.chain(
|
||||
SIMPLE_OPTS,
|
||||
[rpcapi_cap_opt],
|
||||
trusted_opts,
|
||||
metrics_weight_opts,
|
||||
)
|
||||
|
||||
|
||||
def register_opts(conf):
|
||||
conf.register_opts(SIMPLE_OPTS)
|
||||
conf.register_opt(rpcapi_cap_opt, "upgrade_levels")
|
||||
trust_group = cfg.OptGroup(name="trusted_computing",
|
||||
title="Trust parameters")
|
||||
conf.register_group(trust_group)
|
||||
conf.register_opts(trusted_opts, group=trust_group)
|
||||
conf.register_opts(metrics_weight_opts, group="metrics")
|
|
@ -21,21 +21,14 @@ Scheduler base class that all Schedulers should inherit from
|
|||
|
||||
import abc
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import objects
|
||||
from nova import servicegroup
|
||||
|
||||
scheduler_driver_opts = [
|
||||
cfg.StrOpt('scheduler_host_manager',
|
||||
default='nova.scheduler.host_manager.HostManager',
|
||||
help='The scheduler host manager class to use'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(scheduler_driver_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
|
|
|
@ -21,10 +21,10 @@ Weighing Functions.
|
|||
|
||||
import random
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from six.moves import range
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova import objects
|
||||
|
@ -33,25 +33,10 @@ from nova.scheduler import driver
|
|||
from nova.scheduler import scheduler_options
|
||||
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF = nova.conf.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
filter_scheduler_opts = [
|
||||
cfg.IntOpt('scheduler_host_subset_size',
|
||||
default=1,
|
||||
help='New instances will be scheduled on a host chosen '
|
||||
'randomly from a subset of the N best hosts. This '
|
||||
'property defines the subset size that a host is '
|
||||
'chosen from. A value of 1 chooses the '
|
||||
'first host returned by the weighing functions. '
|
||||
'This value must be at least 1. Any value less than 1 '
|
||||
'will be ignored, and 1 will be used instead')
|
||||
]
|
||||
|
||||
CONF.register_opts(filter_scheduler_opts)
|
||||
|
||||
|
||||
class FilterScheduler(driver.Scheduler):
|
||||
"""Scheduler that can be used for filtering and weighing."""
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
|
|
@ -13,23 +13,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt('aggregate_image_properties_isolation_namespace',
|
||||
help='Force the filter to consider only keys matching '
|
||||
'the given namespace.'),
|
||||
cfg.StrOpt('aggregate_image_properties_isolation_separator',
|
||||
default=".",
|
||||
help='The separator used between the namespace and keys'),
|
||||
]
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -13,20 +13,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
from nova.i18n import _LW
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
disk_allocation_ratio_opt = cfg.FloatOpt("disk_allocation_ratio", default=1.0,
|
||||
help="Virtual disk to physical disk allocation ratio")
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(disk_allocation_ratio_opt)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class DiskFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -13,24 +13,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
from nova.i18n import _LW
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
max_io_ops_per_host_opt = cfg.IntOpt("max_io_ops_per_host",
|
||||
default=8,
|
||||
help="Tells filters to ignore hosts that have "
|
||||
"this many or more instances currently in "
|
||||
"build, resize, snapshot, migrate, rescue or unshelve "
|
||||
"task states")
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(max_io_ops_per_host_opt)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class IoOpsFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -13,24 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import nova.conf
|
||||
from nova.scheduler import filters
|
||||
|
||||
isolated_opts = [
|
||||
cfg.ListOpt('isolated_images',
|
||||
default=[],
|
||||
help='Images to run on isolated host'),
|
||||
cfg.ListOpt('isolated_hosts',
|
||||
default=[],
|
||||
help='Host reserved for specific images'),
|
||||
cfg.BoolOpt('restrict_isolated_hosts_to_isolated_images',
|
||||
default=True,
|
||||
help='Whether to force isolated hosts to run only isolated '
|
||||
'images'),
|
||||
]
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(isolated_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class IsolatedHostsFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -13,21 +13,16 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
import nova.conf
|
||||
from nova.i18n import _LW
|
||||
from nova.scheduler import filters
|
||||
from nova.scheduler.filters import utils
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
max_instances_per_host_opt = cfg.IntOpt("max_instances_per_host",
|
||||
default=50,
|
||||
help="Ignore hosts that have too many instances")
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(max_instances_per_host_opt)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class NumInstancesFilter(filters.BaseHostFilter):
|
||||
|
|
|
@ -43,12 +43,12 @@ the Open Attestation project at:
|
|||
https://github.com/OpenAttestation/OpenAttestation
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
import requests
|
||||
|
||||
import nova.conf
|
||||
from nova import context
|
||||
from nova.i18n import _LW
|
||||
from nova import objects
|
||||
|
@ -56,31 +56,7 @@ from nova.scheduler import filters
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
trusted_opts = [
|
||||
cfg.StrOpt('attestation_server',
|
||||
help='Attestation server HTTP'),
|
||||
cfg.StrOpt('attestation_server_ca_file',
|
||||
help='Attestation server Cert file for Identity verification'),
|
||||
cfg.StrOpt('attestation_port',
|
||||
default='8443',
|
||||
help='Attestation server port'),
|
||||
cfg.StrOpt('attestation_api_url',
|
||||
default='/OpenAttestationWebServices/V1.0',
|
||||
help='Attestation web API URL'),
|
||||
cfg.StrOpt('attestation_auth_blob',
|
||||
help='Attestation authorization blob - must change'),
|
||||
cfg.IntOpt('attestation_auth_timeout',
|
||||
default=60,
|
||||
help='Attestation status cache valid period length'),
|
||||
cfg.BoolOpt('attestation_insecure_ssl',
|
||||
default=False,
|
||||
help='Disable SSL cert verification for Attestation service')
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
trust_group = cfg.OptGroup(name='trusted_computing', title='Trust parameters')
|
||||
CONF.register_group(trust_group)
|
||||
CONF.register_opts(trusted_opts, group=trust_group)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class AttestationService(object):
|
||||
|
|
|
@ -27,11 +27,11 @@ except ImportError:
|
|||
|
||||
|
||||
import iso8601
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova import context as context_module
|
||||
from nova import exception
|
||||
from nova.i18n import _LI, _LW
|
||||
|
@ -42,38 +42,8 @@ from nova.scheduler import weights
|
|||
from nova import utils
|
||||
from nova.virt import hardware
|
||||
|
||||
host_manager_opts = [
|
||||
cfg.MultiStrOpt('scheduler_available_filters',
|
||||
default=['nova.scheduler.filters.all_filters'],
|
||||
help='Filter classes available to the scheduler which may '
|
||||
'be specified more than once. An entry of '
|
||||
'"nova.scheduler.filters.all_filters" '
|
||||
'maps to all filters included with nova.'),
|
||||
cfg.ListOpt('scheduler_default_filters',
|
||||
default=[
|
||||
'RetryFilter',
|
||||
'AvailabilityZoneFilter',
|
||||
'RamFilter',
|
||||
'DiskFilter',
|
||||
'ComputeFilter',
|
||||
'ComputeCapabilitiesFilter',
|
||||
'ImagePropertiesFilter',
|
||||
'ServerGroupAntiAffinityFilter',
|
||||
'ServerGroupAffinityFilter',
|
||||
],
|
||||
help='Which filter class names to use for filtering hosts '
|
||||
'when not specified in the request.'),
|
||||
cfg.ListOpt('scheduler_weight_classes',
|
||||
default=['nova.scheduler.weights.all_weighers'],
|
||||
help='Which weight class names to use for weighing hosts'),
|
||||
cfg.BoolOpt('scheduler_tracks_instance_changes',
|
||||
default=True,
|
||||
help='Determines if the Scheduler tracks changes to instances '
|
||||
'to help with its filtering decisions.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(host_manager_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
HOST_INSTANCE_SEMAPHORE = "host_instance"
|
||||
|
|
|
@ -21,35 +21,13 @@ This host manager will consume all cpu's, disk space, and
|
|||
ram from a host / node as it is supporting Baremetal hosts, which can not be
|
||||
subdivided into multiple instances.
|
||||
"""
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from nova.compute import hv_type
|
||||
import nova.conf
|
||||
from nova.scheduler import host_manager
|
||||
|
||||
host_manager_opts = [
|
||||
cfg.ListOpt('baremetal_scheduler_default_filters',
|
||||
default=[
|
||||
'RetryFilter',
|
||||
'AvailabilityZoneFilter',
|
||||
'ComputeFilter',
|
||||
'ComputeCapabilitiesFilter',
|
||||
'ImagePropertiesFilter',
|
||||
'ExactRamFilter',
|
||||
'ExactDiskFilter',
|
||||
'ExactCoreFilter',
|
||||
],
|
||||
help='Which filter class names to use for filtering '
|
||||
'baremetal hosts when not specified in the request.'),
|
||||
cfg.BoolOpt('scheduler_use_baremetal_filters',
|
||||
default=False,
|
||||
help='Flag to decide whether to use '
|
||||
'baremetal_scheduler_default_filters or not.'),
|
||||
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(host_manager_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
Scheduler Service
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import periodic_task
|
||||
from oslo_utils import importutils
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova import manager
|
||||
from nova import quota
|
||||
|
@ -33,20 +33,7 @@ from nova import quota
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
scheduler_driver_opts = [
|
||||
cfg.StrOpt('scheduler_driver',
|
||||
default='nova.scheduler.filter_scheduler.FilterScheduler',
|
||||
help='Default driver to use for the scheduler'),
|
||||
cfg.IntOpt('scheduler_driver_task_period',
|
||||
default=60,
|
||||
help='How often (in seconds) to run periodic tasks in '
|
||||
'the scheduler driver of your choice. '
|
||||
'Please note this is likely to interact with the value '
|
||||
'of service_down_time, but exactly how they interact '
|
||||
'will depend on your choice of scheduler driver.'),
|
||||
]
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(scheduler_driver_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
QUOTAS = quota.QUOTAS
|
||||
|
||||
|
|
|
@ -10,56 +10,16 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import itertools
|
||||
|
||||
import nova.scheduler.driver
|
||||
import nova.scheduler.filter_scheduler
|
||||
import nova.scheduler.filters.aggregate_image_properties_isolation
|
||||
import nova.scheduler.filters.core_filter
|
||||
import nova.scheduler.filters.disk_filter
|
||||
import nova.scheduler.filters.io_ops_filter
|
||||
import nova.scheduler.filters.isolated_hosts_filter
|
||||
import nova.scheduler.filters.num_instances_filter
|
||||
import nova.scheduler.filters.ram_filter
|
||||
import nova.scheduler.filters.trusted_filter
|
||||
import nova.scheduler.host_manager
|
||||
import nova.scheduler.ironic_host_manager
|
||||
import nova.scheduler.manager
|
||||
import nova.scheduler.rpcapi
|
||||
import nova.scheduler.scheduler_options
|
||||
import nova.scheduler.utils
|
||||
import nova.scheduler.weights.io_ops
|
||||
import nova.scheduler.weights.metrics
|
||||
import nova.scheduler.weights.ram
|
||||
import nova.conf.scheduler
|
||||
|
||||
|
||||
def list_opts():
|
||||
return [
|
||||
('DEFAULT',
|
||||
itertools.chain(
|
||||
[nova.scheduler.filters.disk_filter.disk_allocation_ratio_opt],
|
||||
[nova.scheduler.filters.io_ops_filter.max_io_ops_per_host_opt],
|
||||
[nova.scheduler.filters.num_instances_filter.
|
||||
max_instances_per_host_opt],
|
||||
[nova.scheduler.scheduler_options.
|
||||
scheduler_json_config_location_opt],
|
||||
nova.scheduler.driver.scheduler_driver_opts,
|
||||
nova.scheduler.filter_scheduler.filter_scheduler_opts,
|
||||
nova.scheduler.filters.aggregate_image_properties_isolation.opts,
|
||||
nova.scheduler.filters.isolated_hosts_filter.isolated_opts,
|
||||
nova.scheduler.host_manager.host_manager_opts,
|
||||
nova.scheduler.ironic_host_manager.host_manager_opts,
|
||||
nova.scheduler.manager.scheduler_driver_opts,
|
||||
nova.scheduler.rpcapi.rpcapi_opts,
|
||||
nova.scheduler.utils.scheduler_opts,
|
||||
nova.scheduler.weights.io_ops.io_ops_weight_opts,
|
||||
nova.scheduler.weights.ram.ram_weight_opts,
|
||||
)),
|
||||
('metrics', nova.scheduler.weights.metrics.metrics_weight_opts),
|
||||
nova.conf.scheduler.SIMPLE_OPTS),
|
||||
('metrics', nova.conf.scheduler.metrics_weight_opts),
|
||||
('trusted_computing',
|
||||
nova.scheduler.filters.trusted_filter.trusted_opts),
|
||||
nova.conf.scheduler.trusted_opts),
|
||||
('upgrade_levels',
|
||||
itertools.chain(
|
||||
[nova.scheduler.rpcapi.rpcapi_cap_opt],
|
||||
)),
|
||||
[nova.conf.scheduler.rpcapi_cap_opt]),
|
||||
]
|
||||
|
|
|
@ -16,24 +16,13 @@
|
|||
Client side of the scheduler manager RPC API.
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
import oslo_messaging as messaging
|
||||
|
||||
import nova.conf
|
||||
from nova.objects import base as objects_base
|
||||
from nova import rpc
|
||||
|
||||
rpcapi_opts = [
|
||||
cfg.StrOpt('scheduler_topic',
|
||||
default='scheduler',
|
||||
help='The topic scheduler nodes listen on'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(rpcapi_opts)
|
||||
|
||||
rpcapi_cap_opt = cfg.StrOpt('scheduler',
|
||||
help='Set a version cap for messages sent to scheduler services')
|
||||
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class SchedulerAPI(object):
|
||||
|
|
|
@ -23,22 +23,16 @@ dynamic configuration.
|
|||
import datetime
|
||||
import os
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
from oslo_utils import timeutils
|
||||
|
||||
import nova.conf
|
||||
from nova.i18n import _LE
|
||||
|
||||
|
||||
scheduler_json_config_location_opt = cfg.StrOpt(
|
||||
'scheduler_json_config_location',
|
||||
default='',
|
||||
help='Absolute path to scheduler configuration JSON file.')
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opt(scheduler_json_config_location_opt)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@ import collections
|
|||
import functools
|
||||
import sys
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import oslo_messaging as messaging
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nova.compute import flavors
|
||||
from nova.compute import utils as compute_utils
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.i18n import _, _LE, _LW
|
||||
from nova import objects
|
||||
|
@ -35,16 +35,7 @@ from nova import rpc
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
scheduler_opts = [
|
||||
cfg.IntOpt('scheduler_max_attempts',
|
||||
default=3,
|
||||
help='Maximum number of attempts to schedule an instance'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(scheduler_opts)
|
||||
|
||||
CONF.import_opt('scheduler_default_filters', 'nova.scheduler.host_manager')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
GroupDetails = collections.namedtuple('GroupDetails', ['hosts', 'policies'])
|
||||
|
||||
|
|
|
@ -21,20 +21,10 @@ option to a positive number and the weighing has the opposite effect of the
|
|||
default.
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import nova.conf
|
||||
from nova.scheduler import weights
|
||||
|
||||
io_ops_weight_opts = [
|
||||
cfg.FloatOpt('io_ops_weight_multiplier',
|
||||
default=-1.0,
|
||||
help='Multiplier used for weighing host io ops. Negative '
|
||||
'numbers mean a preference to choose light workload '
|
||||
'compute hosts.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(io_ops_weight_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class IoOpsWeigher(weights.BaseHostWeigher):
|
||||
|
|
|
@ -26,45 +26,13 @@ in the configuration file as the followings:
|
|||
The final weight would be name1.value * 1.0 + name2.value * -1.0.
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
from nova.scheduler import utils
|
||||
from nova.scheduler import weights
|
||||
|
||||
metrics_weight_opts = [
|
||||
cfg.FloatOpt('weight_multiplier',
|
||||
default=1.0,
|
||||
help='Multiplier used for weighing metrics.'),
|
||||
cfg.ListOpt('weight_setting',
|
||||
default=[],
|
||||
help='How the metrics are going to be weighed. This '
|
||||
'should be in the form of "<name1>=<ratio1>, '
|
||||
'<name2>=<ratio2>, ...", where <nameX> is one '
|
||||
'of the metrics to be weighed, and <ratioX> is '
|
||||
'the corresponding ratio. So for "name1=1.0, '
|
||||
'name2=-1.0" The final weight would be '
|
||||
'name1.value * 1.0 + name2.value * -1.0.'),
|
||||
cfg.BoolOpt('required',
|
||||
default=True,
|
||||
help='How to treat the unavailable metrics. When a '
|
||||
'metric is NOT available for a host, if it is set '
|
||||
'to be True, it would raise an exception, so it '
|
||||
'is recommended to use the scheduler filter '
|
||||
'MetricFilter to filter out those hosts. If it is '
|
||||
'set to be False, the unavailable metric would be '
|
||||
'treated as a negative factor in weighing '
|
||||
'process, the returned value would be set by '
|
||||
'the option weight_of_unavailable.'),
|
||||
cfg.FloatOpt('weight_of_unavailable',
|
||||
default=float(-10000.0),
|
||||
help='The final weight value to be returned if '
|
||||
'required is set to False and any one of the '
|
||||
'metrics set by weight_setting is unavailable.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(metrics_weight_opts, group='metrics')
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class MetricsWeigher(weights.BaseHostWeigher):
|
||||
|
|
|
@ -20,19 +20,10 @@ stacking, you can set the 'ram_weight_multiplier' option to a negative
|
|||
number and the weighing has the opposite effect of the default.
|
||||
"""
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
import nova.conf
|
||||
from nova.scheduler import weights
|
||||
|
||||
ram_weight_opts = [
|
||||
cfg.FloatOpt('ram_weight_multiplier',
|
||||
default=1.0,
|
||||
help='Multiplier used for weighing ram. Negative '
|
||||
'numbers mean to stack vs spread.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(ram_weight_opts)
|
||||
CONF = nova.conf.CONF
|
||||
|
||||
|
||||
class RAMWeigher(weights.BaseHostWeigher):
|
||||
|
|
|
@ -25,7 +25,6 @@ from nova.tests.unit import utils
|
|||
CONF = cfg.CONF
|
||||
CONF.import_opt('use_ipv6', 'nova.netconf')
|
||||
CONF.import_opt('host', 'nova.netconf')
|
||||
CONF.import_opt('scheduler_driver', 'nova.scheduler.manager')
|
||||
CONF.import_opt('fake_network', 'nova.network.linux_net')
|
||||
CONF.import_opt('network_size', 'nova.network.manager')
|
||||
CONF.import_opt('num_networks', 'nova.network.manager')
|
||||
|
|
Loading…
Reference in New Issue