diff options
author | Mike Snitzer <snitzer@redhat.com> | 2010-02-03 03:58:08 +0000 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2010-02-03 03:58:08 +0000 |
commit | 5bc2af2688e8ea1926a8bd0ce49aab4bcfad56ae (patch) | |
tree | 07f98b7c5194c88c156cfbd5ddb158625b398333 /tools/lvcreate.c | |
parent | ddd6c357badd1e9c8161a4f81ccbf53537e16d92 (diff) | |
download | lvm2-5bc2af2688e8ea1926a8bd0ce49aab4bcfad56ae.tar.gz lvm2-5bc2af2688e8ea1926a8bd0ce49aab4bcfad56ae.tar.xz lvm2-5bc2af2688e8ea1926a8bd0ce49aab4bcfad56ae.zip |
Add %ORIGIN support to lv{create,extend,reduce,resize} --extents option
Allow the number of logical extents to be expressed (for a snapshot) as
a percentage of the total space in the Origin Logical Volume with the
suffix %ORIGIN.
Update the relevant man pages accordingly. Eliminate inconsistencies
between the man pages and tools/commands.h
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'tools/lvcreate.c')
-rw-r--r-- | tools/lvcreate.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/lvcreate.c b/tools/lvcreate.c index 0cfd1403..211cfebb 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -130,6 +130,7 @@ static int _update_extents_params(struct volume_group *vg, struct lvcreate_cmdline_params *lcp) { uint32_t pv_extent_count; + struct logical_volume *origin = NULL; if (lcp->size && !(lp->extents = extents_from_size(vg->cmd, lcp->size, @@ -171,6 +172,15 @@ static int _update_extents_params(struct volume_group *vg, log_error("Please express size as %%VG, %%PVS, or " "%%FREE."); return 0; + case PERCENT_ORIGIN: + if (lp->snapshot && lp->origin && + !(origin = find_lv(vg, lp->origin))) { + log_error("Couldn't find origin volume '%s'.", + lp->origin); + return 0; + } + lp->extents = lp->extents * origin->le_count / 100; + break; case PERCENT_NONE: break; } |