1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

Use a common message for a used PV

Change some inconsistent messages and adopt
the new wording "PV %s is used by" in place
of "PV %s is marked as belonging to"
or "PV %s belongs to".
This commit is contained in:
David Teigland 2016-02-25 14:12:08 -06:00
parent 66e175702a
commit 172bad0d56
6 changed files with 15 additions and 18 deletions

View File

@ -201,8 +201,7 @@ static int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
return_0;
if (used) {
log_error("Physical volume '%s' is marked as belonging to a VG "
"but its metadata is missing.", pv_name);
log_error("PV %s is used by a VG but its metadata is missing.", pv_name);
return 0;
}
}
@ -1585,7 +1584,7 @@ static int _pvcreate_check(struct cmd_context *cmd, const char *name,
goto_out;
if (used && pp->force != DONT_PROMPT_OVERRIDE) {
log_error("PV '%s' is marked as belonging to a VG but its metadata is missing.", name);
log_error("PV %s is used by a VG but its metadata is missing.", name);
log_error("Can't initialize PV '%s' without -ff.", name);
goto out;
}

View File

@ -733,8 +733,7 @@ static int pvremove_check(struct cmd_context *cmd, const char *name,
goto_out;
if (used) {
log_warn("WARNING: PV '%s' is marked as belonging to a VG "
"but its metadata is missing.", name);
log_warn("WARNING: PV %s is used by a VG but its metadata is missing.", name);
if (force_count < 2)
goto_bad;
@ -745,8 +744,7 @@ static int pvremove_check(struct cmd_context *cmd, const char *name,
goto_bad;
}
} else {
log_warn("WARNING: PV %s belongs to Volume Group %s "
"(consider using vgreduce).", name, pv_vg_name(pv));
log_warn("WARNING: PV %s is used by VG %s (consider using vgreduce).", name, pv_vg_name(pv));
if (force_count < 2)
goto_bad;

View File

@ -17,7 +17,7 @@ SKIP_WITH_LVMPOLLD=1
aux prepare_devs 2
# PV_EXT_USED flag
MARKED_AS_USED_MSG="marked as belonging to a VG but its metadata is missing"
MARKED_AS_USED_MSG="is used by a VG but its metadata is missing"
######################################
### CHECK PV WITH 0 METADATA AREAS ###

View File

@ -56,16 +56,16 @@ for mdacp in 0 1 2; do
# pvremove -f fails when pv in a vg (---metadatacopies $mdacp)
not pvremove -f "$dev1" 2>&1 | tee out
grep "belongs" out
grep "is used" out
pvs "$dev1"
# pvremove -ff fails without confirmation when pv in a vg (---metadatacopies $mdacp)
not pvremove -ff "$dev1" 2>&1 | tee out
grep "belongs" out
grep "is used" out
# pvremove -ff succeds with confirmation when pv in a vg (---metadatacopies $mdacp)
pvremove -ffy "$dev1" 2>&1 | tee out
grep "belongs" out
grep "is used" out
not pvs "$dev1"
vgreduce --removemissing $vg

View File

@ -60,7 +60,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,
goto_bad;
if (used && (arg_count(cmd, force_ARG) != DONT_PROMPT_OVERRIDE)) {
log_error("PV '%s' is marked as belonging to a VG but its metadata is missing.", pv_name);
log_error("PV %s is used by a VG but its metadata is missing.", pv_name);
log_error("Can't change PV '%s' without -ff.", pv_name);
goto bad;
}

View File

@ -2962,7 +2962,7 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
pv_name = pv_dev_name(pv);
if (cmd->system_id && is_orphan(pv) && is_used_pv(pv)) {
log_verbose("PV %s is marked as belonging to a VG but its metadata is missing.", pv_name);
log_verbose("PV %s is used by a VG but its metadata is missing.", pv_name);
log_verbose("Skipping PV %s because it's not possible to decide whether it matches system id.", pv_name);
continue;
}
@ -3601,7 +3601,7 @@ static void _check_pvcreate_prompt(struct cmd_context *cmd,
prompt->answer = PROMPT_ANSWER_NO;
if (prompt->vg_name_unknown) {
log_error("PV '%s' is marked as belonging to a VG but its metadata is missing.", pvname);
log_error("PV %s is used by a VG but its metadata is missing.", pvname);
log_error("Can't initialize PV '%s' without -ff.", pvname);
} else if (!strcmp(command_name(cmd), "pvcreate")) {
log_error("Can't initialize physical volume \"%s\" of volume group \"%s\" without -ff", pvname, vgname);
@ -3626,15 +3626,15 @@ static void _check_pvcreate_prompt(struct cmd_context *cmd,
prompt->answer = PROMPT_ANSWER_NO;
if (prompt->vg_name_unknown)
log_error("PV %s belongs to a VG but its metadata is missing.", pvname);
log_error("PV %s is used by a VG but its metadata is missing.", pvname);
else
log_error("PV %s belongs to Volume Group %s so please use vgreduce first.", pvname, vgname);
log_error("PV %s is used by VG %s so please use vgreduce first.", pvname, vgname);
log_error("(If you are certain you need pvremove, then confirm by using --force twice.)");
} else if (pp->yes) {
log_warn("WARNING: PV %s belongs to Volume Group %s", pvname, vgname);
log_warn("WARNING: PV %s is used by VG %s", pvname, vgname);
prompt->answer = PROMPT_ANSWER_YES;
} else if (ask) {
log_warn("WARNING: PV %s belongs to Volume Group %s", pvname, vgname);
log_warn("WARNING: PV %s is used by VG %s", pvname, vgname);
if (yes_no_prompt("Really WIPE LABELS from physical volume \"%s\" of volume group \"%s\" [y/n]? ", pvname, vgname) == 'n') {
prompt->answer = PROMPT_ANSWER_NO;
log_error("%s: physical volume label not removed", pvname);