I think there is a bug in qemu if calling reset gets us one
guest-initiated reset. You are not guaranteed to get two events anyway,
I believe.
Anyway, let's say you're right (for now), I think the following logic is
flawed a bit.

This will be set either if guest_initiated == VIR_TRISTATE_BOOL_ABSENT
(keep in mind this will always be the case with older QEMUs) or
priv->gotReset == false && guest_initiated == VIR_TRISTATE_BOOL_YES.
If we walk through your examples (reboot => guest_initiated = [yes,
yes], reset => guest_initiated = [no, yes]), then:
reboot:
- first event (guest_initiated = yes) => callOnReboot = true;
- second event (guest_initiated = yes) => callOnReboot = true;
( because priv->gotReset is still false )
reset:
- first event (guest_initiated = no) => priv->gotReset = true;
- second event (guest_initiated = yes) => priv->gotReset = false;
So basically in the first scenario you only set the bool to true and in
the second one nothing is set ...