'Note that this function takes an instance name.'

def block_stats(self, instance, disk_id):

    try:
        guest = self._host.get_guest(instance)
        domain = guest._domain
        return domain.blockStats(disk_id)
    except libvirt.libvirtError as e:
        errcode = e.get_error_code()
        LOG.info('Getting    block    stats    failed,    device    might    have    been    detached.    Instance=%(instance_name)s    Disk=%(disk)s    Code=%(errcode)s    Error=%(e)s', {'instance_name': instance.name, 'disk': disk_id, 'errcode': errcode, 'e': e}, instance=instance)
    except exception.InstanceNotFound:
        LOG.info('Could    not    find    domain    in    libvirt    for    instance    %s.    Cannot    get    block    stats    for    device', instance.name, instance=instance)
