New version
- Search for the LVM DBus service in activatable names (vpodzime) - Better check for the LVM DBus API (vpodzime)
This commit is contained in:
parent
72cd5062ea
commit
4d5a5492bc
46
better_lvm_dbus_check.patch
Normal file
46
better_lvm_dbus_check.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From 68afb7d855e269e22fb5fdee60afb73c842534e3 Mon Sep 17 00:00:00 2001
|
||||
From: Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Date: Tue, 15 Mar 2016 10:21:01 +0100
|
||||
Subject: [PATCH 1/2] Better check for the LVM DBus API
|
||||
|
||||
The fact that the service is running doens't automatically mean that we can
|
||||
access and use it. In order to check for that we may simply try to introspect
|
||||
the root node which is guaranteed to always be there. If things work nicely, we
|
||||
may also trigger autostart the service this way.
|
||||
|
||||
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
|
||||
---
|
||||
src/plugins/lvm-dbus.c | 15 +++++++++++++--
|
||||
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
|
||||
index a508b3f..e21568f 100644
|
||||
--- a/src/plugins/lvm-dbus.c
|
||||
+++ b/src/plugins/lvm-dbus.c
|
||||
@@ -230,10 +230,21 @@ gboolean check() {
|
||||
found = (g_strcmp0 (g_variant_get_string (service, NULL), LVM_BUS_NAME) == 0);
|
||||
g_variant_unref (service);
|
||||
}
|
||||
-
|
||||
g_variant_unref (real_ret);
|
||||
|
||||
- return found;
|
||||
+ if (!found)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ /* try to introspect the root node - i.e. check we can access it and possibly
|
||||
+ autostart the service */
|
||||
+ ret = g_dbus_connection_call_sync (bus, LVM_BUS_NAME, LVM_OBJ_PREFIX, DBUS_INTRO_IFACE,
|
||||
+ "Introspect", NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
|
||||
+ -1, NULL, &error);
|
||||
+ if (ret)
|
||||
+ g_variant_unref (ret);
|
||||
+
|
||||
+ /* there has to be no error reported */
|
||||
+ return (error == NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
2.5.0
|
||||
|
@ -1,12 +1,14 @@
|
||||
Name: libblockdev
|
||||
Version: 1.4
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Summary: A library for low-level manipulation with block devices
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/rhinstaller/libblockdev
|
||||
Source0: https://github.com/rhinstaller/libblockdev/archive/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: vgreduce_null_pv.patch
|
||||
Patch1: better_lvm_dbus_check.patch
|
||||
Patch2: search_lvm_dbus_in_activatable.patch
|
||||
|
||||
BuildRequires: glib2-devel
|
||||
BuildRequires: gobject-introspection-devel
|
||||
@ -332,6 +334,8 @@ A meta-package that pulls all the libblockdev plugins as dependencies.
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
%configure
|
||||
@ -507,6 +511,10 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
|
||||
%files plugins-all
|
||||
|
||||
%changelog
|
||||
* Tue Mar 15 2016 Vratislav Podzimek <vpodzime@redhat.com> - 1.4-5
|
||||
- Search for the LVM DBus service in activatable names (vpodzime)
|
||||
- Better check for the LVM DBus API (vpodzime)
|
||||
|
||||
* Wed Mar 9 2016 Vratislav Podzimek <vpodzime@redhat.com> - 1.4-4
|
||||
- Do not try to get object path of NULL in vgreduce (vpodzime)
|
||||
|
||||
|
30
search_lvm_dbus_in_activatable.patch
Normal file
30
search_lvm_dbus_in_activatable.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 950a164f1954c85f5e757ec3fb925150b8623031 Mon Sep 17 00:00:00 2001
|
||||
From: Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Date: Tue, 15 Mar 2016 11:03:13 +0100
|
||||
Subject: [PATCH 2/2] Search for the LVM DBus service in activatable names
|
||||
|
||||
ListNames() gives names of services that are already
|
||||
running. ListActivatableNames() gives a list of services that are either running
|
||||
or activatable (support auto-start).
|
||||
|
||||
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
|
||||
---
|
||||
src/plugins/lvm-dbus.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
|
||||
index e21568f..07363c4 100644
|
||||
--- a/src/plugins/lvm-dbus.c
|
||||
+++ b/src/plugins/lvm-dbus.c
|
||||
@@ -215,7 +215,7 @@ gboolean check() {
|
||||
}
|
||||
|
||||
ret = g_dbus_connection_call_sync (bus, DBUS_TOP_IFACE, DBUS_TOP_OBJ, DBUS_TOP_IFACE,
|
||||
- "ListNames", NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
|
||||
+ "ListActivatableNames", NULL, NULL, G_DBUS_CALL_FLAGS_NONE,
|
||||
-1, NULL, &error);
|
||||
if (!ret) {
|
||||
g_critical ("Failed to get available DBus services: %s", error->message);
|
||||
--
|
||||
2.5.0
|
||||
|
Loading…
Reference in New Issue
Block a user