Link to source of LV snapshots

This commit is contained in:
Jamie Cameron
2017-03-26 14:03:28 -07:00
parent 979aac7178
commit 33f6a5d1a2
3 changed files with 24 additions and 9 deletions

View File

@@ -138,16 +138,19 @@ if ($in{'lv'} && !$lv->{'thin'}) {
if ($lv->{'is_snap'}) {
if ($in{'lv'}) {
# Show which LV this is a snapshot of
local @snapof;
local $snapof;
if ($lv->{'snap_of'}) {
@snapof = grep { $_->{'name'} eq $lv->{'snap_of'}} @lvs;
($snapof) = grep { $_->{'name'} eq $lv->{'snap_of'} }
@lvs;
}
else {
@snapof = grep { $_->{'size'} == $lv->{'size'} &&
$_->{'has_snap'} } @lvs;
($snapof) = grep { $_->{'size'} == $lv->{'size'} &&
$_->{'has_snap'} } @lvs;
}
if (@snapof == 1) {
$snapsel = "<tt>$snapof[0]->{'name'}</tt>";
if ($snapof) {
$snapsel = &ui_link(
"edit_lv.cgi?vg=$in{'vg'}&lv=$snapof->{'name'}",
$snapof->{'name'});
}
else {
$snapsel = "<i>$text{'lv_nosnap'}</i>";

View File

@@ -350,7 +350,12 @@ else {
$lv->{'snap_active'} = 0;
}
}
elsif (/Read ahead sectors\s+(\d+|auto)/) {
elsif (/LV\s+Thin\s+origin\s+name\s+(\S+)/) {
# Snapshot in a thin pool
$lv->{'is_snap'} = 1;
$lv->{'snap_of'} = $1;
}
elsif (/Read ahead sectors\s+(\d+|auto)/) {
$lv->{'readahead'} = $1;
}
elsif (/Stripes\s+(\d+)/) {

View File

@@ -5,11 +5,11 @@
require './lvm-lib.pl';
&ReadParse();
@lvs = &list_logical_volumes($in{'vg'});
($vg) = grep { $_->{'name'} eq $in{'vg'} } &list_volume_groups();
$vg || &error($text{'vg_egone'});
if ($in{'lv'}) {
($lv) = grep { $_->{'name'} eq $in{'lv'} }
&list_logical_volumes($in{'vg'});
($lv) = grep { $_->{'name'} eq $in{'lv'} } @lvs;
$lv || &error($text{'lv_egone'});
$oldlv = { %$lv };
}
@@ -39,6 +39,13 @@ elsif ($in{'delete'}) {
print &ui_hidden("lv", $in{'lv'});
print "<b>",&text($lv->{'is_snap'} ? 'lv_rusnap' : 'lv_rusure',
"<tt>$lv->{'device'}</tt>"),"</b><p>\n";
if ($lv->{'thin'}) {
@thinc = grep { $_->{'thin_in'} eq $lv->{'name'} } @lvs;
if (@thinc) {
print "<b>",&text('lv_delthin',
scalar(@thinc)),"</b><p>\n";
}
}
print &ui_form_end([ [ 'confirm', $text{'lv_deleteok'} ] ]);
print "</center>\n";
&ui_print_footer("index.cgi?mode=lvs", $text{'index_return'});