# where to send notifications upon load_starting
self.substrate=substrate
- def list (self, verbose):
+ def list (self, verbose=False):
for i in self.pool_items: print i.line()
def line (self):
return
self.build_instances.append(BuildInstance(buildname, pid, self))
- def list(self, verbose):
+ def list(self, verbose=False):
if not self.build_instances:
header ('No build process on %s (%s)'%(self.hostname,self.uptime()))
else:
# inspect box and find currently running builds
matcher=re.compile("\s*(?P<pid>[0-9]+).*-[bo]\s+(?P<buildname>[^\s]+)(\s|\Z)")
- matcher_building_vm=re.compile("\s*(?P<pid>[0-9]+).*init-vserver.*-i\s+eth.\s+(?P<buildname>[^\s]+)\s*\Z")
+ matcher_building_vm=re.compile("\s*(?P<pid>[0-9]+).*init-vserver.*\s+(?P<buildname>[^\s]+)\s*\Z")
def sense(self, options):
print 'bb',
self.sense_uptime()
def reboot (self, options):
if not options.soft:
- self.reboot(options)
+ Box.reboot(self,options)
else:
self.soft_reboot (options)
- def list(self, verbose):
+ def list(self, verbose=False):
if not self.plc_instances:
header ('No plc running on %s'%(self.line()))
else:
self.plc_instances.append(PlcVsInstance(self,vservername,ctxid))
def line(self):
- msg="%s [max=%d,%d free, VS-based] (%s)"%(self.hostname, self.max_plcs,self.free_slots(),self.uname())
+ msg="%s [max=%d,free=%d, VS-based] (%s)"%(self.hostname, self.max_plcs,self.free_slots(),self.uname())
return msg
def plc_instance_by_vservername (self, vservername):
# a line describing the box
def line(self):
- msg="%s [max=%d,%d free, LXC-based] (%s)"%(self.hostname, self.max_plcs,self.free_slots(),self.uname())
+ msg="%s [max=%d,free=%d, LXC-based] (%s)"%(self.hostname, self.max_plcs,self.free_slots(),self.uname())
return msg
def plc_instance_by_lxcname (self, lxcname):
self.qemu_instances.append(dummy)
def line (self):
- msg="%s [max=%d,%d free] (%s)"%(self.hostname, self.max_qemus,self.free_slots(),self.driver())
+ msg="%s [max=%d,free=%d] (%s)"%(self.hostname, self.max_qemus,self.free_slots(),self.driver())
return msg
- def list(self, verbose):
+ def list(self, verbose=False):
if not self.qemu_instances:
header ('No qemu process on %s'%(self.line()))
else:
def reboot (self, options):
if not options.soft:
- self.reboot(options)
+ Box.reboot(self,options)
else:
self.run_ssh(['pkill','qemu'],"Killing qemu instances",
dry_run=options.dry_run)
def sense(self, options):
print 'qn',
modules=self.backquote_ssh(['lsmod']).split('\n')
- self._driver='*NO kqemu/kmv_intel MODULE LOADED*'
+ self._driver='*NO kqemu/kvm_intel MODULE LOADED*'
for module in modules:
if module.find('kqemu')==0:
self._driver='kqemu module loaded'
- # kvm might be loaded without vkm_intel (we dont have AMD)
+ # kvm might be loaded without kvm_intel (we dont have AMD)
elif module.find('kvm_intel')==0:
self._driver='kvm_intel module loaded'
########## find out running pids
header(">>%s<<"%line)
########## retrieve alive instances and map to build
live_builds=[]
- command=['grep','.','*/*/qemu.pid','/dev/null']
+ command=['grep','.','/vservers/*/*/qemu.pid','/dev/null']
pid_lines=self.backquote_ssh(command,trash_err=True).split('\n')
for pid_line in pid_lines:
if not pid_line.strip(): continue
# expect <build>/<nodename>/qemu.pid:<pid>pid
try:
- (buildname,nodename,tail)=pid_line.split('/')
+ (_,__,buildname,nodename,tail)=pid_line.split('/')
(_,pid)=tail.split(':')
q=self.qemu_instance_by_pid (pid)
if not q: continue
# retrieve timestamps
if not live_builds: return
command= ['grep','.']
- command += ['%s/*/timestamp'%b for b in live_builds]
+ command += ['/vservers/%s/*/timestamp'%b for b in live_builds]
command += ['/dev/null']
ts_lines=self.backquote_ssh(command,trash_err=True).split('\n')
for ts_line in ts_lines:
if not ts_line.strip(): continue
# expect <build>/<nodename>/timestamp:<timestamp>
try:
- (buildname,nodename,tail)=ts_line.split('/')
+ (_,__,buildname,nodename,tail)=ts_line.split('/')
nodename=nodename.replace('qemu-','')
(_,timestamp)=tail.split(':')
timestamp=int(timestamp)
def line (self):
return "%s (%s)"%(self.hostname,self.uptime())
- def list (self, verbose):
+ def list (self, verbose=False):
# verbose shows all tests
if verbose:
instances = self.test_instances
self._sensed=True
return True
- def list (self, verbose):
+ def list (self, verbose=False):
for b in self.default_boxes:
b.list()