Server IP : 195.201.23.43 / Your IP : 18.119.143.234 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/lvm/ |
Upload File : |
#!/usr/bin/perl # Create a RAID logical volume require './lvm-lib.pl'; &error_setup($text{'raid_err'}); &ReadParse(); ($vg) = grep { $_->{'name'} eq $in{'vg'} } &list_volume_groups(); $vg || &error($text{'vg_egone'}); # Parse and validate inputs &error_setup($text{'raid_err'}); $in{'name'} =~ /^[A-Za-z0-9\.\-\_]+$/ || &error($text{'lv_ename'}); ($same) = grep { $_->{'name'} eq $in{'name'} } &list_logical_volumes($in{'vg'}); $same && &error($text{'lv_esame'}); if ($in{'size_mode'} == 0) { # Absolute size $in{'size'} =~ /^\d+$/ || &error($text{'lv_esize'}); $size = $in{'size'}; if (defined($in{'size_units'})) { # Convert selected units to kB $size *= $in{'size_units'}/1024; } $sizeof = undef; } elsif ($in{'size_mode'} == 1) { # Size of VG $in{'vgsize'} =~ /^\d+$/ && $in{'vgsize'} > 0 && $in{'vgsize'} <= 100 || &error($text{'lv_evgsize'}); $size = $in{'vgsize'}; $sizeof = 'VG'; } elsif ($in{'size_mode'} == 2) { # Size of free space if (!$in{'lv'}) { $in{'freesize'} =~ /^\d+$/ && $in{'freesize'} > 0 && $in{'freesize'} <= 100 || &error($text{'lv_efreesize'}); } $size = $in{'freesize'}; $sizeof = 'FREE'; } elsif ($in{'size_mode'} == 3) { # Size of some PV $in{'pvsize'} =~ /^\d+$/ && $in{'pvsize'} > 0 && $in{'pvsize'} <= 100 || &error($text{'lv_epvsize'}); $size = $in{'pvsize'}; $sizeof = $in{'pvof'}; } if ($in{'raid_mode'} eq 'raid0') { $in{'raid_stripe0'} =~ /^\d+$/ && $in{'raid_stripe0'} >= 2 || &error($text{'raid_estripe0'}); $stripes = $in{'raid_stripe0'}; } elsif ($in{'raid_mode'} eq 'raid1') { $in{'raid_mirror1'} =~ /^\d+$/ && $in{'raid_mirror1'} >= 1 || &error($text{'raid_emirror1'}); $mirrors = $in{'raid_mirror1'}; } elsif ($in{'raid_mode'} eq 'raid4') { $in{'raid_stripe4'} =~ /^\d+$/ && $in{'raid_stripe4'} >= 2 || &error($text{'raid_estripe4'}); $stripes = $in{'raid_stripe4'}; } elsif ($in{'raid_mode'} eq 'raid5') { $in{'raid_stripe5'} =~ /^\d+$/ && $in{'raid_stripe5'} >= 2 || &error($text{'raid_estripe5'}); $stripes = $in{'raid_stripe5'}; } elsif ($in{'raid_mode'} eq 'raid6') { $in{'raid_stripe6'} =~ /^\d+$/ && $in{'raid_stripe6'} >= 2 || &error($text{'raid_estripe6'}); $stripes = $in{'raid_stripe6'}; } elsif ($in{'raid_mode'} eq 'raid10') { $in{'raid_stripe10'} =~ /^\d+$/ && $in{'raid_stripe10'} >= 2 || &error($text{'raid_estripe10'}); $stripes = $in{'raid_stripe10'}; } $mirrors || $stripes || &error($text{'raid_eeither'}); # Create the LV $lv = { }; $lv->{'vg'} = $in{'vg'}; $lv->{'name'} = $in{'name'}; $lv->{'size'} = $size; $lv->{'size_of'} = $sizeof; $lv->{'raid'} = $in{'raid_mode'}; $lv->{'mirrors'} = $mirrors; $lv->{'stripes'} = $stripes; $lv->{'perm'} = $in{'perm'}; $lv->{'alloc'} = $in{'alloc'}; $lv->{'readahead'} = $in{'readahead'}; $err = &create_raid_volume($lv); &error($err) if ($err); &webmin_log("raid", "lv", $in{'name'}, $lv); &redirect("index.cgi?mode=lvs");Private