From fad92b43a9cae41a6e0dbf9a2f75a739a4c52433 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 10 Feb 2012 12:43:39 +0100 Subject: [PATCH] properly reports vserver building processes --- system/Substrate.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/system/Substrate.py b/system/Substrate.py index 1d42cb7..501e3ab 100644 --- a/system/Substrate.py +++ b/system/Substrate.py @@ -353,6 +353,7 @@ class BuildBox (Box): # inspect box and find currently running builds matcher=re.compile("\s*(?P[0-9]+).*-[bo]\s+(?P[^\s]+)(\s|\Z)") + matcher_building_vm=re.compile("\s*(?P[0-9]+).*init-vserver.*-i\s+eth.\s+(?P[^\s]+)\s*\Z") def sense(self, options): print 'b', self.sense_uptime() @@ -367,7 +368,14 @@ class BuildBox (Box): date=time.strftime('%Y-%m-%d',time.localtime(time.time())) buildname=m.group('buildname').replace('@DATE@',date) self.add_build (buildname,m.group('pid')) - else: header('command %r returned line that failed to match'%command) + continue + m=BuildBox.matcher_building_vm.match(line) + if m: + # buildname is expansed here + self.add_build (buildname,m.group('pid')) + continue + header('BuildBox.sense: command %r returned line that failed to match'%command) + header(">>%s<<"%line) ############################################################ class PlcInstance: @@ -622,8 +630,11 @@ class QemuBox (Box): for line in ps_lines: if not line.strip() or line.find('PID') >=0 : continue m=QemuBox.matcher.match(line) - if m: self.add_node (m.group('nodename'),m.group('pid')) - else: header('command %r returned line that failed to match'%command) + if m: + self.add_node (m.group('nodename'),m.group('pid')) + continue + header('QemuBox.sense: command %r returned line that failed to match'%command) + header(">>%s<<"%line) ########## retrieve alive instances and map to build live_builds=[] command=['grep','.','*/*/qemu.pid','/dev/null'] @@ -774,7 +785,9 @@ class TestBox (Box): plcindex=m.group('plcindex') step=m.group('step') self.add_broken(buildname,plcindex, step) - else: header("command %r returned line that failed to match\n%s"%(command,line)) + continue + header("TestBox.sense: command %r returned line that failed to match\n%s"%(command,line)) + header(">>%s<<"%line) pids = self.backquote_ssh (['pgrep','run_log'],trash_err=True) if not pids: return @@ -787,7 +800,9 @@ class TestBox (Box): pid=m.group('pid') buildname=m.group('buildname') self.add_running_test(pid, buildname) - else: header("command %r returned line that failed to match\n%s"%(command,line)) + continue + header("TestBox.sense: command %r returned line that failed to match\n%s"%(command,line)) + header(">>%s<<"%line) def line (self): -- 2.43.0