Re: [PATCH v2 15/25] src/xenxs:Refactor code formating memory config

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

 



David Kiarie wrote:
> From: Kiarie Kahurani <davidkiarie4@xxxxxxxxx>
>
> introduce function
>  xenFormatXMMem(virConfPtr conf, .......);
> which formats mem and max-mem instead.This could be joined into
> XenFormatXMGeneralMeta but I separated them for consistency
>
> signed-off-by: David Kiarie<davidkiarie4@xxxxxxxxx>
> ---
>  src/xenxs/xen_xm.c | 24 +++++++++++++++++-------
>  1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
> index ae474a4..78dc949 100644
> --- a/src/xenxs/xen_xm.c
> +++ b/src/xenxs/xen_xm.c
> @@ -1670,6 +1670,22 @@ int xenFormatXMGeneralMeta(virConfPtr conf, virDomainDefPtr def)
>      return 0;
>  }
>  
> +
> +static
> +int xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
> +{
> +    if (xenXMConfigSetInt(conf, "maxmem",
> +                          VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
> +        return -1;
> +
> +    if (xenXMConfigSetInt(conf, "memory",
> +                          VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
> +        return -1;
> +
> +    return 0;
> +}
> +
> +
>  virConfPtr xenFormatXM(virConnectPtr conn,
>                                     virDomainDefPtr def,
>                                     int xendConfigVersion)
> @@ -1686,14 +1702,8 @@ virConfPtr xenFormatXM(virConnectPtr conn,
>          goto cleanup;
>      if (xenFormatXMGeneralMeta(conf, def) < 0)
>          goto cleanup;
> -    if (xenXMConfigSetInt(conf, "maxmem",
> -                          VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
> +    if (xenFormatXMMem(conf, def) < 0)
>          goto cleanup;
> -
> -    if (xenXMConfigSetInt(conf, "memory",
> -                          VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
> -        goto cleanup;
> -
>   

Same comment here about preserving the whitespace.

Regards,
Jim

>      if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
>          goto cleanup;
>      /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
>   

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