aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMaarten Vanraes <alien@mageia.org>2016-02-07 16:58:05 +0100
committerMaarten Vanraes <alien@mageia.org>2016-05-14 09:25:24 +0200
commit481aaa55f490b4732598099ea41a68a197713735 (patch)
tree1debaf7d5529ebef2c36c82b9a53f1192dcc95c1 /lib
parent6a118f726fec17bd13c6f4e797fd9b7686a5ae36 (diff)
downloadmanatools-481aaa55f490b4732598099ea41a68a197713735.tar
manatools-481aaa55f490b4732598099ea41a68a197713735.tar.gz
manatools-481aaa55f490b4732598099ea41a68a197713735.tar.bz2
manatools-481aaa55f490b4732598099ea41a68a197713735.tar.xz
manatools-481aaa55f490b4732598099ea41a68a197713735.zip
Allow parts to use plugin tools
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/Shared/disk_backend/Part.pm7
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm4
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Disk.pm2
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Loop.pm2
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Mount.pm2
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm2
-rw-r--r--lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm2
7 files changed, 14 insertions, 7 deletions
diff --git a/lib/ManaTools/Shared/disk_backend/Part.pm b/lib/ManaTools/Shared/disk_backend/Part.pm
index b4ebbfa4..85e3cf48 100644
--- a/lib/ManaTools/Shared/disk_backend/Part.pm
+++ b/lib/ManaTools/Shared/disk_backend/Part.pm
@@ -118,6 +118,13 @@ has 'db' => (
default => undef,
);
+has 'plugin' => (
+ is => 'rw',
+ isa => 'ManaTools::Shared::disk_backend::Plugin',
+ required => 1,
+ handles => ['tool', 'tool_lines', 'tool_fields'],
+);
+
has 'ins' => (
is => 'ro',
isa => 'ManaTools::Shared::disk_backend::IOs',
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm
index 5dd3165f..1ce0e488 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Btrfs.pm
@@ -147,7 +147,7 @@ override ('probe', sub {
# check in sysfs and create a Btrfs for each one
for my $fs (glob("/sys/fs/btrfs/*")) {
next if ($fs !~ m'/[-0-9a-f]+$'i);
- my $part = $self->parent->mkpart('Btrfs', {uuid => $fs =~ s'^.+/''r});
+ my $part = $self->parent->mkpart('Btrfs', {uuid => $fs =~ s'^.+/''r, plugin => $self});
$part->prop_from_file('label', "$fs/label");
$part->prop('features', join(',', map {$_ =~ s'^.+/''r} glob("$fs/features/*")));
$part->prop_from_file('used', "$fs/allocation/data/disk_used");
@@ -332,7 +332,7 @@ sub refresh {
# top level is 2 strings, so combine them, so that the fields can be nicely splitted
my %fields = split(/[ \t\r\n]+/, $line =~ s'top level'top_level'r);
# create the volume part
- my $part = $self->db->mkpart('BtrfsVol', {fs => $self, uuid => $fields{uuid}});
+ my $part = $self->db->mkpart('BtrfsVol', {fs => $self, uuid => $fields{uuid}, plugin => $self->plugin()});
# add the IO::Btrfs filesystem
$part->in_add($outs[0]);
# create a IO::BtrfsVol
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Disk.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Disk.pm
index 9b5cbbe2..3bfe788f 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Disk.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Disk.pm
@@ -81,7 +81,7 @@ override ('probe', sub {
$part = $parts[0];
}
else {
- $part = $self->parent->mkpart('Disks', {});
+ $part = $self->parent->mkpart('Disks', {plugin => $self});
if (!defined($part)) {
return 0;
}
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Loop.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Loop.pm
index 5f4f602f..4aac7b5d 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Loop.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Loop.pm
@@ -126,7 +126,7 @@ override ('probe', sub {
$part = $parts[0];
}
else {
- $part = $self->parent->mkpart('Loops', {});
+ $part = $self->parent->mkpart('Loops', {plugin => $self});
if (!defined($part)) {
return 0;
}
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Mount.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Mount.pm
index 428ea82e..04e03b86 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Mount.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Mount.pm
@@ -86,7 +86,7 @@ override ('probe', sub {
open F, '</proc/self/mountinfo' or return 0;
while (my $line = <F>) {
my @fields = split(/ /, $line);
- my $part = $self->parent->mkpart('Mount', {path => $fields[4]});
+ my $part = $self->parent->mkpart('Mount', {path => $fields[4], plugin => $self});
$part->prop('options', $fields[5]);
$part->prop('dev', $fields[2]);
$part->prop('id', $fields[0]);
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
index 1e4fee60..eebb1429 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Partition.pm
@@ -139,7 +139,7 @@ override ('probeio', sub {
$part = $parts[0];
}
else {
- $part = $self->parent->mkpart('PartitionTable', {});
+ $part = $self->parent->mkpart('PartitionTable', {plugin => $self});
if (!defined($part)) {
return 0;
}
diff --git a/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm b/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm
index 8765b041..0b4ad875 100644
--- a/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm
+++ b/lib/ManaTools/Shared/disk_backend/Plugin/Swap.pm
@@ -94,7 +94,7 @@ override ('probe', sub {
<F>;
while (my $line = <F>) {
my @fields = split(/[ \t\r\n]+/, $line);
- my $part = $self->parent->mkpart('Swap', {path => $fields[0]});
+ my $part = $self->parent->mkpart('Swap', {path => $fields[0], plugin => $self});
$part->prop('filename', $fields[0]);
$part->prop('swaptype', $fields[1]);
$part->prop('size', $fields[2]);