mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-21 22:04:19 +03:00
lvconvert: validate name before prompt
Before prompting make sure name fits.
This commit is contained in:
parent
7ad57d55af
commit
fb38426d28
@ -2718,6 +2718,16 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
memcpy(&lockd_data_id, &lv->lvid.id[1], sizeof(struct id));
|
||||
}
|
||||
|
||||
/*
|
||||
* The internal LV names for pool data/meta LVs.
|
||||
*/
|
||||
|
||||
if ((dm_snprintf(meta_name, sizeof(meta_name), "%s%s", lv->name, to_cachepool ? "_cmeta" : "_tmeta") < 0) ||
|
||||
(dm_snprintf(data_name, sizeof(data_name), "%s%s", lv->name, to_cachepool ? "_cdata" : "_tdata") < 0)) {
|
||||
log_error("Failed to create internal lv names, pool name is too long.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If an existing LV is to be used as the metadata LV,
|
||||
* verify that it's in a usable state. These checks are
|
||||
@ -2842,7 +2852,6 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
|
||||
log_verbose("Pool metadata extents %u chunk_size %u", meta_extents, chunk_size);
|
||||
|
||||
|
||||
/*
|
||||
* Verify that user wants to use these LVs.
|
||||
*/
|
||||
@ -2869,16 +2878,6 @@ static int _lvconvert_to_pool(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* The internal LV names for pool data/meta LVs.
|
||||
*/
|
||||
|
||||
if ((dm_snprintf(meta_name, sizeof(meta_name), "%s%s", lv->name, to_cachepool ? "_cmeta" : "_tmeta") < 0) ||
|
||||
(dm_snprintf(data_name, sizeof(data_name), "%s%s", lv->name, to_cachepool ? "_cdata" : "_tdata") < 0)) {
|
||||
log_error("Failed to create internal lv names, pool name is too long.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If a new metadata LV needs to be created, collect the settings for
|
||||
* the new LV and create it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user