new steps to change a node's fcdistro in a bonding environment
[tests.git] / system / TestNode.py
index 59a7924..54de26c 100644 (file)
@@ -193,6 +193,12 @@ class TestNode:
                                            self.name(),{'boot_state':'reinstall'})
         return True
     
+    def nodestate_upgrade(self):
+        "all nodes: mark PLCAPI boot_state as upgrade"
+        self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
+                                           self.name(),{'boot_state':'upgrade'})
+        return True
+    
     def nodestate_safeboot(self):
         "all nodes: mark PLCAPI boot_state as safeboot"
         self.test_plc.apiserver.UpdateNode(self.test_plc.auth_root(),
@@ -211,9 +217,33 @@ class TestNode:
             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)
+        print("boot_state for {} : {}".format(self.name(), state))
         return True
     
+    def nodefcdistro_f14(self):
+        return self.nodefcdistro_set('f14')
+    def nodefcdistro_f18(self):
+        return self.nodefcdistro_set('f18')
+    def nodefcdistro_f20(self):
+        return self.nodefcdistro_set('f20')
+    def nodefcdistro_f21(self):
+        return self.nodefcdistro_set('f21')
+    def nodefcdistro_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 nodefcdistro_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 qemu_local_config(self):
         "all nodes: compute qemu config qemu.conf and store it locally"
         if not self.is_qemu():
@@ -274,6 +304,17 @@ class TestNode:
         return test_box.run_in_buildname("echo {:d} > {}/timestamp"\
                                          .format(now, self.nodedir()), dry_run=self.dry_run()) == 0
 
+    def qemu_nodefamily(self):
+        auth = self.test_plc.auth_root()
+        hostname = self.node_spec['node_fields']['hostname']
+        nodeflavour = self.test_plc.apiserver.GetNodeFlavour(auth, hostname)
+        if self.dry_run():
+            return True
+        nodedir = self.nodedir()
+        nodefamily = nodeflavour['nodefamily']
+        self.test_box().run_in_buildname("echo {nodefamily} > {nodedir}/nodefamily".format(**locals()))
+        return True
+
     def start_qemu(self):
         test_box = self.test_box()
         utils.header("Starting qemu node {} on {}".format(self.name(), test_box.hostname()))