Merge "Fix: Including resources in None cluster"

This commit is contained in:
Zuul 2018-03-25 05:04:14 +00:00 committed by Gerrit Code Review
commit bc4a4d3582
2 changed files with 5 additions and 7 deletions

View File

@ -193,12 +193,11 @@ class Service(service.Service):
service_ref.save()
Service.service_id = service_ref.id
except exception.NotFound:
# We don't want to include cluster information on the service or
# create the cluster entry if we are upgrading.
self._create_service_ref(ctxt, manager_class.RPC_API_VERSION)
# We don't want to include resources in the cluster during the
# start while we are still doing the rolling upgrade.
self.added_to_cluster = True
# Service entry Entry didn't exist because it was manually removed
# or it's the first time running, to be on the safe side we say we
# were added if we are clustered.
self.added_to_cluster = bool(cluster)
self.report_interval = report_interval
self.periodic_interval = periodic_interval
@ -348,7 +347,6 @@ class Service(service.Service):
'rpc_current_version': rpc_version or self.manager.RPC_API_VERSION,
'object_current_version': objects_base.OBJ_VERSIONS.get_current(),
}
# If we are upgrading we have to ignore the cluster value
kwargs['cluster_name'] = self.cluster
service_ref = objects.Service(context=context, **kwargs)
service_ref.create()

View File

@ -389,7 +389,7 @@ class ServiceTestCase(test.TestCase):
app = service.Service.create(host=self.host,
binary=constants.VOLUME_BINARY,
cluster=None, topic=self.topic)
self._check_rpc_servers_and_init_host(app, True, None)
self._check_rpc_servers_and_init_host(app, False, None)
@mock.patch('cinder.objects.Service.get_minimum_obj_version')
def test_start_rpc_and_init_host_cluster(self, get_min_obj_mock):