1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

improve vgmetadatacopies unmanaged message

This commit is contained in:
Alasdair Kergon 2010-06-30 20:03:52 +00:00
parent 3b9d1b1a96
commit 12eadbabdd
6 changed files with 27 additions and 29 deletions

View File

@ -456,7 +456,7 @@ struct pvcreate_params {
const char *restorefile; /* 0 if no --restorefile option */
force_t force;
unsigned yes;
unsigned mda_ignore;
unsigned metadataignore;
};
struct physical_volume *pvcreate_single(struct cmd_context *cmd,
@ -889,7 +889,7 @@ uint64_t vg_max_lv(const struct volume_group *vg);
uint32_t vg_mda_count(const struct volume_group *vg);
uint32_t vg_mda_used_count(const struct volume_group *vg);
uint32_t vg_mda_copies(const struct volume_group *vg);
int vg_set_mda_copies(struct volume_group *vg, uint32_t copies);
int vg_set_mda_copies(struct volume_group *vg, uint32_t mda_copies);
int vg_check_write_mode(struct volume_group *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)
#define vg_is_exported(vg) (vg_status((vg)) & EXPORTED_VG)
@ -905,7 +905,7 @@ struct vgcreate_params {
size_t max_lv;
alloc_policy_t alloc;
int clustered; /* FIXME: put this into a 'status' variable instead? */
uint32_t metadata_copies;
uint32_t vgmetadatacopies;
};
int vgcreate_params_validate(struct cmd_context *cmd,

View File

@ -1583,7 +1583,7 @@ void pvcreate_params_set_defaults(struct pvcreate_params *pp)
pp->restorefile = 0;
pp->force = PROMPT;
pp->yes = 0;
pp->mda_ignore = DEFAULT_PVMETADATAIGNORE;
pp->metadataignore = DEFAULT_PVMETADATAIGNORE;
}
/*
@ -1673,7 +1673,7 @@ struct physical_volume * pvcreate_single(struct cmd_context *cmd,
log_very_verbose("Writing physical volume data to disk \"%s\"",
pv_name);
if (pp->mda_ignore) {
if (pp->metadataignore) {
dm_list_iterate_items(mda, &mdas) {
mda_set_ignored(mda, 1);
}
@ -4247,17 +4247,17 @@ int mdas_empty_or_ignored(struct dm_list *mdas)
return 0;
}
int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignore)
int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignored)
{
const char *pv_name = pv_dev_name(pv);
if (mda_ignore && !pv_mda_used_count(pv)) {
if (mda_ignored && !pv_mda_used_count(pv)) {
log_error("Metadata areas on physical volume \"%s\" already "
"ignored.", pv_name);
return 0;
}
if (!mda_ignore && (pv_mda_used_count(pv) == pv_mda_count(pv))) {
if (!mda_ignored && (pv_mda_used_count(pv) == pv_mda_count(pv))) {
log_error("Metadata areas on physical volume \"%s\" already "
"marked as in-use.", pv_name);
return 0;
@ -4270,9 +4270,9 @@ int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignore)
}
log_verbose("Marking metadata areas on physical volume \"%s\" "
"as %s.", pv_name, mda_ignore ? "ignored" : "in-use");
"as %s.", pv_name, mda_ignored ? "ignored" : "in-use");
if (!pv_mda_set_ignored(pv, mda_ignore))
if (!pv_mda_set_ignored(pv, mda_ignored))
return_0;
/*

View File

@ -1187,7 +1187,7 @@ void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,
vp_def->max_lv = vg->max_lv;
vp_def->alloc = vg->alloc;
vp_def->clustered = vg_is_clustered(vg);
vp_def->metadata_copies = vg->mda_copies;
vp_def->vgmetadatacopies = vg->mda_copies;
} else {
vp_def->vg_name = NULL;
vp_def->extent_size = DEFAULT_EXTENT_SIZE * 2;
@ -1195,7 +1195,7 @@ void vgcreate_params_set_defaults(struct vgcreate_params *vp_def,
vp_def->max_lv = DEFAULT_MAX_LV;
vp_def->alloc = DEFAULT_ALLOC_POLICY;
vp_def->clustered = DEFAULT_CLUSTERED;
vp_def->metadata_copies = DEFAULT_VGMETADATACOPIES;
vp_def->vgmetadatacopies = DEFAULT_VGMETADATACOPIES;
}
}
@ -1244,13 +1244,13 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
}
if (arg_count(cmd, metadatacopies_ARG)) {
vp_new->metadata_copies = arg_int_value(cmd, metadatacopies_ARG,
vp_new->vgmetadatacopies = arg_int_value(cmd, metadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
} else if (arg_count(cmd, vgmetadatacopies_ARG)) {
vp_new->metadata_copies = arg_int_value(cmd, vgmetadatacopies_ARG,
vp_new->vgmetadatacopies = arg_int_value(cmd, vgmetadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
} else {
vp_new->metadata_copies = find_config_tree_int(cmd,
vp_new->vgmetadatacopies = find_config_tree_int(cmd,
"metadata/vgmetadatacopies",
DEFAULT_VGMETADATACOPIES);
}
@ -1378,19 +1378,19 @@ int pvcreate_params_validate(struct cmd_context *cmd,
}
if (arg_count(cmd, metadataignore_ARG)) {
pp->mda_ignore = !strcmp(arg_str_value(cmd,
pp->metadataignore = !strcmp(arg_str_value(cmd,
metadataignore_ARG,
DEFAULT_PVMETADATAIGNORE_STR),
"y");
} else {
pp->mda_ignore = !strcmp(find_config_tree_str(cmd,
pp->metadataignore = !strcmp(find_config_tree_str(cmd,
"metadata/pvmetadataignore",
DEFAULT_PVMETADATAIGNORE_STR),
"y");
}
if (arg_count(cmd, pvmetadatacopies_ARG) &&
!arg_int_value(cmd, pvmetadatacopies_ARG, -1) &&
pp->mda_ignore) {
pp->metadataignore) {
log_error("metadataignore only applies to metadatacopies > 0");
return 0;
}

View File

@ -528,16 +528,14 @@ static int _vgchange_refresh(struct cmd_context *cmd, struct volume_group *vg)
static int _vgchange_metadata_copies(struct cmd_context *cmd,
struct volume_group *vg)
{
uint32_t mda_copies = DEFAULT_VGMETADATACOPIES;
uint32_t mda_copies = arg_uint_value(cmd, vgmetadatacopies_ARG, DEFAULT_VGMETADATACOPIES);
if (arg_count(cmd, vgmetadatacopies_ARG))
mda_copies = arg_uint_value(cmd, vgmetadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
else if (arg_count(cmd, metadatacopies_ARG))
mda_copies = arg_uint_value(cmd, metadatacopies_ARG,
DEFAULT_VGMETADATACOPIES);
if (mda_copies == vg_mda_copies(vg)) {
log_error("Metadata copies of VG %s is already %u",
if (vg_mda_copies(vg) == VGMETADATACOPIES_UNMANAGED)
log_error("Number of metadata copies for VG %s is already unmanaged.",
vg->name);
else
log_error("Number of metadata copies for VG %s is already %" PRIu32,
vg->name, mda_copies);
return ECMD_PROCESSED;
}

View File

@ -64,7 +64,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
!vg_set_max_pv(vg, vp_new.max_pv) ||
!vg_set_alloc_policy(vg, vp_new.alloc) ||
!vg_set_clustered(vg, vp_new.clustered) ||
!vg_set_mda_copies(vg, vp_new.metadata_copies))
!vg_set_mda_copies(vg, vp_new.vgmetadatacopies))
goto bad_orphan;
if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE)) {

View File

@ -384,7 +384,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
!vg_set_max_pv(vg_to, vp_new.max_pv) ||
!vg_set_alloc_policy(vg_to, vp_new.alloc) ||
!vg_set_clustered(vg_to, vp_new.clustered) ||
!vg_set_mda_copies(vg_to, vp_new.metadata_copies))
!vg_set_mda_copies(vg_to, vp_new.vgmetadatacopies))
goto_bad;
}