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

Tomáš Golembiovský tgolembi at redhat.com
Wed Feb 15 11:53:39 UTC 2017


On Wed, 15 Feb 2017 10:55:24 +0000
"Richard W.M. Jones" <rjones at redhat.com> wrote:

> On Tue, Feb 14, 2017 at 10:03:54PM +0100, Tomáš Golembiovský wrote:
> > 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"}}  
> 
> OK, that works.  However it also works with the unpatched version of
> libvirt, so it's not proof that these patches fix any problem.

Ah, sorry. I didn't notice your JSON was bad from the start and I just
blindly extended it. The correct JSON should look like this:

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


    Tomas

> 
> Rich.
> 
> -- 
> Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> Read my programming and virtualization blog: http://rwmj.wordpress.com
> virt-df lists disk usage of guests without needing to install any
> software inside the virtual machine.  Supports Linux and Windows.
> http://people.redhat.com/~rjones/virt-df/


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




More information about the libvir-list mailing list