From dad7e2f052dfd6c494eafc40477eab8380344672 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Fri, 24 Mar 2017 17:32:04 -0700 Subject: [PATCH] Function to create a thin pool --- lvm/lang/en | 2 +- lvm/lvm-lib.pl | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lvm/lang/en b/lvm/lang/en index 14dd62d42..cd8361f9e 100644 --- a/lvm/lang/en +++ b/lvm/lang/en @@ -195,7 +195,7 @@ thin_desc=A thin pool is a pair of LVs that can be used to create additional LVs thin_header=New thin pool details thin_datalv=Existing LV for data thin_metadatalv=Existing LV for metadata -thin_ok=Convert LVs Into Thin Pool +thin_ok=Convert LVs To Thin Pool thin_elvs=No LVs that are not already in use were found in this VG! thin_err=Failed to create thin pool thin_esame=Both selected LVs are the same diff --git a/lvm/lvm-lib.pl b/lvm/lvm-lib.pl index 64bedd7cc..9b16980f4 100755 --- a/lvm/lvm-lib.pl +++ b/lvm/lvm-lib.pl @@ -875,5 +875,17 @@ return $out =~ /^(\d+)\./ && $1 >= 3 || $out =~ /^(\d+)\.(\d+)\.(\d+)/ && $1 == 2 && $2 == 6 && $3 >= 35; } +# create_thin_pool(&data-lv, &metadata-lv) +# Convert two LVs into a thin pool +sub create_thin_pool +{ +local ($datalv, $metadatalv) = @_; +local $cmd = "lvconvert --type thin-pool --poolmetadata ". + quotemeta($metadatalv->{'device'})." ". + quotemeta($datalv->{'device'}); +local $out = &backquote_logged("$cmd 2>&1