'Update the state of this service in the datastore.'

def report_state(self):

    if (not self.manager.is_working()):
        LOG.error('Manager    for    service    %(binary)s    %(host)s    is    reporting    problems,    not    sending    heartbeat.    Service    will    appear    "down".', {'binary': self.binary, 'host': self.host})
        return
    ctxt = context.get_admin_context()
    try:
        try:
            service_ref = objects.Service.get_by_id(ctxt, Service.service_id)
        except exception.NotFound:
            LOG.debug('The    service    database    object    disappeared,    recreating    it.')
            self._create_service_ref(ctxt)
            service_ref = objects.Service.get_by_id(ctxt, Service.service_id)
        service_ref.report_count += 1
        if (self.availability_zone != service_ref.availability_zone):
            service_ref.availability_zone = self.availability_zone
        service_ref.save()
        if getattr(self, 'model_disconnected', False):
            self.model_disconnected = False
            LOG.error('Recovered    model    server    connection!')
    except db_exc.DBConnectionError:
        if (not getattr(self, 'model_disconnected', False)):
            self.model_disconnected = True
            LOG.exception('model    server    went    away')
    except db_exc.DBError:
        if (not getattr(self, 'model_disconnected', False)):
            self.model_disconnected = True
            LOG.exception('DBError    encountered:    ')
    except Exception:
        if (not getattr(self, 'model_disconnected', False)):
            self.model_disconnected = True
            LOG.exception('Exception    encountered:    ')
