Re: [dbus PATCH 3/4] Merge all Domain lifecycle signals into one signal called Domain.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

The tests are adjusted to call correctly connect_to_signal method
on the new signal.

Signed-off-by: Katerina Koukiou <kkoukiou@xxxxxxxxxx>
---
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.

Jan

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux