def _get_instance_disk_info(self, instance_name, xml, block_device_info=None):
    block_device_mapping = driver.block_device_info_get_mapping(block_device_info)
    volume_devices = set()
    for vol in block_device_mapping:
        disk_dev = vol['mount_device'].rpartition('/')[2]
        volume_devices.add(disk_dev)
    disk_info = []
    doc = etree.fromstring(xml)
    disk_nodes = doc.findall('.//devices/disk')
    path_nodes = doc.findall('.//devices/disk/source')
    driver_nodes = doc.findall('.//devices/disk/driver')
    target_nodes = doc.findall('.//devices/disk/target')
    for (cnt, path_node) in enumerate(path_nodes):
        disk_type = disk_nodes[cnt].get('type')
        path = path_node.get('file')
        target = target_nodes[cnt].attrib['dev']
        if (not path):
            LOG.debug('skipping disk for %s as it does not have a path', instance_name)
            continue
        if (disk_type != 'file'):
            LOG.debug('skipping %s since it looks like volume', path)
            continue
        if (target in volume_devices):
            LOG.debug('skipping disk %(path)s (%(target)s) as it is a volume', {'path': path, 'target': target})
            continue
        dk_size = int(os.path.getsize(path))
        disk_type = driver_nodes[cnt].get('type')
        if (disk_type == 'qcow2'):
            backing_file = libvirt_utils.get_disk_backing_file(path)
            virt_size = disk.get_disk_size(path)
            over_commit_size = (int(virt_size) - dk_size)
        else:
            backing_file = ''
            virt_size = dk_size
            over_commit_size = 0
        disk_info.append({'type': disk_type, 'path': path, 'virt_disk_size': virt_size, 'backing_file': backing_file, 'disk_size': dk_size, 'over_committed_disk_size': over_commit_size})
    return jsonutils.dumps(disk_info)
def _get_instance_disk_info(self, instance_name, xml, block_device_info=None):
    block_device_mapping = driver.block_device_info_get_mapping(block_device_info)
    volume_devices = set()
    for vol in block_device_mapping:
        disk_dev = vol['mount_device'].rpartition('/')[2]
        volume_devices.add(disk_dev)
    disk_info = []
    doc = etree.fromstring(xml)
    disk_nodes = doc.findall('.//devices/disk')
    path_nodes = doc.findall('.//devices/disk/source')
    driver_nodes = doc.findall('.//devices/disk/driver')
    target_nodes = doc.findall('.//devices/disk/target')
    for (cnt, path_node) in enumerate(path_nodes):
        disk_type = disk_nodes[cnt].get('type')
        path = path_node.get('file')
        target = target_nodes[cnt].attrib['dev']
        if (not path):
            LOG.debug('skipping disk for %s as it does not have a path', instance_name)
            continue
        if (disk_type != 'file'):
            LOG.debug('skipping %s since it looks like volume', path)
            continue
        if (target in volume_devices):
            LOG.debug('skipping disk %(path)s (%(target)s) as it is a volume', {'path': path, 'target': target})
            continue
        dk_size = int(os.path.getsize(path))
        disk_type = driver_nodes[cnt].get('type')
        if (disk_type == 'qcow2'):
            backing_file = libvirt_utils.get_disk_backing_file(path)
            virt_size = disk.get_disk_size(path)
            over_commit_size = (int(virt_size) - dk_size)
        else:
            backing_file = 
            virt_size = dk_size
            over_commit_size = 0
        disk_info.append({'type': disk_type, 'path': path, 'virt_disk_size': virt_size, 'backing_file': backing_file, 'disk_size': dk_size, 'over_committed_disk_size': over_commit_size})
    return jsonutils.dumps(disk_info)