|
From: <di...@us...> - 2010-11-19 06:55:31
|
Revision: 676
http://safekeep.svn.sourceforge.net/safekeep/?rev=676&view=rev
Author: dimi
Date: 2010-11-19 06:55:25 +0000 (Fri, 19 Nov 2010)
Log Message:
-----------
Add precise control of nice values for both server and
client side of things. By default, safekeep will run now
as nice +10 on both sides.
However, existing installs will have to redeploy keys to
get this running on the client side.
Modified Paths:
--------------
safekeep/trunk/doc/safekeep.backup.txt
safekeep/trunk/doc/safekeep.conf.txt
safekeep/trunk/safekeep
safekeep/trunk/safekeep.conf
safekeep/trunk/samples/sample.backup
Modified: safekeep/trunk/doc/safekeep.backup.txt
===================================================================
--- safekeep/trunk/doc/safekeep.backup.txt 2010-11-19 05:58:45 UTC (rev 675)
+++ safekeep/trunk/doc/safekeep.backup.txt 2010-11-19 06:55:25 UTC (rev 676)
@@ -25,7 +25,7 @@
<!-- the client backup host, the user under which the servers will connect,
the SSH keys used for control and data transfer -->
<host
- name="myhost" user="root"
+ name="myhost" user="root" nice="10"
key-ctrl="/home/jdoe/.ssh/backup_id_dsa"
key-data="/home/jdoe/.ssh/backup2_id_dsa"
/>
@@ -113,6 +113,12 @@
so it most likely needs to be 'root'.
Optional, defaults to 'root'.
+/backup/host/@nice::
+ The nice adjustment for the client. This settings is normally
+ not all that important, as most of the load rests on the server side.
+ NB: if you change this value, you will have to re-deploy the auth keys.
+ Optional, defaults to no nice level.
+
/backup/host/@key-ctrl::
This is the private key used to establish the SSH connection
to the client for the control channel. Use of the default value
Modified: safekeep/trunk/doc/safekeep.conf.txt
===================================================================
--- safekeep/trunk/doc/safekeep.conf.txt 2010-11-19 05:58:45 UTC (rev 675)
+++ safekeep/trunk/doc/safekeep.conf.txt 2010-11-19 06:55:25 UTC (rev 676)
@@ -46,13 +46,23 @@
`/usr/sbin/sendmail` to deliver the mail.
nice.adjustment::
- The nice level adjustment for safekeep, for the time
- being used only on the server side.
+ The default nice level adjustment for safekeep.
It specifies an integer to be added to the current nice
level. Nicenesses range from -20 (most favorable scheduling)
to 19 (least favorable).
If no nice level is specified, safekeep is not niced.
+nice.adjustment.server::
+ The nice level adjustment for safekeep, used on the server side.
+ It overrides the generic setting in nice.adjustment.
+
+nice.adjustment.client::
+ The default nice adjustment for the client. This settings is normally
+ not all that important, as most of the load is on the server side.
+ You can also set the remove nice level on a per-client basis in
+ the .backup file (see /backup/host/@nice).
+ NB: if you change this value, you will have to re-deploy the auth keys.
+
bandwidth.overall::
This is the default bandwidth limit for both upload and
download for all the clients. It is an integer number of KB/s
Modified: safekeep/trunk/safekeep
===================================================================
--- safekeep/trunk/safekeep 2010-11-19 05:58:45 UTC (rev 675)
+++ safekeep/trunk/safekeep 2010-11-19 06:55:25 UTC (rev 676)
@@ -282,6 +282,7 @@
if host_el:
host = host_el[0].getAttribute('name')
user = host_el[0].getAttribute('user')
+ nice = host_el[0].getAttribute('nice')
key_ctrl = host_el[0].getAttribute('key-ctrl')
key_data = host_el[0].getAttribute('key-data')
else:
@@ -373,7 +374,7 @@
'/var/named/chroot/var/run', '/var/named/chroot/var/tmp' ]
cludes = [{ 'type' : 'exclude', 'path' : path, 'glob' : None, 'regexp' : None } for path in path_xcludes]
- return { 'id': id, 'host' : host, 'user' : user, 'key_ctrl' : key_ctrl, 'key_data' : key_data,
+ return { 'id': id, 'host' : host, 'nice' : nice, 'user' : user, 'key_ctrl' : key_ctrl, 'key_data' : key_data,
'dir' : dir, 'retention' : retention, 'dumps' : dumps, 'snaps' : snaps, 'script' : script,
'cludes' : cludes, 'data_options' : data_options, 'options' : options, 'bw' : bw}
@@ -1060,7 +1061,7 @@
info('------------------------------------------------------------------')
debug('Server listing done')
-def do_keys(cfgs, ids, identity, status, dump, deploy):
+def do_keys(cfgs, ids, nice_rem, identity, status, dump, deploy):
for cfg in cfgs.itervalues():
id = cfg['id']
if ids and id not in ids: continue
@@ -1068,6 +1069,13 @@
if not cfg['host']:
info('%s: Client is local, it needs no keys' % id)
continue
+
+ nice = cfg['nice'] or nice_rem
+ if nice:
+ nice_cmd = 'nice -n%s' % (nice)
+ else:
+ nice_cmd = ''
+
cmds = ['safekeep --client', 'rdiff-backup --server --restrict-read-only /']
privatekeyfiles = [cfg.get('key_ctrl'), cfg.get('key_data')]
lines = []
@@ -1099,7 +1107,7 @@
fin = open(publickeyfile, 'r')
publickey = fin.read()
fin.close()
- line = 'command="%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s' % (cmd, publickey.strip())
+ line = 'command="%s%s",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s' % (nice_cmd, cmd, publickey.strip())
lines.append(line)
else:
keys_ok = True
@@ -1386,7 +1394,9 @@
smtp = props['email.smtp.server']
if 'email.to' in props:
email = props['email.to'].split(',')
- nice_srv = get_int('nice.adjustment')
+ nice_def = get_int('nice.adjustment')
+ nice_srv = get_int('nice.adjustment.server') or nice_def
+ nice_cln = get_int('nice.adjustment.client') or nice_def
global default_bandwidth
default_bandwidth['overall'] = get_int('bandwidth.limit') or 0
@@ -1456,7 +1466,7 @@
verbosity_level = 1 + verbosity
if not keys_status and not keys_print and not keys_deploy:
keys_status = True
- do_keys(cfgs, args, identity, keys_status, keys_print, keys_deploy)
+ do_keys(cfgs, args, nice_cln, identity, keys_status, keys_print, keys_deploy)
else:
assert False, 'Unknown mode: %s' % (mode)
except Exception, ex:
Modified: safekeep/trunk/safekeep.conf
===================================================================
--- safekeep/trunk/safekeep.conf 2010-11-19 05:58:45 UTC (rev 675)
+++ safekeep/trunk/safekeep.conf 2010-11-19 06:55:25 UTC (rev 676)
@@ -10,7 +10,10 @@
# the base directory for data repository relative paths
base.dir = /var/lib/safekeep
-# by default, be nice to the server during backup
+# by default, be nice during backup
+# you can control the server/client nice level via
+# nice.adjustment.server and nice.adjustment.client
+# or even on a per-client box in the .backup file.
nice.adjustment = 10
# A default bandwidth limit for both download/upload
Modified: safekeep/trunk/samples/sample.backup
===================================================================
--- safekeep/trunk/samples/sample.backup 2010-11-19 05:58:45 UTC (rev 675)
+++ safekeep/trunk/samples/sample.backup 2010-11-19 06:55:25 UTC (rev 676)
@@ -4,7 +4,7 @@
<!-- the client backup host, the user under which the servers will connect,
the SSH keys used for launching "safekeep -c" and "rdiff-backup" -->
<host
- name="my_box.corp.com" user="root"
+ name="my_box.corp.com" user="root" nice="10"
key-ctrl="/home/jdoe/.ssh/backup_id_dsa"
key-data="/home/jdoe/.ssh/backup2_id_dsa"
/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|