qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [patch 3/4] block stream: add support for partial strea


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [patch 3/4] block stream: add support for partial streaming
Date: Thu, 05 Jan 2012 08:46:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/04/2012 11:40 PM, Stefan Hajnoczi wrote:
What you want sounds almost like an NBD server that can be
launched/stopped while qemu is already running a VM.  This could be a
QEMU monitor command like:
nbd-start tcp::1234 virtio-disk0 --snapshot 20120104

It would be possible to stop the server using the same<socket, drive,
snapshot>  tuple.  Note the server needs to provide read-only access,
allowing writes probably has little use and people will hose their
data.

That makes sense, just like most qemu-img commands have an equivalent in the monitor for online usage.

Paolo: I haven't looked at the new and improved NBD server yet.  Does
this sound doable?

Yes, indeed. It should not be hard. The NBD server is now entirely asynchronous, and by using the main loop the integration is very much simplified.

Briefly, nbd.c now has a simple server API:

    typedef struct NBDExport NBDExport;
    typedef struct NBDClient NBDClient;

    NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset,
                              off_t size, uint32_t nbdflags);
    void nbd_export_close(NBDExport *exp);
    NBDClient *nbd_client_new(NBDExport *exp, int csock,
                              void (*close)(NBDClient *));

... that takes care of everything except creating the server socket and accepting clients from it. Which is actually even better, because instead of having a generic NBD server you could start one on a file descriptor that you pass via SCM_RIGHTS (aka getfd).

Kevin: I think we need something like qcow2_snapshot_load_tmp() but it
returns a full new BlockDriverState.  The hard thing is that duping a
read-only snapshot qcow2 state leads to sharing and lifecycle problems
- what if we want to close the original BlockDriverState, will the
read-only snapshot state prevent this?

We can prevent closing the parent BDS until all its children are gone.

Paolo



reply via email to

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