[pve-devel] r4942 - vzdump/trunk

svn-commits at proxmox.com svn-commits at proxmox.com
Mon Aug 9 08:28:18 CEST 2010


Author: dietmar
Date: 2010-08-09 06:28:18 +0000 (Mon, 09 Aug 2010)
New Revision: 4942

Modified:
   vzdump/trunk/ChangeLog
   vzdump/trunk/Makefile
   vzdump/trunk/OpenVZ.pm
   vzdump/trunk/VZDump.pm
   vzdump/trunk/changelog.Debian
   vzdump/trunk/vzdump
Log:
use ionice to set io priority



Modified: vzdump/trunk/ChangeLog
===================================================================
--- vzdump/trunk/ChangeLog	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/ChangeLog	2010-08-09 06:28:18 UTC (rev 4942)
@@ -1,3 +1,7 @@
+2010-08-09  Proxmox Support Team  <support at proxmox.com>
+
+	* vzdump: set io priority using ionice
+
 2010-05-20  Proxmox Support Team  <support at proxmox.com>
 
 	* vzrestore (restore_openvz): new --force option to overwrite

Modified: vzdump/trunk/Makefile
===================================================================
--- vzdump/trunk/Makefile	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/Makefile	2010-08-09 06:28:18 UTC (rev 4942)
@@ -13,7 +13,7 @@
 
 VERSION=1.2
 PACKAGE=vzdump
-PKGREL=6
+PKGREL=7
 
 #ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 #RPMARCH:=$(shell rpm --eval %_build_arch)

Modified: vzdump/trunk/OpenVZ.pm
===================================================================
--- vzdump/trunk/OpenVZ.pm	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/OpenVZ.pm	2010-08-09 06:28:18 UTC (rev 4942)
@@ -144,8 +144,10 @@
 
     my $opts = $self->{vzdump}->{opts};
 
-    my $rsyncopts = "--stats -x --numeric-ids --bwlimit=$opts->{bwlimit}";
+    my $rsyncopts = "--stats -x --numeric-ids";
 
+    $rsyncopts .= " --bwlimit=$opts->{bwlimit}" if $opts->{bwlimit};
+
     $self->cmd ("rsync $rsyncopts -aH --delete --no-whole-file --inplace '$from' '$to'");
 
     my $delay = time () - $starttime;
@@ -345,7 +347,6 @@
     my $srcdir = $self->{vmlist}->{$vmid}->{dir};
     my $snapdir = $task->{snapdir};
 
-    my $bwl = $opts->{bwlimit}*1024; # bandwidth limit for cstream
     my $zflag = $opts->{compress} ? 'z' : '';
 
     my $taropts = "--totals --sparse --numeric-owner --no-recursion --ignore-failed-read --one-file-system";
@@ -355,8 +356,12 @@
     }
 
     my $out = ">$filename";
-    $out = "|cstream -t $bwl $out" if $opts->{bwlimit};
 
+    if ($opts->{bwlimit}) {
+	my $bwl = $opts->{bwlimit}*1024; # bandwidth limit for cstream
+	$out = "|cstream -t $bwl $out";
+    }
+
     $self->cmd ("(cd $snapdir;find . $findargs|" .
 		"tar c${zflag}pf - $taropts --null -T - $out )");
 

