Coverage for nova/conf/scheduler.py: 94%
17 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-04-24 11:16 +0000
1# Copyright 2015 OpenStack Foundation
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
16from oslo_config import cfg
18from nova.virt import arch
21scheduler_group = cfg.OptGroup(
22 name="scheduler", title="Scheduler configuration")
24scheduler_opts = [
25 cfg.IntOpt("max_attempts",
26 default=3,
27 min=1,
28 help="""
29The maximum number of schedule attempts.
31This is the maximum number of attempts that will be made for a given instance
32build/move operation. It limits the number of alternate hosts returned by the
33scheduler. When that list of hosts is exhausted, a ``MaxRetriesExceeded``
34exception is raised and the instance is set to an error state.
36Possible values:
38* A positive integer, where the integer corresponds to the max number of
39 attempts that can be made when building or moving an instance.
40"""),
41 cfg.IntOpt("discover_hosts_in_cells_interval",
42 default=-1,
43 min=-1,
44 help="""
45Periodic task interval.
47This value controls how often (in seconds) the scheduler should attempt
48to discover new hosts that have been added to cells. If negative (the
49default), no automatic discovery will occur.
51Deployments where compute nodes come and go frequently may want this
52enabled, where others may prefer to manually discover hosts when one
53is added to avoid any overhead from constantly checking. If enabled,
54every time this runs, we will select any unmapped hosts out of each
55cell database on every run.
57Possible values:
59* An integer, where the integer corresponds to periodic task interval in
60 seconds. 0 uses the default interval (60 seconds). A negative value disables
61 periodic tasks.
62"""),
63 cfg.IntOpt("max_placement_results",
64 default=1000,
65 min=1,
66 help="""
67The maximum number of placement results to request.
69This setting determines the maximum limit on results received from the
70placement service during a scheduling operation. It effectively limits
71the number of hosts that may be considered for scheduling requests that
72match a large number of candidates.
74A value of 1 (the minimum) will effectively defer scheduling to the placement
75service strictly on "will it fit" grounds. A higher value will put an upper
76cap on the number of results the scheduler will consider during the filtering
77and weighing process. Large deployments may need to set this lower than the
78total number of hosts available to limit memory consumption, network traffic,
79etc. of the scheduler.
81Possible values:
83* An integer, where the integer corresponds to the number of placement results
84 to return.
85"""),
86 cfg.IntOpt("workers",
87 min=0,
88 help="""
89Number of workers for the nova-scheduler service.
91Defaults to the number of CPUs available.
93Possible values:
95* An integer, where the integer corresponds to the number of worker processes.
96"""),
97 cfg.BoolOpt("query_placement_for_routed_network_aggregates",
98 default=False,
99 help="""
100Enable the scheduler to filter compute hosts affined to routed network segment
101aggregates.
103See https://docs.openstack.org/neutron/latest/admin/config-routed-networks.html
104for details.
105"""),
106 cfg.BoolOpt("limit_tenants_to_placement_aggregate",
107 default=False,
108 help="""
109Restrict tenants to specific placement aggregates.
111This setting causes the scheduler to look up a host aggregate with the
112metadata key of ``filter_tenant_id`` set to the project of an incoming
113request, and request results from placement be limited to that aggregate.
114Multiple tenants may be added to a single aggregate by appending a serial
115number to the key, such as ``filter_tenant_id:123``.
117The matching aggregate UUID must be mirrored in placement for proper operation.
118If the aggregate does not match one in placement, the result will be the same
119as not finding any suitable hosts for the request.
121If no host aggregate with the tenant id is found and ``[scheduler]
122placement_aggregate_required_for_tenants = False``, the request will not be
123restricted to only aggregates matching the tenant. If no host aggregate with
124the tenant id is found and ``[scheduler]
125placement_aggregate_required_for_tenants = True``, the result will be the same
126as not finding any suitable hosts for the request.
128Possible values:
130- A boolean value.
132Related options:
134- ``[scheduler] placement_aggregate_required_for_tenants``
135"""),
136 cfg.BoolOpt("placement_aggregate_required_for_tenants",
137 default=False,
138 help="""
139Require a placement aggregate association for all tenants.
141This setting, when limit_tenants_to_placement_aggregate=True, will control
142whether or not a tenant with no aggregate affinity will be allowed to schedule
143to any available node. If aggregates are used to limit some tenants but
144not all, then this should be False. If all tenants should be confined via
145aggregate, then this should be True to prevent them from receiving unrestricted
146scheduling to any available node.
148Possible values:
150- A boolean value.
152Related options:
154- ``[scheduler] placement_aggregate_required_for_tenants``
155"""),
156 cfg.BoolOpt("query_placement_for_image_type_support",
157 default=False,
158 help="""
159Use placement to determine host support for the instance's image type.
161This setting causes the scheduler to ask placement only for compute
162hosts that support the ``disk_format`` of the image used in the request.
164Possible values:
166- A boolean value.
167"""),
168 cfg.BoolOpt("enable_isolated_aggregate_filtering",
169 default=False,
170 help="""
171Restrict use of aggregates to instances with matching metadata.
173This setting allows the scheduler to restrict hosts in aggregates based on
174matching required traits in the aggregate metadata and the instance
175flavor/image. If an aggregate is configured with a property with key
176``trait:$TRAIT_NAME`` and value ``required``, the instance flavor extra_specs
177and/or image metadata must also contain ``trait:$TRAIT_NAME=required`` to be
178eligible to be scheduled to hosts in that aggregate. More technical details
179at https://docs.openstack.org/nova/latest/reference/isolate-aggregates.html
181Possible values:
183- A boolean value.
184"""),
185 cfg.BoolOpt("image_metadata_prefilter",
186 default=False,
187 help="""
188Use placement to filter hosts based on image metadata.
190This setting causes the scheduler to transform well known image metadata
191properties into placement required traits to filter host based on image
192metadata. This feature requires host support and is currently supported by the
193following compute drivers:
195- ``libvirt.LibvirtDriver`` (since Ussuri (21.0.0))
197Possible values:
199- A boolean value.
201Related options:
203- ``[compute] compute_driver``
204"""),
205]
207filter_scheduler_group = cfg.OptGroup(
208 name="filter_scheduler", title="Filter scheduler options")
210filter_scheduler_opts = [
211 cfg.IntOpt("host_subset_size",
212 default=1,
213 min=1,
214 help="""
215Size of subset of best hosts selected by scheduler.
217New instances will be scheduled on a host chosen randomly from a subset of the
218N best hosts, where N is the value set by this option.
220Setting this to a value greater than 1 will reduce the chance that multiple
221scheduler processes handling similar requests will select the same host,
222creating a potential race condition. By selecting a host randomly from the N
223hosts that best fit the request, the chance of a conflict is reduced. However,
224the higher you set this value, the less optimal the chosen host may be for a
225given request.
227Possible values:
229* An integer, where the integer corresponds to the size of a host subset.
230"""),
231 cfg.IntOpt("max_io_ops_per_host",
232 default=8,
233 min=0,
234 help="""
235The number of instances that can be actively performing IO on a host.
237Instances performing IO includes those in the following states: build, resize,
238snapshot, migrate, rescue, unshelve.
240Note that this setting only affects scheduling if the ``IoOpsFilter`` filter is
241enabled.
243Possible values:
245* An integer, where the integer corresponds to the max number of instances
246 that can be actively performing IO on any given host.
248Related options:
250- ``[filter_scheduler] enabled_filters``
251"""),
252 cfg.IntOpt("max_instances_per_host",
253 default=50,
254 min=1,
255 help="""
256Maximum number of instances that can exist on a host.
258If you need to limit the number of instances on any given host, set this option
259to the maximum number of instances you want to allow. The NumInstancesFilter
260and AggregateNumInstancesFilter will reject any host that has at least as many
261instances as this option's value.
263Note that this setting only affects scheduling if the ``NumInstancesFilter`` or
264``AggregateNumInstancesFilter`` filter is enabled.
266Possible values:
268* An integer, where the integer corresponds to the max instances that can be
269 scheduled on a host.
271Related options:
273- ``[filter_scheduler] enabled_filters``
274"""),
275 cfg.BoolOpt("track_instance_changes",
276 default=True,
277 help="""
278Enable querying of individual hosts for instance information.
280The scheduler may need information about the instances on a host in order to
281evaluate its filters and weighers. The most common need for this information is
282for the (anti-)affinity filters, which need to choose a host based on the
283instances already running on a host.
285If the configured filters and weighers do not need this information, disabling
286this option will improve performance. It may also be disabled when the tracking
287overhead proves too heavy, although this will cause classes requiring host
288usage data to query the database on each request instead.
290.. note::
292 In a multi-cell (v2) setup where the cell MQ is separated from the
293 top-level, computes cannot directly communicate with the scheduler. Thus,
294 this option cannot be enabled in that scenario. See also the
295 ``[workarounds] disable_group_policy_check_upcall`` option.
297Related options:
299- ``[filter_scheduler] enabled_filters``
300- ``[workarounds] disable_group_policy_check_upcall``
301"""),
302 cfg.MultiStrOpt("available_filters",
303 default=["nova.scheduler.filters.all_filters"],
304 help="""
305Filters that the scheduler can use.
307An unordered list of the filter classes the nova scheduler may apply. Only the
308filters specified in the ``[filter_scheduler] enabled_filters`` option will be
309used, but any filter appearing in that option must also be included in this
310list.
312By default, this is set to all filters that are included with nova.
314Possible values:
316* A list of zero or more strings, where each string corresponds to the name of
317 a filter that may be used for selecting a host
319Related options:
321* ``[filter_scheduler] enabled_filters``
322"""),
323 cfg.ListOpt("enabled_filters",
324 # NOTE(artom) If we change the defaults here, we should also update
325 # Tempest's scheduler_enabled_filters to keep the default values in
326 # sync.
327 default=[
328 "ComputeFilter",
329 "ComputeCapabilitiesFilter",
330 "ImagePropertiesFilter",
331 "ServerGroupAntiAffinityFilter",
332 "ServerGroupAffinityFilter",
333 ],
334 help="""
335Filters that the scheduler will use.
337An ordered list of filter class names that will be used for filtering
338hosts. These filters will be applied in the order they are listed so
339place your most restrictive filters first to make the filtering process more
340efficient.
342All of the filters in this option *must* be present in the ``[scheduler_filter]
343available_filter`` option, or a ``SchedulerHostFilterNotFound`` exception will
344be raised.
346Possible values:
348* A list of zero or more strings, where each string corresponds to the name of
349 a filter to be used for selecting a host
351Related options:
353- ``[filter_scheduler] available_filters``
354"""),
355 cfg.ListOpt("weight_classes",
356 default=["nova.scheduler.weights.all_weighers"],
357 help="""
358Weighers that the scheduler will use.
360Only hosts which pass the filters are weighed. The weight for any host starts
361at 0, and the weighers order these hosts by adding to or subtracting from the
362weight assigned by the previous weigher. Weights may become negative. An
363instance will be scheduled to one of the N most-weighted hosts, where N is
364``[filter_scheduler] host_subset_size``.
366By default, this is set to all weighers that are included with Nova.
368Possible values:
370* A list of zero or more strings, where each string corresponds to the name of
371 a weigher that will be used for selecting a host
372"""),
373 cfg.FloatOpt("ram_weight_multiplier",
374 default=1.0,
375 help="""
376RAM weight multiplier ratio.
378This option determines how hosts with more or less available RAM are weighed. A
379positive value will result in the scheduler preferring hosts with more
380available RAM, and a negative number will result in the scheduler preferring
381hosts with less available RAM. Another way to look at it is that positive
382values for this option will tend to spread instances across many hosts, while
383negative values will tend to fill up (stack) hosts as much as possible before
384scheduling to a less-used host. The absolute value, whether positive or
385negative, controls how strong the RAM weigher is relative to other weighers.
387Note that this setting only affects scheduling if the ``RAMWeigher`` weigher is
388enabled.
390Possible values:
392* An integer or float value, where the value corresponds to the multiplier
393 ratio for this weigher.
395Related options:
397* ``[filter_scheduler] weight_classes``
398"""),
399 cfg.FloatOpt("cpu_weight_multiplier",
400 default=1.0,
401 help="""
402CPU weight multiplier ratio.
404Multiplier used for weighting free vCPUs. Negative numbers indicate stacking
405rather than spreading.
407Note that this setting only affects scheduling if the ``CPUWeigher`` weigher is
408enabled.
410Possible values:
412* An integer or float value, where the value corresponds to the multiplier
413 ratio for this weigher.
415Related options:
417* ``[filter_scheduler] weight_classes``
418"""),
419 cfg.FloatOpt("disk_weight_multiplier",
420 default=1.0,
421 help="""
422Disk weight multiplier ratio.
424Multiplier used for weighing free disk space. Negative numbers mean to
425stack vs spread.
427Note that this setting only affects scheduling if the ``DiskWeigher`` weigher
428is enabled.
430Possible values:
432* An integer or float value, where the value corresponds to the multiplier
433 ratio for this weigher.
434"""),
435 cfg.FloatOpt("hypervisor_version_weight_multiplier",
436 default=1.0,
437 help="""
438Hypervisor Version weight multiplier ratio.
440The multiplier is used for weighting hosts based on the reported
441hypervisor version.
442Negative numbers indicate preferring older hosts,
443the default is to prefer newer hosts to aid with upgrades.
445Possible values:
447* An integer or float value, where the value corresponds to the multiplier
448 ratio for this weigher.
450Example:
452* Strongly prefer older hosts
454 .. code-block:: ini
456 [filter_scheduler]
457 hypervisor_version_weight_multiplier=-1000
460* Moderately prefer new hosts
462 .. code-block:: ini
464 [filter_scheduler]
465 hypervisor_version_weight_multiplier=2.5
467* Disable weigher influence
469 .. code-block:: ini
471 [filter_scheduler]
472 hypervisor_version_weight_multiplier=0
474Related options:
476* ``[filter_scheduler] weight_classes``
477"""),
478 cfg.FloatOpt("num_instances_weight_multiplier",
479 default=0.0,
480 help="""
481Number of instances weight multiplier ratio.
483The multiplier is used for weighting hosts based on the reported
484number of instances they have.
485Negative numbers indicate preferring hosts with fewer instances (i.e. choosing
486to spread instances), while positive numbers mean preferring hosts with more
487hosts (ie. choosing to pack).
488The default is 0.0 which means that you have to choose a strategy if you want
489to use it.
491Possible values:
493* An integer or float value, where the value corresponds to the multiplier
494 ratio for this weigher.
496Example:
498* Strongly prefer to pack instances to hosts.
500 .. code-block:: ini
502 [filter_scheduler]
503 num_instances_weight_multiplier=1000
505* Softly prefer to spread instances between hosts.
507 .. code-block:: ini
509 [filter_scheduler]
510 num_instances_weight_multiplier=1.0
512* Disable weigher influence
514 .. code-block:: ini
516 [filter_scheduler]
517 num_instances_weight_multiplier=0
519Related options:
521* ``[filter_scheduler] weight_classes``
522"""),
523 cfg.FloatOpt("io_ops_weight_multiplier",
524 default=-1.0,
525 help="""
526IO operations weight multiplier ratio.
528This option determines how hosts with differing workloads are weighed. Negative
529values, such as the default, will result in the scheduler preferring hosts with
530lighter workloads whereas positive values will prefer hosts with heavier
531workloads. Another way to look at it is that positive values for this option
532will tend to schedule instances onto hosts that are already busy, while
533negative values will tend to distribute the workload across more hosts. The
534absolute value, whether positive or negative, controls how strong the io_ops
535weigher is relative to other weighers.
537Note that this setting only affects scheduling if the ``IoOpsWeigher`` weigher
538is enabled.
540Possible values:
542* An integer or float value, where the value corresponds to the multiplier
543 ratio for this weigher.
545Related options:
547* ``[filter_scheduler] weight_classes``
548"""),
549 cfg.FloatOpt("image_props_weight_multiplier",
550 default=0.0,
551 help="""
552Image Properties weight multiplier ratio.
554The multiplier is used for weighting hosts based on the reported
555image properties for the instances they have.
556A positive value will favor hosts with the same image properties (packing
557strategy) while a negative value will follow a spread strategy that will favor
558hosts not already having instances with those image properties.
559The default value of the multiplier is 0, which disables the weigher.
561Possible values:
563* An integer or float value, where the value corresponds to the multiplier
564 ratio for this weigher.
566Example:
568* Strongly prefer to pack instances with related image properties.
570 .. code-block:: ini
572 [filter_scheduler]
573 image_props_weight_multiplier=1000
575* Softly prefer to spread instances having same properties between hosts
577 .. code-block:: ini
579 [filter_scheduler]
580 image_props_weight_multiplier=-1.0
582* Disable weigher influence
584 .. code-block:: ini
586 [filter_scheduler]
587 image_props_weight_multiplier=0
589Related options:
591* ``[filter_scheduler] weight_classes``
592"""),
593 cfg.ListOpt("image_props_weight_setting",
594 default=[],
595 help="""
596Mapping of image properties to weight modifier.
598This setting specifies the properties to be weighed and the relative ratios for
599each property. This should be a list of key/value pairs, consisting of a series
600of one or more 'name=ratio' pairs, separated by commas, where ``name`` is the
601name of the property to be weighed, and ``ratio`` is the relative weight for
602that metric.
604Note that if the ratio is set to 0, the property value is ignored, and instead
605the weight will be set to the value of the
606``[filter_scheduler] image_props_weight_multiplier`` option.
608As an example, let's consider the case where this option is set to:
610 ``os_distro=1, hw_machine_type=-1``
612If an instance would boot with an image having ``os_distro=windows`` and
613``hw_machine_type=q35``, the final host weight will be:
615 ``(nb_inst(``os_distro=windows``) * 1.0) +
616 (nb_inst(``hw_machine_type=q35``) * -1)``
618where nb_inst(``prop=value``) would give me the number of instances having
619an image where ``prop`` is set to ``value`` (eg. the number of instances
620running with ``os_distro=windows``)
622Possible values:
624* A list of zero or more key/value pairs separated by commas, where the key is
625 a string representing the name of a property and the value is a numeric
626 weight for that property. If any value is set to 0, the number of instances
627 match is ignored for that specific property key.
628 If no key/value pairs are provided, then the weigher will compare all the
629 instance's images with the requested image properties, all of them weighed
630 evenly.
633The overall host weight will be multiplied by the value of the
634 ``[filter_scheduler] image_props_weight_multiplier`` option.
636Related options:
638* ``[filter_scheduler] image_props_weight_multiplier``
639"""),
640 cfg.FloatOpt("pci_weight_multiplier",
641 default=1.0,
642 min=0.0,
643 help="""
644PCI device affinity weight multiplier.
646The PCI device affinity weighter computes a weighting based on the number of
647PCI devices on the host and the number of PCI devices requested by the
648instance.
650Note that this setting only affects scheduling if the ``PCIWeigher`` weigher
651and ``NUMATopologyFilter`` filter are enabled.
653Possible values:
655* A positive integer or float value, where the value corresponds to the
656 multiplier ratio for this weigher.
658Related options:
660* ``[filter_scheduler] weight_classes``
661"""),
662 cfg.FloatOpt("soft_affinity_weight_multiplier",
663 default=1.0,
664 min=0.0,
665 help="""
666Multiplier used for weighing hosts for group soft-affinity.
668Note that this setting only affects scheduling if the
669``ServerGroupSoftAffinityWeigher`` weigher is enabled.
671Possible values:
673* A non-negative integer or float value, where the value corresponds to
674 weight multiplier for hosts with group soft affinity.
676Related options:
678* ``[filter_scheduler] weight_classes``
679"""),
680 cfg.FloatOpt(
681 "soft_anti_affinity_weight_multiplier",
682 default=1.0,
683 min=0.0,
684 help="""
685Multiplier used for weighing hosts for group soft-anti-affinity.
687Note that this setting only affects scheduling if the
688``ServerGroupSoftAntiAffinityWeigher`` weigher is enabled.
690Possible values:
692* A non-negative integer or float value, where the value corresponds to
693 weight multiplier for hosts with group soft anti-affinity.
695Related options:
697* ``[filter_scheduler] weight_classes``
698"""),
699 cfg.FloatOpt(
700 "build_failure_weight_multiplier",
701 default=1000000.0,
702 help="""
703Multiplier used for weighing hosts that have had recent build failures.
705This option determines how much weight is placed on a compute node with
706recent build failures. Build failures may indicate a failing, misconfigured,
707or otherwise ailing compute node, and avoiding it during scheduling may be
708beneficial. The weight is inversely proportional to the number of recent
709build failures the compute node has experienced. This value should be
710set to some high value to offset weight given by other enabled weighers
711due to available resources. To disable weighing compute hosts by the
712number of recent failures, set this to zero.
714Note that this setting only affects scheduling if the ``BuildFailureWeigher``
715weigher is enabled.
717Possible values:
719* An integer or float value, where the value corresponds to the multiplier
720 ratio for this weigher.
722Related options:
724* ``[compute] consecutive_build_service_disable_threshold`` - Must be nonzero
725 for a compute to report data considered by this weigher.
726* ``[filter_scheduler] weight_classes``
727"""),
728 cfg.FloatOpt(
729 "cross_cell_move_weight_multiplier",
730 default=1000000.0,
731 help="""
732Multiplier used for weighing hosts during a cross-cell move.
734This option determines how much weight is placed on a host which is within the
735same source cell when moving a server, for example during cross-cell resize.
736By default, when moving an instance, the scheduler will prefer hosts within
737the same cell since cross-cell move operations can be slower and riskier due to
738the complicated nature of cross-cell migrations.
740Note that this setting only affects scheduling if the ``CrossCellWeigher``
741weigher is enabled. If your cloud is not configured to support cross-cell
742migrations, then this option has no effect.
744The value of this configuration option can be overridden per host aggregate
745by setting the aggregate metadata key with the same name
746(``cross_cell_move_weight_multiplier``).
748Possible values:
750* An integer or float value, where the value corresponds to the multiplier
751 ratio for this weigher. Positive values mean the weigher will prefer
752 hosts within the same cell in which the instance is currently running.
753 Negative values mean the weigher will prefer hosts in *other* cells from
754 which the instance is currently running.
756Related options:
758* ``[filter_scheduler] weight_classes``
759"""),
760 cfg.BoolOpt(
761 "shuffle_best_same_weighed_hosts",
762 default=False,
763 help="""
764Enable spreading the instances between hosts with the same best weight.
766Enabling it is beneficial for cases when ``[filter_scheduler]
767host_subset_size`` is 1 (default), but there is a large number of hosts with
768same maximal weight. This scenario is common in Ironic deployments where there
769are typically many baremetal nodes with identical weights returned to the
770scheduler. In such case enabling this option will reduce contention and
771chances for rescheduling events. At the same time it will make the instance
772packing (even in unweighed case) less dense.
773"""),
774 cfg.StrOpt(
775 "image_properties_default_architecture",
776 choices=arch.ALL,
777 help="""
778The default architecture to be used when using the image properties filter.
780When using the ``ImagePropertiesFilter``, it is possible that you want to
781define a default architecture to make the user experience easier and avoid
782having something like x86_64 images landing on AARCH64 compute nodes because
783the user did not specify the ``hw_architecture`` property in Glance.
785Possible values:
787* CPU Architectures such as x86_64, aarch64, s390x.
788"""),
789 # TODO(mikal): replace this option with something involving host aggregates
790 cfg.ListOpt("isolated_images",
791 default=[],
792 help="""
793List of UUIDs for images that can only be run on certain hosts.
795If there is a need to restrict some images to only run on certain designated
796hosts, list those image UUIDs here.
798Note that this setting only affects scheduling if the ``IsolatedHostsFilter``
799filter is enabled.
801Possible values:
803* A list of UUID strings, where each string corresponds to the UUID of an
804 image
806Related options:
808* ``[filter_scheduler] isolated_hosts``
809* ``[filter_scheduler] restrict_isolated_hosts_to_isolated_images``
810"""),
811 cfg.ListOpt("isolated_hosts",
812 default=[],
813 help="""
814List of hosts that can only run certain images.
816If there is a need to restrict some images to only run on certain designated
817hosts, list those host names here.
819Note that this setting only affects scheduling if the ``IsolatedHostsFilter``
820filter is enabled.
822Possible values:
824* A list of strings, where each string corresponds to the name of a host
826Related options:
828* ``[filter_scheduler] isolated_images``
829* ``[filter_scheduler] restrict_isolated_hosts_to_isolated_images``
830"""),
831 cfg.BoolOpt(
832 "restrict_isolated_hosts_to_isolated_images",
833 default=True,
834 help="""
835Prevent non-isolated images from being built on isolated hosts.
837Note that this setting only affects scheduling if the ``IsolatedHostsFilter``
838filter is enabled. Even then, this option doesn't affect the behavior of
839requests for isolated images, which will *always* be restricted to isolated
840hosts.
842Related options:
844* ``[filter_scheduler] isolated_images``
845* ``[filter_scheduler] isolated_hosts``
846"""),
847 # TODO(stephenfin): Consider deprecating these next two options: they're
848 # effectively useless now that we don't support arbitrary image metadata
849 # properties
850 cfg.StrOpt(
851 "aggregate_image_properties_isolation_namespace",
852 help="""
853Image property namespace for use in the host aggregate.
855Images and hosts can be configured so that certain images can only be scheduled
856to hosts in a particular aggregate. This is done with metadata values set on
857the host aggregate that are identified by beginning with the value of this
858option. If the host is part of an aggregate with such a metadata key, the image
859in the request spec must have the value of that metadata in its properties in
860order for the scheduler to consider the host as acceptable.
862Note that this setting only affects scheduling if the
863``AggregateImagePropertiesIsolation`` filter is enabled.
865Possible values:
867* A string, where the string corresponds to an image property namespace
869Related options:
871* ``[filter_scheduler] aggregate_image_properties_isolation_separator``
872"""),
873 cfg.StrOpt(
874 "aggregate_image_properties_isolation_separator",
875 default=".",
876 help="""
877Separator character(s) for image property namespace and name.
879When using the aggregate_image_properties_isolation filter, the relevant
880metadata keys are prefixed with the namespace defined in the
881aggregate_image_properties_isolation_namespace configuration option plus a
882separator. This option defines the separator to be used.
884Note that this setting only affects scheduling if the
885``AggregateImagePropertiesIsolation`` filter is enabled.
887Possible values:
889* A string, where the string corresponds to an image property namespace
890 separator character
892Related options:
894* ``[filter_scheduler] aggregate_image_properties_isolation_namespace``
895"""),
896 cfg.BoolOpt(
897 "pci_in_placement",
898 default=False,
899 help="""
900Enable scheduling and claiming PCI devices in Placement.
902This can be enabled after ``[pci]report_in_placement`` is enabled on all
903compute hosts.
905When enabled the scheduler queries Placement about the PCI device
906availability to select destination for a server with PCI request. The scheduler
907also allocates the selected PCI devices in Placement. Note that this logic
908does not replace the PCIPassthroughFilter but extends it.
910* ``[pci] report_in_placement``
911* ``[pci] alias``
912* ``[pci] device_spec``
913"""),
914]
916metrics_group = cfg.OptGroup(
917 name="metrics",
918 title="Metrics parameters",
919 help="""
920Configuration options for metrics
922Options under this group allow to adjust how values assigned to metrics are
923calculated.
924""")
926# TODO(stephenfin): This entire feature could probably be removed. It's not
927# tested and likely doesn't work with most drivers now.
928metrics_weight_opts = [
929 cfg.FloatOpt("weight_multiplier",
930 default=1.0,
931 help="""
932Multiplier used for weighing hosts based on reported metrics.
934When using metrics to weight the suitability of a host, you can use this option
935to change how the calculated weight influences the weight assigned to a host as
936follows:
938* ``>1.0``: increases the effect of the metric on overall weight
939* ``1.0``: no change to the calculated weight
940* ``>0.0,<1.0``: reduces the effect of the metric on overall weight
941* ``0.0``: the metric value is ignored, and the value of the
942 ``[metrics] weight_of_unavailable`` option is returned instead
943* ``>-1.0,<0.0``: the effect is reduced and reversed
944* ``-1.0``: the effect is reversed
945* ``<-1.0``: the effect is increased proportionally and reversed
947Possible values:
949* An integer or float value, where the value corresponds to the multiplier
950 ratio for this weigher.
952Related options:
954* ``[filter_scheduler] weight_classes``
955* ``[metrics] weight_of_unavailable``
956"""),
957 cfg.ListOpt("weight_setting",
958 default=[],
959 help="""
960Mapping of metric to weight modifier.
962This setting specifies the metrics to be weighed and the relative ratios for
963each metric. This should be a single string value, consisting of a series of
964one or more 'name=ratio' pairs, separated by commas, where ``name`` is the name
965of the metric to be weighed, and ``ratio`` is the relative weight for that
966metric.
968Note that if the ratio is set to 0, the metric value is ignored, and instead
969the weight will be set to the value of the ``[metrics] weight_of_unavailable``
970option.
972As an example, let's consider the case where this option is set to:
974 ``name1=1.0, name2=-1.3``
976The final weight will be:
978 ``(name1.value * 1.0) + (name2.value * -1.3)``
980Possible values:
982* A list of zero or more key/value pairs separated by commas, where the key is
983 a string representing the name of a metric and the value is a numeric weight
984 for that metric. If any value is set to 0, the value is ignored and the
985 weight will be set to the value of the ``[metrics] weight_of_unavailable``
986 option.
988Related options:
990* ``[metrics] weight_of_unavailable``
991"""),
992 cfg.BoolOpt("required",
993 default=True,
994 help="""
995Whether metrics are required.
997This setting determines how any unavailable metrics are treated. If this option
998is set to True, any hosts for which a metric is unavailable will raise an
999exception, so it is recommended to also use the MetricFilter to filter out
1000those hosts before weighing.
1002Possible values:
1004* A boolean value, where False ensures any metric being unavailable for a host
1005 will set the host weight to ``[metrics] weight_of_unavailable``.
1007Related options:
1009* ``[metrics] weight_of_unavailable``
1010"""),
1011 cfg.FloatOpt("weight_of_unavailable",
1012 default=float(-10000.0),
1013 help="""
1014Default weight for unavailable metrics.
1016When any of the following conditions are met, this value will be used in place
1017of any actual metric value:
1019- One of the metrics named in ``[metrics] weight_setting`` is not available for
1020 a host, and the value of ``required`` is ``False``.
1021- The ratio specified for a metric in ``[metrics] weight_setting`` is 0.
1022- The ``[metrics] weight_multiplier`` option is set to 0.
1024Possible values:
1026* An integer or float value, where the value corresponds to the multiplier
1027 ratio for this weigher.
1029Related options:
1031* ``[metrics] weight_setting``
1032* ``[metrics] required``
1033* ``[metrics] weight_multiplier``
1034"""),
1035]
1038def register_opts(conf):
1039 conf.register_group(scheduler_group)
1040 conf.register_opts(scheduler_opts, group=scheduler_group)
1042 conf.register_group(filter_scheduler_group)
1043 conf.register_opts(filter_scheduler_opts, group=filter_scheduler_group)
1045 conf.register_group(metrics_group)
1046 conf.register_opts(metrics_weight_opts, group=metrics_group)
1049def list_opts():
1050 return {
1051 scheduler_group: scheduler_opts,
1052 filter_scheduler_group: filter_scheduler_opts,
1053 metrics_group: metrics_weight_opts,
1054 }