Skip to contentSkip to conversation

V3 Disk space monitoring

PATCH In review Robert Yang 1 participant 4 messages Feb 20, 2012

lore
Share & tools
lore
#0 lore raw

cover V3 Disk space monitoring

Hi Richard,

Here is V3, the main changes are:
1) Can set each directory's threshold separately
2) Can choose the action when the disk space is running low:
a) Warn
b) No new task
c) Abort
3) Change the time interval to disk space(or inode) interval, the reason is:
If we use the time interval, then we need a timer, and the timer should be actived when the runqueue starts, and it should combine closely with the runqueue since it it needs controll the task(no new task), and the timer should in the subprocess, otherewise it would block the runqueue, it seems hard to terminate to pass the Ctrl-C to the subprocess since the Ctrl-C is captured by the ui, so I change the time interval to the disk space(or inode) interval, this seems more reasonable than the time interval, it would only warn when the disk space reduce more than the interval, for example, if the interval is 10M, it would warn when the space is lower than the threshold, and warn again when the space reduce more than 10M.

4) The testing result: (The action would be executed when the space or inode is lower than the threshold):
a) When the space is running low:
BB_DISKMON_DIRS = "${TMPDIR},130G,20M"
i) BB_DISKMON_ACTION = "WARN"
WARNING: The free space of /dev/sdb4 is running low (119.700GB left)
...

The build will go on, and will warn again when the disk space reduces more than interval.

ii) BB_DISKMON_ACTION = "NO_NEW_TASK"
WARNING: The free space of /dev/sdb4 is running low (119.689GB left)
WARNING: No new tasks can be excuted since BB_DISKMON_ACTION = "NO_NEW_TASK"!

The build will stop after other tasks has been done

iii) WARNING: The free space of /dev/sdb4 is running low (119.689GB left)
ERROR: Immediately abort since BB_DISKMON_ACTION = "ABORT"!

The build will stop immediately.

b) The similar to the inode, and also the similar to more than one disks are monitored.

// Robert

The following changes since commit 41a83ccfe50ec69425a4828fb5836d38d3f99e67:

