[libvirt] [dbus PATCH 3/4] Merge all Domain lifecycle signals into one signal called Domain.
Katerina Koukiou
kkoukiou at redhat.com
Thu Mar 29 15:15:05 UTC 2018
On Thu, 2018-03-29 at 15:05 +0200, Ján Tomko wrote:
> On Thu, Mar 29, 2018 at 01:07:57PM +0200, Katerina Koukiou wrote:
> > Instead of having multiple signals regarding to domain events,
> > like DomainStarted, DomainUndefined etc, we will have only one
> > called Domain, and the specific event type will be specified in
> > the signals arguments.
> >
> > The domain name argument in not needed in the signal since we can
> > fetch it from path.
> >
>
> Any plans to add support for the 'detail' field of
> virConnectDomainEventCallback?
Yes, I guess it's ok to be in different patchset though.
>
> > The tests are adjusted to call correctly connect_to_signal method
> > on the new signal.
> >
> > Signed-off-by: Katerina Koukiou <kkoukiou at redhat.com>
> > ---
> > data/org.libvirt.Connect.xml | 54 +++----------------------------
> > -------------
> > src/events.c | 26 ++++++++++-----------
> > test/test_connect.py | 10 ++++----
> > test/test_domain.py | 20 +++++++---------
> > 4 files changed, 27 insertions(+), 83 deletions(-)
> >
> > diff --git a/src/events.c b/src/events.c
> > index dada55f..62f3729 100644
> > --- a/src/events.c
> > +++ b/src/events.c
> > @@ -12,51 +12,49 @@ virtDBusEventsDomainLifecycle(virConnectPtr
> > connection G_GNUC_UNUSED,
> > gpointer opaque)
> > {
> > virtDBusConnect *connect = opaque;
> > - const gchar *signal = NULL;
> > - const gchar *name;
> > + const gchar *event_type = NULL;
> > g_autofree gchar *path = NULL;
> >
> > switch (event) {
> > case VIR_DOMAIN_EVENT_DEFINED:
> > - signal = "DomainDefined";
> > + event_type = "DomainDefined";
> > break;
> > case VIR_DOMAIN_EVENT_UNDEFINED:
> > - signal = "DomainUndefined";
> > + event_type = "DomainUndefined";
> > break;
> > case VIR_DOMAIN_EVENT_STARTED:
> > - signal = "DomainStarted";
> > + event_type = "DomainStarted";
> > break;
> > case VIR_DOMAIN_EVENT_SUSPENDED:
> > - signal = "DomainSuspended";
> > + event_type = "DomainSuspended";
> > break;
> > case VIR_DOMAIN_EVENT_RESUMED:
> > - signal = "DomainResumed";
> > + event_type = "DomainResumed";
> > break;
> > case VIR_DOMAIN_EVENT_STOPPED:
> > - signal = "DomainStopped";
> > + event_type = "DomainStopped";
> > break;
> > case VIR_DOMAIN_EVENT_SHUTDOWN:
> > - signal = "DomainShutdown";
> > + event_type = "DomainShutdown";
> > break;
> > case VIR_DOMAIN_EVENT_PMSUSPENDED:
> > - signal = "DomainPMSuspended";
> > + event_type = "DomainPMSuspended";
> > break;
> > case VIR_DOMAIN_EVENT_CRASHED:
> > - signal = "DomainCrashed";
> > + event_type = "DomainCrashed";
> > break;
> > default:
> > return 0;
>
> Converting this to an EnumToString call first would make the commit
> replacing
> the char* variable name and the commit dropping the Domain prefix
> nicer.
Good point. I reverted the order of the two commits.
>
> Jan
More information about the libvir-list
mailing list