def block_stats(self, instance_name, disk_id):
    'Note that this function takes an instance name.'
    try:
        domain = self._lookup_by_name(instance_name)
        return domain.blockStats(disk_id)
    except libvirt.libvirtError as e:
        errcode = e.get_error_code()
        LOG.info(_LI('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})
    except exception.InstanceNotFound:
        LOG.info(_LI('Could not find domain in libvirt for instance %s. Cannot get block stats for device'), instance_name)
Note that this function takes an instance name.
def block_stats(self, instance_name, disk_id):
    
    try:
        domain = self._lookup_by_name(instance_name)
        return domain.blockStats(disk_id)
    except libvirt.libvirtError as e:
        errcode = e.get_error_code()
        LOG.info(_LI('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})
    except exception.InstanceNotFound:
        LOG.info(_LI('Could not find domain in libvirt for instance %s. Cannot get block stats for device'), instance_name)