diff options
author | Tony Asleson <tasleson@redhat.com> | 2013-03-13 14:39:56 -0500 |
---|---|---|
committer | Tony Asleson <tasleson@redhat.com> | 2013-07-02 14:24:33 -0500 |
commit | d52b6be455126e7b6a46c39127ca343982955b19 (patch) | |
tree | 25b78416b4cc77bb9b258c65094970bc11a840cb | |
parent | 4d5de8322b3a6050def60542b167b46d97b2824d (diff) | |
download | lvm2-d52b6be455126e7b6a46c39127ca343982955b19.tar.gz |
lvm2app: Implementation of pv resize (v6)
Signed-off-by: Tony Asleson <tasleson@redhat.com>
-rw-r--r-- | liblvm/lvm2app.h | 2 | ||||
-rw-r--r-- | liblvm/lvm_pv.c | 20 |
2 files changed, 17 insertions, 5 deletions
diff --git a/liblvm/lvm2app.h b/liblvm/lvm2app.h index b1d6abd58..633b026ee 100644 --- a/liblvm/lvm2app.h +++ b/liblvm/lvm2app.h @@ -1759,8 +1759,6 @@ pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid); * * \memberof pv_t * - * NOTE: This function is currently not implemented. - * * \param pv * Physical volume handle. * diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c index 3924af4b0..18b1069fe 100644 --- a/liblvm/lvm_pv.c +++ b/liblvm/lvm_pv.c @@ -123,7 +123,21 @@ pv_t lvm_pv_from_uuid(vg_t vg, const char *uuid) int lvm_pv_resize(const pv_t pv, uint64_t new_size) { - /* FIXME: add pv resize code here */ - log_error("NOT IMPLEMENTED YET"); - return -1; + uint64_t size = new_size >> SECTOR_SHIFT; + + if (new_size % SECTOR_SIZE) { + log_errno(EINVAL, "Size not a multiple of 512"); + return -1; + } + + if (!vg_check_write_mode(pv->vg)) { + return -1; + } + + if (!pv_resize(pv, pv->vg, size)) { + log_error("PV re-size failed!"); + return -1; + } else { + return 0; + } } |