1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

pvck: repair should clear hints

repairing a pv can cause the hint file to become incorrect
This commit is contained in:
David Teigland 2020-09-02 14:21:17 -05:00
parent 8b9028bbe7
commit f5a669f314
2 changed files with 17 additions and 0 deletions

View File

@ -338,6 +338,21 @@ pvs
not diff $HINTS $PREV
#
# Test pvck --repair forces refresh
#
rm $HINTS $PREV
pvs
cp $HINTS $PREV
pvck --repairtype label_header -y "$dev5"
cat $NEWHINTS
grep 'Created empty by pvck' $HINTS
# this next pvs creates new hints
pvs
# the only diff will be "Created by..."
not diff $HINTS $PREV
#
# Test incorrect dev-to-pvid info in hints is detected

View File

@ -3037,6 +3037,8 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
if (arg_is_set(cmd, repairtype_ARG) || arg_is_set(cmd, repair_ARG)) {
pv_name = argv[0];
clear_hint_file(cmd);
if (!(dev = dev_cache_get(cmd, pv_name, cmd->filter))) {
log_error("No device found for %s %s.", pv_name, dev_cache_filtered_reason(pv_name));
return ECMD_FAILED;