+ def nodestate_safeboot (self):
+ "all nodes: mark PLCAPI boot_state as safeboot"
+ self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
+ self.name(),{'boot_state':'safeboot'})
+ return True
+
+ def nodestate_boot (self):
+ "all nodes: mark PLCAPI boot_state as boot"
+ self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
+ self.name(),{'boot_state':'boot'})
+ return True
+
+ def nodestate_show (self):
+ "all nodes: show PLCAPI boot_state"
+ if self.dry_run():
+ print "Dry_run: skipped getting current node state"
+ return True
+ state=self.test_plc.apiserver.GetNodes(self.test_plc.auth_root(), self.name(), ['boot_state'])[0]['boot_state']
+ print self.name(),':',state
+ return True
+
+ def qemu_local_config(self):
+ "all nodes: compute qemu config qemu.conf and store it locally"
+ if not self.is_qemu():
+ return
+ mac=self.node_spec['interface_fields']['mac']
+ hostname=self.node_spec['node_fields']['hostname']
+ ip=self.node_spec['interface_fields']['ip']
+ auth=self.test_plc.auth_root()
+ target_arch=self.test_plc.apiserver.GetPlcRelease(auth)['build']['target-arch']
+ conf_filename="%s/qemu.conf"%(self.nodedir())
+ if self.dry_run():
+ print "dry_run: skipped actual storage of qemu.conf"
+ return True
+ utils.header('Storing qemu config for %s in %s'%(self.name(),conf_filename))
+ file=open(conf_filename,'w')
+ file.write('MACADDR=%s\n'%mac)
+ file.write('NODE_ISO=%s.iso\n'%self.name())
+ file.write('HOSTNAME=%s\n'%hostname)
+ file.write('IP=%s\n'%ip)
+ file.write('TARGET_ARCH=%s\n'%target_arch)
+ file.close()
+ return True
+
+ def qemu_clean (self):
+ utils.header("Cleaning up qemu for host %s on box %s"%(self.name(),self.test_box().hostname()))
+ dry_run=self.dry_run()
+ self.test_box().rmdir(self.nodedir(), dry_run=dry_run)
+ return True
+
+ def qemu_export (self):
+ "all nodes: push local node-dep directory on the qemu box"
+ # if relevant, push the qemu area onto the host box
+ if self.test_box().is_local():
+ return True
+ dry_run=self.dry_run()
+ utils.header ("Cleaning any former sequel of %s on %s"%(self.name(),self.host_box()))
+ utils.header ("Transferring configuration files for node %s onto %s"%(self.name(),self.host_box()))
+ return self.test_box().copy(self.nodedir(),recursive=True,dry_run=dry_run)==0
+
+ def qemu_start (self):
+ "all nodes: start the qemu instance (also runs qemu-bridge-init start)"