From 2e9948bda0174cd71579a11c04d3552d6dee85c7 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 22 Jun 2010 12:16:05 +0200 Subject: [PATCH] option -e for deep analysis (in vservers) of build processes --- scripts/manage-infrastructure.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/scripts/manage-infrastructure.py b/scripts/manage-infrastructure.py index 5da94cf..7bb4c58 100755 --- a/scripts/manage-infrastructure.py +++ b/scripts/manage-infrastructure.py @@ -134,6 +134,30 @@ class BuildBoxes: command=['ps','-o','pid,command'] + [ pid for pid in pids.split("\n") if pid] self.run_ssh(box,command,"Active build processes on %s (%s)"%(box,uptime),True) + # this one is more accurate as it locates processes in the vservers as well + # but it's so sloooowww + def handle_build_box_deep (self,box): + if not self.options.probe: + self.reboot(box) + else: + command=['uptime'] + uptime=self.backquote_ssh(box,command,True).strip() + + command=['vps','-e'] + if self.options.dry_run: + self.run_ssh(box,command,None) + else: + # simulate grep vbuild + vps_lines=[ line for line in self.backquote_ssh(box,command,True).split("\n") + if line.find('vbuild') >= 0] + pids=[ line.split()[0] for line in vps_lines ] + if not pids: + self.header ('No build process on %s (%s)'%(box,uptime)) + else: + command=['vps','-o','pid,command'] + pids + self.run_ssh(box,command,"Active build processes on %s (%s)"%(box,uptime),True) + + vplc_matcher = re.compile(".*(vplc[0-9]+$)") def vplcname (self, vservername): match = self.vplc_matcher.match(vservername) @@ -244,7 +268,10 @@ class BuildBoxes: elif box in self.testmaster_boxes: if type=='testmaster': self.handle_testmaster_box(self.fqdn(box)) elif type=="build": - self.handle_build_box(self.fqdn(box)) + if self.options.deep: + self.handle_build_box_deep(self.fqdn(box)) + else: + self.handle_build_box(self.fqdn(box)) def handle_disk (self,box): box=self.fqdn(box) @@ -266,6 +293,8 @@ Default is to act on test boxes only""" help="Acts on build and test boxes") parser.add_option ("-b","--build",action="store_true",dest="build_only",default=False, help="Acts on build boxes only") + parser.add_option ("-e","--deep",action="store_true", dest="deep", default=False, + help="on build boxes, shows vbuild processes in vservers as well; signif. slower") parser.add_option ("-q","--qemu",action="store_true",dest="qemu_only",default=False, help="Only acts on the qemu boxes") parser.add_option ("-t","--trackers",action="store_true",dest="trackers_only",default=False, -- 2.43.0