Function to create a thin pool

This commit is contained in:
Jamie Cameron
2017-03-24 17:32:04 -07:00
parent 01dcde3e62
commit dad7e2f052
2 changed files with 13 additions and 1 deletions

View File

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

View File

@@ -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 </dev/null");
return $? ? $out : undef;
}
1;