summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-04-05 20:58:57 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 00:04:40 +0100
commit0d5e808777cfe007d879e3b31a3e6f2e533f104c (patch)
tree215c4fd47e02897e5775a2b8e943eb73e8c36510
parentc0a812c22272887390e44734fb426fd47c05e346 (diff)
downloadpoky-0d5e808777cfe007d879e3b31a3e6f2e533f104c.tar.gz
diskspace monitor: assign a default value when only of the interval is set
Assign a default value to the other one when either disk space interval or amount of inodes interval value is set for example: BB_DISKMON_WARNINTERVAL = "50M," or BB_DISKMON_WARNINTERVAL = ",5K" The diskspace monitor would not enable in the past, that seemed unreasonable, assign a default value to the other one currently, so the monitor will be enabled, and will warn both of diskspace and free amount of inode if they have been set in BB_DISKMON_DIRS. (Bitbake rev: 09592c119550550edcc59c871f754536d5b7bf65) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/monitordisk.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py
index 9baba5e73b..946919396b 100644
--- a/bitbake/lib/bb/monitordisk.py
+++ b/bitbake/lib/bb/monitordisk.py
@@ -136,10 +136,13 @@ def getInterval(configuration):
136 136
137 """ Get the disk space interval """ 137 """ Get the disk space interval """
138 138
139 # The default value is 50M and 5K.
140 spaceDefault = 50 * 1024 * 1024
141 inodeDefault = 5 * 1024
142
139 interval = configuration.getVar("BB_DISKMON_WARNINTERVAL", True) 143 interval = configuration.getVar("BB_DISKMON_WARNINTERVAL", True)
140 if not interval: 144 if not interval:
141 # The default value is 50M and 5K. 145 return spaceDefault, inodeDefault
142 return 50 * 1024 * 1024, 5 * 1024
143 else: 146 else:
144 # The disk space or inode interval is optional, but it should 147 # The disk space or inode interval is optional, but it should
145 # have a correct value once it is specified 148 # have a correct value once it is specified
@@ -151,12 +154,16 @@ def getInterval(configuration):
151 if not intervalSpace: 154 if not intervalSpace:
152 printErr("Invalid disk space interval value in BB_DISKMON_WARNINTERVAL: %s" % intervalRe.group(1)) 155 printErr("Invalid disk space interval value in BB_DISKMON_WARNINTERVAL: %s" % intervalRe.group(1))
153 return None, None 156 return None, None
157 else:
158 intervalSpace = spaceDefault
154 intervalInode = intervalRe.group(2) 159 intervalInode = intervalRe.group(2)
155 if intervalInode: 160 if intervalInode:
156 intervalInode = convertGMK(intervalInode) 161 intervalInode = convertGMK(intervalInode)
157 if not intervalInode: 162 if not intervalInode:
158 printErr("Invalid disk inode interval value in BB_DISKMON_WARNINTERVAL: %s" % intervalRe.group(2)) 163 printErr("Invalid disk inode interval value in BB_DISKMON_WARNINTERVAL: %s" % intervalRe.group(2))
159 return None, None 164 return None, None
165 else:
166 intervalInode = inodeDefault
160 return intervalSpace, intervalInode 167 return intervalSpace, intervalInode
161 else: 168 else:
162 printErr("Invalid interval value in BB_DISKMON_WARNINTERVAL: %s" % interval) 169 printErr("Invalid interval value in BB_DISKMON_WARNINTERVAL: %s" % interval)