diff options
author | David Teigland <teigland@redhat.com> | 2016-04-27 15:06:43 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2016-05-04 13:28:49 -0500 |
commit | 96b9d12a0e6547310540113c95f5e3532d6ec4b9 (patch) | |
tree | d9ca464c1f07d4bb98d4d01fbef1d7f9fcd6e6f8 | |
parent | 7c1e6011644abd00dac7f71baf330f69bd076381 (diff) | |
download | lvm2-96b9d12a0e6547310540113c95f5e3532d6ec4b9.tar.gz |
pvscan: fix errors for single dev scan while lvmetad is disabled
While lvmetad was disabled, 'pvscan --cache dev' would produce
confusing error messages.
-rw-r--r-- | tools/pvscan.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c index d93773a1c..50753fdc0 100644 --- a/tools/pvscan.c +++ b/tools/pvscan.c @@ -257,6 +257,7 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv) int ret = ECMD_PROCESSED; struct device *dev; const char *pv_name; + const char *reason = NULL; int32_t major = -1; int32_t minor = -1; int devno_args = 0; @@ -309,6 +310,18 @@ static int _pvscan_lvmetad(struct cmd_context *cmd, int argc, char **argv) } /* + * When lvmetad is disabled, all devices need to be rescanned, + * i.e. the !argc case above, pvscan --cache. + */ + if (lvmetad_used() && lvmetad_is_disabled(cmd, &reason)) { + log_warn("WARNING: Not using lvmetad because %s.", reason); + log_warn("WARNING: Rescan all devices to update lvmetad cache (pvscan --cache)."); + log_error("Failed to update cache."); + ret = ECMD_FAILED; + goto out; + } + + /* * FIXME: when specific devs are named, we generally don't * want to scan any other devs, but if lvmetad is not yet * populated, the first 'pvscan --cache dev' does need to |