master - stats: fix error path when region is NULL
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3750b0cff5ab1c41076...
Commit: 3750b0cff5ab1c41076afdf8275e3fa20aa756d0
Parent: 0161ebe484005e948eab6b12bc3942e62a22819b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 20:12:40 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
stats: fix error path when region is NULL
We should not call _stats_cleanup_region_ids() when regions
are NULL.
Also add backtracing for goto.
---
libdm/libdm-stats.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index ca46d9a..80cb42b 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4869,24 +4869,24 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
group_id, &count, ®roup);
if (!regions)
- goto bad;
+ goto_out;
if (!dm_stats_list(dms, NULL))
- goto bad;
+ goto_bad;
/* regroup if there are regions to group */
if (regroup && (*regions != DM_STATS_REGION_NOT_PRESENT))
if (!_stats_group_file_regions(dms, regions, count, alias))
- goto bad;
+ goto_bad;
dm_free(bounds);
dm_free((char *) alias);
return regions;
bad:
_stats_cleanup_region_ids(dms, regions, count);
- dm_free(bounds);
- dm_free(regions);
out:
+ dm_free(regions);
+ dm_free(bounds);
dm_free((char *) alias);
return NULL;
}
4 years, 11 months
master - scripts: simplify including for generator
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0161ebe484005e948ea...
Commit: 0161ebe484005e948eab6b12bc3942e62a22819b
Parent: a4577c427a76c6a337b7812f9da7700c2c8beb89
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 19:14:32 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
scripts: simplify including for generator
Uses included .c file as primary header includer.
---
scripts/generator-internals.c | 2 ++
.../lvm2_activation_generator_systemd_red_hat.c | 20 --------------------
test/unit/activation-generator_t.c | 2 --
3 files changed, 2 insertions(+), 22 deletions(-)
diff --git a/scripts/generator-internals.c b/scripts/generator-internals.c
index 9619e8c..9919247 100644
--- a/scripts/generator-internals.c
+++ b/scripts/generator-internals.c
@@ -1,6 +1,8 @@
// This file contains the unit testable parts of
// lvm2_activation_generator_systemd_red_hat
+#include "device_mapper/all.h"
+
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index b44c8f0..a3a3e88 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -12,29 +12,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h> /* For PATH_MAX for musl libc */
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <string.h>
-#include <syslog.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-#include "configure.h"
-#include "device_mapper/all.h"
-
-//----------------------------------------------------------------
-
// Code in this file gets included in the unit tests.
#include "generator-internals.c"
-//----------------------------------------------------------------
// Logging
#define KMSG_DEV_PATH "/dev/kmsg"
diff --git a/test/unit/activation-generator_t.c b/test/unit/activation-generator_t.c
index ef4946d..6aa115c 100644
--- a/test/unit/activation-generator_t.c
+++ b/test/unit/activation-generator_t.c
@@ -15,8 +15,6 @@
#include "units.h"
#include "scripts/generator-internals.c"
-#include "device_mapper/all.h"
-
//----------------------------------------------------------------
static void _error(const char *format, ...)
4 years, 11 months
master - scripts: avoid voiding write result
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a4577c427a76c6a337b...
Commit: a4577c427a76c6a337b7812f9da7700c2c8beb89
Parent: a3fe6195521a58c93d7158028c7ab62da14d4ddd
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 11:19:25 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
scripts: avoid voiding write result
Gcc doesn't want to ignore write() return code.
---
.../lvm2_activation_generator_systemd_red_hat.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/lvm2_activation_generator_systemd_red_hat.c b/scripts/lvm2_activation_generator_systemd_red_hat.c
index 0e6c05a..b44c8f0 100644
--- a/scripts/lvm2_activation_generator_systemd_red_hat.c
+++ b/scripts/lvm2_activation_generator_systemd_red_hat.c
@@ -69,7 +69,8 @@ static void _error(const char *format, ...)
return;
/* The n+31: +30 for "<n>lvm2-activation-generator: " prefix and +1 for '\0' suffix */
- (void) write(_kmsg_fd, message, n + 31);
+ if (write(_kmsg_fd, message, n + 31) < 0)
+ _error("Failed to write activation message %s: %m.\n", message);
}
//----------------------------------------------------------------
4 years, 11 months
master - lvmlockd: use commonly used define NOTIFYDBUS_SUPPORT
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=71af650760c2b75b3c2...
Commit: 71af650760c2b75b3c267277f47d8ba235421300
Parent: 7832d3566868408ebf6d4c5d708e3efab3d48a67
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 11:17:43 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
lvmlockd: use commonly used define NOTIFYDBUS_SUPPORT
Build with configured NOTIFYDBUS_SUPPORT, SYSTEMD_LIBS, SYSTEMD_CFLAGS.
Also add proper build dependencies on internal libraries.
---
daemons/lvmlockd/Makefile.in | 21 +++++++--------------
daemons/lvmlockd/lvmlockd-core.c | 2 +-
2 files changed, 8 insertions(+), 15 deletions(-)
diff --git a/daemons/lvmlockd/Makefile.in b/daemons/lvmlockd/Makefile.in
index 17fcb40..3ca4167 100644
--- a/daemons/lvmlockd/Makefile.in
+++ b/daemons/lvmlockd/Makefile.in
@@ -37,25 +37,18 @@ TARGETS = lvmlockd lvmlockctl
include $(top_builddir)/make.tmpl
-CFLAGS += $(EXTRA_EXEC_CFLAGS)
+CFLAGS += $(EXTRA_EXEC_CFLAGS) $(SYSTEMD_CFLAGS)
INCLUDES += -I$(top_srcdir)/libdaemon/server
-LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
-LIBS += $(RT_LIBS) $(DAEMON_LIBS) $(PTHREAD_LIBS)
+LDFLAGS += $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
+LIBS += $(PTHREAD_LIBS) $(SYSTEMD_LIBS)
-
-ifeq ($(USE_SD_NOTIFY),yes)
- CFLAGS += $(shell pkg-config --cflags libsystemd) -DUSE_SD_NOTIFY
- LIBS += $(shell pkg-config --libs libsystemd)
-endif
-
-lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
- $(top_builddir)/libdaemon/server/libdaemonserver.a
+lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/server/libdaemonserver.a $(INTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LOCK_LIBS) -ldaemonserver $(INTERNAL_LIBS) $(LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LOCK_LIBS) $(LIBS)
-lvmlockctl: lvmlockctl.o $(top_builddir)/libdaemon/client/libdaemonclient.a
+lvmlockctl: lvmlockctl.o $(INTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ lvmlockctl.o $(INTERNAL_LIBS) $(LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
install_lvmlockd: lvmlockd
@echo " [INSTALL] $<"
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index dd52270..1c58d4d 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -34,7 +34,7 @@
#include <sys/utsname.h>
#include <sys/un.h>
-#ifdef USE_SD_NOTIFY
+#ifdef NOTIFYDBUS_SUPPORT
#include <systemd/sd-daemon.h>
#endif
4 years, 11 months
master - lvmlockd: drop superfluous defines
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a3fe6195521a58c93d7...
Commit: a3fe6195521a58c93d7158028c7ab62da14d4ddd
Parent: 71af650760c2b75b3c267277f47d8ba235421300
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 11:16:05 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
lvmlockd: drop superfluous defines
These defines are automatically granted with _GNU_SOURCE
which is use for whole compilation via configure.h.
---
daemons/lvmlockd/lvmlockd-core.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 1c58d4d..e643d76 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -8,9 +8,6 @@
* of the GNU Lesser General Public License v.2.1.
*/
-#define _XOPEN_SOURCE 500 /* pthread */
-#define _ISOC99_SOURCE
-
#include "tools/tool.h"
#include "libdaemon/client/daemon-io.h"
4 years, 11 months
master - configure: avoid repeative inclusion of configure.h
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=18aa541ca270d70899a...
Commit: 18aa541ca270d70899ab7ec6095075b70a21fb09
Parent: a7034fa4200d63207daa45290150159dd02cf01f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 19:11:49 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 19:19:50 2018 +0100
configure: avoid repeative inclusion of configure.h
Since configure.h is a generated header and it's missing traditional
ifdefs preambule - it can be included & parsed multiple times.
Normally compiler is fine when defines have same value and there is
no warning - yet we don't need to parse this several times
and by adding -include directive we can ensure every file
in the package is rightly compile with configure.h as the
first header file.
---
base/data-struct/radix-tree.h | 2 --
base/memory/zalloc.h | 1 -
daemons/cmirrord/logging.h | 1 -
daemons/dmeventd/dmeventd.c | 1 -
daemons/dmeventd/libdevmapper-event.c | 1 -
device_mapper/all.h | 2 --
device_mapper/vdo/status.c | 2 --
libdm/dm-tools/dmsetup.c | 1 -
libdm/make.tmpl.in | 4 ++--
libdm/misc/dmlib.h | 2 --
make.tmpl.in | 4 ++--
test/lib/brick-shelltest.h | 2 --
test/lib/harness.c | 2 --
test/unit/framework.h | 1 -
tools/tool.h | 2 --
15 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/base/data-struct/radix-tree.h b/base/data-struct/radix-tree.h
index 685b828..5d4d04c 100644
--- a/base/data-struct/radix-tree.h
+++ b/base/data-struct/radix-tree.h
@@ -13,8 +13,6 @@
#ifndef BASE_DATA_STRUCT_RADIX_TREE_H
#define BASE_DATA_STRUCT_RADIX_TREE_H
-#include "configure.h"
-
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/base/memory/zalloc.h b/base/memory/zalloc.h
index 069c599..2509bf4 100644
--- a/base/memory/zalloc.h
+++ b/base/memory/zalloc.h
@@ -13,7 +13,6 @@
#ifndef BASE_MEMORY_ZALLOC_H
#define BASE_MEMORY_ZALLOC_H
-#include "configure.h"
#include <stdlib.h>
//----------------------------------------------------------------
diff --git a/daemons/cmirrord/logging.h b/daemons/cmirrord/logging.h
index 5f640cf..82ebab1 100644
--- a/daemons/cmirrord/logging.h
+++ b/daemons/cmirrord/logging.h
@@ -13,7 +13,6 @@
#ifndef _LVM_CLOG_LOGGING_H
#define _LVM_CLOG_LOGGING_H
-#include "configure.h"
#include <stdio.h>
#include <stdint.h>
#include <syslog.h>
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 4a58449..33859ef 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -17,7 +17,6 @@
*/
-#include "configure.h"
#include "libdevmapper-event.h"
#include "dmeventd.h"
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index 6465f64..491374e 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -12,7 +12,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "configure.h"
#include "libdevmapper-event.h"
#include "dmeventd.h"
#include "libdm/misc/dm-logging.h"
diff --git a/device_mapper/all.h b/device_mapper/all.h
index 9539442..05cd83b 100644
--- a/device_mapper/all.h
+++ b/device_mapper/all.h
@@ -17,8 +17,6 @@
#ifndef LIB_DEVICE_MAPPER_H
#define LIB_DEVICE_MAPPER_H
-#include "configure.h"
-
#include "base/data-struct/list.h"
#include "base/data-struct/hash.h"
#include "vdo/target.h"
diff --git a/device_mapper/vdo/status.c b/device_mapper/vdo/status.c
index a34029d..adb5a9b 100644
--- a/device_mapper/vdo/status.c
+++ b/device_mapper/vdo/status.c
@@ -15,8 +15,6 @@
/* Note: this object is also used by VDO dmeventd plugin for parsing status */
/* File could be included by VDO plugin and can use original libdm library */
#ifndef LIB_DMEVENT_H
-#include "configure.h"
-// For DM_ARRAY_SIZE!
#include "device_mapper/all.h"
#endif
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index efeb978..2feb419 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -17,7 +17,6 @@
*/
// For canonicalize_file_name()
-#include "configure.h"
#include "libdm/misc/dm-logging.h"
#include "libdm/dm-tools/util.h"
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 92f2f55..26e3dba 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -275,11 +275,11 @@ LIB_VERSION_LVM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir
LIB_VERSION_DM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)/VERSION_DM)
-INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include
+INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include -include configure.h
DEPS = $(top_builddir)/libdm/make.tmpl $(top_srcdir)/VERSION \
- $(top_builddir)/libdm/Makefile
+ $(top_builddir)/libdm/Makefile $(top_builddir)/include/configure.h
OBJECTS = $(SOURCES:%.c=%.o) $(CXXSOURCES:%.cpp=%.o)
POTFILES = $(SOURCES:%.c=%.pot)
diff --git a/libdm/misc/dmlib.h b/libdm/misc/dmlib.h
index 60787fe..2ea05c1 100644
--- a/libdm/misc/dmlib.h
+++ b/libdm/misc/dmlib.h
@@ -19,8 +19,6 @@
#ifndef _DM_LIB_H
#define _DM_LIB_H
-#include "configure.h"
-
/*
* Symbol export control macros
*
diff --git a/make.tmpl.in b/make.tmpl.in
index 9158f0e..f3332e9 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -294,12 +294,12 @@ LIB_VERSION_DM := $(shell $(AWK) -F '.' '{printf "%s.%s",$$1,$$2}' $(top_srcdir)
LIB_VERSION_APP := $(shell $(AWK) -F '[(). ]' '{printf "%s.%s",$$1,$$4}' $(top_srcdir)/VERSION)
-INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include
+INCLUDES += -I$(srcdir) -I$(top_srcdir) -I$(top_builddir)/include -include configure.h
#VDO_INCLUDES=-I@VDO_INCLUDE@
DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \
- $(top_builddir)/Makefile
+ $(top_builddir)/Makefile $(top_builddir)/include/configure.h
OBJECTS = $(SOURCES:%.c=%.o) $(CXXSOURCES:%.cpp=%.o)
POTFILES = $(SOURCES:%.c=%.pot)
diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h
index 7c5b601..56429c7 100644
--- a/test/lib/brick-shelltest.h
+++ b/test/lib/brick-shelltest.h
@@ -80,8 +80,6 @@
#include <unistd.h>
#endif
-#include "configure.h"
-
/* Timeout for the whole test suite in hours */
static const time_t TEST_SUITE_TIMEOUT = 4;
diff --git a/test/lib/harness.c b/test/lib/harness.c
index d1274ed..a97f5db 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -12,8 +12,6 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "configure.h"
-
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
diff --git a/test/unit/framework.h b/test/unit/framework.h
index d5a2cdd..0c45596 100644
--- a/test/unit/framework.h
+++ b/test/unit/framework.h
@@ -1,7 +1,6 @@
#ifndef TEST_UNIT_FRAMEWORK_H
#define TEST_UNIT_FRAMEWORK_H
-#include "configure.h"
#include "device_mapper/all.h"
#include <stdbool.h>
diff --git a/tools/tool.h b/tools/tool.h
index 6fd4da0..d78c042 100644
--- a/tools/tool.h
+++ b/tools/tool.h
@@ -18,8 +18,6 @@
#ifndef _LVM_TOOL_H
#define _LVM_TOOL_H
-#include "configure.h"
-
#include "base/memory/zalloc.h"
#include "device_mapper/all.h"
#include "lib/misc/util.h"
4 years, 11 months
master - lvmlockd: fix error return code for _init_vg_sanlock
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7832d3566868408ebf6...
Commit: 7832d3566868408ebf6d4c5d708e3efab3d48a67
Parent: 98924e4703bd798f4e872fbc7e6c6e32a199e102
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 12:08:10 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:30 2018 +0100
lvmlockd: fix error return code for _init_vg_sanlock
In few cases error paths from initialization were returned as
'success == 1'.
Also assing num_mb with single compare checking valid sector_size.
For dumb compiler make num_mb always defined.
---
lib/locking/lvmlockd.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 530378c..9fb7b36 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -632,7 +632,7 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
struct device *sector_dev;
uint32_t sector_size = 0;
unsigned int phys_block_size, block_size;
- int num_mb;
+ int num_mb = 0;
int result;
int ret;
@@ -655,25 +655,20 @@ static int _init_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg, in
sector_size = phys_block_size;
sector_dev = pvl->pv->dev;
} else if (sector_size != phys_block_size) {
- log_warn("Inconsistent sector sizes for %s and %s.",
- dev_name(pvl->pv->dev), dev_name(sector_dev));
- return 1;
+ log_error("Inconsistent sector sizes for %s and %s.",
+ dev_name(pvl->pv->dev), dev_name(sector_dev));
+ return 0;
}
}
- if ((sector_size != 512) && (sector_size != 4096)) {
- log_error("Unknown sector size.");
- return 1;
- }
-
log_debug("Using sector size %u for sanlock LV", sector_size);
/* Base starting size of sanlock LV is 256MB/1GB for 512/4K sectors */
- if (sector_size == 512)
- num_mb = 256;
- else if (sector_size == 4096)
- num_mb = 1024;
-
+ switch (sector_size) {
+ case 512: num_mb = 256; break;
+ case 4096: num_mb = 1024; break;
+ default: log_error("Unknown sector size %u.", sector_size); return 0;
+ }
/*
* Creating the sanlock LV writes the VG containing the new lvmlock
4 years, 11 months
master - lvmpolld: improve makefile deps
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=98924e4703bd798f4e8...
Commit: 98924e4703bd798f4e872fbc7e6c6e32a199e102
Parent: 18aa541ca270d70899ab7ec6095075b70a21fb09
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 21 11:24:00 2018 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Dec 21 21:42:23 2018 +0100
lvmpolld: improve makefile deps
Add correct build dependencies on internal libraries.
---
WHATS_NEW | 1 +
daemons/lvmpolld/Makefile.in | 9 ++++-----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 38525e3..1a9c521 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.02 -
===================================
+ Improve Makefile dependency tracking.
Move VDO support towards V2 target (6.2) support.
Fix missing proper initialization of pv_list struct when adding pv.
Fix (de)activation of RaidLVs with visible SubLVs
diff --git a/daemons/lvmpolld/Makefile.in b/daemons/lvmpolld/Makefile.in
index cfda0f6..05b12ff 100644
--- a/daemons/lvmpolld/Makefile.in
+++ b/daemons/lvmpolld/Makefile.in
@@ -29,13 +29,12 @@ include $(top_builddir)/make.tmpl
CFLAGS += $(EXTRA_EXEC_CFLAGS)
INCLUDES += -I$(top_srcdir)/libdaemon/server
-LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
-LIBS += $(DAEMON_LIBS) -ldaemonserver $(PTHREAD_LIBS)
+LDFLAGS += $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
+LIBS += $(DAEMON_LIBS) $(PTHREAD_LIBS)
-lvmpolld: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
- $(top_builddir)/libdaemon/server/libdaemonserver.a
+lvmpolld: $(OBJECTS) $(top_builddir)/libdaemon/server/libdaemonserver.a $(INTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(INTERNAL_LIBS) $(LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
install_lvmpolld: lvmpolld
@echo " [INSTALL] $<"
4 years, 11 months
master - tests/dbus: Re-enable nesting and pvcreate via symlink
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a7034fa4200d63207da...
Commit: a7034fa4200d63207daa45290150159dd02cf01f
Parent: 5bdcafff47ee6a2e57e0c57d18cbc36cf1a2973e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Dec 18 12:43:57 2018 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Dec 20 10:27:30 2018 -0600
tests/dbus: Re-enable nesting and pvcreate via symlink
If we are running the test where the device is /dev/* we will will
run the unit tests 'test_nesting' and 'test_pv_symlinks'. Otherwise
we will skip them.
---
test/dbus/lvmdbustest.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index d633aa3..9bc1683 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1873,14 +1873,13 @@ class TestDbusService(unittest.TestCase):
# when run from lvm2 testsuite. See dbustest.sh.
pv_object_path = self.objs[PV_INT][0].object_path
- if not pv_object_path.startswith("/dev"):
- std_err_print('Skipping test not running in /dev')
- return
+ if not self.objs[PV_INT][0].Pv.Name.startswith("/dev"):
+ raise unittest.SkipTest('test not running in /dev')
for i in range(0, 5):
pv_object_path = self._create_nested(pv_object_path)
- def DISABLED_test_pv_symlinks(self):
+ def test_pv_symlinks(self):
# Lets take one of our test PVs, pvremove it, find a symlink to it
# and re-create using the symlink to ensure we return an object
# path to it. Additionally, we will take the symlink and do a lookup
@@ -1891,6 +1890,9 @@ class TestDbusService(unittest.TestCase):
pv = self.objs[PV_INT][0]
pv_device_path = pv.Pv.Name
+ if not pv_device_path.startswith("/dev"):
+ raise unittest.SkipTest('test not running in /dev')
+
self._pv_remove(pv)
# Make sure we no longer find the pv
4 years, 11 months
master - lvmdbusd: Exit daemon when unable to retrieve state
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ab1f1a306bf8e146c12...
Commit: ab1f1a306bf8e146c1221786a1c1c24f8b71a377
Parent: 3320ab8334794684b4d324bb78d0b293a27287a6
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Dec 18 09:49:36 2018 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Dec 20 10:27:30 2018 -0600
lvmdbusd: Exit daemon when unable to retrieve state
In some cases we get stuck where we are unable to retrieve the current
state of lvm as we are encountering an error. When the error is
persistent we will log and exit the daemon instead of consuming vast
amounts of resources.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/cfg.py | 10 ++++++++++
daemons/lvmdbusd/fetch.py | 19 ++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index 771909f..be497d0 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -87,3 +87,13 @@ blackbox = None
# RequestEntry ctor
create_request_entry = None
+
+
+def exit_daemon():
+ """
+ Exit the daemon cleanly
+ :return:
+ """
+ if run and loop:
+ run.value = 0
+ loop.quit()
diff --git a/daemons/lvmdbusd/fetch.py b/daemons/lvmdbusd/fetch.py
index 69a4aae..e8f3521 100644
--- a/daemons/lvmdbusd/fetch.py
+++ b/daemons/lvmdbusd/fetch.py
@@ -14,6 +14,7 @@ from . import cfg
from .utils import MThreadRunner, log_debug, log_error
import threading
import queue
+import time
import traceback
@@ -82,6 +83,8 @@ class StateUpdate(object):
@staticmethod
def update_thread(obj):
+ exception_count = 0
+
queued_requests = []
while cfg.run.value != 0:
# noinspection PyBroadException
@@ -136,12 +139,26 @@ class StateUpdate(object):
# wake up if we get an exception
queued_requests = []
+ # We retrieved OK, clear exception count
+ exception_count = 0
+
except queue.Empty:
pass
- except Exception:
+ except Exception as e:
st = traceback.format_exc()
log_error("update_thread exception: \n%s" % st)
cfg.blackbox.dump()
+ exception_count += 1
+ if exception_count >= 5:
+ for i in queued_requests:
+ i.set_result(e)
+
+ log_error("Too many errors in update_thread, exiting daemon")
+ cfg.exit_daemon()
+
+ else:
+ # Slow things down when encountering errors
+ time.sleep(1)
def __init__(self):
self.lock = threading.RLock()
4 years, 11 months