Re: [PATCH 28/34] conf: Add helper to get pointer to a certain vCPU definition

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

 




On 11/20/2015 10:22 AM, Peter Krempa wrote:
> Once more stuff will be moved into the vCPU data structure it will be
> necessary to get a specific one in some ocasions. Add a helper that will
> simplify this task.
> ---
>  src/conf/domain_conf.c   | 15 +++++++++++++++
>  src/conf/domain_conf.h   |  4 ++++
>  src/libvirt_private.syms |  1 +
>  3 files changed, 20 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 66fc6d3..f4b4700 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -1520,6 +1520,21 @@ virDomainDefGetVCpus(const virDomainDef *def)
>  }
> 
> 
> +virDomainVCpuInfoPtr
> +virDomainDefGetVCpu(virDomainDefPtr def,

Use of "VCpu" rather than "Vcpu" or "VCPU"

Think this should be "GetVcpuInfo"...

> +                    unsigned int vcpu)
> +{
> +    if (vcpu > def->maxvcpus) {

Should be an accessor for def->maxvcpus

> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("vCPU '%u' is not present in domain definition"),
> +                       vcpu);
> +        return NULL;
> +    }
> +
> +    return &def->vcpus[vcpu];

yeah - thinking about my comments in 27 - I can foresee a problem with
the ABI check going forward.

> +}
> +
> +
>  virDomainDiskDefPtr
>  virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
>  {
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 68f82c6..7c9457a 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2135,6 +2135,8 @@ typedef virDomainVCpuInfo *virDomainVCpuInfoPtr;
> 
>  struct _virDomainVCpuInfo {
>      bool online;
> +
> +    virBitmapPtr cpumask;

This should be in some future patch...


ACK with changes.

John
>  };
> 
>  typedef struct _virDomainBlkiotune virDomainBlkiotune;
> @@ -2338,6 +2340,8 @@ bool virDomainDefHasVCpusOffline(const virDomainDef *def);
>  unsigned int virDomainDefGetVCpusMax(const virDomainDef *def);
>  int virDomainDefSetVCpus(virDomainDefPtr def, unsigned int vcpus);
>  unsigned int virDomainDefGetVCpus(const virDomainDef *def);
> +virDomainVCpuInfoPtr virDomainDefGetVCpu(virDomainDefPtr def, unsigned int vcpu)
> +    ATTRIBUTE_RETURN_CHECK;
> 
>  unsigned long long virDomainDefGetMemoryInitial(const virDomainDef *def);
>  void virDomainDefSetMemoryTotal(virDomainDefPtr def, unsigned long long size);
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index d2c4945..449caf6 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -217,6 +217,7 @@ virDomainDefGetDefaultEmulator;
>  virDomainDefGetMemoryActual;
>  virDomainDefGetMemoryInitial;
>  virDomainDefGetSecurityLabelDef;
> +virDomainDefGetVCpu;
>  virDomainDefGetVCpus;
>  virDomainDefGetVCpusMax;
>  virDomainDefHasDeviceAddress;
> 

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



[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]