qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] Disconecting /dev/nbdX leaves stale partitions and devi


From: Richard W.M. Jones
Subject: Re: [Qemu-block] Disconecting /dev/nbdX leaves stale partitions and device
Date: Thu, 19 Jul 2018 12:26:45 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jul 19, 2018 at 01:56:34PM +0300, Nir Soffer wrote:
> This looks like a better solution, avoiding root access to attach to
> /dev/nbdX,
> but this makes nbd less attractive for oVirt because we don't have nbd
> client
> supporting streaming.
>
> We are missing libnbd, allowing reading and writing to nbd-server. Can we
> extract code from qemu-img to create such library? Having libnbd with
> bindings
> to popular languages can make nbd much attractive solution for the
> community.

I think it's fairly hopeless to try extracting block/nbd*.c as a
separate library.  It depends very deeply on internal qemu APIs.

> I know Richard is working on adding nbd support for libcurl, but I'm not
> sure
> curl is the best place to integrate it.
> https://curl.haxx.se/mail/lib-2018-07/0052.html

Having almost completed this now (see attachment) I'm kind of in
agreement with that thread, although not for the reasons that were
given.  I now think the internals of libcurl are pretty horrible and
we shouldn't depend on it for anything mission-critical.

I agree therefore that we will eventually need a separate library for
this.

I'm still going to submit the patch once its finished so we have basic
upload/download in curl.

> Basically we we need is something like:
> 
>     nbd_map(fd) - return list of allocated ranges
>     nbd_pread(fd, offset, size, buf) - read data in range into buf
>     nbd_pwrite(fd, offset, size, buf) - write data size bytes in but to
> offset
> 
> (The library api should be probably be bigger, matching the procotol, but
> I'm ignoring anything we don't need now)

We'd probably want to make the library non-blocking.

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

Attachment: 0001-Add-NBD-Network-Block-Device-support.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]