qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>
Cc: Jeff Cody <jcody@redhat.com>,
	qemu-devel@nongnu.org, armbru@redhat.com, kraxel@redhat.com,
	John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 00/25] qmp: add async command type
Date: Thu, 2 Feb 2017 10:13:50 +0000	[thread overview]
Message-ID: <20170202101350.GB22164@stefanha-x1.localdomain> (raw)
In-Reply-To: <CAJ+F1CJxkOoM1qPx0BL8KkabY=EX00jJCwTmHqZp5iahmLf3FA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 7006 bytes --]

On Wed, Feb 01, 2017 at 08:25:10PM +0000, Marc-André Lureau wrote:
> Hi
> 
> On Wed, Feb 1, 2017 at 8:26 PM Stefan Hajnoczi <stefanha@gmail.com> wrote:
> 
> > On Mon, Jan 30, 2017 at 01:18:16PM -0500, Marc-André Lureau wrote:
> > > Hi
> > >
> > > ----- Original Message -----
> > > > On Tue, Jan 24, 2017 at 01:43:17PM -0500, Marc-André Lureau wrote:
> > > > > Hi
> > > > >
> > > > > ----- Original Message -----
> > > > > > On Mon, Jan 23, 2017 at 06:27:29AM -0500, Marc-André Lureau wrote:
> > > > > > > ----- Original Message -----
> > > > > > > > On Wed, Jan 18, 2017 at 08:03:07PM +0400, Marc-André Lureau
> > wrote:
> > > > > > > > > Hi,
> > > > > > > >
> > > > > > > > CCing Jeff Cody and John Snow, who have been working on
> > generalizing
> > > > > > > > Block Job APIs to generic background jobs.  There is some
> > overlap
> > > > > > > > between async commands and background jobs.
> > > > > > >
> > > > > > > If you say so :) Did I miss a proposal or a discussion for async
> > qmp
> > > > > > > commands?
> > > > > >
> > > > > > There is no recent mailing list thread, so it's probably best to
> > discuss
> > > > > > here:
> > > > > >
> > > > > > The goal of jobs is to support long-running operations that can be
> > > > > > managed via QMP.  Jobs can have a more elaborate lifecycle than
> > just
> > > > > > start -> finish/cancel (e.g. they can be paused/resumed and may
> > have
> > > > > > multiple phases of execution that the client controls).  There are
> > QMP
> > > > > > APIs to query their state (Are they running?  How much "progress"
> > has
> > > > > > been made?).
> > > > >
> > > > > Indeed, I mention that in my cover. Such use cases require something
> > more
> > > > > complete than simple async qmp commands. I don't see why it would be
> > > > > incompatible with the usage of async qmp commands.
> > > > >
> > > > > > A client reconnecting to QEMU can query running jobs.  This way a
> > client
> > > > > > can resume with a running QEMU process.  For commands like saving a
> > > > > > screenshot is mostly does not matter, but for commands that modify
> > state
> > > > > > it's critical that clients are aware of running commands after
> > reconnect
> > > > > > to prevent corruption/interference.  This behavior is what I asked
> > about
> > > > > > in my previous mail.
> > > > >
> > > > > That's what I mention in the cover, some commands are global (and
> > > > > broadcasted events are appropriate) and some are local to the client
> > > > > context. Some could be discarded when the client disconnects etc.
> > It's a
> > > > > case by case.
> > > > >
> > > > > > Jobs are currently only used by the block layer and called "block
> > jobs",
> > > > > > but the idea is to generalize this.  They use synchronous QMP +
> > events.
> > > > >
> > > > > That pattern will have the flaws I mentioned (empty return, broadcast
> > > > > events, id conflict, qapi semantic & documentation etc). Something
> > new can
> > > > > be invented, but it will likely make the protocol more complicated
> > > > > compared to the solution I proposed (which is optional btw, and
> > gracefully
> > > > > fallbacks to sync processing for clients that do not support the
> > async qmp
> > > > > capability). However, I believe the job interface could be built on
> > top of
> > > > > what I propose.
> > > > >
> > > > > > Jobs are more heavy-weight than async QMP commands, but
> > pause/resume,
> > > > > > rate-limiting, progress reporting, robust reconnect, etc are
> > important
> > > > > > features.  Users want to be aware of long-running operations and
> > have
> > > > > > the ability to control them.
> > > > >
> > > > > You can't generalize such job interface to all async commands. Some
> > may not
> > > > > implement the ability to report progress, to cancel, to pause etc,
> > etc. In
> > > > > the end, it will be complicated and unneeded in many cases (what's
> > the use
> > > > > case to pause or to get the progress of a screendump?). What I
> > propose is
> > > > > simpler and compatible with job/task interfaces appropriate for
> > various
> > > > > domains.
> > > > >
> > > > > > I suspect that if we transition synchronous QMP commands to async
> > we'll
> > > > > > soon have requirements for progress reporting, pause/resume, etc.
> > So is
> > > > > > there a set of commands that should be async and others that
> > should be
> > > > > > jobs or should everything just be a job?
> > > > >
> > > > > Hard to say without a concrete proposal of what "job" is. Likely,
> > > > > everything is not going to be a "job".
> > > > >
> > > > > But hopefully qmp-async and jobs can co-exist and benefit from each
> > other.
> > > >
> > > > My concern with this series is that background operations must be
> > > > observable and there must be a way to cancel them.  Otherwise
> > management
> > > > tools cannot do their job and it's hard to troubleshoot a misbehaving
> > > > system because you can't answer the question "what's going on?".  Once
> > > > you add that then a large chunk of block jobs is duplicated.
> > >
> > > Tracking ongoing operations can also be done at management layer. If
> > needed, we could add qmp-commands to list on-going commands (their ids
> > etc), and add commands to cancel them. But then again, not all operations
> > will be cancellable, and I am not sure having requirements to list or
> > cancel or modify all on-going operation is needed (I would say no, just
> > like today you can't do anything while a command is running)
> >
> > It cannot be done by robustly by the client.  If the client crashes then
> > there's no way of knowing what pending commands are running.  Requiring
> > the client to keep a journal would force every client that wants to be
> > robust and easy to troubleshoot to duplicate this and IMO isn't a
> > solution.
> >
> >
> My proposal allows for commands to be cancelled when the client is gone.
> And we can quite easily provide a qmp command to list on-going commands, I
> can add a patch for that.
> 
> There is no per-client context as of today, so recovering from on-going job
> would conflict with other clients (there is no per client id or job-id
> namespace neither). I don't know if there is a way to enforce only a single
> qmp client today, I would have to check.
> 
> QEMU knows which commands are in-flight, it should be able to report
> > this info.  It's important for troubleshooting.
> >
> > I agree that it's not important today since only one command runs at a
> > time (except block jobs and migration, which do have commands to query
> > their status).  But the nature of async commands means that they can run
> > in the background for a long time, so it will be necessary.
> >
> >
> If needed, it can be added with this proposal. I will add a
> proof-of-concept patch in the next iteration.

Great.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2017-02-02 10:13 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 16:03 [Qemu-devel] [PATCH v2 00/25] qmp: add async command type Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 01/25] tests: start generic qemu-qmp tests Marc-André Lureau
2017-01-18 16:14   ` Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 02/25] tests: change /0.15/* tests to /qmp/* Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 03/25] qmp: teach qmp_dispatch() to take a pre-filled QDict Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 04/25] qmp: use a return callback for the command reply Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 05/25] qmp: add QmpClient Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 06/25] qmp: add qmp_return_is_cancelled() Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 07/25] qmp: introduce async command type Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 08/25] qapi: ignore top-level 'id' field Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 09/25] qmp: take 'id' from request Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 10/25] qmp: check that async command have an 'id' Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 11/25] scripts: learn 'async' qapi commands Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 12/25] tests: add dispatch async tests Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 13/25] monitor: add 'async' capability Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 14/25] monitor: add !qmp pre-conditions Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 15/25] monitor: suspend when running async and client has no async Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 16/25] qmp: update qmp-spec about async capability Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 17/25] qtest: add qtest-timeout Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 18/25] qtest: add qtest_init_qmp_caps() Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 19/25] tests: add tests for async and non-async clients Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 20/25] qapi: improve 'screendump' documentation Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 21/25] console: graphic_hw_update return true if async Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 22/25] console: add graphic_hw_update_done() Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 23/25] console: make screendump async Marc-André Lureau
2017-01-19  8:20   ` Gerd Hoffmann
2017-01-20 13:07     ` Marc-André Lureau
2017-01-23 12:04       ` Gerd Hoffmann
2017-01-23 12:35         ` Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 24/25] qtest: add /qemu-qmp/screendump test Marc-André Lureau
2017-01-18 16:03 ` [Qemu-devel] [PATCH v2 25/25] qmp: move json-message-parser and check to QmpClient Marc-André Lureau
2017-01-18 17:35 ` [Qemu-devel] [PATCH v2 00/25] qmp: add async command type no-reply
2017-01-23 10:55 ` Stefan Hajnoczi
2017-01-23 11:27   ` Marc-André Lureau
2017-01-24 11:43     ` Stefan Hajnoczi
2017-01-24 18:43       ` Marc-André Lureau
2017-01-30 13:43         ` Stefan Hajnoczi
2017-01-30 18:18           ` Marc-André Lureau
2017-01-31  7:43             ` Gerd Hoffmann
2017-01-31  8:18               ` Markus Armbruster
2017-02-01 16:25             ` Stefan Hajnoczi
2017-02-01 20:25               ` Marc-André Lureau
2017-02-02 10:13                 ` Stefan Hajnoczi [this message]
2017-01-25 15:16 ` Markus Armbruster
2017-04-24 19:10   ` Markus Armbruster
2017-04-25  0:06     ` John Snow
2017-04-25  6:55       ` Markus Armbruster
2017-04-25  9:13     ` Daniel P. Berrange
2017-04-25 10:22     ` Kevin Wolf
2017-04-28 15:55       ` Marc-André Lureau
2017-04-28 19:13         ` Kevin Wolf
2017-05-02  8:30           ` Gerd Hoffmann
2017-05-02  9:05           ` Marc-André Lureau
2017-05-02 10:42             ` Kevin Wolf
2017-05-04 19:01 ` Markus Armbruster
2017-05-05  9:00   ` Marc-André Lureau
2017-05-05 12:35     ` Markus Armbruster
2017-05-05 12:54       ` Marc-André Lureau
2017-05-05 13:50         ` Markus Armbruster
2017-05-05 12:27   ` Kevin Wolf
2017-05-05 12:51     ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170202101350.GB22164@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=armbru@redhat.com \
    --cc=jcody@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=marcandre.lureau@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).