[libvirt] [PATCH 8/9] API: Introduce VIR_DOMAIN_JOB_SUCCESS field for virDomainGetJobStats

Peter Krempa posted 9 patches 6 years, 2 months ago
[libvirt] [PATCH 8/9] API: Introduce VIR_DOMAIN_JOB_SUCCESS field for virDomainGetJobStats
Posted by Peter Krempa 6 years, 2 months ago
The statistics fields are used in two places:

1) virDomainGetJobStats where the job type which ultimately holds
whether the job was successful or not is returned via a different
argument.

2) The virConnectDomainEventJobCompleted event where we report just the
statistics via typed parameters.

Since it might be useful to report the event also for jobs which
completed unsuccessfully and we don't have the means to transport the
state via a different variable with the event let's add a new field
which will hold the success state.

Since this is meant primarily for completed jobs a plain boolean is
sufficient to convey whether the job was successful or not.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 include/libvirt/libvirt-domain.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index 84b3cfdff7..0e490254fd 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3578,6 +3578,13 @@ typedef enum {
  */
 # define VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE  "auto_converge_throttle"

+/**
+ * VIR_DOMAIN_JOB_SUCCESS:
+ *
+ * virDomainGetJobStats field: Present only in statistics for a completed job.
+ * Successful completion of the job as VIR_TYPED_PARAM_BOOLEAN.
+ */
+# define VIR_DOMAIN_JOB_SUCCESS "success"

 /**
  * virConnectDomainEventGenericCallback:
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 8/9] API: Introduce VIR_DOMAIN_JOB_SUCCESS field for virDomainGetJobStats
Posted by Eric Blake 6 years, 2 months ago
On 11/25/19 9:01 AM, Peter Krempa wrote:
> The statistics fields are used in two places:
> 
> 1) virDomainGetJobStats where the job type which ultimately holds
> whether the job was successful or not is returned via a different
> argument.
> 
> 2) The virConnectDomainEventJobCompleted event where we report just the
> statistics via typed parameters.
> 
> Since it might be useful to report the event also for jobs which
> completed unsuccessfully and we don't have the means to transport the
> state via a different variable with the event let's add a new field
> which will hold the success state.
> 
> Since this is meant primarily for completed jobs a plain boolean is
> sufficient to convey whether the job was successful or not.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>   include/libvirt/libvirt-domain.h | 7 +++++++
>   1 file changed, 7 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>

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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list