# where to send notifications upon load_starting
self.substrate=substrate
- def list (self):
+ 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):
+ def list(self, verbose=False):
if not self.build_instances:
header ('No build process on %s (%s)'%(self.hostname,self.uptime()))
else:
def reboot (self, options):
if not options.soft:
- self.reboot(options)
+ Box.reboot(self,options)
else:
self.soft_reboot (options)
- def list(self):
+ 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):
+ 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(options)
else:
self.run_ssh(['pkill','qemu'],"Killing qemu instances",
dry_run=options.dry_run)
def set_now (self): self.timestamp=int(time.time())
def pretty_timestamp (self): return time.strftime("%Y-%m-%d:%H-%M",time.localtime(self.timestamp))
+ def is_running (self): return len(self.pids) != 0
def add_pid (self,pid):
self.pids.append(pid)
def line (self):
return "%s (%s)"%(self.hostname,self.uptime())
- def list (self):
- if not self.test_instances:
- header ("No known tests on %s"%self.line())
+ def list (self, verbose=False):
+ # verbose shows all tests
+ if verbose:
+ instances = self.test_instances
+ msg="knwown tests"
+ else:
+ instances = [ i for i in self.test_instances if i.is_running() ]
+ msg="known running tests"
+
+ if not instances:
+ header ("No %s on %s"%(msg,self.line()))
else:
- header ("Known tests on %s"%self.line())
- self.test_instances.sort(timestamp_sort)
- for i in self.test_instances: print i.line()
+ header ("%s on %s"%(msg,self.line()))
+ instances.sort(timestamp_sort)
+ for i in instances: print i.line()
+ # show 'starting' regardless of verbose
if self.starting_ips:
header ("Starting IP addresses on %s"%self.line())
self.starting_ips.sort()
for starting in self.starting_ips: print starting
+ else:
+ header ("Empty 'starting' on %s"%self.line())
############################################################
class Options: pass
self._sensed=True
return True
- def list (self):
+ def list (self, verbose=False):
for b in self.default_boxes:
b.list()
nodemap={'host_box':qemu_boxname,
'node_fields:hostname':vnode_fqdn,
'interface_fields:ip':ip,
+ 'ipaddress_fields:ip_addr':ip,
'interface_fields:mac':mac,
}
nodemap.update(self.network_settings())
for box in box_or_names:
if not isinstance(box,Box): box=self.get_box(box)
if not box: continue
- box.list()
+ box.list(self.options.verbose)
def reboot_boxes(self,box_or_names):
for box in box_or_names:
if self.options.qemus: boxes += self.qemu_boxes
if self.options.all: boxes += self.all_boxes
- # default scope is -b -p -q
+ # default scope is -b -p -q -t
if not boxes:
- boxes = self.build_boxes + self.plc_boxes + self.qemu_boxes
+ boxes = self.build_boxes + self.plc_boxes + self.qemu_boxes + [self.test_box]
if self.options.reboot: self.reboot_boxes (boxes)
else: self.list_boxes (boxes)