Comment 4 for bug 1459748

Revision history for this message
Ryan Harper (raharper) wrote :

In the change between vivid (1.2.12) and wily (1.2.15) the following patch from upstream was applied:

commit fbcf7da95b872ac45cabc4356fc9c06e809d0237
Author: Ján Tomko <email address hidden>
Date: Thu Jul 31 18:07:56 2014 +0200

    Introduce struct _virStorageBackendQemuImgInfo

    This will contain the data required for creating the qemu-img
    command line without having access to the volume definition.

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index fdda0dc..f5b95ec 100644

The core issue is when the qemu-img command builder includes the size string ("%llk", size_arg). In vivid, if you are not converting, it creates it (0k) in our case, which is completely valid parameter to qemu-img.

In wily (1.2.15) this is now a new condition see this diff:

- if (convert)
- virCommandAddArg(cmd, inputPath);
- virCommandAddArg(cmd, vol->target.path);
- if (!convert)
- virCommandAddArgFormat(cmd, "%lluK", size_arg);
+ if (info.inputPath)
+ virCommandAddArg(cmd, info.inputPath);
+ virCommandAddArg(cmd, info.path);
+ if (!info.inputPath && info.size_arg)
+ virCommandAddArgFormat(cmd, "%lluK", info.size_arg);

I suspect that we might need to report this upstream. If we don't pass a capacity (or pass it as 0)
then the if (!info.inputPath && info.size_arg) will always fail: if (1 && 0), and it will stay broken

I think it's safe to drop the && info.size_arg check since it's safe to call qemu-img with size 0:

(foudres) libvirt % sudo /usr/bin/qemu-img create -f qcow2 -o compat=0.10 /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=
qemu-img: /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=: Image creation needs a size parameter
(foudres) libvirt % sudo /usr/bin/qemu-img create -f qcow2 -o compat=0.10 /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ= 0K
Formatting '/var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=', fmt=qcow2 size=0 compat='0.10' encryption=off cluster_size=65536 lazy_refcounts=off
(foudres) libvirt % ls -al /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=
-rw-r--r-- 1 root root 196608 Jun 29 12:12 /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=
(foudres) libvirt % sudo qemu-img info /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=
image: /var/lib/uvtool/libvirt/images/x-uvt-b64-Y29tLnVidW50dS5jbG91ZDpzZXJ2ZXI6MTUuMTA6YW1kNjQgMjAxNTA2MjQ=
file format: qcow2
virtual size: 0 (0 bytes)
disk size: 192K
cluster_size: 65536
Format specific information:
    compat: 0.10