Merge lp:~alain-miltenburg/powernap/powernap into lp:powernap

Proposed by Alain Miltenburg
Status: Needs review
Proposed branch: lp:~alain-miltenburg/powernap/powernap
Merge into: lp:powernap
Diff against target: 89 lines (+71/-0)
3 files modified
debian/changelog (+6/-0)
debian/patches/diskmonitor-by-symlink.patch (+64/-0)
debian/patches/series (+1/-0)
To merge this branch: bzr merge lp:~alain-miltenburg/powernap/powernap
Reviewer Review Type Date Requested Status
PowerNap Pending
Review via email: mp+190377@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

295. By Alain Miltenburg

DiskMonitor: added the ability to monitor disks by symlink (LP: #1222851)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-12-19 16:11:05 +0000
3+++ debian/changelog 2013-10-10 14:03:30 +0000
4@@ -1,3 +1,9 @@
5+powernap (2.19ubuntu1) UNRELEASED; urgency=low
6+
7+ * DiskMonitor: added the ability to monitor disks by symlink (LP: #1222851)
8+
9+ -- Alain Miltenburg <Alain.Miltenburg@gmail.com> Thu, 10 Oct 2013 15:56:35 +0200
10+
11 powernap (2.19) unreleased; urgency=low
12
13 * UNRELEASED
14
15=== added directory 'debian/patches'
16=== added file 'debian/patches/diskmonitor-by-symlink.patch'
17--- debian/patches/diskmonitor-by-symlink.patch 1970-01-01 00:00:00 +0000
18+++ debian/patches/diskmonitor-by-symlink.patch 2013-10-10 14:03:30 +0000
19@@ -0,0 +1,64 @@
20+## Description: add some description
21+## Origin/Author: add some origin or author
22+## Bug: bug URL
23+Index: powernap.dev/config
24+===================================================================
25+--- powernap.dev.orig/config 2013-10-10 15:44:02.257419000 +0200
26++++ powernap.dev/config 2013-10-10 15:52:05.276933941 +0200
27+@@ -217,11 +217,11 @@
28+ # state of the drive and does not modify the behavior of the drive
29+ # directly. Therefore it only makes sense to monitor a drive that has
30+ # already been configured to standby or sleep.
31+-# To disable checking specific drives, set them to "n" or "no",
32+-# or simply comment them.
33++# The monitor accepts disk devices found under /dev/ as well as symbolic
34++# links to them found under /dev/disk/.
35+ # Examples:
36+-# sda = y
37+-# sdb = n
38++# sda = /dev/sda
39++# disk1 = /dev/disk/by-uuid/38fb40d0-195d-11e3-8ffd-0800200c9a66
40+ [DiskMonitor]
41+-#sda = y
42++#sda = /dev/sda
43+
44+Index: powernap.dev/powernap/monitors/DiskMonitor.py
45+===================================================================
46+--- powernap.dev.orig/powernap/monitors/DiskMonitor.py 2013-10-10 15:44:02.257419000 +0200
47++++ powernap.dev/powernap/monitors/DiskMonitor.py 2013-10-10 15:54:41.108932190 +0200
48+@@ -28,6 +28,7 @@
49+ def __init__(self, config):
50+ self._type = config['monitor']
51+ self._name = config['name']
52++ self._device = config['device']
53+ self._regex_state = re.compile(r"^\s+drive\s+state\s+is:\s+(\S+)")
54+ self._regex_not_found = re.compile(r"^.*No\s+such\s+file")
55+ self._absent_seconds = 0
56+@@ -44,7 +45,11 @@
57+ # 'standby' or 'sleeping'. Assume 'active/idle', except in case
58+ # where fuction returns 'No such file' error (e.g. unknown drive)
59+ def is_disk_active(self):
60+- hdparm = commands.getoutput("hdparm -C /dev/%s" % self._name).splitlines()
61++ if self._device == 'y' or self._device == 'yes':
62++ # Necessary for backward compatibility with older configuration files.
63++ hdparm = commands.getoutput("hdparm -C /dev/%s" % self._name).splitlines()
64++ else:
65++ hdparm = commands.getoutput("hdparm -C %s" % self._device).splitlines()
66+ is_active = True
67+ for line in hdparm:
68+ if self._regex_not_found.match(line):
69+Index: powernap.dev/powernap/powernap.py
70+===================================================================
71+--- powernap.dev.orig/powernap/powernap.py 2013-10-10 15:44:02.257419000 +0200
72++++ powernap.dev/powernap/powernap.py 2013-10-10 15:55:37.792931553 +0200
73+@@ -163,8 +163,8 @@
74+ self.MONITORS.append({"monitor":monitor, "name":items[0], "port":eval(items[1]), "absent":self.ABSENT_SECONDS})
75+ if monitor == "WoLMonitor":
76+ self.MONITORS.append({"monitor":monitor, "name":items[0], "port":eval(items[1]), "absent":self.ABSENT_SECONDS})
77+- if monitor == "DiskMonitor" and (items[1] == "y" or items[1] == "yes"):
78+- self.MONITORS.append({"monitor":monitor, "name":items[0], "absent":self.ABSENT_SECONDS})
79++ if monitor == "DiskMonitor" and (items[1] != "n" and items[1] != "no"):
80++ self.MONITORS.append({"monitor":monitor, "name":items[0], "device":items[1], "absent":self.ABSENT_SECONDS})
81+
82+ def get_monitors(self):
83+ monitor = []
84
85=== added file 'debian/patches/series'
86--- debian/patches/series 1970-01-01 00:00:00 +0000
87+++ debian/patches/series 2013-10-10 14:03:30 +0000
88@@ -0,0 +1,1 @@
89+diskmonitor-by-symlink.patch

Subscribers

People subscribed via source and target branches