summaryrefslogtreecommitdiff
path: root/tools/lvscan.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2018-07-10 13:39:29 -0500
committerDavid Teigland <teigland@redhat.com>2018-07-11 11:26:42 -0500
commit117160b27e510dceb1ed6acf995115c040acd88d (patch)
treeae459f189f4202cb78ef3c9f8196a559b2398801 /tools/lvscan.c
parentedf3f86184a380994e383b9884364e702e4ac647 (diff)
downloadlvm2-117160b27e510dceb1ed6acf995115c040acd88d.tar.gz
Remove lvmetad
Native disk scanning is now both reduced and async/parallel, which makes it comparable in performance (and often faster) when compared to lvm using lvmetad. Autoactivation now uses local temp files to record online PVs, and no longer requires lvmetad. There should be no apparent command-level change in behavior.
Diffstat (limited to 'tools/lvscan.c')
-rw-r--r--tools/lvscan.c62
1 files changed, 3 insertions, 59 deletions
diff --git a/tools/lvscan.c b/tools/lvscan.c
index c38208ab0..cba4d616e 100644
--- a/tools/lvscan.c
+++ b/tools/lvscan.c
@@ -15,36 +15,6 @@
#include "tools.h"
-static int _lvscan_single_lvmetad(struct cmd_context *cmd, struct logical_volume *lv)
-{
- struct pv_list *pvl;
- struct dm_list all_pvs;
- char pvid_s[64] __attribute__((aligned(8)));
-
- if (!lvmetad_used())
- return ECMD_PROCESSED;
-
- dm_list_init(&all_pvs);
-
- if (!get_pv_list_for_lv(lv->vg->vgmem, lv, &all_pvs))
- return ECMD_FAILED;
-
- dm_list_iterate_items(pvl, &all_pvs) {
- if (!pvl->pv->dev) {
- if (!id_write_format(&pvl->pv->id, pvid_s, sizeof(pvid_s)))
- stack;
- else
- log_warn("WARNING: Device for PV %s already missing, skipping.",
- pvid_s);
- continue;
- }
- if (!lvmetad_pvscan_single(cmd, pvl->pv->dev, NULL, NULL))
- return ECMD_FAILED;
- }
-
- return ECMD_PROCESSED;
-}
-
static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle __attribute__((unused)))
{
@@ -54,9 +24,6 @@ static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
const char *active_str, *snapshot_str;
- if (arg_is_set(cmd, cache_long_ARG))
- return _lvscan_single_lvmetad(cmd, lv);
-
if (!arg_is_set(cmd, all_ARG) && !lv_is_visible(lv))
return ECMD_PROCESSED;
@@ -91,32 +58,9 @@ static int _lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,
int lvscan(struct cmd_context *cmd, int argc, char **argv)
{
- const char *reason = NULL;
-
- if (argc && !arg_is_set(cmd, cache_long_ARG)) {
- log_error("No additional command line arguments allowed");
- return EINVALID_CMD_LINE;
- }
-
- if (!lvmetad_used() && arg_is_set(cmd, cache_long_ARG))
- log_verbose("Ignoring lvscan --cache because lvmetad is not in use.");
-
- /* Needed because this command has NO_LVMETAD_AUTOSCAN. */
- if (lvmetad_used() && (!lvmetad_token_matches(cmd) || lvmetad_is_disabled(cmd, &reason))) {
- if (lvmetad_used() && !lvmetad_pvscan_all_devs(cmd, 0)) {
- log_warn("WARNING: Not using lvmetad because cache update failed.");
- lvmetad_make_unused(cmd);
- }
-
- if (lvmetad_used() && lvmetad_is_disabled(cmd, &reason)) {
- log_warn("WARNING: Not using lvmetad because %s.", reason);
- lvmetad_make_unused(cmd);
- }
-
- /*
- * FIXME: doing lvscan --cache after a full scan is pointless.
- * Should the cache case just exit here?
- */
+ if (arg_is_set(cmd, cache_long_ARG)) {
+ log_warn("Ignoring lvscan --cache because lvmetad is no longer used.");
+ return ECMD_PROCESSED;
}
return process_each_lv(cmd, argc, argv, NULL, NULL, 0, NULL, NULL, &_lvscan_single);