mirror of https://gitee.com/openkylin/libvirt.git
New domain state pmsuspended
This introduces a new domain state pmsuspended to represent the domain which has been suspended by guest power management, e.g. (entered itno s3 state). Because a "running" state could be confused in this case, one will see the guest is paused actually while playing. And state "paused" is for the domain which was paused by virDomainSuspend.
This commit is contained in:
parent
487c063381
commit
54d9026a2c
|
@ -86,13 +86,15 @@ typedef virDomain *virDomainPtr;
|
|||
* A domain may be in different states at a given point in time
|
||||
*/
|
||||
typedef enum {
|
||||
VIR_DOMAIN_NOSTATE = 0, /* no state */
|
||||
VIR_DOMAIN_RUNNING = 1, /* the domain is running */
|
||||
VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
|
||||
VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
|
||||
VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
|
||||
VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
|
||||
VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */
|
||||
VIR_DOMAIN_NOSTATE = 0, /* no state */
|
||||
VIR_DOMAIN_RUNNING = 1, /* the domain is running */
|
||||
VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */
|
||||
VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */
|
||||
VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */
|
||||
VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */
|
||||
VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */
|
||||
VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest
|
||||
power management */
|
||||
|
||||
#ifdef VIR_ENUM_SENTINELS
|
||||
/*
|
||||
|
@ -183,6 +185,13 @@ typedef enum {
|
|||
#endif
|
||||
} virDomainCrashedReason;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_PMSUSPENDED_UNKNOWN = 0,
|
||||
|
||||
#ifdef VIR_ENUM_SENTINELS
|
||||
VIR_DOMAIN_PMSUSPENDED_LAST
|
||||
#endif
|
||||
} virDomainPMSuspendedReason;
|
||||
|
||||
/**
|
||||
* virDomainControlState:
|
||||
|
|
|
@ -512,7 +512,8 @@ VIR_ENUM_IMPL(virDomainState, VIR_DOMAIN_LAST,
|
|||
"paused",
|
||||
"shutdown",
|
||||
"shutoff",
|
||||
"crashed")
|
||||
"crashed",
|
||||
"pmsuspended")
|
||||
|
||||
/* virDomainSnapshotState is really virDomainState plus one extra state */
|
||||
VIR_ENUM_IMPL(virDomainSnapshotState, VIR_DOMAIN_SNAPSHOT_STATE_LAST,
|
||||
|
@ -523,6 +524,7 @@ VIR_ENUM_IMPL(virDomainSnapshotState, VIR_DOMAIN_SNAPSHOT_STATE_LAST,
|
|||
"shutdown",
|
||||
"shutoff",
|
||||
"crashed",
|
||||
"pmsuspended",
|
||||
"disk-snapshot")
|
||||
|
||||
#define VIR_DOMAIN_NOSTATE_LAST (VIR_DOMAIN_NOSTATE_UNKNOWN + 1)
|
||||
|
@ -14369,14 +14371,32 @@ 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;
|
||||
default: last = -1;
|
||||
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;
|
||||
case VIR_DOMAIN_PMSUSPENDED:
|
||||
last = VIR_DOMAIN_PMSUSPENDED_LAST;
|
||||
break;
|
||||
default:
|
||||
last = -1;
|
||||
}
|
||||
|
||||
if (last < 0) {
|
||||
|
|
|
@ -18822,6 +18822,8 @@ vshDomainStateToString(int state)
|
|||
return N_("shut off");
|
||||
case VIR_DOMAIN_CRASHED:
|
||||
return N_("crashed");
|
||||
case VIR_DOMAIN_PMSUSPENDED:
|
||||
return N_("pmsuspended");
|
||||
case VIR_DOMAIN_NOSTATE:
|
||||
default:
|
||||
;/*FALLTHROUGH*/
|
||||
|
@ -18935,6 +18937,14 @@ vshDomainStateReasonToString(int state, int reason)
|
|||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_PMSUSPENDED:
|
||||
switch ((virDomainPMSuspendedReason) reason) {
|
||||
case VIR_DOMAIN_PMSUSPENDED_UNKNOWN:
|
||||
case VIR_DOMAIN_PMSUSPENDED_LAST:
|
||||
;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_LAST:
|
||||
;
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ State is the run state (see below).
|
|||
|
||||
B<STATES>
|
||||
|
||||
The State field lists 7 states for a domain, and which ones the
|
||||
The State field lists 8 states for a domain, and which ones the
|
||||
current domain is in.
|
||||
|
||||
=over 4
|
||||
|
@ -372,6 +372,11 @@ restart on crash.
|
|||
The domain is in process of dying, but hasn't completely shutdown or
|
||||
crashed.
|
||||
|
||||
=item B<pmsuspended>
|
||||
|
||||
The domain has been suspended by guest power management, e.g. entered
|
||||
into s3 state.
|
||||
|
||||
=back
|
||||
|
||||
If I<--managed-save> is specified, then domains that have managed save
|
||||
|
|
Loading…
Reference in New Issue