mirror of
https://github.com/libvirt/libvirt.git
synced 2026-09-03 20:53:04 -05:00
snapshot: support extra state in snapshots
In order to distinguish disk snapshots from system checkpoints, a new state value that is only valid for snapshots is helpful. * include/libvirt/libvirt.h.in (VIR_DOMAIN_LAST): New placeholder. * src/conf/domain_conf.h (virDomainSnapshotState): New enum mapping. (VIR_DOMAIN_DISK_SNAPSHOT): New internal enum value. * src/conf/domain_conf.c (virDomainState): Use placeholder. (virDomainSnapshotState): Extend mapping by one for use in snapshot. (virDomainSnapshotDefParseString, virDomainSnapshotDefFormat): Handle new state. (virDomainObjSetState, virDomainStateReasonToString) (virDomainStateReasonFromString): Avoid compiler warnings. * tools/virsh.c (vshDomainState, vshDomainStateReasonToString): Likewise. * src/libvirt_private.syms (domain_conf.h): Export new functions. * docs/schemas/domainsnapshot.rng: Tighten state definition. * docs/formatsnapshot.html.in: Document it. * tests/domainsnapshotxml2xmlout/disk_snapshot.xml: New test.
This commit is contained in:
@@ -14588,6 +14588,8 @@ vshDomainState(vshControl *ctl, virDomainPtr dom, int *reason)
|
||||
static const char *
|
||||
vshDomainStateToString(int state)
|
||||
{
|
||||
/* Can't use virDomainStateTypeToString, because we want to mark
|
||||
* strings for translation. */
|
||||
switch ((virDomainState) state) {
|
||||
case VIR_DOMAIN_RUNNING:
|
||||
return N_("running");
|
||||
@@ -14602,6 +14604,7 @@ vshDomainStateToString(int state)
|
||||
case VIR_DOMAIN_CRASHED:
|
||||
return N_("crashed");
|
||||
case VIR_DOMAIN_NOSTATE:
|
||||
default:
|
||||
;/*FALLTHROUGH*/
|
||||
}
|
||||
return N_("no state"); /* = dom0 state */
|
||||
@@ -14703,6 +14706,9 @@ vshDomainStateReasonToString(int state, int reason)
|
||||
;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
|
||||
return N_("unknown");
|
||||
|
||||
Reference in New Issue
Block a user