From 9b16ba226c01d5cac2962590b97ca5bea6890983 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Thu, 18 Sep 2014 19:51:30 +0300 Subject: [PATCH 1/2] Fix a rare issue in service state reporting Occasionally, conductor_api.service_update() will return None, which will break all further state reports and the service will become unavailable from nova-api/nova-conductor point of view. Should this happen, just skip the current update and try again next time. Closes-Bug: #1331537 Change-Id: I155b304d57a6babcf56f5984dc703e899fdf8648 --- nova/servicegroup/drivers/db.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nova/servicegroup/drivers/db.py b/nova/servicegroup/drivers/db.py index 5a0869d..bc4c6dd 100644 --- a/nova/servicegroup/drivers/db.py +++ b/nova/servicegroup/drivers/db.py @@ -92,8 +92,13 @@ class DbDriver(api.ServiceGroupDriver): report_count = service.service_ref['report_count'] + 1 state_catalog['report_count'] = report_count - service.service_ref = self.conductor_api.service_update(ctxt, - service.service_ref, state_catalog) + new_service_ref = self.conductor_api.service_update(ctxt, + service.service_ref, state_catalog) + if new_service_ref is not None: + service.service_ref = new_service_ref + else: + # NOTE(rpodolyaka): this will be handled below + raise TypeError('Failed to update the service state') # TODO(termie): make this pattern be more elegant. if getattr(service, 'model_disconnected', False): -- 2.1.0