cas | 33 +++++++++++----------------------
cas.conf | 5 +++++
lib/cas/core.py | 6 ++++--
3 files changed, 20 insertions(+), 24 deletions(-)
New commits:
commit ee9864a931fe18c5a58942205d9cfd0551ad9002
Author: adam stokes <uzr(a)jak.rebo>
Date: Mon Sep 28 11:33:16 2009 -0400
merge buffersize settings from stokes-devel branch
diff --git a/cas b/cas
index b6d20cc..f4e3f9d 100755
--- a/cas
+++ b/cas
@@ -38,6 +38,8 @@ if sys.version_info[:2] < (2,3):
raise SystemExit("Python >= 2.3 required")
# Configuration parsing of /etc/cas.conf
+# TODO: rework config read to place all items
+# into a key,value pair automatically
config = ConfigParser.ConfigParser()
config.read("/etc/cas.conf")
WORKDIRECTORY = config.get("settings","workDirectory")
@@ -54,6 +56,11 @@ CRASH_32=None
if config.has_option("advanced", "crash_32"):
CRASH_32=config.get("advanced", "crash_32")
+# Do we have a buffersize
+BUFFERSIZE=None
+if config.has_option("advanced", "buffersize"):
+ BUFFERSIZE=config.get("advanced", "buffersize")
+
class CoreHandler(object):
def __init__(self, filename, dst, logger):
self.filename = filename
@@ -115,7 +122,7 @@ class TimestampHandler(object):
# dig through the buildstamp database and attempt to match it with the
# one found in the core
try:
- coreTimestamp = self.tool.timestamp(self.corefile)
+ coreTimestamp = self.tool.timestamp(self.corefile, BUFFERSIZE)
except CoreException, err:
raise SystemExit(self.casLog.debug(err))
# query timestamp table, return tuple debuginfoRPM, and path to
@@ -252,12 +259,9 @@ class CasApplication(object):
self.casLog.debug("crash problem: err: %s, out: %s" % (err,
out))
else:
# The machine running cas isn't capable of processing this core, lets
- # attempt with Func. Assuming Func is installed and a server database
+ # attempt with paramiko. Assuming paramiko is installed and a server
database
# is configured we attempt to process the core at another machine.
try:
- import func.overlord.client as fc
- import func.jobthing as jobthing
- from time import sleep
self.casLog.info("Crash file built, locating suitable %s system for
" \
"processing" % (debugKernelArch,))
serverList = self.db.getServers()
@@ -269,22 +273,7 @@ class CasApplication(object):
self.casLog.info("Machine %s found, processing " \
"crash output" %
(casProcessMachine,))
cmd = "cd " + os.path.join(self.storagePath) +
" && ./crash -i crash.in > crash.out"
- client = fc.Overlord(casProcessMachine,async=True)
- # test if client is reachable
- isClientReachable = client.run("test",
"ping", [])
- if isClientReachable == 1:
- job_id = client.command.run(cmd)
- while True:
- status = client.job_status(job_id)
- (code, results) = status
- if code == jobthing.JOB_ID_RUNNING:
- self.casLog.status("task is
running...")
- elif code == jobthing.JOB_ID_PARTIAL:
- self.casLog.status("task is
running...")
- elif code == jobthing.JOB_ID_FINISHED:
- self.casLog.status("task complete; results =
%s" % (results,))
- break
- sleep(5)
+ # TODO: run command through paramiko
else:
self.casLog.info("No servers available for arch and current
system not "\
"suitable for processing, please run cas-admin -h
" \
@@ -294,7 +283,7 @@ class CasApplication(object):
"more information"))
except ImportError:
self.casLog.info("Current running machine is not suitable for
processing this core " \
- "and
http://fedorahosted.org/func is not installed/configured
properly.")
+ "and python-paramiko is not installed/configured
properly.")
self.casLog.info("Finishing job without processing the core, please
find a suitable %s "\
"machine in order to view this core in crash." %
(debugKernelArch,))
crashOutFile = os.path.join(self.storagePath,"modules")
diff --git a/cas.conf b/cas.conf
index 8df8ac8..1928139 100644
--- a/cas.conf
+++ b/cas.conf
@@ -54,3 +54,8 @@ autoPurge=no
# rpm --relocate /usr/bin=/usr/local/i386 -ivh crash*i386.rpm
# crash_32=/usr/local/i386/crash
+
+# Define a buffersize to be set when reading a core file
+# Valid options are {number, None, or blank}
+# If set to None or blank default will be ~515M
+# buffersize = None
diff --git a/lib/cas/core.py b/lib/cas/core.py
index f4558d5..010ad6f 100644
--- a/lib/cas/core.py
+++ b/lib/cas/core.py
@@ -93,7 +93,7 @@ class CoreBase(object):
return True
return False
- def timestamp(self, path):
+ def timestamp(self, path, blksize):
""" captures fingerprint from core
"""
match='Linux\sversion.*20\d{1,2}|#1\s.*20\d{1,2}'
@@ -102,7 +102,9 @@ class CoreBase(object):
except IOError:
return False
fd.seek(0)
- b = os.read(fd.fileno(),54000000)
+ if not blksize or blksize == "":
+ blksize = 540000000
+ b = os.read(fd.fileno(),blksize)
out = self.util.regexSearch(match, b)
if out:
return out