summaryrefslogtreecommitdiff
path: root/tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1
diff options
context:
space:
mode:
Diffstat (limited to 'tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1')
-rw-r--r--tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1199
1 files changed, 199 insertions, 0 deletions
diff --git a/tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1 b/tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1
new file mode 100644
index 0000000..a5834c3
--- /dev/null
+++ b/tickets/20bdae3913de49d4afd544d36996ce4b/Maildir/new/1455998997.M825284P17339Q73.exolobe1
@@ -0,0 +1,199 @@
+Return-Path: <obnam-dev-bounces@obnam.org>
+X-Original-To: distix@pieni.net
+Delivered-To: distix@pieni.net
+Received: from bagpuss.pepperfish.net (bagpuss.pepperfish.net [148.251.8.16])
+ (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
+ (No client certificate requested)
+ by pieni.net (Postfix) with ESMTPS id 84E152B926
+ for <distix@pieni.net>; Thu, 29 Oct 2015 05:50:24 +0100 (CET)
+Received: from platypus.pepperfish.net (unknown [10.112.100.20])
+ by bagpuss.pepperfish.net (Postfix) with ESMTP id CFD49CB;
+ Thu, 29 Oct 2015 04:50:23 +0000 (GMT)
+Received: from ip6-localhost ([::1] helo=platypus.pepperfish.net)
+ by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
+ id 1ZrfAN-00044G-JC; Thu, 29 Oct 2015 04:50:23 +0000
+Received: from inmail0 ([10.112.100.10] helo=mx0.pepperfish.net)
+ by platypus.pepperfish.net with esmtp (Exim 4.80 #2 (Debian))
+ id 1ZrfAL-00044A-Vz
+ for <obnam-dev@obnam.org>; Thu, 29 Oct 2015 04:50:22 +0000
+Received: from mail-yk0-f171.google.com ([209.85.160.171])
+ by mx0.pepperfish.net with esmtps (TLS1.2:RSA_ARCFOUR_SHA1:128)
+ (Exim 4.80) (envelope-from <mathstuf@gmail.com>) id 1ZrfAJ-0002gX-Qb
+ for obnam-dev@obnam.org; Thu, 29 Oct 2015 04:50:21 +0000
+Received: by ykft191 with SMTP id t191so31141295ykf.0
+ for <obnam-dev@obnam.org>; Wed, 28 Oct 2015 21:50:06 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;
+ bh=gYI6W/BaZtNFrMk/TFeDM3T8/PD2IwVRG0tUVOR2/pQ=;
+ b=YSdfYdl3JjIPyERxdykEUa3pQt/tuQvdjLR6chuX9K5IW/X/OYxQpGLef+DeAwLlhD
+ 1feXCTJ/WAInNXDp8vjkuMdmG+p+hItToYS558UhvRYJFMO5l1QkLo6iq8ufltY78T1Y
+ FqF4vQR8uZ+Ege7mJa1+Z4kaFhnajenVpWYbTNTWJd2FjDOFG1xgn37AW0FGPjHIDQH1
+ 43x2kpgDfE7fmACa1qc711btewA81tx7pVyGDTe2QMlbK7Ut+qH8Ly0RDcSs62fNmIVp
+ n8q4+oH5oERhPDOF81iMJIGRZX6Ev4+Hehej+Hz0TaK8wjm8xrn4/FReLBiXpaKpTPI7
+ IOrQ==
+X-Received: by 10.129.157.211 with SMTP id u202mr36753486ywg.11.1446094205976;
+ Wed, 28 Oct 2015 21:50:05 -0700 (PDT)
+Received: from localhost (10.sub-70-209-141.myvzw.com. [70.209.141.10])
+ by smtp.gmail.com with ESMTPSA id i66sm33284774ywc.2.2015.10.28.21.50.04
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
+ Wed, 28 Oct 2015 21:50:05 -0700 (PDT)
+From: Ben Boeckel <mathstuf@gmail.com>
+To: obnam-dev@obnam.org
+Date: Thu, 29 Oct 2015 00:49:56 -0400
+Message-Id: <1446094196-14166-1-git-send-email-mathstuf@gmail.com>
+X-Mailer: git-send-email 2.6.2
+In-Reply-To: <20150918050247.GA8128@bronto-burt.dev.benboeckel.net>
+References: <20150918050247.GA8128@bronto-burt.dev.benboeckel.net>
+X-Spam-Score: -0.5
+X-Spam-Score-int: -4
+X-Spam-Bar: /
+X-Scanned-By: pepperfish.net, Thu, 29 Oct 2015 04:50:21 +0000
+X-Spam-Report: Content analysis details: (-0.5 points)
+ pts rule name description
+ ---- ---------------------- --------------------------------------------------
+ 1.0 PPF_FROM_CONTAINS_MAIL The From header contains 'mail'
+ 1.2 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
+ (mathstuf[at]gmail.com)
+ -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
+ trust [209.85.160.171 listed in list.dnswl.org]
+ -0.0 SPF_PASS SPF: sender matches SPF record
+ -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
+ [score: 0.0000]
+ -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
+ domain
+ 0.1 DKIM_SIGNED Message has a DKIM or DK signature,
+ not necessarily valid
+ -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
+X-ACL-Warn: message may be spam
+X-Scan-Signature: fc70ac7cbc1a3ab5eb75965631bdeb45
+Cc: Ben Boeckel <mathstuf@gmail.com>
+Subject: [PATCH] backup: take an inhibitor lock if possible
+X-BeenThere: obnam-dev@obnam.org
+X-Mailman-Version: 2.1.5
+Precedence: list
+List-Id: Obnam development discussions <obnam-dev-obnam.org>
+List-Unsubscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
+ <mailto:obnam-dev-request@obnam.org?subject=unsubscribe>
+List-Archive: <http://listmaster.pepperfish.net/pipermail/obnam-dev-obnam.org>
+List-Post: <mailto:obnam-dev@obnam.org>
+List-Help: <mailto:obnam-dev-request@obnam.org?subject=help>
+List-Subscribe: <http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org>,
+ <mailto:obnam-dev-request@obnam.org?subject=subscribe>
+Sender: obnam-dev-bounces@obnam.org
+Errors-To: obnam-dev-bounces@obnam.org
+
+When a backup is happening, the machine should not suspend or otherwise
+go down. Add a setting for taking a systemd inhibitor lock.
+
+The code fails safely which allows both the dbus module and the
+systemd-logind DBus interface to be optional. In both cases, warnings
+are generated.
+
+Signed-off-by: Ben Boeckel <mathstuf@gmail.com>
+---
+ obnamlib/plugins/backup_plugin.py | 73 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 73 insertions(+)
+
+diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
+index 978db2e..e15d614 100644
+--- a/obnamlib/plugins/backup_plugin.py
++++ b/obnamlib/plugins/backup_plugin.py
+@@ -125,6 +125,13 @@ class BackupPlugin(obnamlib.ObnamPlugin):
+ 'as it is quite bad for performance',
+ group=backup_group)
+
++ self.app.settings.boolean(
++ ['block-suspend'],
++ 'block shutdown and suspending of the '
++ 'system while the backup is in progress',
++ default=True,
++ group=backup_group)
++
+ # Performance related settings.
+
+ perf_group = obnamlib.option_group['perf']
+@@ -155,6 +162,22 @@ class BackupPlugin(obnamlib.ObnamPlugin):
+
+ '''
+
++ if self.app.settings['block-suspend']:
++ inhibitor_args = {
++ 'what': (IDLE, SLEEP, SHUTDOWN),
++ 'why': 'backup in progress',
++ 'who': 'obnam',
++ 'mode': BLOCK,
++ }
++ with Inhibitor(**inhibitor_args):
++ self._backup(args)
++ else:
++ self._backup(args)
++
++ def _backup(self, args):
++ '''Actual backup logic.
++ '''
++
+ logging.info('Backup starts')
+
+ root_urls = self.app.settings['root'] + args
+@@ -900,3 +923,53 @@ class BackupPlugin(obnamlib.ObnamPlugin):
+ tracing.trace('new_roots: %s' % repr(new_roots))
+ gen_id = self.new_generation
+ helper('/')
++
++# Inhibitor logic.
++
++# Things that can be inhibited.
++SHUTDOWN = 'shutdown'
++SLEEP = 'sleep'
++IDLE = 'idle'
++HANDLE_POWER_KEY = 'handle-power-key'
++HANDLE_SUSPEND_KEY = 'handle-suspend-key'
++HANDLE_HIBERNATE_KEY = 'handle-hibernate-key'
++HANDLE_LID_SWITCH = 'handle-lid-switch'
++
++# What kind of block can be taken.
++BLOCK = 'block'
++DELAY = 'delay'
++
++
++class Inhibitor(object):
++ def __init__(self, what=(IDLE, SLEEP, SHUTDOWN),
++ who='obnam', why='Unknown reason', mode=BLOCK):
++ self.what = ':'.join(what)
++ self.who = who
++ self.why = why
++ self.mode = mode
++
++ self._fd = None
++
++ def __enter__(self):
++ try:
++ import dbus
++ except ImportError:
++ logging.warn(
++ 'Failed to import the dbus module. '
++ 'Skipping inhibitor locks.')
++ return
++
++ try:
++ bus = dbus.SystemBus()
++ manager = bus.get_object('org.freedesktop.login1',
++ '/org/freedesktop/login1')
++ iface = 'org.freedesktop.login1.Manager'
++ self._fd = manager.Inhibit(self.what, self.who,
++ self.why, self.mode,
++ dbus_interface=iface)
++ except BaseException, e:
++ logging.warning('failed to take an inhibitor lock')
++ logging.debug('Inhibitor exception %s', str(e))
++
++ def __exit__(self, type_, value, traceback):
++ self._fd = None
+--
+2.6.2
+
+
+_______________________________________________
+obnam-dev mailing list
+obnam-dev@obnam.org
+http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/obnam-dev-obnam.org