If your domain is already paused, then you'll be issuing a
"qemuMonitorStopCPUs"
command unnecessarily. That by itself isn't a huge deal; it will essentially be
a no-op. But you will also generate an event of "VIR_DOMAIN_EVENT_SUSPENDED",
which is wrong; you didn't really suspend the domain, an earlier command did.
Yes, I agree it's better. Since the semantics are fine, only the
implementation will vary (and will be exactly what you suggest in your
email) I'll make the change when I send the rebased patch set.
One other thing to possibly investigate is whether the
"vm->state ==
VIR_DOMAIN_RUNNING" is sufficient. Can we (legitimately) be in state
VIR_DOMAIN_NOSTATE or VIR_DOMAIN_BLOCKED, yet still be "running"?
I'm actually not sure (but I think the answer is no from a quick grep)
if a qemu guest can be in any state but PAUSED, RUNNING, SHUTOFF.
Paolo