Re: [PATCH 1/5] move jobs enums QEMU_X into hypervisor as VIR_X

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

 



On 3/24/22 16:32, Kristina Hanicova wrote:
> These enums are essentially the same and always sorted in the
> same order in every hypervisor with jobs. They can be generalized
> by using the qemu enums as the main ones as they are the most
> extensive.
> 
> Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx>
> ---
>  src/hypervisor/domain_job.c      |  32 +++
>  src/hypervisor/domain_job.h      |  52 +++++
>  src/hypervisor/meson.build       |   1 +
>  src/libvirt_private.syms         |   5 +
>  src/libxl/libxl_domain.c         |   1 +
>  src/qemu/MIGRATION.txt           |   6 +-
>  src/qemu/THREADS.txt             |  16 +-
>  src/qemu/qemu_backup.c           |  22 +-
>  src/qemu/qemu_block.c            |  20 +-
>  src/qemu/qemu_block.h            |  12 +-
>  src/qemu/qemu_blockjob.c         |  32 +--
>  src/qemu/qemu_checkpoint.c       |  18 +-
>  src/qemu/qemu_domain.c           |  26 +--
>  src/qemu/qemu_domain.h           |   4 +-
>  src/qemu/qemu_domainjob.c        | 236 ++++++++++------------
>  src/qemu/qemu_domainjob.h        |  85 ++------
>  src/qemu/qemu_driver.c           | 332 +++++++++++++++----------------
>  src/qemu/qemu_hotplug.c          |  50 ++---
>  src/qemu/qemu_hotplug.h          |  10 +-
>  src/qemu/qemu_migration.c        | 218 ++++++++++----------
>  src/qemu/qemu_migration.h        |   8 +-
>  src/qemu/qemu_migration_params.c |   4 +-
>  src/qemu/qemu_process.c          | 188 ++++++++---------
>  src/qemu/qemu_process.h          |  22 +-
>  src/qemu/qemu_saveimage.c        |   4 +-
>  src/qemu/qemu_saveimage.h        |   4 +-
>  src/qemu/qemu_snapshot.c         |  56 +++---
>  src/qemu/qemu_snapshot.h         |   2 +-
>  28 files changed, 739 insertions(+), 727 deletions(-)
> 
> diff --git a/src/hypervisor/domain_job.c b/src/hypervisor/domain_job.c
> index 9ac8a6d544..ff4e008cb5 100644
> --- a/src/hypervisor/domain_job.c
> +++ b/src/hypervisor/domain_job.c
> @@ -9,6 +9,38 @@
>  #include "domain_job.h"
>  
>  
> +VIR_ENUM_IMPL(virDomainJob,
> +              VIR_JOB_LAST,
> +              "none",
> +              "query",
> +              "destroy",
> +              "suspend",
> +              "modify",
> +              "abort",
> +              "migration operation",
> +              "none",   /* async job is never stored in job.active */
> +              "async nested",
> +);
> +
> +VIR_ENUM_IMPL(virDomainAgentJob,
> +              VIR_AGENT_JOB_LAST,
> +              "none",
> +              "query",
> +              "modify",
> +);
> +
> +VIR_ENUM_IMPL(virDomainAsyncJob,
> +              VIR_ASYNC_JOB_LAST,
> +              "none",
> +              "migration out",
> +              "migration in",
> +              "save",
> +              "dump",
> +              "snapshot",
> +              "start",
> +              "backup",
> +);
> +
>  virDomainJobData *
>  virDomainJobDataInit(virDomainJobDataPrivateDataCallbacks *cb)
>  {
> diff --git a/src/hypervisor/domain_job.h b/src/hypervisor/domain_job.h
> index 257ef067e4..b9d1107580 100644
> --- a/src/hypervisor/domain_job.h
> +++ b/src/hypervisor/domain_job.h
> @@ -6,6 +6,58 @@
>  #pragma once
>  
>  #include "internal.h"
> +#include "virenum.h"
> +
> +/* Only 1 job is allowed at any time
> + * A job includes *all* monitor commands, even those just querying
> + * information, not merely actions */
> +typedef enum {
> +    VIR_JOB_NONE = 0,  /* Always set to 0 for easy if (jobActive) conditions */
> +    VIR_JOB_QUERY,         /* Doesn't change any state */
> +    VIR_JOB_DESTROY,       /* Destroys the domain (cannot be masked out) */
> +    VIR_JOB_SUSPEND,       /* Suspends (stops vCPUs) the domain */
> +    VIR_JOB_MODIFY,        /* May change state */
> +    VIR_JOB_ABORT,         /* Abort current async job */
> +    VIR_JOB_MIGRATION_OP,  /* Operation influencing outgoing migration */
> +
> +    /* The following two items must always be the last items before JOB_LAST */
> +    VIR_JOB_ASYNC,         /* Asynchronous job */
> +    VIR_JOB_ASYNC_NESTED,  /* Normal job within an async job */
> +
> +    VIR_JOB_LAST
> +} virDomainJob;
> +VIR_ENUM_DECL(virDomainJob);

I was gonna suggest VIR_DOMAIN_JOB_* instead, but that's not possible
because that's already used by virDomainJobType which is a public enum.
So I guess this can stay then.

Michal




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux