Re: [PATCH 8/8] Implement domain state reason

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/04/2011 08:45 AM, Jiri Denemark wrote:
> Only in drivers which use virDomainObj, drivers that query hypervisor
> for domain status need to be updated separately in case their hypervisor
> supports this functionality.
> 
> The reason is also saved into domain state XML so if a domain is not
> running (i.e., no state XML exists) the reason will be lost by libvirtd
> restart. I think this is an acceptable limitation.

> +void
> +virDomainObjSetState(virDomainObjPtr dom, virDomainState state, int reason)
> +{
> +    int last = -1;
> +
> +    switch (state) {
> +    case VIR_DOMAIN_NOSTATE:    last = VIR_DOMAIN_NOSTATE_LAST;     break;
> +    case VIR_DOMAIN_RUNNING:    last = VIR_DOMAIN_RUNNING_LAST;     break;
> +    case VIR_DOMAIN_BLOCKED:    last = VIR_DOMAIN_BLOCKED_LAST;     break;
> +    case VIR_DOMAIN_PAUSED:     last = VIR_DOMAIN_PAUSED_LAST;      break;
> +    case VIR_DOMAIN_SHUTDOWN:   last = VIR_DOMAIN_SHUTDOWN_LAST;    break;
> +    case VIR_DOMAIN_SHUTOFF:    last = VIR_DOMAIN_SHUTOFF_LAST;     break;
> +    case VIR_DOMAIN_CRASHED:    last = VIR_DOMAIN_CRASHED_LAST;     break;
> +    }
> +
> +    if (last < 0) {
> +        VIR_ERROR(_("invalid domain state: %d"), state);
> +        return;
> +    }
> +
> +    dom->state.state = state;
> +    if (reason > 0 || reason < last)

&&, not ||

ACK with that nit fixed.  virDomainObjSetState does not need a flags
parameter, even though the public API has one (a virCheckFlags at each
of the public API is sufficient to be the end of the line for that
argument, and it does not have to propagate into src/conf/domain_conf.c).

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]