summaryrefslogtreecommitdiffstats
path: root/liblvm
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2011-01-27 23:41:32 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2012-08-27 13:02:42 +0200
commite52d3167518f5ebbb0296b117a1266874978612f (patch)
tree2ffec07970629ca8995543665be07e3086ead423 /liblvm
parent92330ba9c8e21451f8406377ae4839f397f369a2 (diff)
downloadlvm2-e52d3167518f5ebbb0296b117a1266874978612f.tar.gz
lvm2-e52d3167518f5ebbb0296b117a1266874978612f.tar.xz
lvm2-e52d3167518f5ebbb0296b117a1266874978612f.zip
lvm2api: extend lvm2api with lvm_lv_rename
Add support for LV rename.
Diffstat (limited to 'liblvm')
-rw-r--r--liblvm/lvm2app.h16
-rw-r--r--liblvm/lvm_lv.c10
2 files changed, 26 insertions, 0 deletions
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h
index 72c0d79f..b7589455 100644
--- a/liblvm/lvm2app.h
+++ b/liblvm/lvm2app.h
@@ -1343,6 +1343,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 2d4dc023..d47a8578 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -292,6 +292,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 */