Re: [PATCH v4 1/3] Add per-guest S3/S4 state configuration

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

 



On 23.08.2012 13:47, Martin Kletzander wrote:
> There is a new <pm/> element implemented that can control what ACPI
> sleeping states will be advertised by BIOS and allowed to be switched
> to by libvirt. The default keeps defaults on hypervisor, otherwise
> forces chosen setting.
> The documentation of the pm element is added as well.
> ---
>  docs/formatdomain.html.in     | 24 ++++++++++++++++++++
>  docs/schemas/domaincommon.rng | 39 ++++++++++++++++++++++++++++++++
>  src/conf/domain_conf.c        | 52 ++++++++++++++++++++++++++++++++++++++++++-
>  src/conf/domain_conf.h        | 15 +++++++++++++
>  src/libvirt_private.syms      |  2 ++
>  5 files changed, 131 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 419088c..94a4eb7 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -125,6 +125,11 @@ VIR_ENUM_IMPL(virDomainLifecycleCrash, VIR_DOMAIN_LIFECYCLE_CRASH_LAST,
>                "coredump-destroy",
>                "coredump-restart")
> 
> +VIR_ENUM_IMPL(virDomainPMState, VIR_DOMAIN_PM_STATE_LAST,
> +              "default",
> +              "yes",
> +              "no")
> +
>  VIR_ENUM_IMPL(virDomainDevice, VIR_DOMAIN_DEVICE_LAST,
>                "none",
>                "disk",
> @@ -7202,6 +7207,28 @@ static int virDomainLifecycleParseXML(xmlXPathContextPtr ctxt,
>      return 0;
>  }
> 
> +static int
> +virDomainPMStateParseXML(xmlXPathContextPtr ctxt,
> +                         const char *xpath,
> +                         int *val)
> +{
> +    int ret = -1;
> +    char *tmp = virXPathString(xpath, ctxt);
> +    if (tmp) {
> +        *val = virDomainPMStateTypeFromString(tmp);
> +        if (*val < 0) {
> +            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                           _("unknown PM state value %s"), tmp);
> +            goto cleanup;
> +        }
> +    }
> +
> +    ret = 0;
> + cleanup:
> +    VIR_FREE(tmp);
> +    return ret;
> +}
> +
>  virDomainDeviceDefPtr virDomainDeviceDefParse(virCapsPtr caps,
>                                                virDomainDefPtr def,
>                                                const char *xmlStr,
> @@ -8569,11 +8596,21 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
>          goto error;
> 
>      if (virDomainLifecycleParseXML(ctxt, "string(./on_crash[1])",
> -                                        &def->onCrash,
> +                                   &def->onCrash,

This indentation change is not relevant to this patch. I'd save it for a
separate patch.

>                                     VIR_DOMAIN_LIFECYCLE_CRASH_DESTROY,
>                                     virDomainLifecycleCrashTypeFromString) < 0)
>          goto error;
> 
> +    if (virDomainPMStateParseXML(ctxt,
> +                                 "string(./pm/suspend-to-mem/@enabled)",
> +                                 &def->pm.s3) < 0)
> +        goto error;
> +
> +    if (virDomainPMStateParseXML(ctxt,
> +                                 "string(./pm/suspend-to-disk/@enabled)",
> +                                 &def->pm.s4) < 0)
> +        goto error;
> +
>      tmp = virXPathString("string(./clock/@offset)", ctxt);
>      if (tmp) {
>          if ((def->clock.offset = virDomainClockOffsetTypeFromString(tmp)) < 0) {

ACK modulo indent change.

Michal

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