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

pool: drop create spare on error path

When thin/cache pool creation fails and command created _pmspare,
such volume is now removed on error path.
This commit is contained in:
Zdenek Kabelac 2017-10-28 00:10:16 +02:00
parent 52fd66210b
commit 90ee7783b4
2 changed files with 8 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.176 -
===================================
Remove created spare LV when creation of thin-pool failed.
Avoid reading ignored metadata when mda gets used again.
Fix detection of moved PVs in vgsplit. (2.02.175)
Ignore --stripes/--stripesize on RAID takeover

View File

@ -1579,6 +1579,7 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
struct processing_params *pp = (struct processing_params *) handle->custom_handle;
struct lvcreate_params *lp = pp->lp;
struct lvcreate_cmdline_params *lcp = pp->lcp;
struct logical_volume *spare = vg->pool_metadata_spare_lv;
int ret = ECMD_FAILED;
if (!_read_activation_params(cmd, vg, lp))
@ -1652,6 +1653,12 @@ static int _lvcreate_single(struct cmd_context *cmd, const char *vg_name,
ret = ECMD_PROCESSED;
out:
if (ret != ECMD_PROCESSED && !spare && vg->pool_metadata_spare_lv)
/* Remove created spare volume for failed pool creation */
if (!lvremove_single(cmd, vg->pool_metadata_spare_lv, NULL))
log_error("Removal of created spare volume failed. "
"Manual intervention required.");
return ret;
}