Glib can internally convert only unix timestamps up to
9999-12-31T23:59:59 (
253402300799). Validate that the user doesn't use
more than that as otherwise we cause an assertion failure:
(process:
1183396): GLib-CRITICAL **: 14:25:00.906: g_date_time_format: assertion 'datetime != NULL' failed
Additionally adjust the schema to allow bigger values as we use
'unsigned long long' to parse the value.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
2128993
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
<value>absolute</value>
</attribute>
<attribute name="start">
- <ref name="unsignedInt"/>
+ <ref name="unsignedLong"/>
</attribute>
</group>
</choice>
}
}
+ switch ((virDomainClockOffsetType) def->clock.offset) {
+ case VIR_DOMAIN_CLOCK_OFFSET_ABSOLUTE:
+ /* maximum timestamp glib can convert is 9999-12-31T23:59:59 */
+ if (def->clock.data.starttime > 253402300799) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("The maximum 'start' value for <clock offset='absolute'> is 253402300799"));
+ return -1;
+ }
+
+ case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+ case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+ case VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE:
+ case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
+ case VIR_DOMAIN_CLOCK_OFFSET_LAST:
+ break;
+ }
+
return 0;
}
-nodefaults \
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
-mon chardev=charmonitor,id=monitor,mode=control \
--rtc base=1970-01-01T00:20:34 \
+-rtc base=9999-12-31T23:59:59 \
-no-shutdown \
-no-acpi \
-boot strict=on \
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/>
</os>
- <clock offset='absolute' start='1234'/>
+ <clock offset='absolute' start='253402300799'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<cpu mode='custom' match='exact' check='none'>
<model fallback='forbid'>qemu64</model>
</cpu>
- <clock offset='absolute' start='1234'/>
+ <clock offset='absolute' start='253402300799'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>