1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

device_id: reduce messages

Don't print messages about devices file entries that are
missing or are being updated.
This commit is contained in:
David Teigland 2023-10-24 16:39:15 -05:00
parent 55e36d78a4
commit ec47f0763d
2 changed files with 30 additions and 25 deletions

View File

@ -771,7 +771,6 @@ static int device_id_system_read_preferred(struct cmd_context *cmd, struct devic
if (MAJOR(dev->dev) == cmd->dev_types->drbd_major) {
/* TODO */
log_warn("Missing support for DRBD idtype");
goto id_last;
}
@ -2343,20 +2342,20 @@ void device_ids_match(struct cmd_context *cmd)
/* A detached device would get here which isn't uncommon. */
if ((du->idtype == DEV_ID_TYPE_DEVNAME) && du->devname)
log_warn("Devices file PVID %s last seen on %s not found.",
log_debug("Devices file PVID %s last seen on %s not found.",
du->pvid ?: "none",
du->devname ?: "none");
else if (du->idtype == DEV_ID_TYPE_DEVNAME)
log_warn("Devices file PVID %s not found.",
log_debug("Devices file PVID %s not found.",
du->pvid ?: "none");
else if (du->devname)
log_warn("Devices file %s %s PVID %s last seen on %s not found.",
log_debug("Devices file %s %s PVID %s last seen on %s not found.",
idtype_to_str(du->idtype),
du->idname ?: "none",
du->pvid ?: "none",
du->devname);
else
log_warn("Devices file %s %s PVID %s not found.",
log_debug("Devices file %s %s PVID %s not found.",
idtype_to_str(du->idtype),
du->idname ?: "none",
du->pvid ?: "none");
@ -3072,13 +3071,13 @@ void device_ids_check_serial(struct cmd_context *cmd, struct dm_list *scan_devs,
break;
}
if (count != 1) {
log_warn("No device matches devices file PVID %s with duplicate serial number %s previously %s.",
du->pvid, du->idname, du->devname);
log_debug("No device matches devices file PVID %s with duplicate serial number %s previously %s.",
du->pvid, du->idname, du->devname);
continue;
}
log_warn("Device %s with serial number %s has PVID %s (devices file %s)",
dev_name(dev), du->idname, dev->pvid, du->pvid ?: "none");
log_debug("Device %s with serial number %s has PVID %s (devices file %s)",
dev_name(dev), du->idname, dev->pvid, du->pvid ?: "none");
if (!(tmpdup = strdup(dev->pvid)))
continue;
free(du->pvid);
@ -3137,10 +3136,10 @@ void device_ids_check_serial(struct cmd_context *cmd, struct dm_list *scan_devs,
dm_list_iterate_items(dul, &dus_check) {
if (!dul->du->dev) {
du = dul->du;
log_warn("Devices file %s %s PVID %s not found.",
idtype_to_str(du->idtype),
du->idname ?: "none",
du->pvid ?: "none");
log_debug("Devices file %s %s PVID %s not found.",
idtype_to_str(du->idtype),
du->idname ?: "none",
du->pvid ?: "none");
if (du->devname) {
free(du->devname);
du->devname = NULL;
@ -3404,7 +3403,7 @@ void device_ids_refresh(struct cmd_context *cmd, struct dm_list *dev_list,
log_warn("WARNING: use lvmdevices to select a device for PVID %s.", dil->pvid);
dm_list_del(&dil->list);
} else {
log_warn("Devices file PVID %s found on %s.", dil->pvid, dev_name(dev));
log_debug("Devices file PVID %s found on %s.", dil->pvid, dev_name(dev));
dil->dev = dev;
}
} else {
@ -3463,7 +3462,7 @@ void device_ids_refresh(struct cmd_context *cmd, struct dm_list *dev_list,
new_idname = strdup(devname);
new_idname2 = strdup(devname);
new_devname = strdup(devname);
log_print_unless_silent("Found new device name %s for PVID %s.", devname, du->pvid ?: "");
log_debug("Found new device name %s for PVID %s.", devname, du->pvid ?: "");
}
id = zalloc(sizeof(struct dev_id));

View File

@ -86,6 +86,7 @@ for dev in "${REAL_DEVICES[@]}"; do
pvid=`pvs $dev --noheading -o uuid | tr -d - | awk '{print $1}'`
sys_wwid_file="/sys/dev/block/$maj:$min/device/wwid"
sys_wwid_nvme_file="/sys/dev/block/$maj:$min/wwid"
sys_serial_file="/sys/dev/block/$maj:$min/device/serial"
sys_dm_uuid_file="/sys/dev/block/$maj:$min/dm/uuid"
sys_md_uuid_file="/sys/dev/block/$maj:$min/md/uuid"
@ -94,6 +95,9 @@ for dev in "${REAL_DEVICES[@]}"; do
if test -e $sys_wwid_file; then
sys_file=$sys_wwid_file
idtype="sys_wwid"
elif test -e $sys_wwid_nvme_file; then
sys_file=$sys_wwid_nvme_file
idtype="sys_wwid"
elif test -e $sys_serial_file; then
sys_file=$sys_serial_file
idtype="sys_serial"
@ -304,8 +308,6 @@ pvid1=`pvs $dev1 --noheading -o uuid | tr -d - | awk '{print $1}'`
pvid2=`pvs $dev2 --noheading -o uuid | tr -d - | awk '{print $1}'`
test "$pvid1" != "$pvid2" || die "same uuid"
id1=`pvs $dev1 --noheading -o deviceid | tr -d - | awk '{print $1}'`
id2=`pvs $dev2 --noheading -o deviceid | tr -d - | awk '{print $1}'`
test "$id1" != "$id2" || die "same device id"
grep $dev1 $DF
@ -464,10 +466,11 @@ grep $did1 $DF
rm $DF
sed "s/$did1/baddid/" "$DF.orig" |tee $DF
lvmdevices --check 2>&1|tee out
grep $dev1 out
grep baddid out
not grep $dev2 out
# FIXME: lvmdevices --check needs fixed output
#lvmdevices --check 2>&1|tee out
#grep $dev1 out
#grep baddid out
#not grep $dev2 out
lvmdevices 2>&1|tee out
grep $pvid1 out
@ -496,7 +499,8 @@ d1=$(basename $dev1)
d3=$(basename $dev3)
sed "s/$d1/$d3/" "$DF.orig" |tee $DF
not lvmdevices --check 2>&1 |tee out
grep $dev1 out
# FIXME: define fixed check output
#grep $dev1 out
lvmdevices --update
@ -518,8 +522,9 @@ sed "s/$d2/$d1/" "${DF}_1" |tee ${DF}_2
sed "s/tmp/$d2/" "${DF}_2" |tee $DF
rm ${DF}_1 ${DF}_2
not lvmdevices --check 2>&1 |tee out
grep $dev1 out
grep $dev2 out
# FIXME: define fixed check output
#grep $dev1 out
#grep $dev2 out
lvmdevices --update
@ -539,7 +544,8 @@ d1=$(basename $dev1)
d3=$(basename $dev3)
sed "s/$d1/$d3/" "$DF.orig" |tee $DF
not lvmdevices --check 2>&1 |tee out
grep $dev1 out
# FIXME: define fixed check output
#grep $dev1 out
pvs -o+uuid,deviceid | grep $vg |tee out
grep $dev1 out |tee out1