diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 835c230..e112aa3 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -903,7 +903,6 @@ xenDaemonListDomainsOld(virConnectPtr xend) * * Returns 0 for success, -1 (with errno) on error */ - int xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr) { @@ -2148,7 +2147,6 @@ xenDaemonParseSxpr(virConnectPtr conn, } else def->onCrash = VIR_DOMAIN_LIFECYCLE_DESTROY; - def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC; if (hvm) { if (sexpr_int(root, "domain/image/hvm/acpi")) def->features |= (1 << VIR_DOMAIN_FEATURE_ACPI); @@ -2157,15 +2155,18 @@ xenDaemonParseSxpr(virConnectPtr conn, if (sexpr_int(root, "domain/image/hvm/pae")) def->features |= (1 << VIR_DOMAIN_FEATURE_PAE); - /* Old XenD only allows localtime here for HVM */ - if (sexpr_int(root, "domain/image/hvm/localtime")) + def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_VARIABLE; + def->clock.data.adjustment = sexpr_int(root, "domain/image/hvm/rtc_timeoffset"); + if (def->clock.data.adjustment && sexpr_int(root, "domain/image/hvm/localtime")) { + virXendError(VIR_ERR_INTERNAL_ERROR, _("Ignoring localtime=1 while rtc_timeoffset!=0")); + } + } else { /* !hvm */ + if (sexpr_int(root, "domain/image/linux/localtime")) def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME; + else + def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC; } - /* Current XenD allows localtime here, for PV and HVM */ - if (sexpr_int(root, "domain/localtime")) - def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME; - if (sexpr_node_copy(root, hvm ? "domain/image/hvm/device_model" : "domain/image/linux/device_model", @@ -5759,31 +5760,15 @@ xenDaemonFormatSxpr(virConnectPtr conn, } virBufferVSprintf(&buf, "(on_crash '%s')", tmp); - /* Set localtime here for current XenD (both PV & HVM) */ - if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) { - if (def->clock.data.timezone) { - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("configurable timezones are not supported")); - goto error; - } + if (STREQ(def->os.type, "hvm")) + hvm = 1; - virBufferAddLit(&buf, "(localtime 1)"); - } else if (def->clock.offset != VIR_DOMAIN_CLOCK_OFFSET_UTC) { - virXendError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unsupported clock offset '%s'"), - virDomainClockOffsetTypeToString(def->clock.offset)); - goto error; - } + if (hvm) + virBufferAddLit(&buf, "(image (hvm "); + else + virBufferAddLit(&buf, "(image (linux "); if (!def->os.bootloader) { - if (STREQ(def->os.type, "hvm")) - hvm = 1; - - if (hvm) - virBufferAddLit(&buf, "(image (hvm "); - else - virBufferAddLit(&buf, "(image (linux "); - if (hvm && def->os.loader == NULL) { virXendError(VIR_ERR_INTERNAL_ERROR, @@ -5893,17 +5878,13 @@ xenDaemonFormatSxpr(virConnectPtr conn, virBufferAddLit(&buf, "(serial none)"); } - /* Set localtime here to keep old XenD happy for HVM */ - if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) - virBufferAddLit(&buf, "(localtime 1)"); - if (def->sounds) { virBufferAddLit(&buf, "(soundhw '"); if (xenDaemonFormatSxprSound(def, &buf) < 0) goto error; virBufferAddLit(&buf, "')"); } - } + } /* hvm */ /* get the device emulation model */ if (def->emulator && (hvm || xendConfigVersion >= 3)) @@ -5918,10 +5899,37 @@ xenDaemonFormatSxpr(virConnectPtr conn, &buf, xendConfigVersion) < 0) goto error; } + } /* os.bootloader */ + + if (hvm) { + /* Set localtime here to keep old XenD happy for HVM */ + if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE) { + virBufferVSprintf(&buf, "(localtime 0)(rtc_timeoffset %d)", def->clock.data.adjustment); + } else if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) { + if (def->clock.data.timezone) { + virXendError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("configurable timezones are not supported")); + goto error; + } - virBufferAddLit(&buf, "))"); + virBufferAddLit(&buf, "(localtime 1)(rtc_timeoffset 0)"); + } else if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_UTC) { + virBufferAddLit(&buf, "(localtime 0)(rtc_timeoffset 0)"); + } else { + virXendError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported clock offset '%s'"), + virDomainClockOffsetTypeToString(def->clock.offset)); + goto error; + } + } else { /* !hvm */ + if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) + virBufferAddLit(&buf, "(localtime 1)"); + else if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_UTC) + virBufferAddLit(&buf, "(localtime 0)"); } + virBufferAddLit(&buf, "))"); /* image/{kvm,linux}/ */ + for (i = 0 ; i < def->ndisks ; i++) if (xenDaemonFormatSxprDisk(conn, def->disks[i], &buf, hvm, xendConfigVersion, 0) < 0)