Re: [libvirt PATCH 6/9] libvirt: introduce virConnectGetHypervisorCPUModelDefinition public API

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

 



On Tue, Jun 28, 2022 at 06:09:43PM +0200, Tim Wiederhake wrote:
> Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
> ---
>  include/libvirt/libvirt-host.h |  7 +++++
>  src/driver-hypervisor.h        |  9 ++++++
>  src/libvirt-host.c             | 54 ++++++++++++++++++++++++++++++++++
>  src/libvirt_public.syms        |  1 +
>  4 files changed, 71 insertions(+)
> 
> diff --git a/include/libvirt/libvirt-host.h b/include/libvirt/libvirt-host.h
> index 5aaa001adb..ad11c1172d 100644
> --- a/include/libvirt/libvirt-host.h
> +++ b/include/libvirt/libvirt-host.h
> @@ -968,6 +968,13 @@ int virConnectGetHypervisorCPUModelNames(virConnectPtr conn,
>                                           char ***aliases,
>                                           unsigned int flags);
>  
> +int virConnectGetHypervisorCPUModelDefinition(virConnectPtr conn,
> +                                              const char *arch,
> +                                              const char *machine,

Now we've got machine + arch, but still haven't got 'virttype' and
'emulator' parameters

> +                                              const char *name,
> +                                              char **xmlCPU,
> +                                              unsigned int flags);
> +


> diff --git a/src/libvirt-host.c b/src/libvirt-host.c
> index 6e734628c1..8875f67a7b 100644
> --- a/src/libvirt-host.c
> +++ b/src/libvirt-host.c
> @@ -1288,6 +1288,60 @@ virConnectGetHypervisorCPUModelNames(virConnectPtr conn,
>      return -1;
>  }
>  
> +/**
> + * virConnectGetHypervisorCPUModelDefinition:
> + *
> + * @conn: virConnect connection
> + * @arch: Architecture
> + * @machine: Machine type

Should be optional, defaulting to the default machine type if omitted.

For that matter, arch should be optional too

> + * @name: CPU model name
> + * @xmlCPU: XML description of the CPUs
> + * @flags: extra flags; not used yet, so callers should always pass 0.
> + *
> + * Get the description of a specific hypervisor cpu model for a given machine
> + * type and architecture.
> + *
> + * Returns 0 on success, -1 otherwise.
> + *
> + * Since: 8.5.0
> + */
> +int
> +virConnectGetHypervisorCPUModelDefinition(virConnectPtr conn,
> +                                          const char *arch,
> +                                          const char *machine,
> +                                          const char *name,
> +                                          char **xmlCPU,
> +                                          unsigned int flags)
> +{
> +    VIR_DEBUG("conn=%p, arch=%s, machine=%s, model=%s, flags=0x%x", conn,
> +              NULLSTR(arch), NULLSTR(machine), NULLSTR(name), flags);
> +    virResetLastError();
> +
> +    virCheckConnectReturn(conn, -1);
> +    virCheckNonNullArgGoto(arch, error);
> +    virCheckNonNullArgGoto(machine, error);
> +    virCheckNonNullArgGoto(name, error);
> +
> +    if (conn->driver->connectGetHypervisorCPUModelDefinition) {
> +        int ret;
> +
> +        ret = conn->driver->connectGetHypervisorCPUModelDefinition(conn, arch,
> +                                                                   machine,
> +                                                                   name,
> +                                                                   xmlCPU,
> +                                                                   flags);
> +        if (ret < 0)
> +            goto error;
> +
> +        return ret;
> +    }
> +
> +    virReportUnsupportedError();
> +
> + error:
> +    virDispatchError(conn);
> +    return -1;
> +}
>  
>  /**
>   * virConnectBaselineCPU:
> diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
> index c6a8e898ae..15ef29d07d 100644
> --- a/src/libvirt_public.syms
> +++ b/src/libvirt_public.syms
> @@ -924,6 +924,7 @@ LIBVIRT_8.4.0 {
>  
>  LIBVIRT_8.5.0 {
>      global:
> +        virConnectGetHypervisorCPUModelDefinition;
>          virConnectGetHypervisorCPUModelNames;
>          virDomainAbortJobFlags;
>  } LIBVIRT_8.4.0;
> -- 
> 2.31.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[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