1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvremove: reuse existing dm_build_dm_uuid

Use existing dm_build_dm_uuid() to generate LV's DM UUID.
This commit is contained in:
Zdenek Kabelac 2024-05-30 14:17:33 +02:00
parent a8b8e1f074
commit 91502446ac

View File

@ -4784,26 +4784,6 @@ out:
return ret_max;
}
static void _lvremove_save_uuid(struct cmd_context *cmd, struct logical_volume *lv,
struct lvremove_params *lp)
{
char dm_uuid[DM_UUID_LEN] = { 0 };
/*
* Create the dm/uuid string that would be displayed
* in sysfs for this LV.
*
* DM_UUID_LEN is 129
* ID_LEN is 32
*/
memcpy(dm_uuid, "LVM-", 4);
memcpy(dm_uuid+4, &lv->vg->id, ID_LEN);
memcpy(dm_uuid+4+ID_LEN, &lv->lvid.id[1], ID_LEN);
if (!str_list_add(cmd->mem, &lp->removed_uuids, dm_pool_strdup(cmd->mem, dm_uuid)))
stack;
}
int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
struct processing_handle *handle)
{
@ -4820,8 +4800,11 @@ int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (!lv_remove_with_dependencies(cmd, lv, force, 0))
return_ECMD_FAILED;
if (cmd->scan_lvs && cmd->enable_devices_file)
_lvremove_save_uuid(cmd, lv, lp);
if (cmd->scan_lvs && cmd->enable_devices_file && lp)
/* save for removal */
if (!str_list_add(cmd->mem, &lp->removed_uuids,
dm_build_dm_uuid(cmd->mem, UUID_PREFIX, lv->lvid.s, NULL)))
stack;
return ECMD_PROCESSED;
}