Include snapshot source in LV hash
authorJamie Cameron <jcameron@webmin.com>
Wed, 17 Nov 2010 05:53:25 +0000 (21:53 -0800)
committerJamie Cameron <jcameron@webmin.com>
Wed, 17 Nov 2010 05:53:25 +0000 (21:53 -0800)
lvm/edit_lv.cgi
lvm/lvm-lib.pl

index fcc025c..4bb37eb 100755 (executable)
@@ -110,8 +110,14 @@ if ($in{'lv'}) {
 if ($lv->{'is_snap'}) {
        if ($in{'lv'}) {
                # Show which LV this is a snapshot of
-               local @snapof = grep { $_->{'size'} == $lv->{'size'} &&
-                                      $_->{'has_snap'} } @lvs;
+               local @snapof;
+               if ($lv->{'snap_of'}) {
+                       @snapof = grep { $_->{'name'} eq $lv->{'snap_of'}} @lvs;
+                       }
+               else {
+                       @snapof = grep { $_->{'size'} == $lv->{'size'} &&
+                                        $_->{'has_snap'} } @lvs;
+                       }
                if (@snapof == 1) {
                        $snapsel = "<tt>$snapof[0]->{'name'}</tt>";
                        }
index c5aedf9..235b3bc 100755 (executable)
@@ -324,6 +324,9 @@ else {
                        else {
                                $lv->{'is_snap'} = 1;
                                }
+                       if (/destination\s+for\s+\/dev\/[^\/]+\/(\S+)/) {
+                               $lv->{'snap_of'} = $1;
+                               }
                        }
                elsif (/Stripes\s+(\d+)/) {
                        $lv->{'stripes'} = $1;