On 03/31/2011 01:33 AM, Osier Yang wrote:
This allows both "LIVE" and "CONFIG" are set, and you use two
"if" clauses later for both of them, (
if (flags& VIR_DOMAIN_VCPU_CONFIG), and
if (flags& VIR_DOMAIN_VCPU_LIVE) ) so there should be problem.
IMHO it should be: Exactly one of "LIVE" or "CONFIG" is set.
No, it should be perfectly acceptable to accept both at once (and some
hypervisors may reject LIVE in isolation, as they can only affect LIVE
and CONFIG simultaneously).
We may _also_ want to document that if neither LIVE nor CONFIG is set,
then we instead default to the current state of the domain (LIVE if it
is active, CONFIG if it is just defined), as that has proved to be a
handy shortcut.
We're not very consistent on those semantics on existing APIs (so
someone will have to read the docs for each API to learn which setting
is which, due to backwards compatibility), but for future APIs it is
best to shoot for:
flags = 0 - default to LIVE or CONFIG as appropriate
flags = LIVE - temporary change - affect running guest but not
persistent (error if not running)
flags = CONFIG - config change - affect next boot but not running guest
(error if guest is transient and running, since there is no persistent
state for transient guests)
flags = LIVE|CONFIG - affect running guest and affect next boot (error
if guest is not running, or if guest is transient)
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org