summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorKang Kai <kai.kang@windriver.com>2012-07-27 16:38:02 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-02 15:28:39 +0100
commitb2a959a0ce039b7630c0ea537d772df647c75663 (patch)
tree087c53a0ae4d5b3ee9066cc02f516270c725e2af /bitbake
parent0125438b853348e8a0869e17848173c9d8d51c5d (diff)
downloadpoky-b2a959a0ce039b7630c0ea537d772df647c75663.tar.gz
bitbake: monitordisk: fire event DISKFULL when terminate build
Part of [Yocto #2168] Add a event DiskFull to descript the termination by disk monitor. Update check() to fire the event DiskFull when terminates the build. This could help UIs to deal this scenario and show more information to end user. (Bitbake rev: 0a0fca3d94a1db6458ae21501a66461a334410ed) Signed-off-by: Kang Kai <kai.kang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/event.py8
-rw-r--r--bitbake/lib/bb/monitordisk.py5
2 files changed, 13 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 1116c0a7bf..20923b5f08 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -312,6 +312,14 @@ class BuildCompleted(BuildBase, OperationCompleted):
312 OperationCompleted.__init__(self, total, "Building Failed") 312 OperationCompleted.__init__(self, total, "Building Failed")
313 BuildBase.__init__(self, n, p, failures) 313 BuildBase.__init__(self, n, p, failures)
314 314
315class DiskFull(Event):
316 """Disk full case build aborted"""
317 def __init__(self, dev, type, freespace, mountpoint):
318 Event.__init__(self)
319 self._dev = dev
320 self._type = type
321 self._free = freespace
322 self._mountpoint = mountpoint
315 323
316class NoProvider(Event): 324class NoProvider(Event):
317 """No Provider for an Event""" 325 """No Provider for an Event"""
diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py
index 946919396b..2bd488123e 100644
--- a/bitbake/lib/bb/monitordisk.py
+++ b/bitbake/lib/bb/monitordisk.py
@@ -176,6 +176,7 @@ class diskMonitor:
176 def __init__(self, configuration): 176 def __init__(self, configuration):
177 177
178 self.enableMonitor = False 178 self.enableMonitor = False
179 self.configuration = configuration
179 180
180 BBDirs = configuration.getVar("BB_DISKMON_DIRS", True) or None 181 BBDirs = configuration.getVar("BB_DISKMON_DIRS", True) or None
181 if BBDirs: 182 if BBDirs:
@@ -219,10 +220,12 @@ class diskMonitor:
219 logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!") 220 logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
220 self.checked[dev] = True 221 self.checked[dev] = True
221 rq.finish_runqueue(False) 222 rq.finish_runqueue(False)
223 bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
222 elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]: 224 elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]:
223 logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!") 225 logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
224 self.checked[dev] = True 226 self.checked[dev] = True
225 rq.finish_runqueue(True) 227 rq.finish_runqueue(True)
228 bb.event.fire(bb.event.DiskFull(dev, 'disk', freeSpace, self.devDict[dev][1]), self.configuration)
226 229
227 # The free inodes, float point number 230 # The free inodes, float point number
228 freeInode = st.f_favail 231 freeInode = st.f_favail
@@ -237,8 +240,10 @@ class diskMonitor:
237 logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!") 240 logger.error("No new tasks can be excuted since the disk space monitor action is \"STOPTASKS\"!")
238 self.checked[dev] = True 241 self.checked[dev] = True
239 rq.finish_runqueue(False) 242 rq.finish_runqueue(False)
243 bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
240 elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]: 244 elif self.devDict[dev][0] == "ABORT" and not self.checked[dev]:
241 logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!") 245 logger.error("Immediately abort since the disk space monitor action is \"ABORT\"!")
242 self.checked[dev] = True 246 self.checked[dev] = True
243 rq.finish_runqueue(True) 247 rq.finish_runqueue(True)
248 bb.event.fire(bb.event.DiskFull(dev, 'inode', freeSpace, self.devDict[dev][1]), self.configuration)
244 return 249 return