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

Re: [libvirt] libvirt hooks stopped vs crashed



On 03/13/2012 05:00 PM, Ante Karamatic wrote:
Hi all

I've noticed libvirt's qemu hook doesn't make a difference between
crashed and stopped VM. While I do understand that crashed VM is
essentially a stopped VM, I'd be interested in providing (and working
on) a patch that would differentiate these two cases.

What I'm interested in is if there's a reason, unknown to me, why this
wasn't implemented in the first place. And of course, does it make sense
to differentiate those two.

Thank you!


There are reasons defined for a stopped VM:

typedef enum {
    VIR_DOMAIN_SHUTOFF_UNKNOWN = 0,     /* the reason is unknown */
    VIR_DOMAIN_SHUTOFF_SHUTDOWN = 1,    /* normal shutdown */
    VIR_DOMAIN_SHUTOFF_DESTROYED = 2,   /* forced poweroff */
    VIR_DOMAIN_SHUTOFF_CRASHED = 3,     /* domain crashed */
    VIR_DOMAIN_SHUTOFF_MIGRATED = 4,    /* migrated to another host */
    VIR_DOMAIN_SHUTOFF_SAVED = 5,       /* saved to a file */
    VIR_DOMAIN_SHUTOFF_FAILED = 6,      /* domain failed to start */
VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7, /* restored from a snapshot which was * taken while domain was shutoff */
#ifdef VIR_ENUM_SENTINELS
    VIR_DOMAIN_SHUTOFF_LAST
#endif
} virDomainShutoffReason;

A rough thought is you can take use of the parameter "@extra"
to pass the a string to represent the shutoff reason.

<snip>
 * @op: the operation on the id e.g. VIR_HOOK_QEMU_OP_START
 * @sub_op: a sub_operation, currently unused
 * @extra: optional string information
<snip>

Osier


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