mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvconvert: use public LVs for recovery
Replace the use of internal /dev/mapper names with the use of public LV names /dev/vg/lv for use with repair tools. For this make the activation of _pmspare LV to be handled as a component activation with public name. Metadata is already atomatically activated this way (as readonly). So if there is any 'error' happening, we leave public LVs in system.
This commit is contained in:
parent
409a79621a
commit
d040b68aee
@ -2605,6 +2605,8 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
|
|||||||
if (!lv_is_visible(lv) && lv_is_component(lv)) {
|
if (!lv_is_visible(lv) && lv_is_component(lv)) {
|
||||||
laopts->read_only = 1;
|
laopts->read_only = 1;
|
||||||
laopts->component_lv = lv;
|
laopts->component_lv = lv;
|
||||||
|
} else if (lv_is_pool_metadata_spare(lv)) {
|
||||||
|
laopts->component_lv = lv;
|
||||||
} else if (filter)
|
} else if (filter)
|
||||||
laopts->read_only = _passes_readonly_filter(cmd, lv);
|
laopts->read_only = _passes_readonly_filter(cmd, lv);
|
||||||
|
|
||||||
|
@ -2336,7 +2336,6 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
|
|||||||
struct logical_volume *pool_lv,
|
struct logical_volume *pool_lv,
|
||||||
struct dm_list *pvh, int poolmetadataspare)
|
struct dm_list *pvh, int poolmetadataspare)
|
||||||
{
|
{
|
||||||
const char *dmdir = dm_dir();
|
|
||||||
const char *thin_dump =
|
const char *thin_dump =
|
||||||
find_config_tree_str_allow_empty(cmd, global_thin_dump_executable_CFG, NULL);
|
find_config_tree_str_allow_empty(cmd, global_thin_dump_executable_CFG, NULL);
|
||||||
int ret = 0, status;
|
int ret = 0, status;
|
||||||
@ -2344,7 +2343,7 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
|
|||||||
const char *argv[DEFAULT_MAX_EXEC_ARGS + 7] = { /* Max supported args */
|
const char *argv[DEFAULT_MAX_EXEC_ARGS + 7] = { /* Max supported args */
|
||||||
find_config_tree_str_allow_empty(cmd, global_thin_repair_executable_CFG, NULL)
|
find_config_tree_str_allow_empty(cmd, global_thin_repair_executable_CFG, NULL)
|
||||||
};
|
};
|
||||||
char *dm_name, *trans_id_str;
|
char *trans_id_str;
|
||||||
char meta_path[PATH_MAX];
|
char meta_path[PATH_MAX];
|
||||||
char pms_path[PATH_MAX];
|
char pms_path[PATH_MAX];
|
||||||
uint64_t trans_id;
|
uint64_t trans_id;
|
||||||
@ -2376,16 +2375,14 @@ static int _lvconvert_thin_pool_repair(struct cmd_context *cmd,
|
|||||||
pmslv = pool_lv->vg->pool_metadata_spare_lv;
|
pmslv = pool_lv->vg->pool_metadata_spare_lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dm_name = dm_build_dm_name(cmd->mem, mlv->vg->name,
|
if (dm_snprintf(meta_path, sizeof(meta_path), "%s%s/%s",
|
||||||
mlv->name, NULL)) ||
|
cmd->dev_dir, mlv->vg->name, mlv->name) < 0) {
|
||||||
(dm_snprintf(meta_path, sizeof(meta_path), "%s/%s", dmdir, dm_name) < 0)) {
|
|
||||||
log_error("Failed to build thin metadata path.");
|
log_error("Failed to build thin metadata path.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dm_name = dm_build_dm_name(cmd->mem, pmslv->vg->name,
|
if (dm_snprintf(pms_path, sizeof(pms_path), "%s%s/%s",
|
||||||
pmslv->name, NULL)) ||
|
cmd->dev_dir, pmslv->vg->name, pmslv->name) < 0) {
|
||||||
(dm_snprintf(pms_path, sizeof(pms_path), "%s/%s", dmdir, dm_name) < 0)) {
|
|
||||||
log_error("Failed to build pool metadata spare path.");
|
log_error("Failed to build pool metadata spare path.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -2519,13 +2516,11 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
|
|||||||
struct logical_volume *cache_lv,
|
struct logical_volume *cache_lv,
|
||||||
struct dm_list *pvh, int poolmetadataspare)
|
struct dm_list *pvh, int poolmetadataspare)
|
||||||
{
|
{
|
||||||
const char *dmdir = dm_dir();
|
|
||||||
int ret = 0, status;
|
int ret = 0, status;
|
||||||
int args = 0;
|
int args = 0;
|
||||||
const char *argv[DEFAULT_MAX_EXEC_ARGS + 7] = { /* Max supported args */
|
const char *argv[DEFAULT_MAX_EXEC_ARGS + 7] = { /* Max supported args */
|
||||||
find_config_tree_str_allow_empty(cmd, global_cache_repair_executable_CFG, NULL)
|
find_config_tree_str_allow_empty(cmd, global_cache_repair_executable_CFG, NULL)
|
||||||
};
|
};
|
||||||
char *dm_name;
|
|
||||||
char meta_path[PATH_MAX];
|
char meta_path[PATH_MAX];
|
||||||
char pms_path[PATH_MAX];
|
char pms_path[PATH_MAX];
|
||||||
struct logical_volume *pool_lv;
|
struct logical_volume *pool_lv;
|
||||||
@ -2557,16 +2552,14 @@ static int _lvconvert_cache_repair(struct cmd_context *cmd,
|
|||||||
pmslv = cache_lv->vg->pool_metadata_spare_lv;
|
pmslv = cache_lv->vg->pool_metadata_spare_lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dm_name = dm_build_dm_name(cmd->mem, mlv->vg->name,
|
if (dm_snprintf(meta_path, sizeof(meta_path), "%s%s/%s",
|
||||||
mlv->name, NULL)) ||
|
cmd->dev_dir, mlv->vg->name, mlv->name) < 0) {
|
||||||
(dm_snprintf(meta_path, sizeof(meta_path), "%s/%s", dmdir, dm_name) < 0)) {
|
|
||||||
log_error("Failed to build cache metadata path.");
|
log_error("Failed to build cache metadata path.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(dm_name = dm_build_dm_name(cmd->mem, pmslv->vg->name,
|
if (dm_snprintf(pms_path, sizeof(pms_path), "%s%s/%s",
|
||||||
pmslv->name, NULL)) ||
|
cmd->dev_dir, pmslv->vg->name, pmslv->name) < 0) {
|
||||||
(dm_snprintf(pms_path, sizeof(pms_path), "%s/%s", dmdir, dm_name) < 0)) {
|
|
||||||
log_error("Failed to build pool metadata spare path.");
|
log_error("Failed to build pool metadata spare path.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user