New version

- Merge pull request #72 from vpodzime/master-faster_tests (vpodzime)
- Ignore all .bak files (vpodzime)
- Use python3-pylint and skip Python 2 tests (vpodzime)
- Try a bit harder when deactivating MD arrays in tests (vpodzime)
- Recompile only the LVM plugin in tests (vpodzime)
- Merge pull request #65 from vpodzime/master-loc_indep_error (vpodzime)
- Merge pull request #70 from vojtechtrefny/master-chunk_size (vpodzime)
- Add bd_md_create_with_chunk_size() function (vtrefny)
- Merge pull request #68 from vpodzime/master-no_intro_data (vpodzime)
- Merge pull request #71 from vpodzime/master-ipython3 (vpodzime)
- Run coverage with the right config directories (vpodzime)
- Merge pull request #67 from phatina/master (vpodzime)
- Merge pull request #69 from vpodzime/master-lvm_dbus_autostart (vpodzime)
- Use ipython3 for debugging and testing sessions (vpodzime)
- Don't expect to always get introspection data from DBus (vpodzime)
- Make invocation of tests configurable (phatina)
- Make error messages locale agnostic (vpodzime)
This commit is contained in:
Vratislav Podzimek 2016-03-21 09:34:36 +01:00
parent 4d5a5492bc
commit 46063a3804
6 changed files with 23 additions and 129 deletions

1
.gitignore vendored
View File

@ -16,3 +16,4 @@
/libblockdev-1.2.tar.gz
/libblockdev-1.3.tar.gz
/libblockdev-1.4.tar.gz
/libblockdev-1.5.tar.gz

View File

@ -1,46 +0,0 @@
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

View File

@ -1,15 +1,11 @@
Name: libblockdev
Version: 1.4
Release: 5%{?dist}
Version: 1.5
Release: 1%{?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
BuildRequires: cryptsetup-devel
@ -333,9 +329,6 @@ 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
@ -511,6 +504,25 @@ find %{buildroot} -type f -name "*.la" | xargs %{__rm}
%files plugins-all
%changelog
* Mon Mar 21 2016 Vratislav Podzimek <vpodzime@redhat.com> - 1.5-1
- Merge pull request #72 from vpodzime/master-faster_tests (vpodzime)
- Ignore all .bak files (vpodzime)
- Use python3-pylint and skip Python 2 tests (vpodzime)
- Try a bit harder when deactivating MD arrays in tests (vpodzime)
- Recompile only the LVM plugin in tests (vpodzime)
- Merge pull request #65 from vpodzime/master-loc_indep_error (vpodzime)
- Merge pull request #70 from vojtechtrefny/master-chunk_size (vpodzime)
- Add bd_md_create_with_chunk_size() function (vtrefny)
- Merge pull request #68 from vpodzime/master-no_intro_data (vpodzime)
- Merge pull request #71 from vpodzime/master-ipython3 (vpodzime)
- Run coverage with the right config directories (vpodzime)
- Merge pull request #67 from phatina/master (vpodzime)
- Merge pull request #69 from vpodzime/master-lvm_dbus_autostart (vpodzime)
- Use ipython3 for debugging and testing sessions (vpodzime)
- Don't expect to always get introspection data from DBus (vpodzime)
- Make invocation of tests configurable (phatina)
- Make error messages locale agnostic (vpodzime)
* 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)

View File

@ -1,30 +0,0 @@
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

View File

@ -1 +1 @@
1a1761eb0eab9b7c5b2623213bafadd7 libblockdev-1.4.tar.gz
c3c498fcb0a708b93ba1847b5d2f9fe1 libblockdev-1.5.tar.gz

View File

@ -1,43 +0,0 @@
From 8ee82578de78dceaa1bdeb3e757a84ca527df065 Mon Sep 17 00:00:00 2001
From: Vratislav Podzimek <vpodzime@redhat.com>
Date: Wed, 9 Mar 2016 10:33:47 +0100
Subject: [PATCH] Do not try to get object path of NULL in vgreduce
If no PV is given, we shouldn't try to get its object path.
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com>
---
src/plugins/lvm-dbus.c | 10 ++++++----
tests/lvm_dbus_tests.py | 4 ++++
tests/lvm_test.py | 4 ++++
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/plugins/lvm-dbus.c b/src/plugins/lvm-dbus.c
index a8e5231..a508b3f 100644
--- a/src/plugins/lvm-dbus.c
+++ b/src/plugins/lvm-dbus.c
@@ -1364,14 +1364,16 @@ gboolean bd_lvm_vgreduce (gchar *vg_name, gchar *device, GError **error) {
GVariant *params = NULL;
GVariant *extra = NULL;
- pv = get_object_path (device, error);
- if (!pv)
- return FALSE;
+ if (device) {
+ pv = get_object_path (device, error);
+ if (!pv)
+ return FALSE;
+ }
- pv_var = g_variant_new ("o", pv);
g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
if (device) {
/* do not remove missing */
+ pv_var = g_variant_new ("o", pv);
g_variant_builder_add_value (&builder, g_variant_new_boolean (FALSE));
g_variant_builder_add_value (&builder, g_variant_new_array (NULL, &pv_var, 1));
params = g_variant_builder_end (&builder);
--
2.5.0