[libvirt] [PATCH] util: storagefile: Properly set transport type when parsing NBD strings

Richard W.M. Jones rjones at redhat.com
Thu Jan 16 13:21:15 UTC 2020


On Thu, Jan 16, 2020 at 01:13:38PM +0000, Richard W.M. Jones wrote:
> On Thu, Jan 16, 2020 at 12:41:37PM +0100, Peter Krempa wrote:
> > When parsing legacy NBD backing file strings such as
> > 'nbd:unix:/tmp/sock:exportname=/' we'd fail to set the transport to
> > VIR_STORAGE_NET_HOST_TRANS_UNIX. This started to be a problem once we
> > actually started to generate config of the backing store on the command
> > line with -blockdev as the JSON code would try to format it as TCP and
> > fail with:
> > 
> >  internal error: argument key 'host' must not have null value
> > 
> > Set the type properly and add a test.
> > 
> > This bug was found by the libguestfs test suite in:
> > 
> > https://bugzilla.redhat.com/show_bug.cgi?id=1791614
> 
> The bug was found by Ming Xie of the virt-v2v QE team.
> 
> The patch itself looks fine as far as I can tell.  But I'm having real
> problems actually testing it.  Can you suggest any way to test libvirt
> parsing these URIs?
> 
> My current method (which doesn't work for reasons that I don't
> understand) is:
> 
> (1) Compile libvirt from source.
> 
> (2) Run ./run src/libvirtd &
> 
> (3) Create an NBD server + overlay file:
> 
> rm /tmp/sock
> nbdkit -U /tmp/sock memory 1G
> qemu-img create -f qcow2 overlay.qcow2 -b nbd:unix:/tmp/sock:exportname=/ -F raw
> 
> (4) Try to boot a libvirt guest using the overlay:
> 
> virt-install --import --name test --disk path=overlay.qcow2,format=raw --memory 1024
> 
> But for some reason libvirt just ignores the overlay:
> 
> 2020-01-16 13:00:44.980+0000: 2378711: warning : virStorageBackendVolOpen:1527 : ignoring missing file 'nbd:unix:/tmp/sock'
> 
> I verified that the overlay works in programs like qemu-img so it
> doesn't seem to be a problem with the overlay itself.

The problem was too old qemu.  With qemu 4.2 I can verify that
the patch is working, so:

Tested-by: Richard W.M. Jones <rjones at redhat.com>

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list