[libvirt] [PATCH V3 15/24] src/xenxs:Refactor code formating memory config
Jim Fehlig
jfehlig at suse.com
Wed Aug 6 22:30:45 UTC 2014
David Kiarie wrote:
> From: Kiarie Kahurani <davidkiarie4 at gmail.com>
>
> introduce fucntion
>
s/fucntion/function/
Regards,
Jim
> xenFormatXMMem(virConfPtr conf,...........);
> which parses memory config instead
>
> signed-off-by: David Kiarie<davidkiarie4 at gmail.com>
> ---
> src/xenxs/xen_xm.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
> index 08d26e5..350aeeb 100644
> --- a/src/xenxs/xen_xm.c
> +++ b/src/xenxs/xen_xm.c
> @@ -1672,6 +1672,23 @@ 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;
> +}
> +
> +
> /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
> either 32, or 64 on a platform where long is big enough. */
> verify(MAX_VIRT_CPUS <= sizeof(1UL) * CHAR_BIT);
> @@ -1695,12 +1712,7 @@ xenFormatXM(virConnectPtr conn,
> if (xenFormatXMGeneralMeta(conf, def) < 0)
> goto cleanup;
>
> - if (xenXMConfigSetInt(conf, "maxmem",
> - VIR_DIV_UP(def->mem.max_balloon, 1024)) < 0)
> - goto cleanup;
> -
> - if (xenXMConfigSetInt(conf, "memory",
> - VIR_DIV_UP(def->mem.cur_balloon, 1024)) < 0)
> + if (xenFormatXMMem(conf, def) < 0)
> goto cleanup;
>
> if (xenXMConfigSetInt(conf, "vcpus", def->maxvcpus) < 0)
>
More information about the libvir-list
mailing list