def get_all_volume_usage(self, context, compute_host_bdms):
    'Return usage info for volumes attached to vms on\n           a given host.\n        '
    vol_usage = []
    for instance_bdms in compute_host_bdms:
        instance = instance_bdms['instance']
        for bdm in instance_bdms['instance_bdms']:
            vol_stats = []
            mountpoint = bdm['device_name']
            if mountpoint.startswith('/dev/'):
                mountpoint = mountpoint[5:]
            volume_id = bdm['volume_id']
            LOG.debug('Trying to get stats for the volume %s', volume_id)
            vol_stats = self.block_stats(instance['name'], mountpoint)
            if vol_stats:
                stats = dict(volume=volume_id, instance=instance, rd_req=vol_stats[0], rd_bytes=vol_stats[1], wr_req=vol_stats[2], wr_bytes=vol_stats[3], flush_operations=vol_stats[4])
                LOG.debug('Got volume usage stats for the volume=%(volume)s, rd_req=%(rd_req)d, rd_bytes=%(rd_bytes)d, wr_req=%(wr_req)d, wr_bytes=%(wr_bytes)d', stats, instance=instance)
                vol_usage.append(stats)
    return vol_usage
Return usage info for volumes attached to vms on
a given host.
def get_all_volume_usage(self, context, compute_host_bdms):
    'Return usage info for volumes attached to vms on\n           a given host.\n        '
    vol_usage = []
    for instance_bdms in compute_host_bdms:
        instance = instance_bdms['instance']
        for bdm in instance_bdms['instance_bdms']:
            vol_stats = []
            mountpoint = bdm['device_name']
            if mountpoint.startswith('/dev/'):
                mountpoint = mountpoint[5:]
            volume_id = bdm['volume_id']
            LOG.debug('Trying to get stats for the volume %s', volume_id)
            vol_stats = self.block_stats(instance['name'], mountpoint)
            if vol_stats:
                stats = dict(volume=volume_id, instance=instance, rd_req=vol_stats[0], rd_bytes=vol_stats[1], wr_req=vol_stats[2], wr_bytes=vol_stats[3], flush_operations=vol_stats[4])
                LOG.debug('Got volume usage stats for the volume=%(volume)s, rd_req=%(rd_req)d, rd_bytes=%(rd_bytes)d, wr_req=%(wr_req)d, wr_bytes=%(wr_bytes)d', stats, instance=instance)
                vol_usage.append(stats)
    return vol_usage