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.csa...@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


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to