Update start_service() function in test
Update the 'mapped' field of the created node to be coherent with what it's done in _check_and_create_node_host_mappings function [1]. NOTE(jlejeune): the patch is a bit different compared to the one on 2025.2 branch because the line I remove in nova/tests/functional/test_service.py has been introduced in 2025.2 release [2], so nothing to remove on older stable branches. [1]cc742602bc/nova/objects/host_mapping.py (L209)[2] https://review.opendev.org/c/openstack/nova/+/947245/4/nova/tests/functional/test_service.py Related-Bug: #2085135 Change-Id: I9965932adc521756e4583d1bcfc75c83cc630626 Signed-off-by: Julien Le Jeune <julien.le-jeune@ovhcloud.com> (cherry picked from commit38d1b14170) (cherry picked from commite370a3258c)
This commit is contained in:
13
nova/test.py
13
nova/test.py
@@ -458,6 +458,8 @@ class TestCase(base.BaseTestCase):
|
||||
ctxt = context.get_context()
|
||||
cell_name = cell_name or CELL1_NAME
|
||||
cell = self.cell_mappings[cell_name]
|
||||
svc = self.useFixture(
|
||||
nova_fixtures.ServiceFixture(name, host, cell=cell, **kwargs))
|
||||
if (host or name) not in self.host_mappings:
|
||||
# NOTE(gibi): If the HostMapping does not exists then this is
|
||||
# the first start of the service so we create the mapping.
|
||||
@@ -466,6 +468,17 @@ class TestCase(base.BaseTestCase):
|
||||
cell_mapping=cell)
|
||||
hm.create()
|
||||
self.host_mappings[hm.host] = hm
|
||||
|
||||
# NOTE(jlejeune): update the compute node's mapped field
|
||||
# like it's done in _check_and_create_node_host_mappings()
|
||||
# function.
|
||||
with context.target_cell(ctxt, cell) as cctxt:
|
||||
node = objects.ComputeNode.get_by_service_id(
|
||||
context=cctxt,
|
||||
service_id=svc.service.service_ref.id)
|
||||
node.mapped = 1
|
||||
node.save()
|
||||
else:
|
||||
svc = self.useFixture(
|
||||
nova_fixtures.ServiceFixture(name, host, cell=cell, **kwargs))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user