Re: [Qemu-block] [PATCH v2 36/40] job: Add lifecycle QMP commands

2018-05-22 Thread Kevin Wolf
Am 18.05.2018 um 20:12 hat Eric Blake geschrieben:
> On 05/18/2018 08:21 AM, Kevin Wolf wrote:
> > This adds QMP commands that control the transition between states of the
> > job lifecycle.
> > 
> > Signed-off-by: Kevin Wolf 
> > ---
> >   qapi/job.json |  99 +++
> >   job-qmp.c | 134 
> > ++
> >   MAINTAINERS   |   1 +
> >   Makefile.objs |   1 +
> >   trace-events  |   9 
> >   5 files changed, 244 insertions(+)
> >   create mode 100644 job-qmp.c
> > 
> > +##
> > +# @job-dismiss:
> > +#
> > +# Deletes a job that is in the CONCLUDED state. This command only needs to 
> > be
> > +# run explicitly for jobs that don't have automatic dismiss enabled.
> 
> Did we decide whether it is valid to expect a job with automatic dismiss
> enabled (old-style block jobs) to use the new job control commands?

"job control commands" is a pretty broad term, so I'd say yes, it's
expected that you can use job-* commands on any job. For example,
job-pause/resume make perfect sense on a job with auto-dismiss=true.

> Or would it be reasonable to require that 'job-dismiss' is an error on
> jobs with auto-dismiss enabled

This, too, but only because it implicitly follows from the condition
specified above: You'll never catch a job in the CONCLUDED state when
you have auto-dismiss=true because it will immediately move on to NULL.

> (as in, if you're going to use new style jobs, you are guaranteed to
> also have auto-dismiss false, because we don't expose a way to change
> that flag in new-style jobs; and if you use old style jobs, all
> management of the job should be done through the old interfaces).

I'm not completely convinced that auto-dismiss=false is the only
"correct" setting. That might be the case for libvirt, but possibly not
for simple ad-hoc scripts with lower requirements.

We don't have any new jobs yet, so whether we expose the auto-* flags
there is a decision yet to be made.

Kevin



Re: [Qemu-block] [PATCH v2 36/40] job: Add lifecycle QMP commands

2018-05-18 Thread Eric Blake

On 05/18/2018 08:21 AM, Kevin Wolf wrote:

This adds QMP commands that control the transition between states of the
job lifecycle.

Signed-off-by: Kevin Wolf 
---
  qapi/job.json |  99 +++
  job-qmp.c | 134 ++
  MAINTAINERS   |   1 +
  Makefile.objs |   1 +
  trace-events  |   9 
  5 files changed, 244 insertions(+)
  create mode 100644 job-qmp.c

+##
+# @job-dismiss:
+#
+# Deletes a job that is in the CONCLUDED state. This command only needs to be
+# run explicitly for jobs that don't have automatic dismiss enabled.


Did we decide whether it is valid to expect a job with automatic dismiss 
enabled (old-style block jobs) to use the new job control commands?  Or 
would it be reasonable to require that 'job-dismiss' is an error on jobs 
with auto-dismiss enabled (as in, if you're going to use new style jobs, 
you are guaranteed to also have auto-dismiss false, because we don't 
expose a way to change that flag in new-style jobs; and if you use old 
style jobs, all management of the job should be done through the old 
interfaces).



+# This command will refuse to operate on any job that has not yet reached its
+# terminal state, JOB_STATUS_CONCLUDED. For jobs that make use of JOB_READY
+# event, job-cancel or job-complete will still need to be used as appropriate.
+#
+# @id: The job identifier.
+#
+# Since: 2.13
+##
+{ 'command': 'job-dismiss', 'data': { 'id': 'str' } }
+



--
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org