Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=192d142e1cd38c1593ec7…
Commit: 192d142e1cd38c1593ec76502d8424997ec01ec8
Parent: 3217e0cfeaed313332a0b69437ee87ca1f4b9e5e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Jun 2 12:22:24 2017 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Fri Jun 2 12:32:43 2017 -0500
lvmdbusd: cmdhandler.py vg_reduce, remove extranous '--all'
vgreduce previously allowed --all and --removemissing together even though
it only actual did the remove missing. The lvm dbus daemon was passing
--all anytime there was no entries in pv_object_paths. This change supplies
--all if and only if we are not removing missing and the pv_object_paths
is empty.
Vgreduce has and continues to enforce the invalid combination of supplying a
device list when you specify --all or --removemissing so we do not need
to check for that invalid combination explicitly in the lvm dbus service as
it's already covered.
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1455471
---
daemons/lvmdbusd/cmdhandler.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 8ed38cb..a883f1e 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -618,10 +618,10 @@ def vg_reduce(vg_name, missing, pv_devices, reduce_options):
cmd = ['vgreduce']
cmd.extend(options_to_cli_args(reduce_options))
- if len(pv_devices) == 0:
- cmd.append('--all')
if missing:
cmd.append('--removemissing')
+ elif len(pv_devices) == 0:
+ cmd.append('--all')
cmd.append(vg_name)
cmd.extend(pv_devices)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c98a25aab1659a5640ac4…
Commit: c98a25aab1659a5640ac473517bb6af97d696588
Parent: f3c90e90f8466b5c2fe336e9a1947307c92c9e59
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jun 1 11:10:09 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 1 11:18:42 2017 -0500
print warning about in-use orphans
Warn about a PV that has the in-use flag set, but appears in
the orphan VG (no VG was found referencing it.)
There are a number of conditions that could lead to this:
. The PV was created with no mdas and is used in a VG with
other PVs (with metadata) that have not yet appeared on
the system. So, no VG metadata is found by lvm which
references the in-use PV with no mdas.
. vgremove could have failed after clearing mdas but
before clearing the in-use flag. In this case, the
in-use flag needs to be manually cleared on the PV.
. The PV may have damanged/unrecognized VG metadata
that lvm could not read.
. The PV may have no mdas, and the PVs with the metadata
may have damaged/unrecognized metadata.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 10d845f..ae704af 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Print a warning about in-use PVs with no VG using them.
Disable automatic clearing of PVs that look like in-use orphans.
Cache format2 flag is now using segment name type field.
Support storing status flags via segtype name field.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index cb02ecf..4ba81c7 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3802,6 +3802,8 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
struct _vg_read_orphan_baton *b = baton;
struct physical_volume *pv = NULL;
struct pv_list *pvl;
+ uint32_t ext_version;
+ uint32_t ext_flags;
if (!(pv = _pv_read(b->vg->cmd, b->vg->vgmem, dev_name(lvmcache_device(info)),
b->vg->fid, b->warn_flags, 0))) {
@@ -3837,6 +3839,40 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
}
*/
+ /*
+ * Nothing to do if PV header extension < 2:
+ * - version 0 is PV header without any extensions,
+ * - version 1 has bootloader area support only and
+ * we're not checking anything for that one here.
+ */
+ ext_version = lvmcache_ext_version(info);
+ ext_flags = lvmcache_ext_flags(info);
+
+ /*
+ * Warn about a PV that has the in-use flag set, but appears in
+ * the orphan VG (no VG was found referencing it.)
+ * There are a number of conditions that could lead to this:
+ *
+ * . The PV was created with no mdas and is used in a VG with
+ * other PVs (with metadata) that have not yet appeared on
+ * the system. So, no VG metadata is found by lvm which
+ * references the in-use PV with no mdas.
+ *
+ * . vgremove could have failed after clearing mdas but
+ * before clearing the in-use flag. In this case, the
+ * in-use flag needs to be manually cleared on the PV.
+ *
+ * . The PV may have damanged/unrecognized VG metadata
+ * that lvm could not read.
+ *
+ * . The PV may have no mdas, and the PVs with the metadata
+ * may have damaged/unrecognized metadata.
+ */
+ if ((ext_version >= 2) && (ext_flags & PV_EXT_USED)) {
+ log_warn("WARNING: PV %s is marked in use but no VG was found using it.", pv_dev_name(pv));
+ log_warn("WARNING: PV %s might need repairing.", pv_dev_name(pv));
+ }
+
return 1;
}
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f3c90e90f8466b5c2fe33…
Commit: f3c90e90f8466b5c2fe336e9a1947307c92c9e59
Parent: 743ffb1962ef272e5023c1ac652c5bcde86ff5fd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri May 26 13:26:09 2017 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 1 09:53:14 2017 -0500
disable repairing in-use flag on orphan PVs
A PV holding VG metadata that lvm can't understand
(e.g. damaged, checksum error, unrecognized flag)
will appear as an in-use orphan, and will be cleared
by this repair code. Disable this repair until the
code can keep track of these problematic PVs, and
distinguish them from actual in-use orphans.
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 878aa7a..10d845f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Disable automatic clearing of PVs that look like in-use orphans.
Cache format2 flag is now using segment name type field.
Support storing status flags via segtype name field.
Stop using '--yes' mode when fsadm runs without terminal.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c5a41fe..cb02ecf 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3741,6 +3741,7 @@ struct _vg_read_orphan_baton {
* by pvcreate, and are displayed with a special flag by 'pvs'.
*/
+#if 0
static int _check_or_repair_orphan_pv_ext(struct physical_volume *pv,
struct lvmcache_info *info,
struct _vg_read_orphan_baton *b)
@@ -3794,6 +3795,7 @@ static int _check_or_repair_orphan_pv_ext(struct physical_volume *pv,
return 1;
}
+#endif
static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
{
@@ -3815,10 +3817,25 @@ static int _vg_read_orphan_pv(struct lvmcache_info *info, void *baton)
pvl->pv = pv;
add_pvl_to_vgs(b->vg, pvl);
+ /*
+ * FIXME: this bit of code that does the auto repair is disabled
+ * until we can distinguish cases where the repair should not
+ * happen, i.e. the VG metadata could not be read/parsed.
+ *
+ * A PV holding VG metadata that lvm can't understand
+ * (e.g. damaged, checksum error, unrecognized flag)
+ * will appear as an in-use orphan, and would be cleared
+ * by this repair code. Disable this repair until the
+ * code can keep track of these problematic PVs, and
+ * distinguish them from actual in-use orphans.
+ */
+
+ /*
if (!_check_or_repair_orphan_pv_ext(pv, info, baton)) {
stack;
return 0;
}
+ */
return 1;
}