[libvirt] [PATCH 12/34] conf: Replace writes to def->vcpus with accessor

John Ferlan jferlan at redhat.com
Mon Nov 23 15:26:46 UTC 2015



On 11/20/2015 10:22 AM, Peter Krempa wrote:
> ---
>  src/conf/domain_conf.c     | 25 +++++++++++++++++++------
>  src/conf/domain_conf.h     |  1 +
>  src/hyperv/hyperv_driver.c |  5 ++++-
>  src/libvirt_private.syms   |  1 +
>  src/libxl/libxl_driver.c   | 14 +++++++++-----
>  src/openvz/openvz_conf.c   |  3 ++-
>  src/openvz/openvz_driver.c |  4 +++-
>  src/phyp/phyp_driver.c     |  3 ++-
>  src/qemu/qemu_command.c    |  9 ++++++---
>  src/qemu/qemu_driver.c     |  8 +++++---
>  src/test/test_driver.c     |  8 +++++---
>  src/vbox/vbox_common.c     |  6 ++++--
>  src/vmx/vmx.c              |  3 ++-
>  src/vz/vz_sdk.c            |  3 ++-
>  src/xen/xm_internal.c      |  3 ++-
>  src/xenapi/xenapi_driver.c |  3 ++-
>  src/xenconfig/xen_common.c |  5 ++++-
>  src/xenconfig/xen_sxpr.c   | 10 +++++++---
>  18 files changed, 80 insertions(+), 34 deletions(-)
> 

Still prefer to see "Vcpus" (or "VCPUs") rather than "VCpus"...

[...]

> diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> index b136314..4a67361 100644
> --- a/src/qemu/qemu_command.c
> +++ b/src/qemu/qemu_command.c
> @@ -12543,6 +12543,7 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
>      unsigned int cores = 0;
>      unsigned int threads = 0;
>      unsigned int maxcpus = 0;
> +    unsigned int vcpus = 0;
>      size_t i;
>      int nkws;
>      char **kws;
> @@ -12557,9 +12558,8 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
>      for (i = 0; i < nkws; i++) {
>          if (vals[i] == NULL) {
>              if (i > 0 ||
> -                virStrToLong_i(kws[i], &end, 10, &n) < 0 || *end != '\0')
> +                virStrToLong_ui(kws[i], &end, 10, &vcpus) < 0 || *end != '\0')
>                  goto syntax;
> -            dom->vcpus = n;
>          } else {
>              if (virStrToLong_i(vals[i], &end, 10, &n) < 0 || *end != '\0')
>                  goto syntax;

A few lines down from here:

             else if (STREQ(kws[i], "maxcpus"))
                 maxcpus = n;

Unrelated to this patch, but perhaps related to an earlier patch (at
least w/r/t to the Long_ui rather than Long_i change.  Since all the
elements are unsigned int, then all could use _ui.

In any case, ACK w/ "VCpus" name adjustment

John

> @@ -12577,11 +12577,14 @@ qemuParseCommandLineSmp(virDomainDefPtr dom,
>      }
> 
>      if (maxcpus == 0)
> -        maxcpus = dom->vcpus;
> +        maxcpus = vcpus;
> 
>      if (virDomainDefSetVCpusMax(dom, maxcpus) < 0)
>          goto error;
> 
> +    if (virDomainDefSetVCpus(dom, vcpus) < 0)
> +        goto error;
> +
>      if (sockets && cores && threads) {
>          virCPUDefPtr cpu;
> 




More information about the libvir-list mailing list