master - WHATS_NEW: typo
by Joe Thornber
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a60416a13fbfdf053c3...
Commit: a60416a13fbfdf053c327709c9997239f2ec1c71
Parent: 73ae68e1c4308c3391fe3b21f2c721f659343f98
Author: Joe Thornber <ejt(a)redhat.com>
AuthorDate: Tue May 22 09:46:59 2018 +0100
Committer: Joe Thornber <ejt(a)redhat.com>
CommitterDate: Tue May 22 09:46:59 2018 +0100
WHATS_NEW: typo
---
WHATS_NEW | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 84805a9..3d722da 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -18,7 +18,7 @@ Version 2.02.178 -
Fix evaluation of maximal region size for mirror log.
Enhance mirror log size estimation and use smaller size when possible.
Fix incorrect mirror log size calculation on 32bit arch.
- Enhnace preloading tree creating.
+ Enhance preloading tree creating.
Fix regression on acceptance of any LV on lvconvert.
Restore usability of thin LV to be again external origin for another thin.
Keep systemd vars on change event in 69-dm-lvm-metad.rules for systemd reload.
5 years, 10 months
master - filters: clarify some parts of md filter
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=61583281e5703f8b923...
Commit: 61583281e5703f8b923654d0ff1576d6093d2ead
Parent: 3c9ed33f83c90aa15e57ba6dc12d8f1a80afab6d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue May 22 14:07:13 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue May 22 14:07:13 2018 -0500
filters: clarify some parts of md filter
Rename some functions to be consistent with the return values,
and add some comments about how it works.
---
lib/filters/filter-md.c | 89 +++++++++++++++++++++++++++++++++++++++++------
1 files changed, 78 insertions(+), 11 deletions(-)
diff --git a/lib/filters/filter-md.c b/lib/filters/filter-md.c
index bb8a7cf..ab97b59 100644
--- a/lib/filters/filter-md.c
+++ b/lib/filters/filter-md.c
@@ -20,13 +20,77 @@
#define MSG_SKIPPING "%s: Skipping md component device"
-static int _ignore_md(struct device *dev, int full)
+/*
+ * The purpose of these functions is to ignore md component devices,
+ * e.g. if /dev/md0 is a raid1 composed of /dev/loop0 and /dev/loop1,
+ * lvm wants to deal with md0 and ignore loop0 and loop1. md0 should
+ * pass the filter, and loop0,loop1 should not pass the filter so lvm
+ * will ignore them.
+ *
+ * (This is assuming lvm.conf md_component_detection=1.)
+ *
+ * If lvm does *not* ignore the components, then lvm will read lvm
+ * labels from the md dev and from the component devs, and will see
+ * them all as duplicates of each other. LVM duplicate resolution
+ * will then kick in and keep the md dev around to use and ignore
+ * the components.
+ *
+ * It is better to exclude the components as early as possible during
+ * lvm processing, ideally before lvm even looks for labels on the
+ * components, so that duplicate resolution can be avoided. There are
+ * a number of ways that md components can be excluded earlier than
+ * the duplicate resolution phase:
+ *
+ * - When external_device_info_source="udev", lvm discovers a device is
+ * an md component by asking udev during the initial filtering phase.
+ * However, lvm's default is to not use udev for this. The
+ * alternative is "native" detection in which lvm tries to detect
+ * md components itself.
+ *
+ * - When using native detection, lvm's md filter looks for the md
+ * superblock at the start of devices. It will see the md superblock
+ * on the components, exclude them in the md filter, and avoid
+ * handling them later in duplicate resolution.
+ *
+ * - When using native detection, lvm's md filter will not detect
+ * components when the md device has an older superblock version that
+ * places the superblock at the end of the device. This case will
+ * fall back to duplicate resolution to exclude components.
+ *
+ * A variation of the description above occurs for lvm commands that
+ * intend to create new PVs on devices (pvcreate, vgcreate, vgextend).
+ * For these commands, the native md filter also reads the end of all
+ * devices to check for the odd md superblocks.
+ *
+ * (The reason that external_device_info_source is not set to udev by
+ * default is that there have be issues with udev not being promptly
+ * or reliably updated about md state changes, causing the udev info
+ * that lvm uses to be occasionally wrong.)
+ */
+
+/*
+ * Returns 0 if:
+ * the device is an md component and it should be ignored.
+ *
+ * Returns 1 if:
+ * the device is not md component and should not be ignored.
+ *
+ * The actual md device will pass this filter and should be used,
+ * it is the md component devices that we are trying to exclude
+ * that will not pass.
+ */
+
+static int _passes_md_filter(struct device *dev, int full)
{
int ret;
-
+
+ /*
+ * When md_component_dectection=0, don't even try to skip md
+ * components.
+ */
if (!md_filtering())
return 1;
-
+
ret = dev_is_md(dev, NULL, full);
if (ret == -EAGAIN) {
@@ -36,6 +100,9 @@ static int _ignore_md(struct device *dev, int full)
return 1;
}
+ if (ret == 0)
+ return 1;
+
if (ret == 1) {
if (dev->ext.src == DEV_EXT_NONE)
log_debug_devs(MSG_SKIPPING, dev_name(dev));
@@ -54,16 +121,16 @@ static int _ignore_md(struct device *dev, int full)
return 1;
}
-static int _ignore_md_lite(struct dev_filter *f __attribute__((unused)),
- struct device *dev)
+static int _passes_md_filter_lite(struct dev_filter *f __attribute__((unused)),
+ struct device *dev)
{
- return _ignore_md(dev, 0);
+ return _passes_md_filter(dev, 0);
}
-static int _ignore_md_full(struct dev_filter *f __attribute__((unused)),
- struct device *dev)
+static int _passes_md_filter_full(struct dev_filter *f __attribute__((unused)),
+ struct device *dev)
{
- return _ignore_md(dev, 1);
+ return _passes_md_filter(dev, 1);
}
static void _destroy(struct dev_filter *f)
@@ -91,9 +158,9 @@ struct dev_filter *md_filter_create(struct cmd_context *cmd, struct dev_types *d
*/
if (cmd->use_full_md_check)
- f->passes_filter = _ignore_md_full;
+ f->passes_filter = _passes_md_filter_full;
else
- f->passes_filter = _ignore_md_lite;
+ f->passes_filter = _passes_md_filter_lite;
f->destroy = _destroy;
f->use_count = 0;
5 years, 10 months
master - scan: move warnings about duplicate devices
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3c9ed33f83c90aa15e5...
Commit: 3c9ed33f83c90aa15e57ba6dc12d8f1a80afab6d
Parent: 73ae68e1c4308c3391fe3b21f2c721f659343f98
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon May 21 14:20:19 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon May 21 16:48:02 2018 -0500
scan: move warnings about duplicate devices
We have been warning about duplicate devices (and disabling lvmetad)
immediately when the dup was detected (during label_scan). Move the
warnings (and the disabling) to happen later, after label_scan is
finished.
This lets us avoid an unwanted warning message about duplicates
in the special case were md components are eliminated during the
duplicate device resolution.
---
lib/cache/lvmcache.c | 125 ++++++++++++++++++++++++++----
lib/cache/lvmcache.h | 2 +
lib/cache/lvmetad.c | 2 +
lib/device/device.h | 1 +
test/shell/process-each-duplicate-pvs.sh | 22 +++---
test/shell/pv-duplicate-uuid.sh | 5 +-
6 files changed, 126 insertions(+), 31 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 9912995..c306a3a 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -981,11 +981,25 @@ int lvmcache_dev_is_unchosen_duplicate(struct device *dev)
* The actual filters are evaluated too early, before a complete
* picture of all PVs is available, to eliminate these duplicates.
*
- * By removing the filtered duplicates from unused_duplicate_devs, we remove
+ * By removing some duplicates from unused_duplicate_devs here, we remove
* the restrictions that are placed on using duplicate devs or VGs with
* duplicate devs.
*
- * There may other kinds of duplicates that we want to ignore.
+ * In cases where we know that two duplicates refer to the same underlying
+ * storage, and we know which dev path to use, it's best for us to just
+ * use that one preferred device path and ignore the others. It is the cases
+ * where we are unsure whether dups refer to the same underlying storage where
+ * we need to keep the unused duplicate referenced in the
+ * unused_duplicate_devs list, and restrict what we allow done with it.
+ *
+ * In the case of md components, we usually filter these out in filter-md,
+ * but in the special case of md superblocks <= 1.0 where the superblock
+ * is at the end of the device, filter-md doesn't always eliminate them
+ * first, so we eliminate them here.
+ *
+ * There may other kinds of duplicates that we want to eliminate at
+ * this point (using the knowledge from the scan) that we couldn't
+ * eliminate in the filters prior to the scan.
*/
static void _filter_duplicate_devs(struct cmd_context *cmd)
@@ -1004,6 +1018,34 @@ static void _filter_duplicate_devs(struct cmd_context *cmd)
dm_free(devl);
}
}
+
+ if (dm_list_empty(&_unused_duplicate_devs))
+ _found_duplicate_pvs = 0;
+}
+
+static void _warn_duplicate_devs(struct cmd_context *cmd)
+{
+ char uuid[64] __attribute__((aligned(8)));
+ struct lvmcache_info *info;
+ struct device_list *devl, *devl2;
+
+ dm_list_iterate_items_safe(devl, devl2, &_unused_duplicate_devs) {
+ if (!id_write_format((const struct id *)devl->dev->pvid, uuid, sizeof(uuid)))
+ stack;
+
+ log_warn("WARNING: Not using device %s for PV %s.", dev_name(devl->dev), uuid);
+ }
+
+ dm_list_iterate_items_safe(devl, devl2, &_unused_duplicate_devs) {
+ /* info for the preferred device that we're actually using */
+ info = lvmcache_info_from_pvid(devl->dev->pvid, NULL, 0);
+
+ if (!id_write_format((const struct id *)info->dev->pvid, uuid, sizeof(uuid)))
+ stack;
+
+ log_warn("WARNING: PV %s prefers device %s because %s.",
+ uuid, dev_name(info->dev), info->dev->duplicate_prefer_reason);
+ }
}
/*
@@ -1028,7 +1070,6 @@ static void _choose_preferred_devs(struct cmd_context *cmd,
struct dm_list *del_cache_devs,
struct dm_list *add_cache_devs)
{
- char uuid[64] __attribute__((aligned(8)));
const char *reason;
struct dm_list altdevs;
struct dm_list new_unused;
@@ -1229,9 +1270,7 @@ next:
alt = devl;
}
- if (!id_write_format((const struct id *)dev1->pvid, uuid, sizeof(uuid)))
- stack;
- log_warn("WARNING: PV %s prefers device %s because %s.", uuid, dev_name(dev1), reason);
+ dev1->duplicate_prefer_reason = reason;
}
if (dev1 != info->dev) {
@@ -1480,11 +1519,21 @@ int lvmcache_label_scan(struct cmd_context *cmd)
dm_list_splice(&_unused_duplicate_devs, &del_cache_devs);
/*
- * We might want to move the duplicate device warnings until
- * after this filtering so that we can skip warning about
- * duplicates that we are filtering out.
+ * This may remove some entries from the unused_duplicates list for
+ * devs that we know are the same underlying dev.
*/
_filter_duplicate_devs(cmd);
+
+ /*
+ * Warn about remaining duplicates that may actually be separate copies of
+ * the same device.
+ */
+ _warn_duplicate_devs(cmd);
+
+ if (!_found_duplicate_pvs && lvmetad_used()) {
+ log_warn("WARNING: Disabling lvmetad cache which does not support duplicate PVs.");
+ lvmetad_set_disabled(cmd, LVMETAD_DISABLE_REASON_DUPLICATES);
+ }
}
/* Perform any format-specific scanning e.g. text files */
@@ -1509,6 +1558,53 @@ int lvmcache_label_scan(struct cmd_context *cmd)
return r;
}
+/*
+ * When not using lvmetad, lvmcache_label_scan() detects duplicates in
+ * the basic label_scan(), then filters out some dups, and chooses
+ * preferred duplicates to use.
+ *
+ * When using lvmetad, pvscan --cache does not use lvmcache_label_scan(),
+ * only label_scan() which detects the duplicates. This function is used
+ * after pvscan's label_scan() to filter out some dups, print any warnings,
+ * and disable lvmetad if any dups are left.
+ */
+
+void lvmcache_pvscan_duplicate_check(struct cmd_context *cmd)
+{
+ struct device_list *devl;
+
+ /* Check if label_scan() detected any dups. */
+ if (!_found_duplicate_pvs)
+ return;
+
+ /*
+ * Once all the dups are identified, they are moved from the
+ * "found" list to the "unused" list to sort out.
+ */
+ dm_list_splice(&_unused_duplicate_devs, &_found_duplicate_devs);
+
+ /*
+ * Remove items from the dups list that we know are the same
+ * underlying dev, e.g. md components, that we want to just ignore.
+ */
+ _filter_duplicate_devs(cmd);
+
+ /*
+ * If no more dups after ignoring some, then we can use lvmetad.
+ */
+ if (!_found_duplicate_pvs)
+ return;
+
+ /* Duplicates are found where we would have to pick one, so disable lvmetad. */
+
+ dm_list_iterate_items(devl, &_unused_duplicate_devs)
+ log_warn("WARNING: found device with duplicate %s", dev_name(devl->dev));
+
+ log_warn("WARNING: Disabling lvmetad cache which does not support duplicate PVs.");
+ lvmetad_set_disabled(cmd, LVMETAD_DISABLE_REASON_DUPLICATES);
+ lvmetad_make_unused(cmd);
+}
+
int lvmcache_get_vgnameids(struct cmd_context *cmd, int include_internal,
struct dm_list *vgnameids)
{
@@ -2303,14 +2399,8 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller,
*/
if (!created) {
if (info->dev != dev) {
- log_warn("WARNING: PV %s on %s was already found on %s.",
- uuid, dev_name(dev), dev_name(info->dev));
-
- if (!_found_duplicate_pvs && lvmetad_used()) {
- log_warn("WARNING: Disabling lvmetad cache which does not support duplicate PVs.");
- lvmetad_set_disabled(labeller->fmt->cmd, LVMETAD_DISABLE_REASON_DUPLICATES);
- }
- _found_duplicate_pvs = 1;
+ log_debug_cache("PV %s on %s was already found on %s.",
+ uuid, dev_name(dev), dev_name(info->dev));
strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
@@ -2328,6 +2418,7 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller,
devl->dev = dev;
dm_list_add(&_found_duplicate_devs, &devl->list);
+ _found_duplicate_pvs = 1;
return NULL;
}
diff --git a/lib/cache/lvmcache.h b/lib/cache/lvmcache.h
index a2a7f07..b988be6 100644
--- a/lib/cache/lvmcache.h
+++ b/lib/cache/lvmcache.h
@@ -188,6 +188,8 @@ uint64_t lvmcache_smallest_mda_size(struct lvmcache_info *info);
int lvmcache_found_duplicate_pvs(void);
+void lvmcache_pvscan_duplicate_check(struct cmd_context *cmd);
+
int lvmcache_get_unused_duplicate_devs(struct cmd_context *cmd, struct dm_list *head);
int vg_has_duplicate_pvs(struct volume_group *vg);
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 235f72b..a1ab41a 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -2350,6 +2350,8 @@ int lvmetad_pvscan_all_devs(struct cmd_context *cmd, int do_wait)
label_scan(cmd);
+ lvmcache_pvscan_duplicate_check(cmd);
+
if (lvmcache_found_duplicate_pvs()) {
log_warn("WARNING: Scan found duplicate PVs.");
return 0;
diff --git a/lib/device/device.h b/lib/device/device.h
index 42659cd..c8ccd73 100644
--- a/lib/device/device.h
+++ b/lib/device/device.h
@@ -75,6 +75,7 @@ struct device {
uint64_t size;
uint64_t end;
struct dev_ext ext;
+ const char *duplicate_prefer_reason;
const char *vgid; /* if device is an LV */
const char *lvid; /* if device is an LV */
diff --git a/test/shell/process-each-duplicate-pvs.sh b/test/shell/process-each-duplicate-pvs.sh
index 98dd285..9ce4e14 100644
--- a/test/shell/process-each-duplicate-pvs.sh
+++ b/test/shell/process-each-duplicate-pvs.sh
@@ -72,7 +72,7 @@ not grep duplicate main
not grep $vg2 main
not grep $UUID2 main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
# Find which is the preferred dev and which is the duplicate.
@@ -119,7 +119,7 @@ grep "$dev2" main | grep $vg1
grep "$dev1" main | grep $UUID1
grep "$dev2" main | grep $UUID1
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
#
@@ -136,7 +136,7 @@ grep "$dev1" main
not grep "$dev2" main
grep "$UUID1" main
grep "$vg1" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
pvs -o+uuid "$dev2" 2>&1 | tee out
@@ -149,7 +149,7 @@ grep "$dev2" main
not grep "$dev1" main
grep "$UUID1" main
grep "$vg1" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
pvs -o+uuid,duplicate "$dev1" "$dev2" 2>&1 | tee out
@@ -225,7 +225,7 @@ grep -v WARNING out > main || true
not grep "$dev1" main
grep "$dev2" main
-not grep "was already found on" warn
+not grep "Not using device" warn
not grep "prefers device" warn
@@ -238,7 +238,7 @@ grep -v WARNING out > main || true
grep "$dev1" main
not grep "$dev2" main
-not grep "was already found on" warn
+not grep "Not using device" warn
not grep "prefers device" warn
# PV size and minor is still reported correctly for each.
@@ -306,7 +306,7 @@ grep -v WARNING out > main || true
test "$(grep -c "$UUID3" main)" -eq 1
not grep "$UUID4" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
# Both appear with 'pvs -a'
@@ -325,7 +325,7 @@ grep "$dev4" main
grep $UUID3 main
not grep $UUID4 main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
# Show each dev individually and both together
@@ -339,7 +339,7 @@ grep -v WARNING out > main || true
grep "$dev3" main
not grep "$dev4" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
pvs -o+uuid "$dev4" 2>&1 | tee out
@@ -351,7 +351,7 @@ grep -v WARNING out > main || true
not grep "$dev3" main
grep "$dev4" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
pvs -o+uuid "$dev3" "$dev4" 2>&1 | tee out
@@ -363,7 +363,7 @@ grep -v WARNING out > main || true
grep "$dev3" main
grep "$dev4" main
-grep "was already found on" warn
+grep "Not using device" warn
grep "prefers device" warn
# Same sizes shown.
diff --git a/test/shell/pv-duplicate-uuid.sh b/test/shell/pv-duplicate-uuid.sh
index 43eb830..2c121d7 100644
--- a/test/shell/pv-duplicate-uuid.sh
+++ b/test/shell/pv-duplicate-uuid.sh
@@ -26,7 +26,6 @@ pvcreate --config "devices{filter=[\"a|$dev3|\",\"r|.*|\"]} global/use_lvmetad=0
pvscan --cache 2>&1 | tee out
if test -e LOCAL_LVMETAD; then
- grep "was already found" out
grep "WARNING: Disabling lvmetad cache which does not support duplicate PVs." out
fi
@@ -37,7 +36,7 @@ grep -v WARNING out > main || true
test "$(grep -c $UUID1 main)" -eq 1
-COUNT=$(grep --count "was already found" warn)
+COUNT=$(grep --count "Not using device" warn)
[ "$COUNT" -eq 2 ]
pvs -o+uuid --config "devices{filter=[\"a|$dev2|\",\"r|.*|\"]}" 2>&1 | tee out
@@ -50,5 +49,5 @@ not grep "$dev1" main
grep "$dev2" main
not grep "$dev3" main
-not grep "was already found" warn
+not grep "Not using device" warn
5 years, 10 months
master - man vgexport: expand description
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=73ae68e1c4308c3391f...
Commit: 73ae68e1c4308c3391fe3b21f2c721f659343f98
Parent: 6029d6d8d8198aee17ec8972c333477f2c581bff
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon May 21 16:26:49 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon May 21 16:26:49 2018 -0500
man vgexport: expand description
---
man/vgexport.8_des | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/man/vgexport.8_des b/man/vgexport.8_des
index 66d3af3..9f276af 100644
--- a/man/vgexport.8_des
+++ b/man/vgexport.8_des
@@ -1,8 +1,19 @@
-vgexport makes inactive VGs unknown to the system. In this state, all the
-PVs in the VG can be moved to a different system, from which
-\fBvgimport\fP(8) can then be run.
+vgexport changes a VG into the exported state, which ensures that the VG
+and its disks are not being used, and cannot be used until the VG is
+imported by \fBvgimport\fP(8). Putting a VG into an unusable, offline
+state can be useful when doing things like moving a VG's disks to another
+system. Exporting a VG provides some protection from its LVs being
+accidentally used, or being used by an automated system before it's ready.
-Most LVM tools ignore exported VGs.
+A VG cannot be exported until all of its LVs are inactive.
+
+LVM commands will ignore an exported VG or report an error if a command
+tries to use it.
+
+For an exported VG, the vgs command will display \"x\" in the third VG
+attribute, and the pvs command will display \"x\" in the second PV
+attribute. Both vgs and pvs will display \"exported\" from the export
+report field.
vgexport clears the VG system ID, and vgimport sets the VG system ID to
match the host running vgimport (if the host has a system ID).
5 years, 10 months
master - tests: disable symlink test
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6029d6d8d8198aee17e...
Commit: 6029d6d8d8198aee17ec8972c333477f2c581bff
Parent: 25a66737e3c9fee218c84a659d5d9b7a34347e47
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat May 19 12:08:23 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon May 21 11:59:39 2018 +0200
tests: disable symlink test
It's quite unclear what the test is meant to do - disable it just like
within python test.
---
test/dbus/lvmdbustest.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 5f34847..d633aa3 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1873,10 +1873,14 @@ 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
+
for i in range(0, 5):
pv_object_path = self._create_nested(pv_object_path)
- def test_pv_symlinks(self):
+ def DISABLED_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
5 years, 10 months
master - tests: use 4K extent size
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=25a66737e3c9fee218c...
Commit: 25a66737e3c9fee218c84a659d5d9b7a34347e47
Parent: a9f2c1e1f568d7fc7ffba7ec702b584f34f678c6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon May 21 11:56:45 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon May 21 11:58:10 2018 +0200
tests: use 4K extent size
To work with for 4k backend devices.
---
test/api/vgtest.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/api/vgtest.c b/test/api/vgtest.c
index da04dda..97f0d2c 100644
--- a/test/api/vgtest.c
+++ b/test/api/vgtest.c
@@ -28,7 +28,7 @@ vg_t vg;
const char *vg_name;
#define MAX_DEVICES 16
const char *device[MAX_DEVICES];
-uint64_t size = 1024;
+uint64_t size = 4096;
#define vg_create(vg_name) \
printf("Creating VG %s\n", vg_name); \
5 years, 10 months
master - lvmlockd: suppress error messages related to lvmetad
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a9f2c1e1f568d7fc7ff...
Commit: a9f2c1e1f568d7fc7ffba7ec702b584f34f678c6
Parent: bc275bcddf3fac6ea691e2dfda0ca3531c4b3c0c
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 18 16:00:54 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 18 16:00:54 2018 -0500
lvmlockd: suppress error messages related to lvmetad
Log lvmetad related messages as debug, not as errors,
when using lvmlockd without lvmetad.
---
daemons/lvmlockd/lvmlockd-core.c | 38 +++++++++++++++++++++++++++++---------
1 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index df6e214..861fb4a 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -1009,6 +1009,8 @@ static void add_work_action(struct action *act)
pthread_mutex_unlock(&worker_mutex);
}
+#define ERR_LVMETAD_NOT_RUNNING -200
+
static daemon_reply send_lvmetad(const char *id, ...)
{
daemon_reply reply;
@@ -1029,9 +1031,9 @@ retry:
if (lvmetad_handle.error || lvmetad_handle.socket_fd < 0) {
err = lvmetad_handle.error ?: lvmetad_handle.socket_fd;
pthread_mutex_unlock(&lvmetad_mutex);
- log_error("lvmetad_open reconnect error %d", err);
+ log_debug("lvmetad_open reconnect error %d", err);
memset(&reply, 0, sizeof(reply));
- reply.error = err;
+ reply.error = ERR_LVMETAD_NOT_RUNNING;
va_end(ap);
return reply;
} else {
@@ -1265,6 +1267,15 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act
* caches, and tell lvmetad to set global invalid to 0.
*/
+ /*
+ * lvmetad not running:
+ * Even if we have not previously found lvmetad running,
+ * we attempt to connect and invalidate in case it has
+ * been started while lvmlockd is running. We don't
+ * want to allow lvmetad to be used with invalid data if
+ * it happens to be enabled and started after lvmlockd.
+ */
+
if (inval_meta && (r->type == LD_RT_VG)) {
daemon_reply reply;
char *uuid;
@@ -1284,8 +1295,10 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act
"version = " FMTd64, (int64_t)new_version,
NULL);
- if (reply.error || strcmp(daemon_reply_str(reply, "response", ""), "OK"))
- log_error("set_vg_info in lvmetad failed %d", reply.error);
+ if (reply.error || strcmp(daemon_reply_str(reply, "response", ""), "OK")) {
+ if (reply.error != ERR_LVMETAD_NOT_RUNNING)
+ log_error("set_vg_info in lvmetad failed %d", reply.error);
+ }
daemon_reply_destroy(reply);
}
@@ -1300,8 +1313,10 @@ static int res_lock(struct lockspace *ls, struct resource *r, struct action *act
"global_invalid = " FMTd64, INT64_C(1),
NULL);
- if (reply.error || strcmp(daemon_reply_str(reply, "response", ""), "OK"))
- log_error("set_global_info in lvmetad failed %d", reply.error);
+ if (reply.error || strcmp(daemon_reply_str(reply, "response", ""), "OK")) {
+ if (reply.error != ERR_LVMETAD_NOT_RUNNING)
+ log_error("set_global_info in lvmetad failed %d", reply.error);
+ }
daemon_reply_destroy(reply);
}
@@ -5848,7 +5863,7 @@ static int main_loop(daemon_state *ds_arg)
pthread_mutex_init(&lvmetad_mutex, NULL);
lvmetad_handle = lvmetad_open(NULL);
if (lvmetad_handle.error || lvmetad_handle.socket_fd < 0)
- log_error("lvmetad_open error %d", lvmetad_handle.error);
+ log_debug("lvmetad_open error %d", lvmetad_handle.error);
else
lvmetad_connected = 1;
@@ -5856,8 +5871,13 @@ static int main_loop(daemon_state *ds_arg)
* Attempt to rejoin lockspaces and adopt locks from a previous
* instance of lvmlockd that left behind lockspaces/locks.
*/
- if (adopt_opt)
- adopt_locks();
+ if (adopt_opt) {
+ /* FIXME: implement this without lvmetad */
+ if (!lvmetad_connected)
+ log_error("Cannot adopt locks without lvmetad running.");
+ else
+ adopt_locks();
+ }
while (1) {
rv = poll(pollfd, pollfd_maxi + 1, -1);
5 years, 10 months
master - fullreport: fix with lvmetad and only orphan PVs are visible
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bc275bcddf3fac6ea69...
Commit: bc275bcddf3fac6ea691e2dfda0ca3531c4b3c0c
Parent: 0253f5a21dc0b9ee8641228739d3d1036212ba80
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 18 14:26:32 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 18 14:31:52 2018 -0500
fullreport: fix with lvmetad and only orphan PVs are visible
The report uses process_each_vg() which populates lvmcache
based on a VG list from lvmetad. If there are no VGs,
but only orphan PVs, the orphans are not shown. Add an
explicit call to populate lvmcache with PV info from lvmetad.
---
tools/reporter.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/reporter.c b/tools/reporter.c
index 98e3d12..2d83421 100644
--- a/tools/reporter.c
+++ b/tools/reporter.c
@@ -1421,6 +1421,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, report_type_t
return ECMD_FAILED;
}
+ lvmcache_seed_infos_from_lvmetad(cmd);
+
if (single_args->report_type == FULL) {
handle->custom_handle = &args;
r = process_each_vg(cmd, argc, argv, NULL, NULL, 0, 1, handle, &_full_report_single);
5 years, 10 months
master - fix id_write_format on non-uuid string
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0253f5a21dc0b9ee864...
Commit: 0253f5a21dc0b9ee8641228739d3d1036212ba80
Parent: b2574c2f3a4a35b7ea3f51dc776cc64ebbe88ba8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 18 13:41:20 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri May 18 13:41:20 2018 -0500
fix id_write_format on non-uuid string
orphan vgs using the vgname "#orphans" as the vgid,
and valgrind complains about calling id_write_format
on that invalid uuid.
---
lib/metadata/metadata.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 2f84d5f..3f6c2e4 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3765,13 +3765,9 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
struct cached_vg_fmtdata *vg_fmtdata = NULL; /* Additional format-specific data about the vg */
unsigned use_previous_vg;
- uuid[0] = '\0';
- if (vgid && !id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
- stack;
-
- log_very_verbose("Reading VG %s %s", vgname ?: "<no name>", vgid ? uuid : "<no vgid>");
-
if (is_orphan_vg(vgname)) {
+ log_very_verbose("Reading VG %s", vgname);
+
if (use_precommitted) {
log_error(INTERNAL_ERROR "vg_read_internal requires vgname "
"with pre-commit.");
@@ -3780,6 +3776,12 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
return _vg_read_orphans(cmd, warn_flags, vgname, consistent);
}
+ uuid[0] = '\0';
+ if (vgid && !id_write_format((const struct id*)vgid, uuid, sizeof(uuid)))
+ stack;
+
+ log_very_verbose("Reading VG %s %s", vgname ?: "<no name>", vgid ? uuid : "<no vgid>");
+
if (lvmetad_used() && !use_precommitted) {
if ((correct_vg = lvmetad_vg_lookup(cmd, vgname, vgid))) {
dm_list_iterate_items(pvl, &correct_vg->pvs)
5 years, 10 months
master - python: use // for integer division
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b2574c2f3a4a35b7ea3...
Commit: b2574c2f3a4a35b7ea3f51dc776cc64ebbe88ba8
Parent: 3bbdde808a9dcb55a9ffd092e931dff80814daa7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 18 16:23:10 2018 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri May 18 16:25:44 2018 +0200
python: use // for integer division
---
daemons/lvmdbusd/lv.py | 2 +-
test/api/python_lvm_unit.py.in | 10 +++++-----
test/dbus/lvmdbustest.py | 8 ++++----
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index d73d3d2..ba9499f 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -497,7 +497,7 @@ class Lv(LvCommon):
# it is a thin lv
if not dbo.IsThinVolume:
if optional_size == 0:
- space = dbo.SizeBytes / 80
+ space = dbo.SizeBytes // 80
remainder = space % 512
optional_size = space + 512 - remainder
diff --git a/test/api/python_lvm_unit.py.in b/test/api/python_lvm_unit.py.in
index 2f9cbb5..78ced7e 100755
--- a/test/api/python_lvm_unit.py.in
+++ b/test/api/python_lvm_unit.py.in
@@ -112,7 +112,7 @@ class TestLvm(unittest.TestCase):
for d in device_list:
vg.extend(d)
- vg.createLvLinear(name, vg.getSize() / 2)
+ vg.createLvLinear(name, vg.getSize() // 2)
vg.close()
vg = None
@@ -124,14 +124,14 @@ class TestLvm(unittest.TestCase):
vg.extend(d)
vg.createLvThinpool(
- pool_name, vg.getSize() / 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1)
+ pool_name, vg.getSize() // 2, 0, 0, lvm.THIN_DISCARDS_PASSDOWN, 1)
return vg
@staticmethod
def _create_thin_lv(pv_devices, name):
thin_pool_name = 'thin_vg_pool_' + rs(4)
vg = TestLvm._create_thin_pool(pv_devices, thin_pool_name)
- vg.createLvThin(thin_pool_name, name, vg.getSize() / 8)
+ vg.createLvThin(thin_pool_name, name, vg.getSize() // 8)
vg.close()
vg = None
@@ -231,7 +231,7 @@ class TestLvm(unittest.TestCase):
curr_size = pv.getSize()
dev_size = pv.getDevSize()
self.assertTrue(curr_size == dev_size)
- pv.resize(curr_size / 2)
+ pv.resize(curr_size // 2)
with AllowedPVS() as pvs:
pv = pvs[0]
resized_size = pv.getSize()
@@ -718,7 +718,7 @@ class TestLvm(unittest.TestCase):
def test_percent_to_float(self):
self.assertEqual(lvm.percentToFloat(0), 0.0)
self.assertEqual(lvm.percentToFloat(1000000), 1.0)
- self.assertEqual(lvm.percentToFloat(1000000 / 2), 0.5)
+ self.assertEqual(lvm.percentToFloat(1000000 // 2), 0.5)
def test_scan(self):
self.assertEqual(lvm.scan(), None)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index bab9986..5f34847 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1027,7 +1027,7 @@ class TestDbusService(unittest.TestCase):
vg.Move(
dbus.ObjectPath(location),
dbus.Struct((0, 0), signature='tt'),
- dbus.Array([(dst, pv.PeCount / 2, 0), ], '(ott)'),
+ dbus.Array([(dst, pv.PeCount // 2, 0), ], '(ott)'),
dbus.Int32(g_tmo),
EOD))
self.assertEqual(job, '/')
@@ -1320,7 +1320,7 @@ class TestDbusService(unittest.TestCase):
original_size = pv.SizeBytes
- new_size = original_size / 2
+ new_size = original_size // 2
self.handle_return(
pv.ReSize(
@@ -1454,7 +1454,7 @@ class TestDbusService(unittest.TestCase):
@staticmethod
def _write_some_data(device_path, size):
- blocks = int(size / 512)
+ blocks = int(size // 512)
block = bytearray(512)
for i in range(0, 512):
block[i] = i % 255
@@ -1481,7 +1481,7 @@ class TestDbusService(unittest.TestCase):
interfaces=(LV_COMMON_INT, LV_INT, SNAPSHOT_INT, ))
# Write some data to snapshot so merge takes some time
- TestDbusService._write_some_data(ss.LvCommon.Path, ss_size / 2)
+ TestDbusService._write_some_data(ss.LvCommon.Path, ss_size // 2)
job_path = self.handle_return(
ss.Snapshot.Merge(
5 years, 10 months