#!/usr/bin/python
-import os.path
+import os.path, sys
import re
import subprocess
from optparse import OptionParser
class BuildBoxes:
# everything in the onelab.eu domain
- domain = 'onelab.eu'
+ domain = 'pl.sophia.inria.fr'
testmaster = 'testmaster'
build_boxes = [ "mirror", "liquid", "reed", "velvet", ]
plc_boxes = [ "testplc" ]
qemu_boxes = \
- [ "testqemu%d"%i for i in range (1,4) ] + \
- [ "testqemu32-%d"%i for i in range (1,6) ]
+ [ "qemu64-%d"%i for i in range (1,4) ] + \
+ [ "qemu32-%d"%i for i in range (1,6) ]
test_boxes = plc_boxes + qemu_boxes
def __init__ (self):
def header (self,message):
print "===============",message
+ sys.stdout.flush()
def run (self,argv,message, trash_err=False):
if self.options.dry_run:
return subprocess.Popen(argv,stdout=subprocess.PIPE,stderr=file('/dev/null','w')).communicate()[0]
def backquote_ssh (self, box, argv, trash_err=False):
-# print 'BACKQUOTE_SSH [%s] %s'%(box,' '.join(argv))
# first probe the ssh link
hostname=self.backquote ( self.ssh(box) + [ "hostname"], trash_err=True )
if not hostname:
elif type=="build":
self.handle_build_box(self.fqdn(box))
+ def handle_disk (self,box):
+ box=self.fqdn(box)
+ return self.run_ssh(box,["df","-h",],"Disk space on %s"%box)
+
def main (self):
usage="""%prog [options] [hostname..(s)]
Default is to act on test boxes only (with trackers clean)"""
help="Only acts on the qemu boxes")
parser.add_option ("-t","--trackers",action="store_true",dest="trackers_only",default=False,
help="Only wipes trackers")
+ parser.add_option ("-d","--disk",action="store_true",dest="show_disk",default=False,
+ help="Only inspects disk status")
(self.options,args) = parser.parse_args()
self.do_tracker_plcs = True
self.do_tracker_qemus = True
+ if self.options.show_disk:
+ for box in self.boxes: self.handle_disk(box)
+ return
+
# ALL OTHERS
for box in self.boxes: self.handle_box (box,"build")
# PLCS