Merge "Increase code reuse in test_numa_servers"
This commit is contained in:
commit
301a5c6bc9
@ -441,21 +441,8 @@ class NUMAServersTest(NUMAServersTestBase):
|
|||||||
kB_mem=15740000)
|
kB_mem=15740000)
|
||||||
|
|
||||||
# Start services
|
# Start services
|
||||||
self.computes = {}
|
self.start_computes({'test_compute0': host_info,
|
||||||
for host in ['test_compute0', 'test_compute1']:
|
'test_compute1': host_info})
|
||||||
fake_connection = self._get_connection(
|
|
||||||
host_info=host_info, hostname=host)
|
|
||||||
|
|
||||||
# This is fun. Firstly we need to do a global'ish mock so we can
|
|
||||||
# actually start the service.
|
|
||||||
with mock.patch('nova.virt.libvirt.host.Host.get_connection',
|
|
||||||
return_value=fake_connection):
|
|
||||||
compute = self.start_service('compute', host=host)
|
|
||||||
|
|
||||||
# Once that's done, we need to do some tweaks to each individual
|
|
||||||
# compute "service" to make sure they return unique objects
|
|
||||||
compute.driver._host.get_connection = lambda: fake_connection
|
|
||||||
self.computes[host] = compute
|
|
||||||
|
|
||||||
# STEP ONE
|
# STEP ONE
|
||||||
|
|
||||||
@ -653,10 +640,6 @@ class ReshapeForPCPUsTest(NUMAServersTestBase):
|
|||||||
group='compute')
|
group='compute')
|
||||||
self.flags(vcpu_pin_set='0-7')
|
self.flags(vcpu_pin_set='0-7')
|
||||||
|
|
||||||
host_info = fakelibvirt.HostInfo(cpu_nodes=2, cpu_sockets=1,
|
|
||||||
cpu_cores=2, cpu_threads=2,
|
|
||||||
kB_mem=15740000)
|
|
||||||
|
|
||||||
# Start services
|
# Start services
|
||||||
self.start_computes(save_rp_uuids=True)
|
self.start_computes(save_rp_uuids=True)
|
||||||
|
|
||||||
@ -774,22 +757,10 @@ class ReshapeForPCPUsTest(NUMAServersTestBase):
|
|||||||
self.flags(cpu_dedicated_set='0-7', group='compute')
|
self.flags(cpu_dedicated_set='0-7', group='compute')
|
||||||
self.flags(vcpu_pin_set=None)
|
self.flags(vcpu_pin_set=None)
|
||||||
|
|
||||||
for host in ['test_compute0', 'test_compute1']:
|
computes = {}
|
||||||
self.computes[host].stop()
|
for host, compute in self.computes.items():
|
||||||
|
computes[host] = self.restart_compute_service(compute)
|
||||||
fake_connection = self._get_connection(
|
self.computes = computes
|
||||||
host_info=host_info, hostname=host)
|
|
||||||
|
|
||||||
# This is fun. Firstly we need to do a global'ish mock so we can
|
|
||||||
# actually start the service.
|
|
||||||
with mock.patch('nova.virt.libvirt.host.Host.get_connection',
|
|
||||||
return_value=fake_connection):
|
|
||||||
compute = self.start_service('compute', host=host)
|
|
||||||
|
|
||||||
# Once that's done, we need to do some tweaks to each individual
|
|
||||||
# compute "service" to make sure they return unique objects
|
|
||||||
compute.driver._host.get_connection = lambda: fake_connection
|
|
||||||
self.computes[host] = compute
|
|
||||||
|
|
||||||
# verify that the inventory, usages and allocation are correct after
|
# verify that the inventory, usages and allocation are correct after
|
||||||
# the reshape
|
# the reshape
|
||||||
|
Loading…
Reference in New Issue
Block a user