On Fri, Feb 14, 2014 at 05:21:41PM -0700, Eric Blake wrote:
Add 'virsh net-event --list' and 'virsh net-event [net]
--event=name
[--loop] [--timeout]'. Very similar to 'virsh event'.
* tools/virsh.pod (net-event): Document new command.
* tools/virsh-network.c (vshNetworkEventToString, vshNetEventData)
(vshEventLifecyclePrint, cmdNetworkEvent): New struct and
functions.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
tools/virsh-network.c | 171 +++++++++++++++++++++++++++++++++++++++++++++++++-
tools/virsh.pod | 15 +++++
2 files changed, 185 insertions(+), 1 deletion(-)
+
+/*
+ * "net-event" command
+ */
+static const char *
+vshNetworkEventToString(int event)
+{
+ const char *ret = _("unknown");
+ switch ((virNetworkEventLifecycleType) event) {
+ case VIR_NETWORK_EVENT_DEFINED:
+ ret = _("Defined");
+ break;
+ case VIR_NETWORK_EVENT_UNDEFINED:
+ ret = _("Undefined");
+ break;
+ case VIR_NETWORK_EVENT_STARTED:
+ ret = _("Started");
+ break;
+ case VIR_NETWORK_EVENT_STOPPED:
+ ret = _("Stopped");
+ break;
+ case VIR_NETWORK_EVENT_LAST:
+ break;
+ }
+ return ret;
+}
Another enum use case I think
+By default, tihs command is one-shot, and returns success once an
event
Yay, copy+paste mistakes :-)
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|