def _lookup_by_id(self, instance_id):
    'Retrieve libvirt domain object given an instance id.\n\n        All libvirt error handling should be handled in this method and\n        relevant nova exceptions should be raised in response.\n\n        '
    try:
        return self._conn.lookupByID(instance_id)
    except libvirt.libvirtError as ex:
        error_code = ex.get_error_code()
        if (error_code == libvirt.VIR_ERR_NO_DOMAIN):
            raise exception.InstanceNotFound(instance_id=instance_id)
        msg = (_('Error from libvirt while looking up %(instance_id)s: [Error Code %(error_code)s] %(ex)s') % {'instance_id': instance_id, 'error_code': error_code, 'ex': ex})
        raise exception.NovaException(msg)
Retrieve libvirt domain object given an instance id.

All libvirt error handling should be handled in this method and
relevant nova exceptions should be raised in response.
def _lookup_by_id(self, instance_id):
    'Retrieve libvirt domain object given an instance id.\n\n        All libvirt error handling should be handled in this method and\n        relevant nova exceptions should be raised in response.\n\n        '
    try:
        return self._conn.lookupByID(instance_id)
    except libvirt.libvirtError as ex:
        error_code = ex.get_error_code()
        if (error_code == libvirt.VIR_ERR_NO_DOMAIN):
            raise exception.InstanceNotFound(instance_id=instance_id)
        msg = (_('Error from libvirt while looking up %(instance_id)s: [Error Code %(error_code)s] %(ex)s') % {'instance_id': instance_id, 'error_code': error_code, 'ex': ex})
        raise exception.NovaException(msg)