summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2011-12-05 21:24:44 +0000
committerGerrit Code Review <review@openstack.org>2011-12-05 21:24:44 +0000
commit63593ff80b182c1123ea2980f5ed14d2cbf70ca5 (patch)
treec47d78eaccff8b0399d4f958b763000a1ebe49c0
parente3ecd38debf3258660e703b065db0799cbbafcfb (diff)
parent85f9d927f5becfca94e90941a3f01f96c6dbf439 (diff)
Merge "Add availabity_zone to the refresh list"
-rw-r--r--nova/service.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/service.py b/nova/service.py
index 47c88eede..fe6bf8e59 100644
--- a/nova/service.py
+++ b/nova/service.py
@@ -259,6 +259,8 @@ class Service(object):
def report_state(self):
"""Update the state of this service in the datastore."""
ctxt = context.get_admin_context()
+ zone = FLAGS.node_availability_zone
+ state_catalog = {}
try:
try:
service_ref = db.service_get(ctxt, self.service_id)
@@ -268,9 +270,12 @@ class Service(object):
self._create_service_ref(ctxt)
service_ref = db.service_get(ctxt, self.service_id)
+ state_catalog['report_count'] = service_ref['report_count'] + 1
+ if zone != service_ref['availability_zone']:
+ state_catalog['availability_zone'] = zone
+
db.service_update(ctxt,
- self.service_id,
- {'report_count': service_ref['report_count'] + 1})
+ self.service_id, state_catalog)
# TODO(termie): make this pattern be more elegant.
if getattr(self, 'model_disconnected', False):