def obj_load_attr(self, attrname):
    if (not self._context):
        raise exception.OrphanedObjectError(method='obj_load_attr', objtype=self.obj_name())
    LOG.debug("Lazy-loading '%(attr)s' on %(name)s id %(id)s", {'attr': attrname, 'name': self.obj_name(), 'id': self.id})
    if (attrname != 'compute_node'):
        raise exception.ObjectActionError(action='obj_load_attr', reason=('attribute %s not lazy-loadable' % attrname))
    if (self.binary == 'nova-compute'):
        compute_nodes = objects.ComputeNodeList.get_all_by_host(self._context, self.host)
    else:
        raise exception.ServiceNotFound(service_id=self.id)
    self.compute_node = compute_nodes[0]
def obj_load_attr(self, attrname):
    if (not self._context):
        raise exception.OrphanedObjectError(method='obj_load_attr', objtype=self.obj_name())
    LOG.debug("Lazy-loading '%(attr)s' on %(name)s id %(id)s", {'attr': attrname, 'name': self.obj_name(), 'id': self.id})
    if (attrname != 'compute_node'):
        raise exception.ObjectActionError(action='obj_load_attr', reason=('attribute %s not lazy-loadable' % attrname))
    if (self.binary == 'nova-compute'):
        compute_nodes = objects.ComputeNodeList.get_all_by_host(self._context, self.host)
    else:
        raise exception.ServiceNotFound(service_id=self.id)
    self.compute_node = compute_nodes[0]