Fixed display of space used on each physical volume by a logical volume for LVM version 2.
---- Changes since 1.390 ----
Re-designed the module's main page to use tabs, and added an option to show volumes and groups in tables (with more information) instead of using icons.
+Converted all user interface code to use the new Webmin UI library.
$vg->{'pe_size'} };
}
-print "<form action=save_lv.cgi>\n";
-print "<input type=hidden name=vg value='$in{'vg'}'>\n";
-print "<input type=hidden name=lv value='$in{'lv'}'>\n";
-print "<input type=hidden name=snap value='$in{'snap'}'>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'lv_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
+print &ui_form_start("save_lv.cgi");
+print &ui_hidden("vg", $in{'vg'});
+print &ui_hidden("lv", $in{'lv'});
+print &ui_hidden("snap", $in{'snap'});
+print &ui_table_start($text{'lv_header'}, "width=100%", 4);
if ($stat[2]) {
- print "<tr> <td><b>$text{'lv_name'}</b></td>\n";
- print "<td>$lv->{'name'}</td>\n";
+ # Current status
+ print &ui_table_row($text{'lv_name'}, $lv->{'name'});
- print "<td><b>$text{'lv_size'}</b></td>\n";
- print "<td>",&nice_size($lv->{'size'}*1024),"</td> </tr>\n";
+ print &ui_table_row($text{'lv_size'}, &nice_size($lv->{'size'}*1024));
}
else {
- print "<tr> <td><b>$text{'lv_name'}</b></td>\n";
- print "<td><input name=name size=15 value='$lv->{'name'}'></td>\n";
+ # Details for new LV
+ print &ui_table_row($text{'lv_name'},
+ &ui_textbox("name", $lv->{'name'}, 20));
- print "<td><b>$text{'lv_size'}</b></td>\n";
- print "<td><input name=size size=8 value='$lv->{'size'}'> kB</td> </tr>\n";
+ print &ui_table_row($text{'lv_size'},
+ &ui_textbox("size", $lv->{'size'}, 8)." kB");
}
-print "<tr> <td><b>$text{'lv_petotal'}</b></td>\n";
-print "<td>",&text('lv_petotals', $vg->{'pe_alloc'}, $vg->{'pe_total'}),
- "</td>\n";
+# Number of physical extents
+print &ui_table_row($text{'lv_petotal'},
+ &text('lv_petotals', $vg->{'pe_alloc'}, $vg->{'pe_total'}));
-print "<td><b>$text{'lv_pesize'}</b></td>\n";
-print "<td>$vg->{'pe_size'} kB</td> </tr>\n";
+# Extent size
+print &ui_table_row($text{'lv_pesize'},
+ &nice_size($vg->{'pe_size'}*1024));
if ($in{'lv'}) {
- print "<tr> <td><b>$text{'lv_device'}</b></td>\n";
- print "<td><tt>$lv->{'device'}</tt></td>\n";
+ # Device file and current status
+ print &ui_table_row($text{'lv_device'}, "<tt>$lv->{'device'}</tt>");
- print "<td><b>$text{'lv_status'}</b></td> <td>\n";
- if (!@stat) {
- print $text{'lv_notused'};
- }
- else {
- $msg = &device_message(@stat);
- print $msg;
- }
- print "</td> </tr>\n";
+ print &ui_table_row($text{'lv_status'},
+ @stat ? &device_message(@stat) : $text{'lv_notused'});
}
if ($lv->{'is_snap'}) {
- print "<tr> <td><b>$text{'lv_snapof'}</b></td> <td>\n";
if ($in{'lv'}) {
# Show which LV this is a snapshot of
local @snapof = grep { $_->{'size'} == $lv->{'size'} &&
$_->{'has_snap'} } @lvs;
if (@snapof == 1) {
- print "<tt>$snapof[0]->{'name'}</tt>";
+ $snapsel = "<tt>$snapof[0]->{'name'}</tt>";
}
else {
- print "<i>$text{'lv_nosnap'}</i>";
+ $snapsel = "<i>$text{'lv_nosnap'}</i>";
}
}
else {
# Allow selection of snapshot source
- print "<select name=snapof>\n";
- foreach $l (@lvs) {
- print "<option>$l->{'name'}\n" if (!$l->{'is_snap'});
- }
- print "</select>\n";
+ $snapsel = &ui_select("snapof", undef,
+ [ map { $_->{'name'} } grep { !$_->{'is_snap'} } @lvs ]);
}
- print "</td> </tr>\n";
+ print &ui_table_row($text{'lv_snapof'}, $snapsel);
}
elsif ($stat[2]) {
# Display current permissons and allocation method
- print "<tr> <td><b>$text{'lv_perm'}</b></td>\n";
- print "<td>",$text{"lv_perm".$lv->{'perm'}},"</td>\n";
+ print &ui_table_row($text{'lv_perm'},
+ $text{"lv_perm".$lv->{'perm'}});
- print "<td><b>$text{'lv_alloc'}</b></td>\n";
- print "<td>",$text{"lv_alloc".$lv->{'alloc'}},"</td> </tr>\n";
+ print &ui_table_row($text{'lv_alloc'},
+ $text{"lv_alloc".$lv->{'alloc'}});
}
else {
# Allow editing of permissons and allocation method
- print "<tr> <td><b>$text{'lv_perm'}</b></td>\n";
- printf "<td><input type=radio name=perm value=rw %s> %s\n",
- $lv->{'perm'} eq 'rw' ? 'checked' : '', $text{'lv_permrw'};
- printf "<input type=radio name=perm value=r %s> %s</td>\n",
- $lv->{'perm'} eq 'r' ? 'checked' : '', $text{'lv_permr'};
+ print &ui_table_row($text{'lv_perm'},
+ &ui_radio("perm", $lv->{'perm'},
+ [ [ 'rw', $text{'lv_permrw'} ],
+ [ 'r', $text{'lv_permr'} ] ]));
- print "<td><b>$text{'lv_alloc'}</b></td>\n";
- printf "<td><input type=radio name=alloc value=y %s> %s\n",
- $lv->{'alloc'} eq 'y' ? 'checked' : '', $text{'lv_allocy'};
- printf "<input type=radio name=alloc value=n %s> %s</td> </tr>\n",
- $lv->{'alloc'} eq 'n' ? 'checked' : '', $text{'lv_allocn'};
+ print &ui_table_row($text{'lv_alloc'},
+ &ui_radio("alloc", $lv->{'alloc'},
+ [ [ 'y', $text{'lv_allocy'} ],
+ [ 'n', $text{'lv_allocn'} ] ]));
}
if (!$in{'lv'} && !$lv->{'is_snap'}) {
# Allow selection of striping
- print "<tr> <td><b>$text{'lv_stripe'}</b></td> <td colspan=3>\n";
- printf "<input type=radio name=stripe_def value=1 checked> %s\n",
- $text{'lv_nostripe'};
- print "<input type=radio name=stripe_def value=0>\n";
- print &text('lv_stripes', "<input name=stripe size=4>"),
- "</td> </tr>\n";
+ print &ui_table_row($text{'lv_stripe'},
+ &ui_opt_textbox("stripe", undef, 4, $text{'lv_nostripe'},
+ $text{'lv_stripes2'}), 3);
}
elsif (!$lv->{'is_snap'}) {
# Show current striping
- print "<tr> <td><b>$text{'lv_stripe'}</b></td> <td colspan=3>\n";
- if ($lv->{'stripes'} > 1) {
- print &text('lv_stripes', $lv->{'stripes'});
- }
- else {
- print $text{'lv_nostripe'};
- }
- print "</td> </tr>\n";
+ print &ui_table_row($text{'lv_stripe'},
+ $lv->{'stripes'} > 1 ? &text('lv_stripes', $lv->{'stripes'})
+ : $text{'lv_nostripe'}, 3);
}
# Show free disk space
if (@stat && $stat[2]) {
($total, $free) = &mount::disk_space($stat[1], $stat[0]);
- print "<tr> <td><b>$text{'lv_freedisk'}</b></td> <td>\n";
- print &nice_size($free*1024),"</td>\n";
+ print &ui_table_row($text{'lv_freedisk'},
+ &nice_size($free*1024));
- print "<td><b>$text{'lv_free'}</b></td> <td>\n";
- printf "%d %%\n", $total ? 100 * $free / $total : 0;
- print "</td> </tr>\n";
+ print &ui_table_row($text{'lv_free'},
+ ($total ? 100 * $free / $total : 0)." %");
}
# Show extents on PVs
@pvinfo = &get_logical_volume_usage($lv);
if (@pvinfo) {
@pvs = &list_physical_volumes($in{'vg'});
- print "<tr> <td><b>$text{'lv_pvs'}</b></td> <td colspan=3>\n";
foreach $p (@pvinfo) {
- print " , \n" if ($p ne $pvinfo[0]);
($pv) = grep { $_->{'name'} eq $p->[0] } @pvs;
- print "<a href='edit_pv.cgi?vg=$in{'vg'}&pv=$pv->{'name'}'>$pv->{'name'}</a> ";
- print &nice_size($p->[1]*$pv->{'pe_size'}*1024),"\n";
+ push(@pvlist, "<a href='edit_pv.cgi?vg=$in{'vg'}&pv=$pv->{'name'}'>$pv->{'name'}</a> ".&nice_size($p->[1]*$pv->{'pe_size'}*1024));
}
- print "</td> </tr>\n";
+ print &ui_table_row($text{'lv_pvs'}, join(" , ", @pvlist), 3);
}
}
-print "</table></td></tr></table>\n";
-print "<table width=100%><tr>\n";
+print &ui_table_end();
if ($stat[2]) {
- print "<td><b>$text{'lv_cannot'}</b></td>\n";
+ # In use - cannot be edited
+ print &ui_form_end();
+ print "<b>$text{'lv_cannot'}</b><p>\n";
}
elsif ($in{'lv'}) {
- print "<td><input type=submit value='$text{'save'}'></td>\n";
- print "<td align=right><input type=submit name=delete ",
- "value='$text{'delete'}'></td>\n";
+ print &ui_form_end([ [ undef, $text{'save'} ],
+ [ 'delete', $text{'delete'} ] ]);
}
else {
- print "<td><input type=submit value='$text{'create'}'></td>\n";
+ print &ui_form_end([ [ undef, $text{'create'} ] ]);
}
-print "</tr></table></form>\n";
if ($in{'lv'} && !$stat[2] && !$lv->{'is_snap'}) {
# Show button for creating filesystems
print "<hr>\n";
- print "<table width=100%><tr>\n";
- print "<form action=mkfs_form.cgi>\n";
- print "<input type=hidden name=dev value='$lv->{'device'}'>\n";
- print "<td nowrap><input type=submit value='$text{'lv_mkfs'}'>\n";
- print "<select name=fs>\n";
+ print &ui_buttons_start();
+
$fstype = $stat[1] || "ext3";
- foreach $f (&fdisk::supported_filesystems()) {
- printf "<option value=%s %s>%s (%s)\n",
- $f, $fstype eq $f ? "selected" : "",
- $fdisk::text{"fs_$f"}, $f;
- }
- print "</select></td>\n";
- print "<td>$text{'lv_mkfsdesc'}</td>\n";
- print "</form></tr>\n";
+ print &ui_buttons_row("mkfs_form.cgi", $text{'lv_mkfs'},
+ $text{'lv_mkfsdesc'},
+ &ui_hidden("dev", $lv->{'device'}),
+ &ui_select("fs", $fstype,
+ [ map { [ $_, $fdisk::text{"fs_".$_}." ($_)" ] }
+ &fdisk::supported_filesystems() ]));
if (!@stat) {
# Show button for mounting
$type = $config{'lasttype_'.$lv->{'device'}} || "ext2";
- print "<tr> <form action=../mount/edit_mount.cgi>\n";
- print "<input type=hidden name=type value=$type>\n";
- print "<input type=hidden name=newdev value=$lv->{'device'}>\n";
- print "<td valign=top>\n";
- print "<input type=submit value=\"",$text{'lv_newmount'},"\">\n";
- print "<input name=newdir size=20></td>\n";
- print "<td>$text{'lv_mountmsg'}</td> </tr>\n";
- print "</form> </tr>\n";
+ print &ui_buttons_row("../mount/edit_mount.cgi",
+ $text{'lv_newmount'},
+ $text{'lv_mountmsg'},
+ &ui_hidden("type", $type).
+ &ui_hidden("newdev", $lv->{'device'}),
+ &ui_textbox("newdir", "", 20));
}
- print "</table>\n";
+ print &ui_buttons_end();
}
-&ui_print_footer("", $text{'index_return'});
+&ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});
$pv = { 'alloc' => 'y' };
}
-print "<form action=save_pv.cgi>\n";
-print "<input type=hidden name=vg value='$in{'vg'}'>\n";
-print "<input type=hidden name=pv value='$in{'pv'}'>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'pv_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
+print &ui_form_start("save_pv.cgi");
+print &ui_hidden("vg", $in{'vg'});
+print &ui_hidden("pv", $in{'pv'});
+print &ui_table_start($text{'pv_header'}, "width=100%", 4);
-print "<tr> <td><b>$text{'pv_device'}</b></td> <td colspan=3>\n";
+# Device file
if ($in{'pv'}) {
- local $name = &foreign_call("mount", "device_name", $pv->{'device'});
- print "$name\n";
+ print &ui_table_row($text{'pv_device'},
+ &mount::device_name($pv->{'device'}), 3);
}
else {
- &device_input();
+ print &ui_table_row($text{'pv_device'}, &device_input(), 3);
}
-print "</td> </tr>\n";
-print "<tr> <td><b>$text{'pv_alloc'}</b></td>\n";
-printf "<td><input type=radio name=alloc value=y %s> %s\n",
- $pv->{'alloc'} eq 'y' ? 'checked' : '', $text{'yes'};
-printf "<input type=radio name=alloc value=n %s> %s</td>\n",
- $pv->{'alloc'} eq 'n' ? 'checked' : '', $text{'no'};
+# Enabled for allocation
+print &ui_table_row($text{'pv_alloc'},
+ &ui_radio('alloc', $pv->{'alloc'}, [ [ 'y', $text{'yes'} ],
+ [ 'n', $text{'no'} ] ]));
if ($in{'pv'}) {
- print "<td><b>$text{'pv_size'}</b></td>\n";
- print "<td>",&nice_size($pv->{'size'}*1024),"</td> </tr>\n";
+ # Details of existing PV
+ print &ui_table_row($text{'pv_size'},
+ &nice_size($pv->{'size'}*1024));
- print "<tr> <td><b>$text{'pv_petotal'}</b></td>\n";
- print "<td>",&text('lv_petotals', $pv->{'pe_alloc'}, $pv->{'pe_total'}),
- "</td>\n";
+ print &ui_table_row($text{'pv_petotal'},
+ &text('lv_petotals', $pv->{'pe_alloc'}, $pv->{'pe_total'}));
- print "<td><b>$text{'pv_pesize'}</b></td>\n";
- print "<td>$pv->{'pe_size'} kB</td> </tr>\n";
+ print &ui_table_row($text{'pv_pesize'},
+ &nice_size($pv->{'pe_size'}*1024));
- print "<tr> <td><b>$text{'pv_petotal2'}</b></td>\n";
- print "<td>",&text('lv_petotals', &nice_size($pv->{'pe_alloc'}*$pv->{'pe_size'}*1024), &nice_size($pv->{'pe_total'}*$pv->{'pe_size'}*1024)),
- "</td>\n";
-
- print "</tr>\n";
+ print &ui_table_row($text{'pv_petotal2'},
+ &text('lv_petotals', &nice_size($pv->{'pe_alloc'}*$pv->{'pe_size'}*1024), &nice_size($pv->{'pe_total'}*$pv->{'pe_size'}*1024)));
+ # Used by logical volumes
@lvinfo = &get_physical_volume_usage($pv);
if (@lvinfo) {
@lvs = &list_logical_volumes($in{'vg'});
- print "<tr> <td><b>$text{'pv_lvs'}</b></td> <td colspan=3>\n";
foreach $l (@lvinfo) {
- print " , \n" if ($l ne $lvinfo[0]);
($lv) = grep { $_->{'name'} eq $l->[0] } @lvs;
- print "<a href='edit_lv.cgi?vg=$in{'vg'}&lv=$lv->{'name'}'>$lv->{'name'}</a> ";
- print &nice_size($l->[2]*$pv->{'pe_size'}*1024),"\n";
+ push(@lvlist, "<a href='edit_lv.cgi?vg=$in{'vg'}&lv=$lv->{'name'}'>$lv->{'name'}</a> ".&nice_size($l->[2]*$pv->{'pe_size'}*1024));
}
- print "</td> </tr>\n";
+ print &ui_table_row($text{'pv_lvs'}, join(" , ", @lvlist), 3);
}
}
-else {
- print "</tr>\n";
- }
-print "</table></td></tr></table>\n";
-print "<table width=100%><tr>\n";
+print &ui_table_end();
if ($in{'pv'}) {
- print "<td><input type=submit value='$text{'save'}'></td>\n";
- print "<td align=right><input type=submit name=delete ",
- " value='$text{'pv_delete2'}'></td>\n" if (@pvs > 1);
+ print &ui_form_end([ [ undef, $text{'save'} ],
+ @pvs > 1 ? ( [ 'delete', $text{'pv_delete2'} ] )
+ : ( ) ]);
}
else {
- print "<td><input type=submit value='$text{'pv_create2'}'></td>\n";
+ print &ui_form_end([ [ undef, $text{'pv_create2'} ] ]);
}
-print "</tr></table>\n";
-&ui_print_footer("", $text{'index_return'});
+&ui_print_footer("index.cgi?mode=pvs", $text{'index_return'});
&ui_print_header(undef, $text{'vg_create'}, "");
}
-print "<form action=save_vg.cgi>\n";
-print "<input type=hidden name=vg value='$in{'vg'}'>\n";
-print "<table border width=100%>\n";
-print "<tr $tb> <td><b>$text{'vg_header'}</b></td> </tr>\n";
-print "<tr $cb> <td><table width=100%>\n";
+print &ui_form_start("save_vg.cgi");
+print &ui_hidden("vg", $in{'vg'});
+print &ui_table_start($text{'vg_header'}, "width=100%", 4);
-print "<tr> <td><b>$text{'vg_name'}</b></td>\n";
-print "<td><input name=name size=20 value='$vg->{'name'}'></td>\n";
+# VG name
+print &ui_table_row($text{'vg_name'},
+ &ui_textbox("name", $vg->{'name'}, 20));
if ($in{'vg'}) {
- print "<td><b>$text{'vg_size'}</b></td>\n";
- print "<td>",&nice_size($vg->{'size'}*1024),"</td> </tr>\n";
+ # Details of existing VG
+ print &ui_table_row($text{'vg_size'},
+ &nice_size($vg->{'size'}*1024));
- print "<tr> <td><b>$text{'vg_petotal'}</b></td>\n";
- print "<td>",&text('lv_petotals', $vg->{'pe_alloc'}, $vg->{'pe_total'}),
- "</td>\n";
+ print &ui_table_row($text{'vg_petotal'},
+ &text('lv_petotals', $vg->{'pe_alloc'}, $vg->{'pe_total'}));
- print "<td><b>$text{'vg_pesize'}</b></td>\n";
- print "<td>$vg->{'pe_size'} kB</td> </tr>\n";
+ print &ui_table_row($text{'vg_pesize'},
+ &nice_size($vg->{'pe_size'}*1024));
- print "<tr> <td><b>$text{'vg_petotal2'}</b></td>\n";
- print "<td>",&text('lv_petotals', &nice_size($vg->{'pe_alloc'}*$vg->{'pe_size'}*1024), &nice_size($vg->{'pe_total'}*$vg->{'pe_size'}*1024)),"</td>\n";
-
- print "</tr>\n";
+ print &ui_table_row($text{'vg_petotal2'},
+ &text('lv_petotals',
+ &nice_size($vg->{'pe_alloc'}*$vg->{'pe_size'}*1024),
+ &nice_size($vg->{'pe_total'}*$vg->{'pe_size'}*1024)));
}
else {
- print "<td><b>$text{'vg_pesize'}</b></td>\n";
- print "<td><input type=radio name=pesize_def value=1 checked> ",
- $text{'default'},"\n";
- print "<input type=radio name=pesize_def value=0>\n";
- print "<input name=pesize size=8> kB</td> </tr>\n";
+ # Extent size for new VG
+ print &ui_table_row($text{'vg_pesize'},
+ &ui_opt_textbox("pesize", undef, 8, $text{'default'})." kB");
- print "<tr> <td><b>$text{'vg_device'}</b></td> <td colspan=3>\n";
- &device_input();
- print "</td> </tr>\n";
+ print &ui_table_row($text{'vg_device'},
+ &device_input(), 3);
}
-print "</table></td></tr></table>\n";
-print "<table width=100%><tr>\n";
+print &ui_table_end();
if ($in{'vg'}) {
- print "<td><input type=submit value='$text{'save'}'></td>\n";
- print "<td align=right><input type=submit name=delete ",
- " value='$text{'delete'}'></td>\n";
+ print &ui_form_end([ [ undef, $text{'save'} ],
+ [ 'delete', $text{'delete'} ] ]);
}
else {
- print "<td><input type=submit value='$text{'create'}'></td>\n";
+ print &ui_form_end([ [ undef, $text{'create'} ] ]);
}
print "</tr></table>\n";
-&ui_print_footer("", $text{'index_return'});
+&ui_print_footer("index.cgi?mode=vgs", $text{'index_return'});
foreach $v (@vgs) {
push(@links, "<a href='edit_lv.cgi?vg=".&urlize($v->{'name'}).
"'>".&text('index_addlv2', $v->{'name'})."</a>");
- push(@links, "<a href='edit_lv.cgi?vg=".&urlize($v->{'name'}).
- "&snap=1'>".&text('index_addlv2s', $v->{'name'})."</a>");
+ @lvsin = grep { $_->{'vg'} eq $v->{'name'} } @alllvs;
+ if (@lvsin) {
+ push(@links,
+ "<a href='edit_lv.cgi?vg=".&urlize($v->{'name'}).
+ "&snap=1'>".&text('index_addlv2s', $v->{'name'}).
+ "</a>");
+ }
}
if (!@alllvs) {
# None yet
index_pvsize=Device size
index_pvtotal=Blocks used
index_pvtotal2=Size used
-index_vgsdesc=A volume group is a set of disks that can be allocated to one or more logical volumes. Most systems will have only one.
+index_vgsdesc=A volume group is a set of disks that can be allocated to one or more logical volumes. Most systems will have only one, and at least one must be created before any physical or logical volumes can be.
index_pvsdesc=A physical volume is a disk partition or RAID device that is part of a volume group. Its disk space can then be used by one or more logical volumes.
index_lvsdesc=A logical volume is a virtual partition created from the combined disk space of a volume group. Each can have a filesystem which is then mounted to store files.
index_lvname=Logical volume
lv_stripe=Volume striping
lv_nostripe=Disabled (always allocate from start)
lv_stripes=Stripe across $1 physical volumes
+lv_stripes2=Physical volumes to stripe across
lv_err=Failed to save logical volume
lv_ename=Missing or invalid volume name
lv_esame=A logical volume with the same name already exists
}
# device_input()
+# Returns a selector for a free device
sub device_input
{
local (%used, $vg, $pv, $d, $p);
}
# Show available partitions
-print "<select name=device>\n";
+local @opts;
foreach $d (&foreign_call("fdisk", "list_disks_partitions")) {
foreach $p (@{$d->{'parts'}}) {
next if ($used{$p->{'device'}} || $p->{'extended'});
next if ($used{"LABEL=$label"});
}
local $tag = &foreign_call("fdisk", "tag_name", $p->{'type'});
- printf "<option value='%s'>%s%s%s\n",
- $p->{'device'}, $p->{'desc'},
- $tag ? " ($tag)" : "",
- $d->{'cylsize'} ? " (".&nice_size($d->{'cylsize'}*($p->{'end'} - $p->{'start'} + 1)).")" :
- " ($p->{'blocks'} $text{'blocks'})";
+ push(@opts, [ $p->{'device'},
+ $p->{'desc'}.
+ ($tag ? " ($tag)" : "").
+ ($d->{'cylsize'} ? " (".&nice_size($d->{'cylsize'}*($p->{'end'} - $p->{'start'} + 1)).")" :
+ " ($p->{'blocks'} $text{'blocks'})") ]);
}
}
next if ($used{$c->{'value'}});
local @ds = &device_status($c->{'value'});
next if (@ds);
- printf "<option value='%s'>%s\n",
- $c->{'value'}, &text('pv_raid', $c->{'value'} =~ /md(\d+)$/ ? "$1" : $c->{'value'});
+ push(@opts, [ $c->{'value'}, &text('pv_raid', $c->{'value'} =~ /md(\d+)$/ ? "$1" : $c->{'value'}) ]);
}
-print "<option value=''>$text{'pv_other'}\n";
-print "</select>\n";
-print "<input name=other size=30> ",
- &file_chooser_button("other"),"<br>\n";
-print "<b>$text{'pv_warn'}</b>\n";
+push(@opts, [ '', $text{'pv_other'} ]);
+return &ui_select("device", $opts[0]->[0], \@opts)." ".
+ &ui_textbox("other", undef, 30)." ".&file_chooser_button("other").
+ "<br>\n<b>$text{'pv_warn'}</b>";
}
# get_lvm_version()
&save_module_config();
&webmin_log("mkfs", "lv", $in{'dev'}, \%in);
-&ui_print_footer("", $text{'index_return'});
+&ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});
print "</table></td></tr></table>\n";
print "<input type=submit value='$text{'create'}'></form>\n";
-&ui_print_footer("", $text{'index_return'});
+&ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});
$err = &delete_logical_volume($lv);
&error("<pre>$err</pre>") if ($err);
&webmin_log("delete", "lv", $in{'lv'}, $lv);
- &redirect("");
+ &redirect("index.cgi?mode=lvs");
}
elsif ($in{'delete'}) {
# Ask the user if he is sure
&ui_print_header(undef, $text{'lv_delete'}, "");
- print "<center><form action=save_lv.cgi>\n";
- print "<input type=hidden name=vg value='$in{'vg'}'>\n";
- print "<input type=hidden name=lv value='$in{'lv'}'>\n";
+ print "<center>\n";
+ print &ui_form_start("save_lv.cgi");
+ print &ui_hidden("vg", $in{'vg'});
+ print &ui_hidden("lv", $in{'lv'});
print "<b>",&text($lv->{'is_snap'} ? 'lv_rusnap' : 'lv_rusure',
"<tt>$lv->{'device'}</tt>"),"</b><p>\n";
- print "<input type=submit name=confirm ",
- "value='$text{'lv_deleteok'}'>\n";
- print "</center></form>\n";
- &ui_print_footer("", $text{'index_return'});
+ print &ui_form_end([ [ 'confirm', $text{'lv_deleteok'} ] ]);
+ print "</center>\n";
+ &ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});
}
else {
# Validate inputs
}
&webmin_log("modify", "lv", $in{'lv'}, $lv);
}
- &redirect("");
+ &redirect("index.cgi?mode=lvs");
}
$err = &delete_physical_volume($pv);
&error("<pre>$err</pre>") if ($err);
&webmin_log("delete", "pv", $in{'pv'}, $pv);
- &redirect("");
+ &redirect("index.cgi?mode=pvs");
}
elsif ($in{'delete'}) {
# Ask the user if he is sure
&ui_print_header(undef, $text{'pv_delete'}, "");
- print "<center><form action=save_pv.cgi>\n";
- print "<input type=hidden name=vg value='$in{'vg'}'>\n";
- print "<input type=hidden name=pv value='$in{'pv'}'>\n";
+ print "<center>\n";
+ print &ui_form_start("save_pv.cgi");
+ print &ui_hidden("vg", $in{'vg'});
+ print &ui_hidden("pv", $in{'pv'});
print "<b>",&text('pv_rusure',
"<tt>$pv->{'device'}</tt>"),"</b><p>\n";
- print "<input type=submit name=confirm ",
- "value='$text{'pv_deleteok'}'>\n";
- print "</center></form>\n";
- &ui_print_footer("", $text{'index_return'});
+ print &ui_form_end([ [ 'confirm', $text{'pv_deleteok'} ] ]);
+ print "</center>\n";
+ &ui_print_footer("index.cgi?mode=pvs", $text{'index_return'});
}
else {
&error_setup($text{'pv_err'});
}
&webmin_log($in{'pv'} ? "modify" : "create", "pv", $pv->{'device'},$pv);
- &redirect("");
+ &redirect("index.cgi?mode=pvs");
}
print "<p><b>",&text('vg_cannot', scalar(@lvs)),"</b> <p>\n";
}
else {
- print "<center><form action=save_vg.cgi>\n";
- print "<input type=hidden name=vg value='$in{'vg'}'>\n";
+ print "<center>\n";
+ print &ui_form_start("save_vg.cgi");
+ print &ui_hidden("vg", $in{'vg'});
print "<b>",&text('vg_rusure', $vg->{'name'}),"</b><p>\n";
- print "<input type=submit name=confirm ",
- "value='$text{'vg_deleteok'}'>\n";
- print "</center></form>\n";
+ print &ui_form_end([ [ 'confirm', $text{'vg_deleteok'} ] ]);
+ print "</center>\n";
}
&ui_print_footer("", $text{'index_return'});
}
}
&webmin_log("modify", "vg", $in{'vg'}, $vg);
}
- &redirect("");
+ &redirect("index.cgi?mode=vgs");
}