[libvirt] [PATCH RFC 3/4] Create new virDrvDomainSuspendFlags API

Eric Blake eblake at redhat.com
Thu Jan 26 14:17:54 UTC 2012


On 01/26/2012 07:06 AM, Michal Privoznik wrote:
> define these flags:
> 
>    VIR_DOMAIN_SUSPEND_SLEEP     = 0,        /* Suspend to RAM */
>    VIR_DOMAIN_SUSPEND_HIBERNATE = (1 << 0), /* Suspend to disk */

Not quite right.  Our policy when fixing old APIs that forgot a flags
argument is that the new API with flags 0 must be identical to the old
API.  Which means you need:

VIR_DOMAIN_SUSPEND_PAUSE = 0, /* pause CPUs */
VIR_DOMAIN_SUSPEND_SLEEP = 1<<0, /* Suspend to RAM, power stays on */
VIR_DOMAIN_SUSPEND_HIBERNATE = 1<<1, /* Suspend to disk, power off */

and you might as well make things convenient:

VIR_DOMAIN_SUSPEND_HYBRID = 3, /* Suspend to disk but leave power on */

Then, you should also provide a stub virDomainSuspendFlags for all other
hypervisors that only takes flags == 0, forwarding the old
virDomainSuspend to the new callback name.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120126/ad18ddb7/attachment-0001.sig>


More information about the libvir-list mailing list