+ 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("boot_state for {} : {}".format(self.name(), state))
+ return True
+
+ def nodedistro_f14(self):
+ return self.nodedistro_set('f14')
+ def nodedistro_f18(self):
+ return self.nodedistro_set('f18')
+ def nodedistro_f20(self):
+ return self.nodedistro_set('f20')
+ def nodedistro_f21(self):
+ return self.nodedistro_set('f21')
+ def nodedistro_f22(self):
+ return self.nodedistro_set('f22')
+ def nodedistro_set(self, distro):
+ "set the fcdistro tag to distro, passed in arg"
+ self.test_plc.apiserver.SetNodeFcdistro(self.test_plc.auth_root(),
+ self.name(), distro)
+ return True
+ def nodeflavour_show(self):
+ "display the fcdistro tag - or flavour actually - of node"
+ if self.dry_run():
+ print("Dry_run: would fetch node flavour")
+ return True
+ flavour = self.test_plc.apiserver.GetNodeFlavour(self.test_plc.auth_root(),
+ self.name())
+ print("Flavour for {} : {}".format(self.name(), flavour))
+ return True
+
+ def nodeplain_set(self, plain):
+ " set bootstrapfs-plain tag on nodes"
+ self.test_plc.apiserver.SetNodePlainBootstrapfs(self.test_plc.auth_root(),
+ self.name(), plain)
+ return True
+ def nodeplain_on(self):
+ return self.nodeplain_set("True")
+ def nodeplain_off(self):
+ return self.nodeplain_set("")
+ def nodeplain_show(self):
+ "display bootstrapfs-plain tag"
+ if self.dry_run():
+ print("Dry_run: would fetch node plain-bootstrapfs tag")
+ return True
+ plain = self.test_plc.apiserver.GetNodePlainBootstrapfs(self.test_plc.auth_root(),
+ self.name())
+ print("Plain bootstrapfs for {} is {}".format(self.name(), plain))
+ 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 = "{}/qemu.conf".format(self.nodedir())
+ if self.dry_run():
+ print("dry_run: skipped actual storage of qemu.conf")
+ return True
+ utils.header('Storing qemu config for {} in {}'.format(self.name(), conf_filename))
+ with open(conf_filename,'w') as file:
+ file.write('MACADDR={}\n'.format(mac))
+ file.write('NODE_ISO={}.iso\n'.format(self.name()))
+ file.write('HOSTNAME={}\n'.format(hostname))
+ file.write('IP={}\n'.format(ip))
+ file.write('TARGET_ARCH={}\n'.format(target_arch))
+ return True
+
+ def qemu_clean(self):
+ utils.header("Cleaning up qemu for host {} on box {}"\
+ .format(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 {} on {}"\
+ .format(self.name(), self.host_box()))
+ utils.header("Transferring configuration files for node {} onto {}"\
+ .format(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)"
+ model = self.node_spec['node_fields']['model']