[pve-devel] [PATCH_V2] This function checks if the $volid reside on zfs.
Wolfgang Link
w.link at proxmox.com
Fri Mar 11 09:46:08 CET 2016
---
PVE/Storage.pm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 140f8ae..af3facd 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', '--output=fstype', $path], 'timeout' => 5, 'outfunc' => $is_zfs);
+
+ return $zfs;
+}
+
1;
--
2.1.4
More information about the pve-devel
mailing list