From d4d081ad4cb028f9f9d389e0d7d4af3873c94cb6 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 26 Mar 2012 14:33:39 -0700 Subject: [PATCH] Default scheduler to spread-first * Fixes bug 965732 Change-Id: I239b2b235905b30879974144263037eba6ed409f --- etc/nova/nova.conf.sample | 4 ++-- nova/scheduler/least_cost.py | 6 ++++-- nova/tests/scheduler/test_filter_scheduler.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/etc/nova/nova.conf.sample b/etc/nova/nova.conf.sample index 32ca9a23f94..ea4e014a9fb 100644 --- a/etc/nova/nova.conf.sample +++ b/etc/nova/nova.conf.sample @@ -986,8 +986,8 @@ ######### defined in nova.scheduler.least_cost ######### -###### (FloatOpt) How much weight to give the fill-first cost function -# compute_fill_first_cost_fn_weight=1.0 +###### (FloatOpt) How much weight to give the fill-first cost function. A negative value will reverse behavior: e.g. spread-first +# compute_fill_first_cost_fn_weight=-1.0 ###### (ListOpt) Which cost functions the LeastCostScheduler should use # least_cost_functions="nova.scheduler.least_cost.compute_fill_first_cost_fn" ###### (FloatOpt) How much weight to give the noop cost function diff --git a/nova/scheduler/least_cost.py b/nova/scheduler/least_cost.py index 74ea0765c3e..70dc180e8a8 100644 --- a/nova/scheduler/least_cost.py +++ b/nova/scheduler/least_cost.py @@ -39,8 +39,10 @@ default=1.0, help='How much weight to give the noop cost function'), cfg.FloatOpt('compute_fill_first_cost_fn_weight', - default=1.0, - help='How much weight to give the fill-first cost function'), + default=-1.0, + help='How much weight to give the fill-first cost function. ' + 'A negative value will reverse behavior: ' + 'e.g. spread-first'), ] FLAGS = flags.FLAGS diff --git a/nova/tests/scheduler/test_filter_scheduler.py b/nova/tests/scheduler/test_filter_scheduler.py index 9c0fbb91926..733d3a267a9 100644 --- a/nova/tests/scheduler/test_filter_scheduler.py +++ b/nova/tests/scheduler/test_filter_scheduler.py @@ -170,7 +170,7 @@ def test_get_cost_functions(self): fns = fixture.get_cost_functions() self.assertEquals(len(fns), 1) weight, fn = fns[0] - self.assertEquals(weight, 1.0) + self.assertEquals(weight, -1.0) hostinfo = host_manager.HostState('host', 'compute') hostinfo.update_from_compute_node(dict(memory_mb=1000, local_gb=0, vcpus=1))