Skip to content

v0.2.2 - Event timestamp parsing fix

Choose a tag to compare

@schankst schankst released this 24 Jul 22:43
· 14 commits to main since this release

Bugfix release - no schema change, still XAPI release 26.16.1-next
(xenapi.SchemaXAPIRelease unchanged).

Fixed

  • EventRecord.Timestamp (from Event.Next, i.e. event.next) could
    arrive from a live XCP-ng host as an OCaml-style float-as-string Unix
    timestamp (e.g. "1784931839." - note the trailing dot, from OCaml's
    string_of_float on a whole number) instead of a properly wire-tagged
    dateTime.iso8601 value. convertTimeToGo failed the entire event on
    this mismatch instead of just this one field.
  • convertTimeToGo now falls back to strconv.ParseFloat + time.Unix
    for any datetime-typed field that isn't already a decoded time.Time,
    mirroring this generator's existing enum-tolerance approach to
    schema/wire divergence (baked into xenapi.go, not a one-off patch).

Why this showed up now

Found building a Task/Event-driven VM start/stop monitor in the
xen CLI: watching a XenAPI Task via
Event.Register/Event.Next (scoped to the task class) hit this on
every single event, silently degrading the monitor to polling-only every
time instead of ever using the event stream it was built to use.

See GOOD_TO_KNOW.md
for the write-up, and convert_test.go for regression tests covering the
normal time.Time case, the OCaml float-string case, a plain-integer
fallback, and the invalid-input error case.