#!/usr/local/bin/perl # edit_pv.cgi # Display a form for editing or creating a physical volume require './lvm-lib.pl'; &foreign_require("fdisk", "fdisk-lib.pl"); &ReadParse(); ($vg) = grep { $_->{'name'} eq $in{'vg'} } &list_volume_groups(); $vgdesc = &text('pv_vg', $vg->{'name'}); if ($in{'pv'}) { @pvs = &list_physical_volumes($in{'vg'}); ($pv) = grep { $_->{'name'} eq $in{'pv'} } @pvs; &ui_print_header($vgdesc, $text{'pv_edit'}, ""); } else { &ui_print_header($vgdesc, $text{'pv_create'}, ""); $pv = { 'alloc' => 'y' }; } print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'pv_header'}
\n"; print "\n"; print "\n"; printf "\n", $pv->{'alloc'} eq 'n' ? 'checked' : '', $text{'no'}; if ($in{'pv'}) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; @lvinfo = &get_physical_volume_usage($pv); if (@lvinfo) { @lvs = &list_logical_volumes($in{'vg'}); print "\n"; } } else { print "\n"; } print "
$text{'pv_device'} \n"; if ($in{'pv'}) { local $name = &foreign_call("mount", "device_name", $pv->{'device'}); print "$name\n"; } else { &device_input(); } print "
$text{'pv_alloc'} %s\n", $pv->{'alloc'} eq 'y' ? 'checked' : '', $text{'yes'}; printf " %s$text{'pv_size'}",&nice_size($pv->{'size'}*1024),"
$text{'pv_petotal'}",&text('lv_petotals', $pv->{'pe_alloc'}, $pv->{'pe_total'}), "$text{'pv_pesize'}$pv->{'pe_size'} kB
$text{'pv_petotal2'}",&text('lv_petotals', &nice_size($pv->{'pe_alloc'}*$pv->{'pe_size'}*1024), &nice_size($pv->{'pe_total'}*$pv->{'pe_size'}*1024)), "
$text{'pv_lvs'} \n"; foreach $l (@lvinfo) { print " , \n" if ($l ne $lvinfo[0]); ($lv) = grep { $_->{'name'} eq $l->[0] } @lvs; print "{'name'}'>$lv->{'name'} "; print &nice_size($l->[2]*$pv->{'pe_size'}*1024),"\n"; } print "
\n"; print "\n"; if ($in{'pv'}) { print "\n"; print "\n" if (@pvs > 1); } else { print "\n"; } print "
\n"; &ui_print_footer("", $text{'index_return'});