master - tests: Some lvmdbus tests require larger PVs
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=87e88078c993a149af6...
Commit: 87e88078c993a149af6d2f104998c508b7aee9be
Parent: a2a993d99558a719b0f4450e7b2fc8fc43bb5962
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Dec 18 15:33:58 2019 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Wed Dec 18 15:33:58 2019 +0100
tests: Some lvmdbus tests require larger PVs
---
test/api/dbustest.sh | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/test/api/dbustest.sh b/test/api/dbustest.sh
index 9da4fe0..8aa0ce0 100644
--- a/test/api/dbustest.sh
+++ b/test/api/dbustest.sh
@@ -16,7 +16,9 @@ SKIP_WITH_CLVMD=1
. lib/inittest
-aux prepare_pvs 6
+# NOTE: Some tests, namely anything with vdo, and
+# api/dbus_test_lv_interface_cache_lv.sh, require larger PVs
+aux prepare_pvs 6 6400
# Required by test_nesting:
aux extend_filter_LVMTEST
3 years, 11 months
master - tests: VDO detection in dbus tests
by Marian Csontos
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a2a993d99558a719b0f...
Commit: a2a993d99558a719b0f4450e7b2fc8fc43bb5962
Parent: 2173bdb82177fc687474b72561742955cb292522
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Mon Dec 16 11:25:37 2019 +0100
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Mon Dec 16 12:06:42 2019 +0100
tests: VDO detection in dbus tests
---
test/dbus/lvmdbustest.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 522e3ca..8215968 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -193,11 +193,14 @@ def call_lvm(command):
def supports_vdo():
cmd = ['segtypes']
+ modprobe = Popen(["modprobe", "kvdo"], stdout=PIPE, stderr=PIPE, close_fds=True, env=os.environ)
+ modprobe.communicate()
+ if modprobe.returncode != 0:
+ return False
rc, out, err = call_lvm(cmd)
- if rc == 0:
- if "vdo" in out:
- return True
- return False
+ if rc != 0 or "vdo" not in out:
+ return False
+ return True
# noinspection PyUnresolvedReferences
3 years, 11 months
master - drop warnings about missing pvs in foreign vgs
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2173bdb82177fc68747...
Commit: 2173bdb82177fc687474b72561742955cb292522
Parent: 2da6f01c1544a0b94bd06abc691fe0ac59268700
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Dec 11 12:56:15 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Dec 11 12:56:15 2019 -0600
drop warnings about missing pvs in foreign vgs
When a foreign VG is ignored, don't print warnings that
it is missing PVs.
---
lib/metadata/metadata.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 246682c..9c44388 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3564,7 +3564,8 @@ static void _set_pv_device(struct format_instance *fid,
if (!id_write_format(&pv->id, buffer, sizeof(buffer)))
buffer[0] = '\0';
- if (cmd && !cmd->pvscan_cache_single)
+ if (cmd && !cmd->pvscan_cache_single &&
+ (!vg_is_foreign(vg) && !cmd->include_foreign_vgs))
log_warn("WARNING: Couldn't find device with uuid %s.", buffer);
else
log_debug_metadata("Couldn't find device with uuid %s.", buffer);
@@ -5079,7 +5080,9 @@ struct volume_group *vg_read(struct cmd_context *cmd, const char *vg_name, const
if (!pvl->pv->dev) {
/* The obvious and common case of a missing device. */
- if (pvl->pv->device_hint)
+ if (vg_is_foreign(vg) && !cmd->include_foreign_vgs)
+ log_debug("VG %s is missing PV %s (last written to %s)", vg_name, uuidstr, pvl->pv->device_hint ?: "na");
+ else if (pvl->pv->device_hint)
log_warn("WARNING: VG %s is missing PV %s (last written to %s).", vg_name, uuidstr, pvl->pv->device_hint);
else
log_warn("WARNING: VG %s is missing PV %s.", vg_name, uuidstr);
3 years, 11 months
master - pvck: show specific dump option values
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2da6f01c1544a0b94bd...
Commit: 2da6f01c1544a0b94bd06abc691fe0ac59268700
Parent: 4a52855899bdbd8bc570a667a03394872667e754
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 10 11:06:45 2019 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 10 11:07:07 2019 -0600
pvck: show specific dump option values
---
tools/args.h | 2 +-
tools/command-lines.in | 2 +-
tools/command.c | 1 +
tools/lvmcmdline.c | 12 ++++++++++++
tools/tools.h | 1 +
tools/vals.h | 1 +
6 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tools/args.h b/tools/args.h
index e0bd42a..999d891 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -213,7 +213,7 @@ arg(driverloaded_ARG, '\0', "driverloaded", bool_VAL, 0, 0,
"If set to no, the command will not attempt to use device-mapper.\n"
"For testing and debugging.\n")
-arg(dump_ARG, '\0', "dump", string_VAL, 0, 0,
+arg(dump_ARG, '\0', "dump", dumptype_VAL, 0, 0,
"Dump headers and metadata from a PV for debugging and repair.\n"
"Option values include: \\fBheaders\\fP to print and check LVM headers,\n"
"\\fBmetadata\\fP to print or save the current text metadata,\n"
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 10165ea..37a01cb 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -1436,7 +1436,7 @@ OO: --labelsector Number
ID: pvck_general
DESC: Check for metadata on a device
-pvck --dump String PV
+pvck --dump DumpType PV
OO: --settings String, --file String,
--pvmetadatacopies MetadataCopiesPV, --labelsector Number
ID: pvck_dump
diff --git a/tools/command.c b/tools/command.c
index 7bad98d..0cbd877 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -123,6 +123,7 @@ static inline int reportformat_arg(struct cmd_context *cmd __attribute__((unused
static inline int configreport_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av) { return 0; }
static inline int configtype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av) { return 0; }
static inline int repairtype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av) { return 0; }
+static inline int dumptype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av) { return 0; }
/* needed to include commands.h when building man page generator */
#define CACHE_VGMETADATA 0x00000001
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 3d79e97..f147be3 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1086,6 +1086,18 @@ int repairtype_arg(struct cmd_context *cmd, struct arg_values *av)
return 0;
}
+int dumptype_arg(struct cmd_context *cmd, struct arg_values *av)
+{
+ if (!strcmp(av->value, "headers") ||
+ !strcmp(av->value, "metadata") ||
+ !strcmp(av->value, "metadata_all") ||
+ !strcmp(av->value, "metadata_search") ||
+ !strcmp(av->value, "metadata_area") ||
+ !strcmp(av->value, "backup_to_raw"))
+ return 1;
+ return 0;
+}
+
/*
* FIXME: there's been a confusing mixup among:
* resizeable, resizable, allocatable, allocation.
diff --git a/tools/tools.h b/tools/tools.h
index a2baaa5..3cf4293 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -185,6 +185,7 @@ int reportformat_arg(struct cmd_context *cmd __attribute__((unused)), struct arg
int configreport_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
int configtype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
int repairtype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
+int dumptype_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
/* we use the enums to access the switches */
unsigned arg_count(const struct cmd_context *cmd, int a);
diff --git a/tools/vals.h b/tools/vals.h
index 317e498..7040443 100644
--- a/tools/vals.h
+++ b/tools/vals.h
@@ -142,6 +142,7 @@ val(reportformat_VAL, reportformat_arg, "ReportFmt", "basic|json")
val(configreport_VAL, configreport_arg, "ConfigReport", "log|vg|lv|pv|pvseg|seg")
val(configtype_VAL, configtype_arg, "ConfigType", "current|default|diff|full|list|missing|new|profilable|profilable-command|profilable-metadata")
val(repairtype_VAL, repairtype_arg, "RepairType", "pv_header|metadata|label_header")
+val(dumptype_VAL, dumptype_arg, "DumpType", "headers|metadata|metadata_all|metadata_search")
/* this should always be last */
val(VAL_COUNT, NULL, NULL, NULL)
3 years, 11 months
master - tests: improve secure test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4a52855899bdbd8bc57...
Commit: 4a52855899bdbd8bc570a667a03394872667e754
Parent: 611d4107a4b3c434c4266ae6f2638927541bc9b6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Dec 10 13:43:47 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
tests: improve secure test
Validate we capture core while original task sleeps.
---
test/shell/dmsecuretest.sh | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/shell/dmsecuretest.sh b/test/shell/dmsecuretest.sh
index 75ad56d..0f53ea7 100644
--- a/test/shell/dmsecuretest.sh
+++ b/test/shell/dmsecuretest.sh
@@ -45,7 +45,9 @@ sleep .5
dmsetup status "$DMTEST"
# generate core file for running&sleeping binary
-gcore "$PID"
+gcore "$PID" | tee out
+# check we capture core while dmsecuretest was already sleeping
+grep "nanosleep" out
kill "$PID" || true
wait
@@ -55,7 +57,7 @@ cat cmdout
not grep "$SECURE" "core.$PID" || {
## cp "core.$PID" /dev/shm/core
rm -f "core.$PID"
- dmsetup remove "$DMTEST"
+ should dmsetup remove "$DMTEST" # go around weird bugs
die "!!! Secure string $SECURE found present in core.$PID !!!"
}
rm -f "core.$PID"
3 years, 11 months
master - test: fix missing waiting on udev
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=611d4107a4b3c434c42...
Commit: 611d4107a4b3c434c4266ae6f2638927541bc9b6
Parent: 3b6defcf1fb20d3a9b2fb4f407e9abd4a8291bb0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Dec 10 13:40:56 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
test: fix missing waiting on udev
After device creation we need to wait for a cookie so it's not forgotten
in the system.
---
test/lib/dmsecuretest.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/lib/dmsecuretest.c b/test/lib/dmsecuretest.c
index d90546c..19265bf 100644
--- a/test/lib/dmsecuretest.c
+++ b/test/lib/dmsecuretest.c
@@ -48,6 +48,7 @@ int main (int argc, char *argv[])
char aes[] = "434r0pono02pn68sson9268222p3789q703sr62427o78o308518o3228s6n2122";
const char *device = (argc > 1) ? argv[1] : "/dev/loop0"; /* device for use */
const char *devname = (argc > 2) ? argv[2] : "test-secure"; /* name of dm device */
+ const char *cipher = (argc > 3) ? argv[3] : "aes-xts-plain64"; /* name of dm device */
uint32_t cookie = 0;
char table[300];
struct dm_task *dmt;
@@ -63,7 +64,7 @@ int main (int argc, char *argv[])
(void) dm_task_set_name(dmt, devname);
(void) dm_task_secure_data(dmt);
rot13(aes);
- snprintf(table, sizeof(table), "aes-xts-plain64 %s 0 %s %u", aes, device, sz);
+ snprintf(table, sizeof(table), "%s %s 0 %s %u", cipher, aes, device, sz);
memset(aes, 0, sizeof(aes));
(void) dm_task_add_target(dmt, 0, sz, "crypt", table);
memset(table, 0, sizeof(table));
@@ -71,10 +72,9 @@ int main (int argc, char *argv[])
(void) dm_task_set_cookie(dmt, &cookie, DM_UDEV_DISABLE_LIBRARY_FALLBACK);
(void) dm_task_run(dmt);
(void) dm_task_destroy(dmt);
+ (void) dm_udev_wait(cookie); /* Finish udev processing */
}
- dm_task_update_nodes();
-
/* At this point there should be no memory trace from a secure table line */
#ifdef SLEEP
3 years, 11 months
master - test: fail on device create
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3b6defcf1fb20d3a9b2...
Commit: 3b6defcf1fb20d3a9b2fb4f407e9abd4a8291bb0
Parent: 8ab1d489f3e3ab140f014d5b5a10859e396bce66
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Dec 10 13:30:55 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
test: fail on device create
Correct validation of prepared device and fail if the device can't
be created.
---
test/lib/aux.sh | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index cbe0e21..ea126de 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -874,7 +874,11 @@ prepare_devs() {
wait
finish_udev_transaction
- if test -f CREATE_FAILED -a -n "$LVM_TEST_BACKING_DEVICE"; then
+ if test -f CREATE_FAILED ; then
+ if test -z "$LVM_TEST_BACKING_DEVICE"; then
+ echo "failed"
+ return 1
+ fi
LVM_TEST_BACKING_DEVICE=
rm -f BACKING_DEV CREATE_FAILED
prepare_devs "$@"
3 years, 11 months
master - test: aux setup
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8ab1d489f3e3ab140f0...
Commit: 8ab1d489f3e3ab140f014d5b5a10859e396bce66
Parent: 89d839e54116d29e78909c63eb20ab50dc00e93f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Dec 10 13:30:11 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
test: aux setup
Avoid endless loop if there was no 'remove' progress.
---
test/lib/aux.sh | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 566e9b5..cbe0e21 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -382,7 +382,7 @@ teardown_devs_prefixed() {
while :; do
local sortby="name"
- local num_devs=0
+ local progress=0
# HACK: sort also by minors - so we try to close 'possibly later' created device first
test "$i" = 0 || sortby="-minor"
@@ -392,23 +392,23 @@ teardown_devs_prefixed() {
DM_NAME=${dm##DM_NAME=}
DM_NAME=${DM_NAME%%;DM_OPEN*}
DM_OPEN=${dm##*;DM_OPEN=}
+ local force="-f"
if test "$i" = 0; then
if test "$once" = 1 ; then
once=0
echo "## removing stray mapped devices with names beginning with $prefix: "
fi
test "$DM_OPEN" = 0 || break # stop loop with 1st. opened device
- dmsetup remove "$DM_NAME" --mangle none || true # &>/dev/null || touch REMOVE_FAILED &
- else
- dmsetup remove -f "$DM_NAME" --mangle none || true
+ force=""
fi
- num_devs=$(( num_devs + 1 ))
+ # Succesfull 'remove' signals progress
+ dmsetup remove $force "$DM_NAME" --mangle none && progress=1
done
test "$i" = 0 || break
- test "$num_devs" -gt 0 || break
+ test "$progress" = 1 || break
udev_wait
wait
3 years, 11 months
master - clenaup: simpler form
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=89d839e54116d29e789...
Commit: 89d839e54116d29e78909c63eb20ab50dc00e93f
Parent: abc0a8faba2a1437f4f9d158310acb8af6ab2fe5
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 28 15:15:10 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
clenaup: simpler form
---
lib/metadata/metadata.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 24958d0..246682c 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4932,13 +4932,12 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
log_debug_metadata("Drop dev for MD component from cache %s.", dev_name(dev));
lvmcache_del_dev(dev);
- dm_list_iterate_items(mda, &fid->metadata_areas_in_use) {
- if (mda_get_device(mda) != dev)
- continue;
- log_debug_metadata("Drop mda from MD component from mda list %s.", dev_name(dev));
- dm_list_del(&mda->list);
- break;
- }
+ dm_list_iterate_items(mda, &fid->metadata_areas_in_use)
+ if (mda_get_device(mda) == dev) {
+ log_debug_metadata("Drop mda from MD component from mda list %s.", dev_name(dev));
+ dm_list_del(&mda->list);
+ break;
+ }
}
}
3 years, 11 months
master - vg_read: use else for 3 case
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=abc0a8faba2a1437f4f...
Commit: abc0a8faba2a1437f4f9d158310acb8af6ab2fe5
Parent: 5555765cfc71a87eadcb1f6ac9bdd41f2e3c9052
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 28 15:09:27 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Dec 10 15:44:16 2019 +0100
vg_read: use else for 3 case
Make it visible we check for ==, >, < of same var.
---
lib/metadata/metadata.c | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 5856a92..24958d0 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4878,10 +4878,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (vg->seqno == vg_ret->seqno) {
release_vg(vg);
- continue;
- }
-
- if (vg->seqno > vg_ret->seqno) {
+ } else if (vg->seqno > vg_ret->seqno) {
log_warn("WARNING: ignoring metadata seqno %u on %s for seqno %u on %s for VG %s.",
vg_ret->seqno, dev_name(dev_ret),
vg->seqno, dev_name(mda_dev), vg->name);
@@ -4890,17 +4887,13 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
vg_ret = vg;
dev_ret = mda_dev;
vg_fmtdata = NULL;
- continue;
- }
-
- if (vg_ret->seqno > vg->seqno) {
+ } else { /* vg->seqno < vg_ret->seqno */
log_warn("WARNING: ignoring metadata seqno %u on %s for seqno %u on %s for VG %s.",
vg->seqno, dev_name(mda_dev),
vg_ret->seqno, dev_name(dev_ret), vg->name);
found_old_metadata = 1;
release_vg(vg);
vg_fmtdata = NULL;
- continue;
}
}
3 years, 11 months