'Copy data from snapshot to destination volume.
This is done with a qemu-img convert to raw/qcow2 from the snapshot
qcow2.'

def _copy_volume_from_snapshot(self, snapshot, volume, volume_size):

    info_path = self._local_path_volume_info(snapshot.volume)
    snap_info = self._read_info_file(info_path)
    vol_dir = self._local_volume_dir(snapshot.volume)
    out_format = self.choose_volume_format(volume)
    volume_format = self.get_volume_format(snapshot.volume)
    volume_path = self.local_path(volume)
    if (volume_format in (DISK_FORMAT_QCOW2, DISK_FORMAT_RAW)):
        forward_file = snap_info[snapshot.id]
        forward_path = os.path.join(vol_dir, forward_file)
        img_info = self._qemu_img_info(forward_path, snapshot.volume.name)
        path_to_snap_img = os.path.join(vol_dir, img_info.backing_file)
        LOG.debug('_copy_volume_from_snapshot:    will    copy    from    snapshot    at    %s.', path_to_snap_img)
        image_utils.convert_image(path_to_snap_img, volume_path, _to_qemu_format(out_format))
    elif (volume_format == DISK_FORMAT_PLOOP):
        with PloopDevice(self.local_path(snapshot.volume), snapshot.id, execute=self._execute) as dev:
            base_file = os.path.join(volume_path, 'root.hds')
            image_utils.convert_image(dev, base_file, _to_qemu_format(out_format))
    else:
        msg = (_('Unsupported    volume    format    %s') % volume_format)
        raise exception.InvalidVolume(msg)
    self._extend_volume(volume, volume_size, out_format)
    img_info = self._qemu_img_info(volume_path, volume.name)
