[libvirt PATCH v5 21/32] qemu: use nbdkit to serve network disks if available

Peter Krempa pkrempa at redhat.com
Thu Feb 16 16:27:54 UTC 2023


On Thu, Feb 16, 2023 at 10:13:27 -0600, Jonathon Jongsma wrote:
> On 2/16/23 9:55 AM, Peter Krempa wrote:
> > On Tue, Feb 14, 2023 at 11:08:08 -0600, Jonathon Jongsma wrote:
> > > For virStorageSource objects that contain an nbdkitProcess, start that
> > > nbdkit process to serve that network drive and then pass the nbdkit
> > > socket to qemu rather than sending the network url to qemu directly.
> > > 
> > > Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> > > ---

[...]

> > 
> > Any particular reason why you need to setup the cgroups starting from
> > the bottom-most image?
> > 
> > Specifically for nbdkit it should not matter too much as we need to
> > start them before starting qemu anyways.
> > 
> > In QEMU we indeed must construct the backing chain from the bottom image
> > first.
> 
> I just figured that logically the backing source should always be available
> to the upper layers, so I would try to be consistent and always set them up
> that way. But I agree that this is not really necessary here and makes the
> code less concise, so I'll change them.

Well, that makes sense, but for actual starting of nbdkit you use this
algorithm:



  for (backing = src->backingStore; backing != NULL; backing = backing->backingStore)
     if (qemuNbdkitStartStorageSourceOne(driver, vm, backing) < 0)
        return -1;

   return qemuNbdkitStartStorageSourceOne(driver, vm, src);

So a chain of images such as

 [qemu] -> top -> b1 -> b2

Gets started as

b1, b2, top

But yeah, it doesn't matter as long as you start everything before
talking to qemu as nbdkit doesn't actually try to do anything with the
actual image itself.


More information about the libvir-list mailing list