On Tue, Jun 23, 2020 at 01:14:43PM +0300, Nir Soffer wrote: > On Tue, Jun 23, 2020 at 12:47 PM Richard W.M. Jones <rjo...@redhat.com> wrote: > > Here you go: > > > > https://github.com/libguestfs/nbdkit/commit/2d15e79f65764d9b0c68bea28ed6afbcbcc63467 > > Nice! > > But using qemu-nbd directly is much simpler and will perform better.
Not sure about simpler, and you might want to verify the "perform better" claim (it is likely to be true because writing a plugin in Python causes requests to be serialized, but it may not matter if you're reading linearly from a file). The tar plugin could be rewritten in C if performance was really a problem. > Regardless, nbdit tar plugin is awesome. Is it possible to expose > all the disks from a tar file so they are accessible using the > export name? In theory yes, but it would require exposing the export name (nbdkit_export_name() -> nbdkit.export_name()) to Python plugins, which we don't do at the moment. See plugins/python/python.c: NbdkitMethods[]. That would also mean the plugin would require the latest nbdkit so you'd have to wait for patches to get backported to RHEL 8. You would also have to be cautious with security because the export name is supplied by the untrusted client. > For example: > > $ nbdkit tar file=vm.ova > > $ qemu-nbd --list > exports available: 2 > export: 'disk1.qcow2' > size: 910848 > flags: 0x48f ( readonly flush fua df cache ) > min block: 512 > opt block: 4096 > max block: 33554432 > available meta contexts: 1 > base:allocation > export: 'disk2.qcow2' > size: 910848 > flags: 0x48f ( readonly flush fua df cache ) > min block: 512 > opt block: 4096 > max block: 33554432 > available meta contexts: 1 > base:allocation > > $ qemu-img convert -f qcow2 -O raw nbb://localhost/disk1.qcow2 disk1.raw > > $ qemu-img convert -f qcow2 -O raw nbb://localhost/disk2.qcow2 disk2.raw Yup, it'd be nice ... Also nbdkit doesn't support the extension for listing export names, and that's a bunch more work. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v