]> git.proxmox.com Git - qemu-server.git/commitdiff
move test for block device to vmtar.c
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 10 Feb 2012 06:47:46 +0000 (07:47 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 10 Feb 2012 06:47:46 +0000 (07:47 +0100)
PVE/VZDump/QemuServer.pm
vmtar.c

index 6e5bee1fc1a81e29cf477bd372108778a9d613f7..aee79da48bc68623b5200b0b8b4ef7fda219cbac 100644 (file)
@@ -382,15 +382,8 @@ sub archive {
 
     my $fh;
 
-    my $sparse = ''; 
-
-    # no sparse file scan for block devices
-    # no sparse file scan when we use compression
-    # but we enable it for files
-
     my @filea = ($conffile, 'qemu-server.conf'); # always first file in tar
     foreach my $di (@{$task->{disks}}) {
-       $sparse = '-s' if !$comp && $di->{type} eq 'file';
        if ($di->{type} eq 'block' || $di->{type} eq 'file') {
            push @filea, $di->{snappath}, $di->{filename};
        } else {
@@ -400,6 +393,9 @@ sub archive {
 
     my $files = join (' ', map { "'$_'" } @filea);
     
+    # no sparse file scan when we use compression
+    my $sparse = $comp ? '' : '-s'; 
+
     my $cmd = "/usr/lib/qemu-server/vmtar $sparse $files";
     my $bwl = $opts->{bwlimit}*1024; # bandwidth limit for cstream
     $cmd .= "|cstream -t $bwl" if $opts->{bwlimit};
diff --git a/vmtar.c b/vmtar.c
index b1d84841a201103b6c4f7a60f3d6675e90804c8b..6b34a88bcec53c83d7b5f80d777cc1e46eaf9027 100644 (file)
--- a/vmtar.c
+++ b/vmtar.c
@@ -530,7 +530,7 @@ main (int argc, char **argv)
     time_t ctime = fs.st_mtime;
 
     struct sp_array *ma = sparray_new();
-    if (sparse) {
+    if (sparse && !S_ISBLK(fs.st_mode)) {
       if (!scan_sparse_file (fd, ma)) {
        fprintf (stderr, "scanning '%s' failed\n", source); 
        exit (-1);