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

vdo: enhance error path

When the conversion to VDO fails, try to restore previous VG state
and also remove orphan DM node from table.
This commit is contained in:
Zdenek Kabelac 2024-05-03 21:12:45 +02:00
parent 1f92fc2af7
commit a6f4aed3c0

View File

@ -572,8 +572,20 @@ int create_pool(struct logical_volume *pool_lv,
if (!lv_add_segment(ah, 0, stripes, pool_lv, striped, stripe_size, 0, 0))
goto_bad;
if (pool_lv->vg->cmd->lvcreate_vcp && !convert_vdo_lv(pool_lv, pool_lv->vg->cmd->lvcreate_vcp))
if (pool_lv->vg->cmd->lvcreate_vcp && !convert_vdo_lv(pool_lv, pool_lv->vg->cmd->lvcreate_vcp)) {
/* Conversion to VDO commits metadata,
* try to deactivate pool LV, and remove metadata LV */
if (!deactivate_lv(pool_lv->vg->cmd, pool_lv))
log_error("Failedto deactivate pool volume %s.",
display_lvname(pool_lv));
if (!lv_remove(meta_lv) ||
!vg_write(meta_lv->vg) || !vg_commit(meta_lv->vg))
log_error("Manual intervention may be required to "
"remove abandoned LV(s) before retrying.");
goto_bad;
}
if (!(data_lv = insert_layer_for_lv(pool_lv->vg->cmd, pool_lv,
pool_lv->status,