[pve-devel] [PATCH qemu-server] change check for write-zeros

Dominik Csapak d.csapak at proxmox.com
Tue Feb 23 12:43:51 CET 2016


instead of hardcoding the storagetypes for writing zeros on a
backup restore, we use volume_has_feature with 'sparseinit'
for determining if we can omit writing zeros

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
please apply after my patch 'add sparseinit to has_feature'
 
 PVE/QemuServer.pm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index c199437..e661dc6 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5607,9 +5607,7 @@ sub restore_vma_archive {
 	    PVE::Storage::activate_volumes($cfg,[$volid]);
 
 	    my $write_zeros = 1;
-	    # fixme: what other storages types initialize volumes with zero?
-	    if ($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs' || $scfg->{type} eq 'glusterfs' ||
-		$scfg->{type} eq 'sheepdog' || $scfg->{type} eq 'rbd') {
+	    if (PVE::Storage::volume_has_feature($cfg, 'sparseinit', $volid)) {
 		$write_zeros = 0;
 	    }
 
-- 
2.1.4





More information about the pve-devel mailing list