mirror of https://gitee.com/openkylin/libvirt.git
Revert "qemu: Report the offset from host UTC for RTC_CHANGE event"
This reverts commit e31b5cf393
.
This commit attempted to work around a bug in the offset value
reported by qemu's RTC_CHANGE event in the case that a variable base
date was given on the qemu commandline. The patch mixed up the math
involved in arriving at the corrected offset to report, and in the
process added an unnecessary private attribute to the clock
element. Since that element is private/internal and not used by anyone
else, it makes sense to simplify things by removing it.
This commit is contained in:
parent
1cddaea7ae
commit
b8efa6f2e3
|
@ -99,7 +99,6 @@ typedef enum {
|
|||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES = (1<<18),
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_ROM = (1<<19),
|
||||
VIR_DOMAIN_XML_INTERNAL_ALLOW_BOOT = (1<<20),
|
||||
VIR_DOMAIN_XML_INTERNAL_BASEDATE = (1 << 21),
|
||||
} virDomainXMLInternalFlags;
|
||||
|
||||
VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST,
|
||||
|
@ -12047,16 +12046,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|||
break;
|
||||
}
|
||||
|
||||
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE &&
|
||||
flags & VIR_DOMAIN_XML_INTERNAL_BASEDATE) {
|
||||
if (virXPathULongLong("number(./clock/@basedate)", ctxt,
|
||||
&def->clock.data.variable.basedate) < 0) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("invalid basedate"));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
if ((n = virXPathNodeSet("./clock/timer", ctxt, &nodes)) < 0)
|
||||
goto error;
|
||||
|
||||
|
@ -17128,8 +17117,7 @@ virDomainResourceDefFormat(virBufferPtr buf,
|
|||
|
||||
verify(((VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_BASEDATE)
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES)
|
||||
& DUMPXML_FLAGS) == 0);
|
||||
|
||||
/* This internal version can accept VIR_DOMAIN_XML_INTERNAL_*,
|
||||
|
@ -17151,8 +17139,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||
virCheckFlags(DUMPXML_FLAGS |
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_BASEDATE,
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES,
|
||||
-1);
|
||||
|
||||
if (!(type = virDomainVirtTypeToString(def->virtType))) {
|
||||
|
@ -17686,10 +17673,6 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|||
virBufferAsprintf(buf, " adjustment='%lld' basis='%s'",
|
||||
def->clock.data.variable.adjustment,
|
||||
virDomainClockBasisTypeToString(def->clock.data.variable.basis));
|
||||
|
||||
if (flags & VIR_DOMAIN_XML_INTERNAL_BASEDATE)
|
||||
virBufferAsprintf(buf, " basedate='%llu'",
|
||||
def->clock.data.variable.basedate);
|
||||
break;
|
||||
case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE:
|
||||
virBufferEscapeString(buf, " timezone='%s'", def->clock.data.timezone);
|
||||
|
@ -18120,8 +18103,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
|
|||
unsigned int flags = (VIR_DOMAIN_XML_SECURE |
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_BASEDATE);
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES);
|
||||
|
||||
int ret = -1;
|
||||
char *xml;
|
||||
|
@ -18209,8 +18191,7 @@ virDomainObjListLoadStatus(virDomainObjListPtr doms,
|
|||
if (!(obj = virDomainObjParseFile(statusFile, caps, xmlopt, expectedVirtTypes,
|
||||
VIR_DOMAIN_XML_INTERNAL_STATUS |
|
||||
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
|
||||
VIR_DOMAIN_XML_INTERNAL_BASEDATE)))
|
||||
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES)))
|
||||
goto error;
|
||||
|
||||
virUUIDFormat(obj->def->uuid, uuidstr);
|
||||
|
|
|
@ -1727,11 +1727,6 @@ struct _virDomainClockDef {
|
|||
struct {
|
||||
long long adjustment;
|
||||
int basis;
|
||||
|
||||
/* Store the base date (-rtc base=$date, in seconds
|
||||
* since the Epoch) of guest process, internal only
|
||||
*/
|
||||
unsigned long long basedate;
|
||||
} variable;
|
||||
|
||||
/* Timezone name, when
|
||||
|
|
|
@ -5999,9 +5999,6 @@ qemuBuildClockArgStr(virDomainClockDefPtr def)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Store the guest's basedate */
|
||||
def->data.variable.basedate = now;
|
||||
|
||||
virBufferAsprintf(&buf, "base=%d-%02d-%02dT%02d:%02d:%02d",
|
||||
nowbits.tm_year + 1900,
|
||||
nowbits.tm_mon + 1,
|
||||
|
|
|
@ -843,19 +843,6 @@ qemuProcessHandleRTCChange(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
virObjectLock(vm);
|
||||
|
||||
/* QEMU's RTC_CHANGE event returns the offset from the specified
|
||||
* date instead of the host UTC if a specific date is provided
|
||||
* (-rtc base=$date). We need to convert it to be offset from
|
||||
* host UTC.
|
||||
*/
|
||||
if (vm->def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE) {
|
||||
time_t now = time(NULL);
|
||||
|
||||
offset += vm->def->clock.data.variable.basedate -
|
||||
(unsigned long long)now;
|
||||
}
|
||||
|
||||
event = virDomainEventRTCChangeNewFromObj(vm, offset);
|
||||
|
||||
if (vm->def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_VARIABLE)
|
||||
|
|
Loading…
Reference in New Issue