replace chance with filter scheduler in func tests
FilterScheduler is the only scheduler driver that properly integrated with placement api so this patch changes the functional test environment to use the FilterScheduler instead of the ChanceScheduler. The amount of vcpu the SmallFakeDriver reports need to be bumped to 2 as during resize to same host the filter scheduler doubles the allocation on the host. Simply relying on the 16.0 default allocation ratio does not work as the max_unit of the vcpu does not use the allocation ratio to avoid that a single server overallocates the cpu. The only change in unit test is test_create_instance_with_oversubscribed_cpu which also loads the SmallFakeDriver and asserts available resources on it. Change-Id: I12de2e195022593ea2a3e2894f2c3b5226930d4f
This commit is contained in:
parent
563d71f7cc
commit
cc83335987
@ -2,7 +2,7 @@
|
||||
"host": [
|
||||
{
|
||||
"resource": {
|
||||
"cpu": 1,
|
||||
"cpu": 2,
|
||||
"disk_gb": 1028,
|
||||
"host": "c1a7de0ac9d94e4baceae031d05caae3",
|
||||
"memory_mb": 8192,
|
||||
|
@ -23,7 +23,7 @@
|
||||
"id": 2,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -22,7 +22,7 @@
|
||||
"id": 2,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
"id": 2,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -35,7 +35,7 @@
|
||||
"id": 2,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
"id": 7,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
],
|
||||
|
@ -36,7 +36,7 @@
|
||||
"id": "62f62f6e-a713-4cbe-87d3-3ecf8a1e0f8d",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
],
|
||||
|
@ -46,7 +46,7 @@
|
||||
"id": "5d343e1d-938e-4284-b98b-6a2b5406ba76",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -35,7 +35,7 @@
|
||||
"id": "5d343e1d-938e-4284-b98b-6a2b5406ba76",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
"id": "5d343e1d-938e-4284-b98b-6a2b5406ba76",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
"host": [
|
||||
{
|
||||
"resource": {
|
||||
"cpu": 1,
|
||||
"cpu": 2,
|
||||
"disk_gb": 1028,
|
||||
"host": "%(host_name)s",
|
||||
"memory_mb": 8192,
|
||||
|
@ -23,7 +23,7 @@
|
||||
"id": "%(int:service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -22,7 +22,7 @@
|
||||
"id": "%(int:service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
"id": "%(int:service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -35,7 +35,7 @@
|
||||
"id": "%(int:service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
"id": 7,
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
],
|
||||
|
@ -36,7 +36,7 @@
|
||||
"id": "%(service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
],
|
||||
|
@ -46,7 +46,7 @@
|
||||
"id": "%(service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
]
|
||||
|
@ -35,7 +35,7 @@
|
||||
"id": "%(service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
"id": "%(service_id)s",
|
||||
"disabled_reason": null
|
||||
},
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
"memory_mb": 8192,
|
||||
"memory_mb_used": 512,
|
||||
"running_vms": 0,
|
||||
"vcpus": 1,
|
||||
"vcpus": 2,
|
||||
"vcpus_used": 0
|
||||
}
|
||||
}
|
@ -77,18 +77,18 @@ class _IntegratedTestBase(test.TestCase):
|
||||
self.flags(use_neutron=self.USE_NEUTRON)
|
||||
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
self._setup_services()
|
||||
|
||||
self.useFixture(cast_as_call.CastAsCall(self))
|
||||
self.useFixture(nova_fixtures.PlacementFixture())
|
||||
|
||||
self._setup_services()
|
||||
|
||||
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
|
||||
|
||||
def _setup_compute_service(self):
|
||||
return self.start_service('compute')
|
||||
|
||||
def _setup_scheduler_service(self):
|
||||
self.flags(group='scheduler', driver='chance_scheduler')
|
||||
return self.start_service('scheduler')
|
||||
|
||||
def _setup_services(self):
|
||||
|
@ -78,7 +78,6 @@ class NotificationSampleTestBase(test.TestCase,
|
||||
|
||||
self.useFixture(utils_fixture.TimeFixture(test_services.fake_utcnow()))
|
||||
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
# the image fake backend needed for image discovery
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
self.addCleanup(nova.tests.unit.image.fake.FakeImageService_reset)
|
||||
|
@ -38,7 +38,6 @@ class TestServerGet(test.TestCase):
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.compute = self.start_service('compute')
|
||||
|
||||
|
@ -46,7 +46,6 @@ class TestServerGet(test.TestCase):
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.compute = self.start_service('compute')
|
||||
self.consoleauth = self.start_service('consoleauth')
|
||||
|
@ -67,7 +67,6 @@ class TestSerialConsoleLiveMigrate(test.TestCase):
|
||||
self.flags(host="test_compute1")
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.compute = self.start_service('compute', host='test_compute1')
|
||||
self.consoleauth = self.start_service('consoleauth')
|
||||
|
@ -63,10 +63,6 @@ class TestRetryBetweenComputeNodeBuilds(test.TestCase):
|
||||
|
||||
self.start_service('conductor')
|
||||
self.start_service('consoleauth')
|
||||
|
||||
# Configure a minimal filter scheduler setup.
|
||||
self.flags(enabled_filters=['ComputeFilter', 'RetryFilter'],
|
||||
group='filter_scheduler')
|
||||
self.start_service('scheduler')
|
||||
|
||||
# We start two compute services because we're going to fake one
|
||||
|
@ -61,7 +61,6 @@ class TestLocalDeleteAttachedVolumes(test.TestCase):
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.start_service('compute')
|
||||
# The consoleauth service is needed for deleting console tokens.
|
||||
|
@ -41,8 +41,6 @@ class TestLocalDeleteAllocations(test.TestCase,
|
||||
self.start_service('conductor')
|
||||
self.start_service('consoleauth')
|
||||
|
||||
self.flags(enabled_filters=['RetryFilter', 'ComputeFilter'],
|
||||
group='filter_scheduler')
|
||||
self.start_service('scheduler')
|
||||
|
||||
self.compute = self.start_service('compute')
|
||||
|
@ -50,7 +50,6 @@ class ServerTagsFilteringTest(test.TestCase,
|
||||
self.api.microversion = 'latest'
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.start_service('compute')
|
||||
# The consoleauth service is needed for deleting console tokens when
|
||||
|
@ -52,7 +52,6 @@ class ServerListLimitMarkerCell0Test(test.TestCase,
|
||||
self.api.microversion = 'latest'
|
||||
|
||||
self.start_service('conductor')
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.start_service('scheduler')
|
||||
# We don't start the compute service because we want NoValidHost so
|
||||
# all of the instances go into ERROR state and get put into cell0.
|
||||
|
@ -37,10 +37,11 @@ class TestListServersIpFilter(test.TestCase):
|
||||
# the image fake backend needed for image discovery
|
||||
nova.tests.unit.image.fake.stub_out_image_service(self)
|
||||
|
||||
self.useFixture(nova_fixtures.PlacementFixture())
|
||||
|
||||
self.start_service('conductor')
|
||||
# Use the chance scheduler to bypass filtering and just pick the single
|
||||
# compute host that we have.
|
||||
self.flags(driver='chance_scheduler', group='scheduler')
|
||||
self.flags(enabled_filters=['ComputeFilter'],
|
||||
group='filter_scheduler')
|
||||
self.start_service('scheduler')
|
||||
self.start_service('compute')
|
||||
self.start_service('consoleauth')
|
||||
|
@ -1068,15 +1068,11 @@ class ServerMovingTests(test.TestCase, integrated_helpers.InstanceHelperMixin):
|
||||
REQUIRES_LOCKING = True
|
||||
microversion = 'latest'
|
||||
|
||||
_enabled_filters = ['RetryFilter', 'ComputeFilter']
|
||||
|
||||
def setUp(self):
|
||||
# NOTE(danms): The test defaults to using SmallFakeDriver,
|
||||
# which only has one vcpu, which can't take the doubled allocation
|
||||
# we're now giving it. So, use the bigger MediumFakeDriver here.
|
||||
self.flags(compute_driver='fake.MediumFakeDriver')
|
||||
self.flags(enabled_filters=self._enabled_filters,
|
||||
group='filter_scheduler')
|
||||
super(ServerMovingTests, self).setUp()
|
||||
|
||||
self.useFixture(policy_fixture.RealPolicyFixture())
|
||||
|
@ -1700,7 +1700,7 @@ class ComputeTestCase(BaseTestCase,
|
||||
|
||||
# get total memory as reported by virt driver:
|
||||
resources = self.compute.driver.get_available_resource(NODENAME)
|
||||
self.assertEqual(1, resources['vcpus'])
|
||||
self.assertEqual(2, resources['vcpus'])
|
||||
|
||||
# build an instance, specifying an amount of memory that exceeds
|
||||
# total_mem_mb, but is less than the oversubscribed limit:
|
||||
|
@ -596,7 +596,7 @@ class SmallFakeDriver(FakeDriver):
|
||||
# instead of requiring new samples every time those
|
||||
# values are adjusted allow them to be overwritten here.
|
||||
|
||||
vcpus = 1
|
||||
vcpus = 2
|
||||
memory_mb = 8192
|
||||
local_gb = 1028
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user