1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-28 02:50:41 +03:00

lvm2app: Implementation of pv resize (v6)

Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
Tony Asleson 2013-03-13 14:39:56 -05:00
parent 4d5de8322b
commit d52b6be455
2 changed files with 17 additions and 5 deletions

View File

@ -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.
*

View File

@ -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;
}
}