summaryrefslogtreecommitdiffstats
path: root/perl-install/lvm.pm
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2001-08-07 17:40:36 +0000
committerMystery Man <unknown@mandriva.org>2001-08-07 17:40:36 +0000
commit068d599562888a36a50e5bbdeb8b70f83fa7c287 (patch)
tree18f5eed8353b3af647412875d438b55ef8c07670 /perl-install/lvm.pm
parentbe838931607e1ab14c8c699e20dd807b55579f7b (diff)
downloaddrakx-topic/v_webmin_0_87.tar
drakx-topic/v_webmin_0_87.tar.gz
drakx-topic/v_webmin_0_87.tar.bz2
drakx-topic/v_webmin_0_87.tar.xz
drakx-topic/v_webmin_0_87.zip
This commit was manufactured by cvs2svn to create branchtopic/v_webmin_0_87
'v_webmin_0_87'.
Diffstat (limited to 'perl-install/lvm.pm')
-rw-r--r--perl-install/lvm.pm98
1 files changed, 0 insertions, 98 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
deleted file mode 100644
index 72e1b4bb2..000000000
--- a/perl-install/lvm.pm
+++ /dev/null
@@ -1,98 +0,0 @@
-package lvm; # $Id$
-
-use diagnostics;
-use strict;
-
-#-######################################################################################
-#- misc imports
-#-######################################################################################
-use common;
-use modules;
-use fsedit;
-use devices;
-use run_program;
-
-#- for partition_table_xxx emulation
-sub hasExtended { 0 }
-sub adjustStart {}
-sub adjustEnd {}
-sub write {}
-sub cylinder_size {
- my ($hd) = @_;
- $hd->{PE_size};
-}
-
-
-eval { modules::load('lvm-mod') };
-run_program::run('vgscan') if !-e '/etc/lvmtab';
-run_program::run('vgchange', '-a', 'y');
-
-sub get_vg {
- my ($part) = @_;
- my $dev = devices::make($part->{device});
- (split(':', `pvdisplay -c $dev`))[1];
-}
-
-sub update_size {
- my ($lvm) = @_;
- my @l = split(':', `vgdisplay -c -D $lvm->{LVMname}`);
- $lvm->{totalsectors} = ($lvm->{PE_size} = $l[12]) * $l[13];
-}
-
-sub get_lvs {
- my ($lvm) = @_;
- $lvm->{primary}{normal} =
- [
- map {
- my $type = -e $_ && fsedit::typeOfPart($_);
- { device => $_,
- type => $type || 0x83,
- size => (split(':', `lvdisplay -D -c $_`))[6] }
- } map { /^LV Name\s+(\S+)/ ? $1 : () } `vgdisplay -v -D $lvm->{LVMname}`
- ];
-}
-
-sub vg_add {
- my ($part) = @_;
- if (my $old_name = get_vg($part)) {
- run_program::run('vgchange', '-a', 'n', $old_name);
- run_program::run('vgremove', $old_name);
- }
- my $dev = devices::make($part->{device});
- run_program::run_or_die('pvcreate', $dev);
- my $prog = run_program::run('vgdisplay', $part->{lvm}) ? 'vgextend' : 'vgcreate';
- run_program::run_or_die($prog, $part->{lvm}, $dev);
-}
-
-sub vg_destroy {
- my ($lvm) = @_;
-
- is_empty_array_ref($lvm->{primary}{normal}) or die _("Remove the logical volumes first\n");
- run_program::run('vgchange', '-a', 'n', $lvm->{LVMname});
- run_program::run_or_die('vgremove', $lvm->{LVMname});
- foreach (@{$lvm->{disks}}) {
- delete $_->{lvm};
- $_->{isFormatted} = 0;
- $_->{notFormatted} = 1;
- }
-}
-
-sub lv_delete {
- my ($lvm, $lv) = @_;
-
- run_program::run_or_die('lvremove', '-f', $lv->{device});
-
- my $list = $lvm->{primary}{normal};
- @$list = grep { $_ != $lv } @$list;
-}
-
-sub lv_create {
- my ($lvm, $lv) = @_;
- my $list = $lvm->{primary}{normal};
- my $nb = 1 + max(map { basename($_->{device}) } @$list);
- $lv->{device} = "/dev/$lvm->{LVMname}/$nb";
- run_program::run_or_die('lvcreate', '--size', int($lv->{size} / 2) . 'k', '-n', $nb, $lvm->{LVMname});
- push @$list, $lv;
-}
-
-1;