On 02/10/2012 12:21 PM, Dave Allan wrote:
> I'm wondering if we're too late for one more API to round
out the API we
> added in this release. Qemu is proposing a new monitor command
> system_wakeup which lets the host inject a power-button wakeup to a
> guest that has gone into S3 sleep. Since we added the
> virDomainPMSuspendForDuration command to put the guest into S3 from the
> host, I think we need a counterpart API that wakes the guest back up,
> rather than relying on mouse clicks, serial input, or timeouts doing the
> job for us. It's a shame that virDomainResume() has no flags argument,
> and that it is already tied to virDomainSuspend() (aka guest pause), so
> I'm thinking something like:
>
> /* Inject a wakeup into the guest that previously used
> * virDomainPMSuspendForDuration, rather than waiting for the
> * previously requested duration (if any) to elapse. */
> int virDomainPMWakeup(virDomainPtr dom, unsigned int flags);
Just to throw this out there, could we not simply implement the rest
of the power states in this API? Kind of late to be asking this
question, I suppose, but we haven't released this API yet, could we
change its name to virDomainPMSetPowerStateForDuration?
Interesting idea! It means we have one call, instead of 2, and 4 PM
states instead of 3 (suspend, hibernate, hybrid, and now wakeup). Of
course, wakeup for duration doesn't make much sense, so we could
explicitly require a 0 duration for the wakeup case.
That name is rather long; we originally went with
DomainPMSuspendForDuration for similarity to NodeSuspendForDuration and
to make it clear that this is PMSuspend (power management in the guest)
vs. virDomainSuspend (hypervisor pause). But once we lose the name
'Suspend', the 'ForDuration' just sounds long; and then there is the
fact that this API can wakeup where NodeSuspendForDuration cannot.
Maybe even this shorter name would do:
virDomainSetPowerState(domain, state, duration, flags)
On the other hand, it probably also points out that we are missing a
counterpart:
virDomainGetPowerState(domain, flags)
after all, with NodeSuspendForDuration, we always know what state we are
in (the host is active if you can query, and all other states the host
is non-responsive); but with guests, the hypervisor can indeed be
queried to see whether the guest is currently active or in S3.
Sounds like we have some important API decisions to make, and fast,
before the 0.9.10 release locks us in stone.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org