summaryrefslogtreecommitdiffstats
path: root/perl-install/lvm.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-05-20 19:47:18 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-05-20 19:47:18 +0200
commit5b79623823350d79e58b0375ccdef294e24d4848 (patch)
tree78b2dd30924ffa8063bda2b54ae2c922e33a98c7 /perl-install/lvm.pm
parent335e8be11b757c6146819271135668b7f58afb81 (diff)
downloaddrakx-5b79623823350d79e58b0375ccdef294e24d4848.tar
drakx-5b79623823350d79e58b0375ccdef294e24d4848.tar.gz
drakx-5b79623823350d79e58b0375ccdef294e24d4848.tar.bz2
drakx-5b79623823350d79e58b0375ccdef294e24d4848.tar.xz
drakx-5b79623823350d79e58b0375ccdef294e24d4848.zip
partially podify some modules
Diffstat (limited to 'perl-install/lvm.pm')
-rw-r--r--perl-install/lvm.pm44
1 files changed, 44 insertions, 0 deletions
diff --git a/perl-install/lvm.pm b/perl-install/lvm.pm
index 5bca97af9..006dbb087 100644
--- a/perl-install/lvm.pm
+++ b/perl-install/lvm.pm
@@ -12,6 +12,14 @@ use devices;
use fs::type;
use run_program;
+=head1 SYNOPSYS
+
+Manage LVM (PV, VG, LV)
+
+=over 4
+
+=cut
+
#- for partition_table_xxx emulation
sub new {
my ($class, $name) = @_;
@@ -29,11 +37,23 @@ sub cylinder_size {
$hd->{extent_size};
}
+=item detect_durting_install()
+
+Explicitely scan VGs.
+
+=cut
+
sub detect_during_install() {
run_program::run('lvm2', 'vgscan');
run_program::run('lvm2', 'vgchange', '-a', 'y');
}
+=item init()
+
+Loads LVM modules and scan VGs (if in installer, not in standalone tool).
+
+=cut
+
sub init() {
devices::init_device_mapper();
detect_during_install() if $::isInstall;
@@ -42,6 +62,13 @@ sub init() {
init() or log::l("lvm::init failed");
+=item lvm_cmd(...)
+
+Run a LVM command, then rescan VG.
+See run_program::run() for arguments.
+
+=cut
+
sub lvm_cmd {
if (my $r = run_program::run('lvm2', @_)) {
$r;
@@ -54,6 +81,13 @@ sub lvm_cmd {
run_program::run('lvm2', @_);
}
}
+
+=item lvm_cmd_or_die($prog, @para)
+
+Like lvm_cmd() but die if there's an error.
+
+=cut
+
sub lvm_cmd_or_die {
my ($prog, @para) = @_;
my @err;
@@ -112,6 +146,12 @@ sub lv_nb_pvs {
listlength(lv_to_pvs($lv));
}
+=item get_lvs($lvm)
+
+Return list of LVs.
+
+=cut
+
sub get_lvs {
my ($lvm) = @_;
my @l = run_program::get_stdout('lvm2', 'lvs', '--noheadings', '--nosuffix', '--units', 's', '-o', 'lv_name', $lvm->{VG_name}) =~ /(\S+)/g;
@@ -241,4 +281,8 @@ sub create_singleton_vg {
add_to_VG($part, $lvm);
}
+=back
+
+=cut
+
1;