On 10/04/2010 06:01 AM, Jiri Denemark wrote:
It seems like we need a 12-way table (in fact, this is pretty much what
I ended up resorting to with my vcpus stuff).  Here's my shot at it,
from reading the comments (but not actually testing it); once we fix
this attempt to an actual table, then I can answer whether the code
matches the table.

                    _LIVE     _CONFIG      _LIVE|_CONFIG
xen 2,running     good      unsupported  unsupported
xen 2,inactive    error     good         error or silently good
xen 3,running     good      good         good
xen 3,inactive    error     good         error or silently good

Yeah, this is probably a good idea however we shouldn't forget about _CURRENT
which is an equivalent of either _CONFIG or _LIVE depending on current state
of the guest.

LI: _LIVE
CO: _CONFIG
CU: _CURRENT = active ? _LIVE : _CONFIG
g: good
i: OPERATION_INVALID (in the wrong state)
u: CONFIG_UNSUPPORTED (never possible)

                 LI  CO  LI|CO  CU  LI|CU  CO|CU  LI|CO|CU
xen 2,running    g   u   u      g   g      u      u
xen 2,inactive   i   u   u      i   i      u      u
xen 3,running    u   u   g      u   u      g      g
xen 3,inactive   u   u   i      u   i      u      i

The logic might be rendered easier by starting the function with:

if (!flags)
    return -1;
if (flags & _CURRENT)
    flags |= running ? _LIVE : _CONFIG;

so that the rest of the function need only operate on _LIVE and _CONFIG (reducing 2^3==8 flag combinations down to 3).

But, as written, and with your extra context explanations, ACK to patch 2.

--
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to