diff options
author | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-26 14:36:52 +0000 |
---|---|---|
committer | Dave Wysochanski <dwysocha@redhat.com> | 2009-07-26 14:36:52 +0000 |
commit | 8bcb96836df083f4cafb9ddf9066f2b57c0a08af (patch) | |
tree | 135c7d198e8da8e206f2aca6cbef8c09edd2ac77 /liblvm | |
parent | 90e0faf3db9afff67741ea96f667cbb4d03fc5e0 (diff) | |
download | lvm2-8bcb96836df083f4cafb9ddf9066f2b57c0a08af.tar.gz lvm2-8bcb96836df083f4cafb9ddf9066f2b57c0a08af.tar.xz lvm2-8bcb96836df083f4cafb9ddf9066f2b57c0a08af.zip |
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>
Diffstat (limited to 'liblvm')
-rw-r--r-- | liblvm/.exported_symbols | 1 | ||||
-rw-r--r-- | liblvm/lvm.h | 11 | ||||
-rw-r--r-- | liblvm/lvm_lv.c | 6 |
3 files changed, 18 insertions, 0 deletions
diff --git a/liblvm/.exported_symbols b/liblvm/.exported_symbols index bf184322..7ae1c998 100644 --- a/liblvm/.exported_symbols +++ b/liblvm/.exported_symbols @@ -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 diff --git a/liblvm/lvm.h b/liblvm/lvm.h index a39f1980..2bb36eef 100644 --- a/liblvm/lvm.h +++ b/liblvm/lvm.h @@ -117,6 +117,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. * * Users of liblvm should use lvm_errno to determine success or failure diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c index 7a7bfb30..556d4579 100644 --- a/liblvm/lvm_lv.c +++ b/liblvm/lvm_lv.c @@ -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); +} |