[libvirt] [PATCH 2/2] util: storage: add JSON backing volume parser 'raw' block driver

Tomáš Golembiovský tgolembi at redhat.com
Tue Feb 14 21:03:54 UTC 2017


Hi,

On Tue, 14 Feb 2017 15:58:45 +0000
"Richard W.M. Jones" <rjones at redhat.com> wrote:

> The patches compile.
> 
> I looked at both commits and they at least superficially seem
> sensible.  I'm not intimately familiar enough with the original code
> to review this fully.
> 
> However I want to try to test this using libguestfs.  I believe the
> following test case should be sufficient:
> 
>   $ cd /var/tmp
>   $ truncate -s 1M backing.img
>   $ qemu-img create \
>       -b 'json:{"driver":"raw", "file":{"filename":"/var/tmp/backing.img"}}' \

The problem lies in the JSON here. Libvirt lacks the driver probing
mechanism QEMU has (which makes sense). That means one has to be
explicit about the drivers. Try with the following backing definition:

json:{"driver":"raw", "file":{ "driver":"file", "filename":"/var/tmp/backing.img"}}

    Tomas

>       -f qcow2 overlay.qcow2
>   $ guestfish -a /var/tmp/overlay.qcow2 run
>   libguestfs: error: could not create appliance through libvirt.
>   
>   Try running qemu directly without libvirt using this environment variable:
>   export LIBGUESTFS_BACKEND=direct
>   
>   Original error from libvirt: invalid argument: JSON backing volume defintion '{"driver":"raw", "file":{"filename":"/var/tmp/backing.img"}}' lacks driver name [code=8 int1=-1]
> 
> But with libvirt built with your patches:
> 
>   $ killall libvirtd
>   $ ../libvirt/run guestfish -a /var/tmp/overlay.qcow2 run
>   libguestfs: error: could not create appliance through libvirt.
>   
>   Try running qemu directly without libvirt using this environment variable:
>   export LIBGUESTFS_BACKEND=direct
>   
>   Original error from libvirt: invalid argument: JSON backing volume defintion '{"driver":"raw","file":{"filename":"/var/tmp/backing.img"}}' lacks driver name [code=8 int1=-1]
> 
> It could be that my test case is wrong in some way.  I enabled
> debugging and it does appear to be using the new version of libvirt,
> so I'm not sure what's up ...
> 
> Rich.
> 
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> libguestfs lets you edit virtual machines.  Supports shell scripting,
> bindings from many languages.  http://libguestfs.org


-- 
Tomáš Golembiovský <tgolembi at redhat.com>




More information about the libvir-list mailing list