Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/connect.c | 7 ++----- src/connect.h | 2 ++ src/domain.c | 7 +++++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/connect.c b/src/connect.c index 10183f3..314277f 100644 --- a/src/connect.c +++ b/src/connect.c @@ -248,6 +248,8 @@ virtDBusConnectNew(virtDBusConnect **connectp, connect->bus = sd_bus_ref(bus); connect->uri = uri; + connect->enumerateDomains = virtDBusConnectEnumarateDomains; + r = sd_bus_add_object_vtable(connect->bus, NULL, "/org/libvirt/Connect", @@ -257,11 +259,6 @@ virtDBusConnectNew(virtDBusConnect **connectp, if (r < 0) return r; - r = sd_bus_add_node_enumerator(bus, NULL, "/org/libvirt/domain", - virtDBusConnectEnumarateDomains, connect); - if (r < 0) - return r; - if ((r = virtDBusDomainRegister(connect, bus) < 0)) return r; diff --git a/src/connect.h b/src/connect.h index 52e8279..de1aae7 100644 --- a/src/connect.h +++ b/src/connect.h @@ -10,6 +10,8 @@ struct virtDBusConnect { const char *uri; virConnectPtr connection; + sd_bus_node_enumerator_t enumerateDomains; + int callback_ids[VIR_DOMAIN_EVENT_ID_LAST]; }; typedef struct virtDBusConnect virtDBusConnect; diff --git a/src/domain.c b/src/domain.c index a3e1d0b..bc465b0 100644 --- a/src/domain.c +++ b/src/domain.c @@ -539,6 +539,13 @@ int virtDBusDomainRegister(virtDBusConnect *connect, sd_bus *bus) { + int r; + + r = sd_bus_add_node_enumerator(bus, NULL, "/org/libvirt/domain", + connect->enumerateDomains, connect); + if (r < 0) + return r; + return sd_bus_add_fallback_vtable(bus, NULL, "/org/libvirt/domain", -- 2.14.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list