[pve-devel] r5335 - qemu-server/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Dec 6 14:00:32 CET 2010


Author: dietmar
Date: 2010-12-06 14:00:32 +0100 (Mon, 06 Dec 2010)
New Revision: 5335

Modified:
   qemu-server/trunk/ChangeLog
   qemu-server/trunk/VZDump::QemuServer.pm
   qemu-server/trunk/qmrestore
Log:


Modified: qemu-server/trunk/ChangeLog
===================================================================
--- qemu-server/trunk/ChangeLog	2010-12-06 09:43:32 UTC (rev 5334)
+++ qemu-server/trunk/ChangeLog	2010-12-06 13:00:32 UTC (rev 5335)
@@ -1,3 +1,10 @@
+2010-12-06  Proxmox Support Team  <support at proxmox.com>
+
+	* VZDump::QemuServer.pm (archive): support new --stdout option (as
+	suggested by Mario Wolff)
+
+	* qmrestore (restore_qemu): allow to restore from STDIN ('-')
+
 2010-12-03  Proxmox Support Team  <support at proxmox.com>
 
 	* QemuServer.pm (config_to_command): die if ifname > 15

Modified: qemu-server/trunk/VZDump::QemuServer.pm
===================================================================
--- qemu-server/trunk/VZDump::QemuServer.pm	2010-12-06 09:43:32 UTC (rev 5334)
+++ qemu-server/trunk/VZDump::QemuServer.pm	2010-12-06 13:00:32 UTC (rev 5335)
@@ -425,13 +425,17 @@
 	}
     }
 
-    my $out = ">$filename";
-    $out = "|cstream -t $bwl $out" if $opts->{bwlimit};
-    $out = "|gzip $out" if $opts->{compress};
+    my $files = join (' ', map { "'$_'" } @filea);
 
-    my $files = join (' ', map { "'$_'" } @filea);
-    
-    $self->cmd("/usr/lib/qemu-server/vmtar $files $out");
+    my $cmd = "/usr/lib/qemu-server/vmtar $files";
+    $cmd .= "|cstream -t $bwl" if $opts->{bwlimit};
+    $cmd .= "|gzip -" if $opts->{compress};
+
+    if ($opts->{stdout}) {
+	$self->cmd ($cmd, output => ">&=" . fileno($opts->{stdout}));
+    } else {
+	$self->cmd("$cmd >$filename");
+    }
 }
 
 sub cleanup {

Modified: qemu-server/trunk/qmrestore
===================================================================
--- qemu-server/trunk/qmrestore	2010-12-06 09:43:32 UTC (rev 5334)
+++ qemu-server/trunk/qmrestore	2010-12-06 13:00:32 UTC (rev 5335)
@@ -267,8 +267,13 @@
  
     my $subcmd = shellquote ("--to-command=${quoted_cmd}\ --extract\ $vmid");
     my $cmd = "tar xf '$archive' $subcmd";
-    run_command ($cmd);
 
+    if ($archive eq '-') {
+	run_command ($cmd, input => "<&STDIN");	
+    } else {
+	run_command ($cmd);
+    }
+
     return if $opts->{info};
 
     # reed new mapping
@@ -337,9 +342,11 @@
     }
 }
 
-my $firstfile = PVE::VZDump::read_firstfile ($archive);
-if ($firstfile ne 'qemu-server.conf') {
-    die "ERROR: file '$archive' dos not lock like a QemuServer vzdump backup\n";
+if ($archive ne '-') {
+    my $firstfile = PVE::VZDump::read_firstfile ($archive);
+    if ($firstfile ne 'qemu-server.conf') {
+	die "ERROR: file '$archive' dos not lock like a QemuServer vzdump backup\n";
+    }
 }
 
 sub restore_archive {




More information about the pve-devel mailing list