aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2011-08-18 18:14:40 -0600
committerEric Blake <eblake@redhat.com>2011-09-05 07:03:04 -0600
commit5b30b08d665af2869a94cf34c032d6a42da4578f (patch)
treeb20c217f9d3088e2b8b9567d2871c1921ba15148 /tools
parentsnapshot: expose halt-after-creation in virsh (diff)
downloadlibvirt-5b30b08d665af2869a94cf34c032d6a42da4578f.tar.gz
libvirt-5b30b08d665af2869a94cf34c032d6a42da4578f.tar.bz2
libvirt-5b30b08d665af2869a94cf34c032d6a42da4578f.zip
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.
Diffstat (limited to 'tools')
-rw-r--r--tools/virsh.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/virsh.c b/tools/virsh.c
index d1ebc4093..7ae5b404e 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -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");