[pve-devel] [PATCH storage] add sparseinit to has_feature

Dominik Csapak d.csapak at proxmox.com
Tue Feb 23 12:30:14 CET 2016


we will use this for determining if we need to write zeros to a
volume

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Storage/LvmThinPlugin.pm  | 1 +
 PVE/Storage/Plugin.pm         | 2 ++
 PVE/Storage/RBDPlugin.pm      | 1 +
 PVE/Storage/SheepdogPlugin.pm | 1 +
 PVE/Storage/ZFSPoolPlugin.pm  | 4 ++++
 5 files changed, 9 insertions(+)

diff --git a/PVE/Storage/LvmThinPlugin.pm b/PVE/Storage/LvmThinPlugin.pm
index a55fecd..c8b48f0 100644
--- a/PVE/Storage/LvmThinPlugin.pm
+++ b/PVE/Storage/LvmThinPlugin.pm
@@ -336,6 +336,7 @@ sub volume_has_feature {
 	clone => { base => 1, snap => 1},
 	template => { current => 1},
 	copy => { base => 1, current => 1, snap => 1},
+	sparseinit => { base => 1, current => 1},
     };
 
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 6aa71e0..ccb3280 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -742,6 +742,8 @@ sub volume_has_feature {
 	copy => { base => {qcow2 => 1, raw => 1, vmdk => 1},
 		  current => {qcow2 => 1, raw => 1, vmdk => 1},
 		  snap => {qcow2 => 1} },
+	sparseinit => { base => {qcow2 => 1, raw => 1, vmdk => 1},
+			current => {qcow2 => 1, raw => 1, vmdk => 1} },
     };
 
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) =
diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 730fb85..35692fd 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -594,6 +594,7 @@ sub volume_has_feature {
 	clone => { base => 1, snap => 1},
 	template => { current => 1},
 	copy => { base => 1, current => 1, snap => 1},
+	sparseinit => { base => 1, current => 1},
     };
 
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
diff --git a/PVE/Storage/SheepdogPlugin.pm b/PVE/Storage/SheepdogPlugin.pm
index 6368cf4..6b8fe2f 100644
--- a/PVE/Storage/SheepdogPlugin.pm
+++ b/PVE/Storage/SheepdogPlugin.pm
@@ -435,6 +435,7 @@ sub volume_has_feature {
 	clone => { base => 1},
 	template => { current => 1},
 	copy => { base => 1, current => 1, snap => 1},
+	sparseinit => { base => 1, current => 1 },
     };
 
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 6b276e4..0ec6ed9 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -579,6 +579,10 @@ sub volume_has_feature {
 	copy => { base => 1, current => 1},
     };
 
+    if ($scfg->{sparse}) {
+	$features->{sparseinit} = { base => 1, current => 1};
+    }
+
     my ($vtype, $name, $vmid, $basename, $basevmid, $isBase) =
 	$class->parse_volname($volname);
 
-- 
2.1.4





More information about the pve-devel mailing list