main - lvmdbusd: Correct env. variable
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=599cbd7dd37ba50b445...
Commit: 599cbd7dd37ba50b44579f64207cc1e47e004899
Parent: b09de683c72b62167fbbd64491708ede652c32a1
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Sep 30 11:49:49 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Sep 30 11:51:23 2022 -0500
lvmdbusd: Correct env. variable
Make this match the unit test expectation and the form we use for
other env. variables.
---
daemons/lvmdbusd/main.py | 2 +-
test/dbus/validatestate.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index e4531526c..662d7569f 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -146,7 +146,7 @@ def running_under_systemd():
def main():
start = time.time()
- use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
+ use_session = os.getenv('LVM_DBUSD_USE_SESSION', False)
# Ensure that we get consistent output for parsing stdout/stderr and that we
# are using the lvmdbusd profile.
diff --git a/test/dbus/validatestate.py b/test/dbus/validatestate.py
index ae999ad17..1af303f15 100755
--- a/test/dbus/validatestate.py
+++ b/test/dbus/validatestate.py
@@ -21,7 +21,7 @@ import os
if __name__ == "__main__":
- use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
+ use_session = os.getenv('LVMD_BUSD_USE_SESSION', False)
if use_session:
bus = dbus.SessionBus(mainloop=DBusGMainLoop())
1 year, 2 months
main - blkid: fix BLKID_SUBLKS_FSINFO usage
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b09de683c72b62167fb...
Commit: b09de683c72b62167fbbd64491708ede652c32a1
Parent: 5a0052a1d3b06a071ff6197fc41d9fa312827538
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Sep 29 15:25:32 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Sep 29 15:25:32 2022 -0500
blkid: fix BLKID_SUBLKS_FSINFO usage
Use this flag for all fs info lookups, including BLOCK_SIZE,
if it is defined in blkid.h.
---
lib/device/dev-type.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index bb8925483..8b51a672a 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -25,12 +25,7 @@
#include "device_mapper/misc/dm-ioctl.h"
#ifdef BLKID_WIPING_SUPPORT
-#include <blkid.h>
-/*
- * FIXME: recent addition to blkid.h copied here.
- * Remove this and require a recent libblkid version from configure.
- */
-#define BLKID_SUBLKS_FSINFO (1 << 11) /* read and define fs properties from superblock */
+#include <blkid/blkid.h>
#endif
#ifdef UDEV_SYNC_SUPPORT
@@ -847,6 +842,9 @@ int fs_block_size_and_type(const char *pathname, uint32_t *fs_block_size_bytes,
BLKID_SUBLKS_UUID | BLKID_SUBLKS_UUIDRAW |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
+#ifdef BLKID_SUBLKS_FSINFO
+ BLKID_SUBLKS_FSINFO |
+#endif
BLKID_SUBLKS_MAGIC);
rc = blkid_do_safeprobe(probe);
if (rc < 0) {
@@ -906,7 +904,10 @@ int fs_get_blkid(const char *pathname, struct fs_info *fsi)
BLKID_SUBLKS_UUID | BLKID_SUBLKS_UUIDRAW |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
- BLKID_SUBLKS_MAGIC | BLKID_SUBLKS_FSINFO);
+#ifdef BLKID_SUBLKS_FSINFO
+ BLKID_SUBLKS_FSINFO |
+#endif
+ BLKID_SUBLKS_MAGIC);
rc = blkid_do_safeprobe(probe);
if (rc < 0) {
log_error("Failed libblkid probe for %s", pathname);
1 year, 2 months
main - lvresize: give special advice to reiserfs users
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5a0052a1d3b06a071ff...
Commit: 5a0052a1d3b06a071ff6197fc41d9fa312827538
Parent: 1924fed30807ac0d355d2c6527d2f0a1d7efafcc
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:52:40 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:54:13 2022 -0500
lvresize: give special advice to reiserfs users
---
lib/metadata/lv_manip.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 083e54150..99045c220 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6024,7 +6024,11 @@ static int _fs_reduce_allow(struct cmd_context *cmd, struct logical_volume *lv,
display_lvname(lv), fsi->mount_dir);
if (!fsi->fs_last_byte) {
- log_error("File system device usage not available from libblkid, see --fs resize_fsadm.");
+ if (!strcmp(fsi->fstype, "reiserfs")) {
+ log_error("File system reduce for reiserfs requires --fs resize_fsadm.");
+ return 0;
+ }
+ log_error("File system device usage is not available from libblkid.");
return 0;
}
@@ -6064,6 +6068,9 @@ static int _fs_reduce_allow(struct cmd_context *cmd, struct logical_volume *lv,
*/
if (is_ext_fstype) {
log_print("File system reduce is required using resize2fs.");
+ } else if (!strcmp(fsi->fstype, "reiserfs")) {
+ log_error("File system reduce for reiserfs requires --fs resize_fsadm.");
+ return 0;
} else {
log_error("File system reduce is required and not supported (%s).", fsi->fstype);
return 0;
@@ -6181,6 +6188,9 @@ static int _fs_extend_allow(struct cmd_context *cmd, struct logical_volume *lv,
fsi->fstype, (unsigned long long)fsi->fs_last_byte);
if (!strncmp(fsi->fstype, "ext", 3))
is_ext_fstype = 1;
+ } else if (!strcmp(fsi->fstype, "reiserfs")) {
+ log_error("File system extend for reiserfs requires --fs resize_fsadm.");
+ return 0;
} else {
log_error("File system extend is not supported (%s).", fsi->fstype);
return 0;
1 year, 2 months
main - lvresize: exclude new fs handling at build time
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1924fed30807ac0d355...
Commit: 1924fed30807ac0d355d2c6527d2f0a1d7efafcc
Parent: b39ad99325342f2cdc7a9944f11b6d6ae120febe
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Sep 28 11:02:17 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Sep 28 11:16:43 2022 -0500
lvresize: exclude new fs handling at build time
Exclude the new fs resizing capabilities at build time
(rather than run time) if the necessary libblkid features
are not available. When excluded, all fs resizing options
are translated to resize_fsadm. Accessing the new
features now requires rebuilding lvm if libblkid is
upgraded.
---
tools/lvresize.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/tools/lvresize.c b/tools/lvresize.c
index bba8ee26c..f3cee8322 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -15,6 +15,8 @@
#include "tools.h"
+#include <blkid/blkid.h>
+
static int _lvresize_params(struct cmd_context *cmd, struct lvresize_params *lp)
{
const char *type_str = arg_str_value(cmd, type_ARG, NULL);
@@ -96,6 +98,12 @@ static int _lvresize_params(struct cmd_context *cmd, struct lvresize_params *lp)
return 0;
}
+#ifdef BLKID_SUBLKS_FSINFO
+ /*
+ * When the libblkid fs info feature is available, use the
+ * the newer fs resizing capabability unless the older
+ * fsadm-based resizing is requested with --fs resize_fsadm.
+ */
if ((str = arg_str_value(cmd, fs_ARG, NULL))) {
if (!strcmp(str, "checksize") ||
!strcmp(str, "resize") ||
@@ -123,7 +131,29 @@ static int _lvresize_params(struct cmd_context *cmd, struct lvresize_params *lp)
*/
strncpy(lp->fsopt, "checksize", sizeof(lp->fsopt)-1);
}
-
+#else
+ /*
+ * When the libblkid fs info feature is not available we can only
+ * use fsadm, so --resizefs, --fs resize, --fs resize_fsadm
+ * all translate to resize_fsadm.
+ */
+ if ((str = arg_str_value(cmd, fs_ARG, NULL))) {
+ if (!strcmp(str, "resize")) {
+ log_warn("Using fsadm for file system handling (resize_fsadm).");
+ strcpy(lp->fsopt, "resize_fsadm");
+ } else if (!strcmp(str, "resize_fsadm")) {
+ strcpy(lp->fsopt, "resize_fsadm");
+ } else if (!strcmp(str, "ignore")) {
+ log_warn("Ignoring unsupported --fs ignore with fsadm resizing.");
+ } else {
+ log_error("Unknown --fs value.");
+ return 0;
+ }
+ } else if (arg_is_set(cmd, resizefs_ARG)) {
+ /* --resizefs alone equates to --fs resize_fsadm */
+ strcpy(lp->fsopt, "resize_fsadm");
+ }
+#endif
if (lp->fsopt[0])
lp->nofsck = arg_is_set(cmd, nofsck_ARG);
1 year, 2 months
main - lvresize: let env var set lvresize_fs_helper_path
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b39ad99325342f2cdc7...
Commit: b39ad99325342f2cdc7a9944f11b6d6ae120febe
Parent: 7f1ef25b46cc96a2f8dce5beac57362370274261
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 27 15:39:09 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 27 15:42:18 2022 -0500
lvresize: let env var set lvresize_fs_helper_path
---
lib/device/filesystem.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/device/filesystem.c b/lib/device/filesystem.c
index c53a377ea..bdc230175 100644
--- a/lib/device/filesystem.c
+++ b/lib/device/filesystem.c
@@ -24,6 +24,19 @@
#include <mntent.h>
#include <sys/ioctl.h>
+static const char *_lvresize_fs_helper_path;
+
+static const char *_get_lvresize_fs_helper_path(void)
+{
+ if (!_lvresize_fs_helper_path)
+ _lvresize_fs_helper_path = getenv("LVRESIZE_FS_HELPER_PATH");
+
+ if (!_lvresize_fs_helper_path)
+ _lvresize_fs_helper_path = LVRESIZE_FS_HELPER_PATH; /* from configure, usually in /usr/libexec */
+
+ return _lvresize_fs_helper_path;
+}
+
/*
* Set the path of the dm-crypt device, i.e. /dev/dm-N, that is using the LV.
*/
@@ -206,7 +219,7 @@ int crypt_resize_script(struct cmd_context *cmd, struct logical_volume *lv, stru
if (dm_snprintf(crypt_path, sizeof(crypt_path), "/dev/dm-%d", (int)MINOR(fsi->crypt_devt)) < 0)
return_0;
- argv[0] = LVRESIZE_FS_HELPER_PATH; /* from configure, usually in /usr/libexec */
+ argv[0] = _get_lvresize_fs_helper_path();
argv[++args] = "--cryptresize";
argv[++args] = "--cryptpath";
argv[++args] = crypt_path;
@@ -257,7 +270,7 @@ int fs_reduce_script(struct cmd_context *cmd, struct logical_volume *lv, struct
if (dm_snprintf(lv_path, PATH_MAX, "%s%s/%s", lv->vg->cmd->dev_dir, lv->vg->name, lv->name) < 0)
return_0;
- argv[0] = LVRESIZE_FS_HELPER_PATH; /* from configure, usually in /usr/libexec */
+ argv[0] = _get_lvresize_fs_helper_path();
argv[++args] = "--fsreduce";
argv[++args] = "--fstype";
argv[++args] = fsi->fstype;
@@ -346,7 +359,7 @@ int fs_extend_script(struct cmd_context *cmd, struct logical_volume *lv, struct
if (dm_snprintf(lv_path, PATH_MAX, "%s%s/%s", lv->vg->cmd->dev_dir, lv->vg->name, lv->name) < 0)
return_0;
- argv[0] = LVRESIZE_FS_HELPER_PATH; /* from configure, usually in /usr/libexec */
+ argv[0] = _get_lvresize_fs_helper_path();
argv[++args] = "--fsextend";
argv[++args] = "--fstype";
argv[++args] = fsi->fstype;
1 year, 2 months
main - remove unused variables
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=7f1ef25b46cc96a2f8d...
Commit: 7f1ef25b46cc96a2f8dce5beac57362370274261
Parent: 50281e5710dd8cb50208614066ca52ac4574eda6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 27 15:40:39 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 27 15:42:18 2022 -0500
remove unused variables
---
lib/device/dev-type.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index eb9e169bb..bb8925483 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -893,7 +893,6 @@ int fs_get_blkid(const char *pathname, struct fs_info *fsi)
size_t len;
uint64_t fslastblock = 0;
unsigned int fsblocksize = 0;
- int no_block_size = 0, no_fslastblock = 0, no_fsblocksize = 0;
int rc;
if (!(probe = blkid_new_probe_from_filename(pathname))) {
@@ -933,18 +932,12 @@ int fs_get_blkid(const char *pathname, struct fs_info *fsi)
if (!blkid_probe_lookup_value(probe, "BLOCK_SIZE", &str, &len) && len)
fsi->fs_block_size_bytes = atoi(str);
- else
- no_block_size = 1;
if (!blkid_probe_lookup_value(probe, "FSLASTBLOCK", &str, &len) && len)
fslastblock = strtoull(str, NULL, 0);
- else
- no_fslastblock = 1;
if (!blkid_probe_lookup_value(probe, "FSBLOCKSIZE", &str, &len) && len)
fsblocksize = (unsigned int)atoi(str);
- else
- no_fsblocksize = 1;
blkid_free_probe(probe);
1 year, 2 months
main - change messages about libblkid features
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=50281e5710dd8cb5020...
Commit: 50281e5710dd8cb50208614066ca52ac4574eda6
Parent: 3ca44e13beb8532d19828c71540af0d0307fd017
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 27 15:10:04 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 27 15:13:31 2022 -0500
change messages about libblkid features
remove message about missing libblkid features
change message recommending resize_fsadm when libblkid
features are not available.
---
lib/device/dev-type.c | 9 ---------
lib/metadata/lv_manip.c | 2 +-
2 files changed, 1 insertion(+), 10 deletions(-)
diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
index fb6e9a444..eb9e169bb 100644
--- a/lib/device/dev-type.c
+++ b/lib/device/dev-type.c
@@ -948,15 +948,6 @@ int fs_get_blkid(const char *pathname, struct fs_info *fsi)
blkid_free_probe(probe);
- /* We don't expect to get this info for luks */
- if (strcmp(fsi->fstype, "crypto_LUKS") && (no_block_size || no_fslastblock || no_fsblocksize)) {
- log_print("Missing libblkid %s%s%sfor %s",
- no_block_size ? "BLOCK_SIZE " : "",
- no_fslastblock ? "FSLASTBLOCK " : "",
- no_fsblocksize ? "FSBLOCKSIZE " : "",
- pathname);
- }
-
if (fslastblock && fsblocksize)
fsi->fs_last_byte = fslastblock * fsblocksize;
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index f2ec5d99c..083e54150 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6024,7 +6024,7 @@ static int _fs_reduce_allow(struct cmd_context *cmd, struct logical_volume *lv,
display_lvname(lv), fsi->mount_dir);
if (!fsi->fs_last_byte) {
- log_error("File system size unknown: update libblkid for FSLASTBLOCK, or see --fs resize_fsadm.");
+ log_error("File system device usage not available from libblkid, see --fs resize_fsadm.");
return 0;
}
1 year, 2 months
main - lvreduce: use temporary flag when activating lv to check for fs
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3ca44e13beb8532d198...
Commit: 3ca44e13beb8532d19828c71540af0d0307fd017
Parent: c1ab9fb37faee56cee278ccd94cb958d30d61b94
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 27 12:59:17 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 27 12:59:17 2022 -0500
lvreduce: use temporary flag when activating lv to check for fs
This flag is meant to suppress udev processing of the LV.
---
lib/metadata/lv_manip.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 71aee7fb7..f2ec5d99c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -6856,10 +6856,12 @@ int lv_resize(struct cmd_context *cmd, struct logical_volume *lv,
is_active = lv_is_active(lv_top);
if (is_reduce && !is_active && !strcmp(lp->fsopt, "checksize")) {
+ lv_top->status |= LV_TEMPORARY;
if (!activate_lv(cmd, lv_top)) {
log_error("Failed to activate %s to check for fs.", display_lvname(lv_top));
goto out;
}
+ lv_top->status &= ~LV_TEMPORARY;
if (!sync_local_dev_names(cmd))
stack;
activated_checksize = 1;
1 year, 2 months
main - make: move cmds.h
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c1ab9fb37faee56cee2...
Commit: c1ab9fb37faee56cee278ccd94cb958d30d61b94
Parent: fd05b79aad6ccf89f85bd85f5a4b32e1275ce785
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Sep 27 09:06:06 2022 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Sep 27 09:06:06 2022 -0500
make: move cmds.h
generate the header in the include dir so it
can be easily used from both lib and tools dirs.
---
Makefile.in | 2 +-
include/Makefile.in | 18 +++++++++++++++++-
lib/commands/cmd_enum.h | 4 ++--
tools/Makefile.in | 18 ++++--------------
tools/command.c | 4 ++--
5 files changed, 26 insertions(+), 20 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 3b7e0ecaa..1d5aff482 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -47,7 +47,7 @@ include $(top_srcdir)/base/Makefile
include $(top_srcdir)/device_mapper/Makefile
include $(top_srcdir)/test/unit/Makefile
-lib: libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET)
+lib: include libdaemon $(BASE_TARGET) $(DEVICE_MAPPER_TARGET)
daemons: lib libdaemon tools
scripts: lib
tools: lib libdaemon
diff --git a/include/Makefile.in b/include/Makefile.in
index d6c30d15b..88a06a934 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -18,6 +18,21 @@ top_builddir = @top_builddir@
include $(top_builddir)/make.tmpl
+cmds.h:
+ @echo " [GEN] $@"
+ $(Q) set -o pipefail && \
+ ( cat $(top_srcdir)/tools/license.inc && \
+ echo "/* Do not edit. This file is generated by the Makefile. */" && \
+ echo "cmd(CMD_NONE, none)" && \
+ $(GREP) '^ID:' $(top_srcdir)/tools/command-lines.in | LC_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
+ echo "cmd(CMD_COUNT, count)" \
+ ) > $@
+
+all: cmds.h
+
+clean:
+ rm -f cmds.h
+
DISTCLEAN_TARGETS += configure.h lvm-version.h
CLEAN_TARGETS += \
.symlinks \
@@ -99,4 +114,5 @@ CLEAN_TARGETS += \
util.h \
uuid.h \
vg.h \
- xlate.h
+ xlate.h \
+ cmds.h
diff --git a/lib/commands/cmd_enum.h b/lib/commands/cmd_enum.h
index 939af81c3..9e9902224 100644
--- a/lib/commands/cmd_enum.h
+++ b/lib/commands/cmd_enum.h
@@ -2,7 +2,7 @@
#define _CMD_ENUM_H
/*
- * tools/cmds.h is generated by the Makefile. For each command definition
+ * include/cmds.h is generated by the Makefile. For each command definition
* in command-lines.in, cmds.h contains:
* cmd(foo_CMD, foo)
*
@@ -12,7 +12,7 @@
enum {
#define cmd(a, b) a ,
-#include "../tools/cmds.h"
+#include "../../include/cmds.h"
#undef cmd
};
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 25fe3b6b3..49d9b89c7 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -98,7 +98,7 @@ CLEAN_TARGETS = liblvm2cmd.$(LIB_SUFFIX) $(TARGETS_DM) \
liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION) lvm-static.o \
liblvm2cmd-static.a lvm.static \
$(LDDEPS) .exported_symbols_generated \
- cmds.h command-lines-input.h command-count.h man-generator.c
+ command-lines-input.h command-count.h man-generator.c
ifeq ("@CMDLIB@", "yes")
TARGETS += liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION)
@@ -175,16 +175,6 @@ command-count.h: $(srcdir)/command-lines.in Makefile
$(GREP) '^ID:' $< | $(WC) -l \
) > $@
-cmds.h: $(srcdir)/command-lines.in Makefile
- @echo " [GEN] $@"
- $(Q) set -o pipefail && \
- ( cat $(srcdir)/license.inc && \
- echo "/* Do not edit. This file is generated by the Makefile. */" && \
- echo "cmd(CMD_NONE, none)" && \
- $(GREP) '^ID:' $(srcdir)/command-lines.in | LC_ALL=C $(SORT) -u | $(AWK) '{print "cmd(" $$2 "_CMD, " $$2 ")"}' && \
- echo "cmd(CMD_COUNT, count)" \
- ) > $@
-
command-lines-input.h: $(srcdir)/command-lines.in Makefile
@echo " [GEN] $@"
$(Q) set -o pipefail && \
@@ -195,9 +185,9 @@ command-lines-input.h: $(srcdir)/command-lines.in Makefile
echo "\\n\\n\";" \
) > $@
-$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h cmds.h
-$(SOURCES:%.c=%.o) $(SOURCES2:%.c=%.o): command-lines-input.h command-count.h cmds.h
-lvm.cflow lvm.xref lvm.tree lvm.xref: command-lines-input.h command-count.h cmds.h
+$(SOURCES:%.c=%.d) $(SOURCES2:%.c=%.d): command-lines-input.h command-count.h
+$(SOURCES:%.c=%.o) $(SOURCES2:%.c=%.o): command-lines-input.h command-count.h
+lvm.cflow lvm.xref lvm.tree lvm.xref: command-lines-input.h command-count.h
.PHONY: install_cmdlib_dynamic install_cmdlib_static install_cmdlib_include \
install_tools_dynamic install_tools_static
diff --git a/tools/command.c b/tools/command.c
index 5da511530..7a7415201 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -149,7 +149,7 @@ static inline int dumptype_arg(struct cmd_context *cmd __attribute__((unused)),
enum {
#define cmd(a, b) a ,
-#include "cmds.h"
+#include "../include/cmds.h"
#undef cmd
};
@@ -238,7 +238,7 @@ struct lv_type lv_types[LVT_COUNT + 1] = {
struct cmd_name cmd_names[CMD_COUNT + 1] = {
#define cmd(a, b) { # a, a, # b },
-#include "cmds.h"
+#include "../include/cmds.h"
#undef cmd
};
1 year, 2 months
main - lvmdbustest: Add test to stress mode changing
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fd05b79aad6ccf89f85...
Commit: fd05b79aad6ccf89f85bd85f5a4b32e1275ce785
Parent: 897b326cccc017b9e033b83d24ddcb007a3922f4
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Sep 22 17:11:45 2022 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Sep 22 17:14:10 2022 -0500
lvmdbustest: Add test to stress mode changing
Add a test to toggle from fork & exec to lvm shell repeatedly, to stress
test it.
---
test/dbus/lvmdbustest.py | 29 ++++++++++++++++++++++++-----
1 file changed, 24 insertions(+), 5 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index cf50bc564..41ee2fd1b 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -26,12 +26,14 @@ from testlib import *
g_tmo = 0
+g_lvm_shell = False
+
# Approx. min size
VDO_MIN_SIZE = mib(8192)
VG_TEST_SUFFIX = "_vg_LvMdBuS_TEST"
-EXE_NAME="/lvmdbusd"
+EXE_NAME = "/lvmdbusd"
# Prefix on created objects to enable easier clean-up
g_prefix = os.getenv('PREFIX', '')
@@ -164,18 +166,24 @@ def get_objects():
return _prune(rc, pv_device_list), bus
+def set_exec_mode(lvmshell):
+ lvm_manager = dbus.Interface(bus.get_object(
+ BUS_NAME, "/com/redhat/lvmdbus1/Manager", introspect=False),
+ "com.redhat.lvmdbus1.Manager")
+ return lvm_manager.UseLvmShell(lvmshell)
+
+
def set_execution(lvmshell, test_result):
+ global g_lvm_shell
if lvmshell:
m = 'lvm shell (non-fork)'
else:
m = "forking & exec'ing"
- lvm_manager = dbus.Interface(bus.get_object(
- BUS_NAME, "/com/redhat/lvmdbus1/Manager", introspect=False),
- "com.redhat.lvmdbus1.Manager")
- rc = lvm_manager.UseLvmShell(lvmshell)
+ rc = set_exec_mode(lvmshell)
if rc:
+ g_lvm_shell = lvmshell
std_err_print('Successfully changed execution mode to "%s"' % m)
else:
std_err_print('ERROR: Failed to change execution mode to "%s"' % m)
@@ -2355,6 +2363,7 @@ class TestDbusService(unittest.TestCase):
self.assertTrue(exited,
"Failed to exit after sending signal %f seconds after "
"queuing up work for signal %d" % (sleep_amt, signal.SIGINT))
+ set_exec_mode(g_lvm_shell)
def test_z_singleton_daemon(self):
# Ensure we can only have 1 daemon running at a time, daemon should exit with 114 if already running
@@ -2366,6 +2375,16 @@ class TestDbusService(unittest.TestCase):
ec = di.start(True)
self.assertEqual(ec, 114)
+ def test_z_switching(self):
+ # Ensure we can switch from forking to shell repeatedly
+ try:
+ t_mode = True
+ for _ in range(50):
+ t_mode = not t_mode
+ set_exec_mode(t_mode)
+ finally:
+ set_exec_mode(g_lvm_shell)
+
class AggregateResults(object):
1 year, 2 months