]> git.proxmox.com Git - pve-storage.git/commitdiff
lvmthin: allow to acces snapshots in filesystem_path
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Nov 2015 10:14:47 +0000 (11:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 12 Nov 2015 10:14:47 +0000 (11:14 +0100)
PVE/Storage/LvmThinPlugin.pm

index 96c8dfa818adc629a77af74427eaa8a2e16042e9..91f608927704ce4dbd8c58d5758b37597244a589 100644 (file)
@@ -58,6 +58,18 @@ sub parse_volname {
     die "unable to parse lvm volume name '$volname'\n";
 }
 
+sub filesystem_path {
+    my ($class, $scfg, $volname, $snapname) = @_;
+
+    my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+
+    my $vg = $scfg->{vgname};
+
+    my $path = defined($snapname) ? "/dev/$vg/snap_${name}_$snapname": "/dev/$vg/$name";
+
+    return wantarray ? ($path, $vmid, $vtype) : $path;
+}
+
 sub alloc_image {
     my ($class, $storeid, $scfg, $vmid, $fmt, $name, $size) = @_;