On Wed, Feb 15, 2017 at 12:53:39PM +0100, Tomáš Golembiovský wrote:
On Wed, 15 Feb 2017 10:55:24 +0000
"Richard W.M. Jones" <rjones(a)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(a)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"
}
}
}
Ok that does now demonstrate the fix.
For reference, here is the full test:
$ cd /var/tmp
$ rm -f backing.img
$ truncate -s 10M backing.img
$ qemu-img create -b 'json:{"file":{"driver":"raw",
"file":{"driver":"file",
"filename":"/var/tmp/backing.img"}}}' -f qcow2 overlay.qcow2
With old libvirt:
$ 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: internal error: missing parser implementation for JSON
backing volume driver 'raw' [code=1 int1=-1]
With patched libvirt:
$ killall libvirtd
$ ~/d/libvirt/run guestfish -a /var/tmp/overlay.qcow2 run
[no errors printed]
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW