
On 05/20/2011 05:17 PM, Eric Blake wrote:
On 05/20/2011 02:54 PM, Adam Litke wrote:
I am really confused about what the default flags (VIR_DOMAIN_VCPU_CURRENT) actually means. It doesn't seem like I can ever know what it means from an API perspective (since it's behavior is arbitrary depending on the hypervisor). Wouldn't it be better to require _either_ VIR_DOMAIN_VCPU_LIVE _or_ VIR_DOMAIN_VCPU_CONFIG to be set so that the intended behavior can be set with specificity?
Anywhere we use _CURRENT, it is supposed to mean _LIVE (if the VM is running) or _CONFIG (if the VM is persistent but offline).
Yes, explicitly specifying _LIVE, _CONFIG, or the combination of both, is probably better.
And in the past, we haven't always used those conventions; that is, there are some APIs where _CURRENT is non-zero, and the default (0) was unclear in its meaning. But all new APIs should use _CURRENT as 0, so that the default has clear semantics.
However, there are some hypervisors that cannot do just _LIVE on persistent domains - they can only do _LIVE|_CONFIG (for transient domains, though, it should be obvious that just _LIVE works, since _CONFIG cannot succeed on a transient domain).
Thanks for your explanation, Eric. It's a lot clearer to me now and the API makes sense. Cleanups to the virsh documentation as you suggest will hopefully prevent future questions like mine. -- Adam Litke IBM Linux Technology Center