Re: [libvirt] [PATCH] Solaris PV is localtime. Allow this setting through the conversions

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

 



On Wed, Jan 28, 2009 at 07:09:19PM -0800, john.levon@xxxxxxx wrote:
> # HG changeset patch
> # User john.levon@xxxxxxx
> # Date 1233198416 28800
> # Node ID 76d670ab6ea5476be96441ea88af94644c985201
> # Parent  f0247b9f4da199c01412d5bd0f9d7d888cbb84de
> Solaris PV is localtime. Allow this setting through the conversions.
> 
> Signed-off-by: John Levon <john.levon@xxxxxxx>
> 
> diff --git a/src/xend_internal.c b/src/xend_internal.c
> --- a/src/xend_internal.c
> +++ b/src/xend_internal.c
> @@ -2272,10 +2272,12 @@ xenDaemonParseSxpr(virConnectPtr conn,
>              def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
>          if (sexpr_int(root, "domain/image/hvm/pae"))
>              def->features |= (1 << VIR_DOMAIN_FEATURE_PAE);
> -
> -        if (sexpr_int(root, "domain/image/hvm/localtime"))
> +    }
> +
> +   if (sexpr_int(root, "domain/localtime") ||
> +       sexpr_int(root, "domain/image/hvm/localtime") ||
> +       sexpr_int(root, "domain/image/linux/localtime"))
>              def->localtime = 1;
> -    }
>  
>      if (sexpr_node_copy(root, hvm ?
>                          "domain/image/hvm/device_model" :
> @@ -5338,6 +5340,14 @@ xenDaemonFormatSxpr(virConnectPtr conn,
>      }
>      virBufferVSprintf(&buf, "(on_crash '%s')", tmp);
>  
> +    /*
> +     * xend puts localtime in image/{hvm,linux}/, but is clearly
> +     * bootloader independent. As a simple workaround, we define it
> +     * here - xend happily picks it up from here.
> +     */
> +    if (def->localtime)
> +        virBufferAddLit(&buf, "(localtime 1)");
> +


Hmm, current XenD may not mind having 'localtime' here, but I'm
worried older XenD may not be so forgiving. Will have to check
older source.

>      if (!def->os.bootloader) {
>          if (STREQ(def->os.type, "hvm"))
>              hvm = 1;
> @@ -5453,9 +5463,6 @@ xenDaemonFormatSxpr(virConnectPtr conn,
>                  virBufferAddLit(&buf, "(serial none)");
>              }
>  
> -            if (def->localtime)
> -                virBufferAddLit(&buf, "(localtime 1)");
> -
>              if (def->sounds) {
>                  virBufferAddLit(&buf, "(soundhw '");
>                  if (xenDaemonFormatSxprSound(conn, def, &buf) < 0)
> diff --git a/src/xm_internal.c b/src/xm_internal.c
> --- a/src/xm_internal.c
> +++ b/src/xm_internal.c
> @@ -818,10 +818,11 @@ xenXMDomainConfigParse(virConnectPtr con
>              goto cleanup;
>          else if (val)
>              def->features |= (1 << VIR_DOMAIN_FEATURE_APIC);
> -
> -        if (xenXMConfigGetBool(conn, conf, "localtime", &def->localtime, 0) < 0)
> -            goto cleanup;
> -    }
> +    }
> +
> +    if (xenXMConfigGetBool(conn, conf, "localtime", &def->localtime, 0) < 0)
> +        goto cleanup;
> +
>      if (xenXMConfigCopyStringOpt(conn, conf, "device_model", &def->emulator) < 0)
>          goto cleanup;
>  
> @@ -1972,6 +1973,9 @@ virConfPtr xenXMDomainConfigFormat(virCo
>      if (xenXMConfigSetInt(conf, "vcpus", def->vcpus) < 0)
>          goto no_memory;
>  
> +    if (def->localtime && xenXMConfigSetInt(conf, "localtime", 1) < 0)
> +        goto no_memory;

Existing code unconditionally sets localtime=0 and localtime=1,
but this only sets localtime=1, relying on XM defaults for localtime=0.
I prefer not to rely on defaults when writing the config back out to disk
because those have a habit of being broken over time. Unconditionally
setting it avoids the need to change all those test case config files.

> +
>      if (def->cpumask &&
>          !(cpus = virDomainCpuSetFormat(conn, def->cpumask, def->cpumasklen)) < 0)
>          goto cleanup;
> @@ -2034,9 +2038,6 @@ virConfPtr xenXMDomainConfigFormat(virCo
>                                 (1 << VIR_DOMAIN_FEATURE_APIC)) ? 1 : 0) < 0)
>              goto no_memory;
>  
> -
> -        if (xenXMConfigSetInt(conf, "localtime", def->localtime ? 1 : 0) < 0)
> -            goto no_memory;
>  
>          if (priv->xendConfigVersion == 1) {
>              for (i = 0 ; i < def->ndisks ; i++) {

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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