[libvirt] [PATCH 3/4] virsh: add event command, for lifecycle events

Daniel P. Berrange berrange at redhat.com
Thu Feb 20 18:14:34 UTC 2014


On Thu, Feb 20, 2014 at 11:06:55AM -0700, Eric Blake wrote:
> On 02/20/2014 10:33 AM, Daniel P. Berrange wrote:
> > On Fri, Feb 14, 2014 at 05:21:40PM -0700, Eric Blake wrote:
> >> Add 'virsh event --list' and 'virsh event [dom] --event=name
> >> [--loop] [--timeout]'.  Borrows somewhat from event-test.c,
> >> but defaults to a one-shot notification, and takes advantage
> >> of the event loop integration to allow Ctrl-C to interrupt the
> >> wait for an event.  For now, this just does lifecycle events.
> >>
> >> * tools/virsh.pod (event): Document new command.
> >> * tools/virsh-domain.c (vshDomainEventToString)
> >> (vshDomainEventDetailToString, vshDomEventData)
> >> (vshEventLifecyclePrint, cmdEvent): New struct and functions.
> > 
> > ACK
> > 
> 
> >> +    case VIR_DOMAIN_EVENT_DEFINED:
> >> +        ret = _("Defined");
> >> +        break;
> > 
> 
> > How about using VIR_ENUM ?
> > 
> > We avoided it in the event-test.c file since we wanted it to
> > be example code people can compile outside libvirt. Using
> > enums would be fine for virsh though i think
> 
> VIR_ENUM doesn't allow _("") translation.  This output is human legible,
> so we want it to appear in the user's locale (see also
> vshDomainVcpuStateToString() and friends).

This is what the   N_("") macro is for though isn't it. Marks the
string for translation, but actual gettext call is done at time of
use instead.

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 :|




More information about the libvir-list mailing list