[pve-devel] [PATCH] This function checks if the $volid reside on zfs.
Wolfgang Link
w.link at proxmox.com
Mon Mar 7 12:49:20 CET 2016
---
PVE/Storage.pm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 140f8ae..044e866 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -1270,4 +1270,24 @@ sub complete_volume {
return $res;
}
+sub is_image_on_zfs {
+ my ($volid) = @_;
+
+ my ($storeid, $volname) = parse_volume_id($volid);
+
+ my $storecfg = config();
+ my $path = $storecfg->{ids}->{$storeid}->{path};
+ my $zfs = 0;
+
+ my $is_zfs = sub{
+ my ($line) = shift @_;
+
+ $zfs = 1 if ($line =~ m/ zfs /);
+ };
+
+ PVE::Tools::run_command("df -T $path", 'timeout' => 5, 'outfunc' => $is_zfs);
+
+ return $zfs;
+}
+
1;
--
2.1.4
More information about the pve-devel
mailing list