LVM thin pool form

This commit is contained in:
Jamie Cameron
2017-03-24 16:13:40 -07:00
parent 5a69c9ddbd
commit dcd57e44c0
3 changed files with 54 additions and 0 deletions

View File

@ -156,6 +156,10 @@ if (@vgs) {
"<a href='edit_lv.cgi?vg=".&urlize($v->{'name'}).
"&snap=1'>".&text('index_addlv2s', $v->{'name'}).
"</a>");
push(@links,
"<a href='thin_form.cgi?vg=".&urlize($v->{'name'}).
"'>".&text('index_addlv3', $v->{'name'}).
"</a>");
}
}
if (!@alllvs) {

View File

@ -12,6 +12,7 @@ i2ndex_addpv=Add a physical volume to the group.
index_addpv2=Add a physical volume to <tt>$1</tt>.
index_addlv2=Create a logical volume in <tt>$1</tt>.
index_addlv2s=Create a snapshot in <tt>$1</tt>.
index_addlv3=Create a thin pool in <tt>$1</tt>.
index_addlv=Create a new logical volume.
index_addsnap=Create a new snapshot.
index_return=volume groups
@ -189,6 +190,14 @@ pvmove_start=Moving logical volume $1 from $2 to $3 ..
pvmove_failed=.. move failed!
pvmove_done=.. move complete
thin_title=Create Thin Pool
thin_desc=A thin pool is a pair of LVs that can be used to create additional LVs that can be larger than the available extents. Space is only consumed when needed, rather than when the LVs inside the pool are created.
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_elvs=No LVs that are not already in use were found in this VG!
log_create_vg=Created volume group $1
log_modify_vg=Modified volume group $1
log_delete_vg=Deleted volume group $1

41
lvm/thin_form.cgi Normal file
View File

@ -0,0 +1,41 @@
#!/usr/local/bin/perl
# Display a form for creating a new thinpool from two LVs
require './lvm-lib.pl';
&ReadParse();
($vg) = grep { $_->{'name'} eq $in{'vg'} } &list_volume_groups();
$vg || &error($text{'vg_egone'});
# Find LVs that aren't in use
my @lvs;
foreach my $lv (&list_logical_volumes($in{'vg'})) {
next if ($lv->{'is_snap'});
my @stat = &device_status($lv->{'device'});
next if (@stat);
push(@lvs, $lv);
}
@lvs || &error($text{'thin_elvs'});
@lvsel = map { [ $_->{'name'},
$_->{'name'}." (".&nice_size($_->{'size'} * 1024).")" ] } @lvs;
$vgdesc = &text('lv_vg', $vg->{'name'});
&ui_print_header($vgdesc, $text{'thin_title'}, "");
print $text{'thin_desc'},"<p>\n";
print &ui_form_start("thin_create.cgi", "post");
print &ui_hidden("vg", $in{'vg'});
print &ui_table_start($text{'thin_header'}, undef, 2);
# Data LV
print &ui_table_row($text{'thin_datalv'},
&ui_select("data", undef, \@lvsel));
# Metadata LV
print &ui_table_row($text{'thin_metadatalv'},
&ui_select("metadata", undef, \@lvsel));
print &ui_table_end();
print &ui_form_end([ [ undef, $text{'thin_ok'} ] ]);
&ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});