Modified: vzdump/trunk/VZDump.pm
===================================================================
--- vzdump/trunk/VZDump.pm	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/VZDump.pm	2010-08-09 06:28:18 UTC (rev 4942)
@@ -267,7 +267,8 @@
     my $fn = "/etc/vzdump.conf";
 
     my $res = {
-	bwlimit => 10240,
+	bwlimit => 0,
+	ionice => 7,
 	size => 1024,
 	lockwait => 3*60, # 3 hours
 	stopwait => 10, # 10 minutes
@@ -293,6 +294,8 @@
 	    $res->{script} = $1;
 	} elsif ($line =~ m/bwlimit:\s*(\d+)\s*$/) {
 	    $res->{bwlimit} = int($1);
+	} elsif ($line =~ m/ionice:\s*([0-7])\s*$/) {
+	    $res->{ionice} = int($1);
 	} elsif ($line =~ m/lockwait:\s*(\d+)\s*$/) {
 	    $res->{lockwait} = int($1);
 	} elsif ($line =~ m/stopwait:\s*(\d+)\s*$/) {
@@ -533,6 +536,7 @@
     check_bin ('mount');
     check_bin ('umount');
     check_bin ('cstream');
+    check_bin ('ionice');
 
     if ($opts->{snapshot}) {
 	check_bin ('lvcreate');
@@ -851,6 +855,8 @@
 	debugmsg ('info', "bandwidth limit: $opts->{bwlimit} KB/s", $logfd)
 	    if $opts->{bwlimit};
 
+	debugmsg ('info', "ionice priority: $opts->{ionice}", $logfd);
+
 	if ($mode eq 'stop') {
 
 	    $plugin->prepare ($task, $vmid, $mode);

Modified: vzdump/trunk/changelog.Debian
===================================================================
--- vzdump/trunk/changelog.Debian	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/changelog.Debian	2010-08-09 06:28:18 UTC (rev 4942)
@@ -1,3 +1,10 @@
+vzdump (1.2-7) unstable; urgency=low
+
+  * use ionice to set io priority. By default, we now set "ionice -c2 -n7"
+    to limit io (instead of using a default bwlimit)
+
+ -- Proxmox Support Team <support at proxmox.com>  Mon, 09 Aug 2010 08:24:52 +0200
+
 vzdump (1.2-6) unstable; urgency=low
 
   * vzrestore: new --force option to overwrite existing data

Modified: vzdump/trunk/vzdump
===================================================================
--- vzdump/trunk/vzdump	2010-08-06 10:02:44 UTC (rev 4941)
+++ vzdump/trunk/vzdump	2010-08-09 06:28:18 UTC (rev 4942)
@@ -56,6 +56,7 @@
 		'size=i',
 		'node=i',
 		'bwlimit=i',
+		'ionice=i',
 		'lockwait=i',
 		'stopwait=i',
 		'tmpdir=s',
@@ -91,7 +92,8 @@
     print STDERR "\t--node CID\t\tonly run on pve cluster node CID\n";
     print STDERR "\t--lockwait MINUTES\tmaximal time to wait for the global lock\n";
     print STDERR "\t--stopwait MINUTES\tmaximal time to wait until a VM is stopped\n";
-    print STDERR "\t--bwlimit KBPS\t\tlimit I/O bandwidth; KBytes per second\n\n";
+    print STDERR "\t--bwlimit KBPS\t\tlimit I/O bandwidth; KBytes per second\n";
+    print STDERR "\t--ionice PRI\t\tset ionice priority (0-7)\n\n";
 
     print STDERR "\n";
 }
@@ -142,6 +144,9 @@
 # parameters are OK - now start real work and log everything
 
 eval {
+    if (defined($opts->{ionice})) {
+	PVE::VZDump::run_command (undef, "ionice -c2 -n$opts->{ionice} -p $$");
+    }
     $vzdump->exec_backup(); 
 };
 my $err = $@;
@@ -198,6 +203,9 @@
     
 --bwlimit KBPS          limit I/O bandwidth; KBytes per second
 
+--ionice PRI            set ionice priority (0-7). default is 7 (lowest
+                        priority).
+
 --lockwait MINUTES      maximal time to wait for the global
                         lock. vzdump uses a global lock file to make
                         sure that only one instance is running
@@ -274,6 +282,7 @@
  storage: STORAGE_ID
  mode: snapshot|suspend|stop
  bwlimit: KBPS
+ ionize: PRI
  lockwait: MINUTES 
  stopwait: MINUTES 
  size: MB



More information about the pve-devel mailing list