summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2021-11-03 09:50:11 -0500
committerDavid Teigland <teigland@redhat.com>2021-11-04 11:08:38 -0500
commit594f6ca97024fa23dfa852b6cc9da272877e1ced (patch)
tree0c127cbde8e04757d5bb5d4282c2a1e88e0a2a3b
parent726dd25969e9e6a3de285a22cea45e9f5f53520f (diff)
downloadlvm2-594f6ca97024fa23dfa852b6cc9da272877e1ced.tar.gz
rename pvscan_cache_single to expect_missing_vg_device in cmd
-rw-r--r--lib/commands/toolcontext.h2
-rw-r--r--lib/device/device_id.c5
-rw-r--r--lib/metadata/metadata.c4
-rw-r--r--tools/pvscan.c2
4 files changed, 6 insertions, 7 deletions
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index e864932f2..0ae45ccc0 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -174,7 +174,7 @@ struct cmd_context {
unsigned activate_component:1; /* command activates component LV */
unsigned process_component_lvs:1; /* command processes also component LVs */
unsigned mirror_warn_printed:1; /* command already printed warning about non-monitored mirrors */
- unsigned pvscan_cache_single:1;
+ unsigned expect_missing_vg_device:1; /* when reading a vg it's expected that a dev for a pv isn't found */
unsigned can_use_one_scan:1;
unsigned is_clvmd:1;
unsigned md_component_detection:1;
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index 167bf661b..18669630c 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -778,9 +778,8 @@ static void _device_ids_update_try(struct cmd_context *cmd)
{
int held = 0;
- /* Defer updates to non-pvscan-cache commands. */
- if (cmd->pvscan_cache_single) {
- log_print("pvscan[%d] skip updating devices file.", getpid());
+ if (cmd->expect_missing_vg_device) {
+ log_print("skip updating devices file.");
return;
}
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index c4f65366b..f01a0bea6 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -3558,7 +3558,7 @@ 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->expect_missing_vg_device &&
(!vg_is_foreign(vg) && !cmd->include_foreign_vgs))
log_warn("WARNING: Couldn't find device with uuid %s.", buffer);
else
@@ -5084,7 +5084,7 @@ 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 (vg_is_foreign(vg) && !cmd->include_foreign_vgs)
+ if ((vg_is_foreign(vg) && !cmd->include_foreign_vgs) || cmd->expect_missing_vg_device)
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);
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 01f57af0c..4f97e211c 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -1679,7 +1679,7 @@ static int _pvscan_cache_args(struct cmd_context *cmd, int argc, char **argv,
dm_list_init(&pvscan_args);
dm_list_init(&pvscan_devs);
- cmd->pvscan_cache_single = 1;
+ cmd->expect_missing_vg_device = 1;
/*
* Special pvscan-specific setup steps to avoid looking