guile: fix cross configure failure (2012-02-10 17:01:42 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/disk-space-monitor
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/disk-space-monitor

Robert Yang (2):
Disk space monitoring
Add config sample for disk space monitoring

 bitbake/bin/bitbake               |    1 +
 bitbake/lib/bb/monitordisk.py     |  177 +++++++++++++++++++++++++++++++++++++
 bitbake/lib/bb/runqueue.py        |   65 +++++++++++++-
 meta-yocto/conf/local.conf.sample |   29 ++++++
 4 files changed, 269 insertions(+), 3 deletions(-)
 create mode 100644 bitbake/lib/bb/monitordisk.py
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/2 V3 Disk space monitoring

Monitor disk availability and take action when the free disk space or amount of free inode is running low, it is enabled when BB_DISKMON_DIRS is set.

* Variable meanings(from meta-yocto/conf/local.conf.sample):

   # Set the directories to monitor for disk usage, if more than one
   # directories are mounted in the same device, then only one directory
   # would be monitored since the monitor is based on the device.
   # The format are: "directory,minimum space,minimum free inode",
   # either space or inode (Or both of them) should be specified, otherwise
   # the monitor would not be enabled, the unit can be G, M, K or none,
   # but do NOT use GB, MB or KB (B is not needed).
   #BB_DISKMON_DIRS = "${TMPDIR},1G,1K ${SSTATE_DIR},500M,1K"
   #
   # Set the action when the space is running low, the action is one of:
   # ABORT: Immediately abort
   # NO_NEW_TASK: no new tasks
   # WARN: show warnings
   # The default is WARN
   #BB_DISKMON_ACTION = "WARN"
   #
   # Set disk space and inode interval, the unit can be G, M, or K, but do
   # NOT use the GB, MB or KB (B is not needed), the format is:
   # "disk space interval, disk inode interval",  the default value is
   # "10M, 50" which means that it would warn when the free space is
   # lower than the minimum space(or inode), and would repeat the action
   # when the disk space reduces 10M (or the amount of inode reduces 50)
   # again.
   #BB_DISKMON_INTERVAL = "10M,10K"
[YOCTO #1589]
---
 bitbake/bin/bitbake           |    1 +
 bitbake/lib/bb/monitordisk.py |  177 +++++++++++++++++++++++++++++++++++++++++
 bitbake/lib/bb/runqueue.py    |   65 ++++++++++++++-
 3 files changed, 240 insertions(+), 3 deletions(-)
 create mode 100644 bitbake/lib/bb/monitordisk.py
bitbake/bin/bitbake +1 -0
index 6da4980..d295229 100755
@@ -240,6 +240,7 @@ Default BBFILES are the .bb files in the current directory.""")
     else:
         print("server address: %s, server port: %s" % (server.serverinfo.host, server.serverinfo.port))
 
+
     return 1
 
 if __name__ == "__main__":
bitbake/lib/bb/monitordisk.py new file +177 -0

177 lines not on this page · raw message

bitbake/lib/bb/runqueue.py +62 -3

97 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#2 lore raw
In reply to Robert Yang

Sorry, please ignore this one, I sent the wrong version, I will send another one sooner.

// Robert

Quoted 68 lines · Robert Yang

Hi Richard,

Here is V3, the main changes are:
1) Can set each directory's threshold separately
2) Can choose the action when the disk space is running low:
a) Warn
b) No new task
c) Abort
3) Change the time interval to disk space(or inode) interval, the reason is:
If we use the time interval, then we need a timer, and the timer should be actived when the runqueue starts, and it should combine closely with the runqueue since it it needs controll the task(no new task), and the timer should in the subprocess, otherewise it would block the runqueue, it seems hard to terminate to pass the Ctrl-C to the subprocess since the Ctrl-C is captured by the ui, so I change the time interval to the disk space(or inode) interval, this seems more reasonable than the time interval, it would only warn when the disk space reduce more than the interval, for example, if the interval is 10M, it would warn when the space is lower than the threshold, and warn again when the space reduce more than 10M.

4) The testing result: (The action would be executed when the space or inode is lower than the threshold):
a) When the space is running low:
BB_DISKMON_DIRS = "${TMPDIR},130G,20M"
i) BB_DISKMON_ACTION = "WARN"
WARNING: The free space of /dev/sdb4 is running low (119.700GB left)
...

The build will go on, and will warn again when the disk space reduces more than interval.

ii) BB_DISKMON_ACTION = "NO_NEW_TASK"
WARNING: The free space of /dev/sdb4 is running low (119.689GB left)
WARNING: No new tasks can be excuted since BB_DISKMON_ACTION = "NO_NEW_TASK"!

The build will stop after other tasks has been done

iii) WARNING: The free space of /dev/sdb4 is running low (119.689GB left)
ERROR: Immediately abort since BB_DISKMON_ACTION = "ABORT"!

The build will stop immediately.

b) The similar to the inode, and also the similar to more than one disks are monitored.

// Robert

The following changes since commit 41a83ccfe50ec69425a4828fb5836d38d3f99e67:

guile: fix cross configure failure (2012-02-10 17:01:42 +0000)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib robert/disk-space-monitor
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/disk-space-monitor

Robert Yang (2):
Disk space monitoring
Add config sample for disk space monitoring

  bitbake/bin/bitbake               |    1 +
  bitbake/lib/bb/monitordisk.py     |  177 +++++++++++++++++++++++++++++++++++++
  bitbake/lib/bb/runqueue.py        |   65 +++++++++++++-
  meta-yocto/conf/local.conf.sample |   29 ++++++
  4 files changed, 269 insertions(+), 3 deletions(-)

create mode 100644 bitbake/lib/bb/monitordisk.py

#3 lore raw

PATCH 2/2 V3 Add config sample for disk space monitoring

In reply to Robert Yang

Add config sample for disk space monitoring to
meta-yocto/conf/local.conf.sample

[YOCTO #1589]
---
 meta-yocto/conf/local.conf.sample |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
meta-yocto/conf/local.conf.sample +29 -0
index 38507e3..33e6d7a 100644
@@ -224,3 +224,32 @@ PATCHRESOLVE = "noop"
 # track the version of this file when it was generated. This can safely be ignored if
 # this doesn't mean anything to you.
 CONF_VERSION = "1"
+
+#
+# Disk space monitor, take action when the disk space or the amount of
+# inode is running low, it is enabled when BB_DISKMON_DIRS is set.
+#
+# Set the directories to monitor for disk usage, if more than one
+# directories are mounted in the same device, then only one directory
+# would be monitored since the monitor is based on the device.
+# The format are: "directory,minimum space,minimum free inode",
+# either space or inode (Or both of them) should be specified, otherwise
+# the monitor would not be enabled, the unit can be G, M, K or none,
+# but do NOT use GB, MB or KB (B is not needed).
+#BB_DISKMON_DIRS = "${TMPDIR},1G,1K ${SSTATE_DIR},500M,1K"
+#
+# Set the action when the space is running low, the action is one of:
+# ABORT: Immediately abort
+# NO_NEW_TASK: no new tasks
+# WARN: show warnings
+# The default is WARN
+#BB_DISKMON_ACTION = "WARN"
+#
+# Set disk space and inode interval, the unit can be G, M, or K, but do
+# NOT use the GB, MB or KB (B is not needed), the format is:
+# "disk space interval, disk inode interval",  the default value is
+# "10M, 50" which means that it would warn when the free space is
+# lower than the minimum space(or inode), and would repeat the action
+# when the disk space reduces 10M (or the amount of inode reduces 50)
+# again.
+#BB_DISKMON_INTERVAL = "10M,1K"
Signature · 1 line
1.7.4.1