[lvm-devel] [PATCH 23/24] Extend lvm2api with lvm_lv_rename
Zdenek Kabelac
zkabelac at redhat.com
Sun Jan 30 12:57:46 UTC 2011
Add support for LV rename
Now useful now mainly for testing various combination of ops stacking.
(following patch).
Signed-off-by: Zdenek Kabelac <zkabelac at redhat.com>
---
liblvm/lvm2app.h | 16 ++++++++++++++++
liblvm/lvm_lv.c | 10 ++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index 317911d..cb7414c 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -1321,6 +1321,22 @@ int lvm_lv_remove_tag(lv_t lv, const char *tag);
*/
struct dm_list *lvm_lv_get_tags(const lv_t lv);
+/**
+ * Rename logical volume to new_name.
+ *
+ * \memberof lv_t
+ *
+ * \param lv
+ * Logical volume handle.
+ *
+ * \param new_name
+ * New name of logical volume.
+ *
+ * \return
+ * 0 (success) or -1 (failure).
+ *
+ */
+int lvm_lv_rename(lv_t lv, const char *new_name);
/**
* Resize logical volume to new_size bytes.
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index 664c39d..aef6c5e 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -282,6 +282,16 @@ lv_t lvm_lv_from_uuid(vg_t vg, const char *uuid)
}
return NULL;
}
+
+int lvm_lv_rename(lv_t lv, const char *new_name)
+{
+ if (!lv_rename(lv->vg->cmd, lv, new_name)) {
+ log_verbose("LV Rename failed.");
+ return -1;
+ }
+ return 0;
+}
+
int lvm_lv_resize(const lv_t lv, uint64_t new_size)
{
/* FIXME: add lv resize code here */
--
1.7.3.5
More information about the lvm-devel
mailing list