diff options
author | Tony Asleson <tasleson@redhat.com> | 2013-03-13 18:07:16 -0400 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2013-07-02 14:24:33 -0500 |
commit | 49d7596581be013ec71a1da7897f861b721eaa19 (patch) | |
tree | 3585188e740c672b57f7a45e2840f5e75b46b43c /liblvm | |
parent | c43ce46ba796d92382b386bbeee933fc7479a9cd (diff) | |
download | lvm2-49d7596581be013ec71a1da7897f861b721eaa19.tar.gz |
lvm2app: Implement lv resize (v3)
Simplified version of lv resize.
v3: Rebase changes to make work. Needed to set sizeargs = 1
to indicate to resize that we are asking for a size based
resize.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Diffstat (limited to 'liblvm')
-rw-r--r-- | liblvm/lvm2app.h | 2 | ||||
-rw-r--r-- | liblvm/lvm_lv.c | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h index 633b026ee..25778d155 100644 --- a/liblvm/lvm2app.h +++ b/liblvm/lvm2app.h @@ -1374,8 +1374,6 @@ int lvm_lv_rename(lv_t lv, const char *new_name); * * \memberof lv_t * - * NOTE: This function is currently not implemented. - * * \param lv * Logical volume handle. * diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c index 2039126a0..d0f89f112 100644 --- a/liblvm/lvm_lv.c +++ b/liblvm/lvm_lv.c @@ -318,9 +318,23 @@ int lvm_lv_rename(lv_t lv, const char *new_name) int lvm_lv_resize(const lv_t lv, uint64_t new_size) { - /* FIXME: add lv resize code here */ - log_error("NOT IMPLEMENTED YET"); - return -1; + struct lvresize_params lp = { 0 }; + + lp.vg_name = lv->vg->name; + lp.lv_name = lv->name; + lp.sign = SIGN_NONE; + lp.percent = PERCENT_NONE; + lp.resize = LV_ANY; + lp.size = new_size >> SECTOR_SHIFT; + lp.ac_force = 1; /* Assume the user has a good backup? */ + lp.sizeargs = 1; + + if (ECMD_PROCESSED != lv_resize(lv->vg->cmd, lv->vg, &lp, &lv->vg->pvs)) { + log_verbose("LV Re-size failed."); + return -1; + } + + return 0; } lv_t lvm_lv_snapshot(const lv_t lv, const char *snap_name, uint64_t max_snap_size) |