summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-10-21 13:43:53 -0500
committerDavid Teigland <teigland@redhat.com>2015-10-21 13:56:28 -0500
commitd9fad86510118fa589b1aa45845380daa585b363 (patch)
tree1c4238bd68ebe9a4f8181def2ff02fd1cc623810
parentd99c9ed5f33f01a99ca371a172dde0d893ccd136 (diff)
downloadlvm2-d9fad86510118fa589b1aa45845380daa585b363.tar.gz
lvmnotify: use separate event for vg_remove
versus vg_update when a vg is created or changed.
-rw-r--r--lib/metadata/metadata.c2
-rw-r--r--lib/notify/lvmnotify.c43
2 files changed, 44 insertions, 1 deletions
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 5e5f2848b..38b02149c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -603,7 +603,7 @@ int vg_remove_direct(struct volume_group *vg)
lockd_vg_update(vg);
- notify_vg_update(vg);
+ notify_vg_remove(vg);
if (!backup_remove(vg->cmd, vg->name))
stack;
diff --git a/lib/notify/lvmnotify.c b/lib/notify/lvmnotify.c
index b98bf9247..e01441804 100644
--- a/lib/notify/lvmnotify.c
+++ b/lib/notify/lvmnotify.c
@@ -86,6 +86,45 @@ void notify_vg_update(struct volume_group *vg)
}
}
+void notify_vg_remove(struct volume_group *vg)
+{
+ char uuid[64] __attribute__((aligned(8)));
+ GError *error = NULL;
+ GVariant *rc;
+ int result = 0;
+
+ if (!_dbus_con)
+ return;
+
+ if (!id_write_format(&vg->id, uuid, sizeof(uuid)))
+ return;
+
+ rc = g_dbus_proxy_call_sync(_dbus_con,
+ "ExternalEvent",
+ g_variant_new("(sssu)",
+ "vg_remove",
+ vg->name,
+ uuid,
+ vg->seqno),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL, &error);
+
+ if (rc) {
+ g_variant_get(rc, "(i)", &result);
+ if (result)
+ log_debug("Error from sending dbus notification %d", result);
+ g_variant_unref(rc);
+
+ } else if (error) {
+ if (error->code != 2)
+ log_debug("Failed to send dbus notification %d %s", error->code, error->message);
+ g_error_free(error);
+
+ } else {
+ log_debug("Undefined dbus result");
+ }
+}
+
#else
int lvmnotify_init(struct cmd_context *cmd)
@@ -100,5 +139,9 @@ void notify_vg_update(struct volume_group *vg)
{
}
+void notify_vg_remove(struct volume_group *vg)
+{
+}
+
#endif