1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-02-27 01:57:55 +03:00

Add lvm_vg_remove_lv liblvm function.

Add a very simple version of lvm_vg_remove_lv.
Since we currently can only create linear LVs, this simple remove function
is adequate.  We must refactor lvremove_single a bit.


Author: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2009-07-26 14:36:52 +00:00
parent c4510327d4
commit 7e3141512a
3 changed files with 18 additions and 0 deletions

View File

@ -30,3 +30,4 @@ lvm_vg_list_lvs
lvm_list_vg_names
lvm_list_vg_ids
lvm_vg_create_lv_linear
lvm_vg_remove_lv

View File

@ -116,6 +116,17 @@ int lvm_reload_config(lvm_t libh);
*/
lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size);
/**
* Remove a logical volume from a volume group.
* This API commits the change to disk and does _not_ require calling
* lvm_vg_write.
* Currently only removing linear LVs are possible.
*
* FIXME: This API should probably not commit to disk but require calling
* lvm_vg_write.
*/
int lvm_vg_remove_lv(lv_t *lv);
/**
* Return stored error no describing last LVM API error.
*

View File

@ -96,3 +96,9 @@ lv_t *lvm_vg_create_lv_linear(vg_t *vg, const char *name, uint64_t size)
return lvl->lv;
}
int lvm_vg_remove_lv(lv_t *lv)
{
if (!lv || !lv->vg || vg_read_error(lv->vg))
return 0;
return lv_remove_single(lv->vg->cmd, lv, DONT_PROMPT);
}