decodebytes, not decodestring
[tests.git] / system / TestNode.py
index 54de26c..686a38d 100644 (file)
@@ -182,9 +182,9 @@ class TestNode:
             print("Dry_run: skipped writing of iso image")
             return True
         else:
-            # with python3 we need to call decodestring here
+            # with python3 we need to call decodebytes here
             with open(filename,'wb') as storage:
-                storage.write(base64.decodestring(bencoded))
+                storage.write(base64.decodebytes(bencoded))
             return True
 
     def nodestate_reinstall(self):
@@ -220,21 +220,24 @@ class TestNode:
         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):
+    def nodedistro_f14(self):
+        return self.nodedistro_set('f14', 'onelab')
+    def nodedistro_f18(self):
+        return self.nodedistro_set('f18', 'lxc')
+    def nodedistro_f20(self):
+        return self.nodedistro_set('f20', 'lxc')
+    def nodedistro_f21(self):
+        return self.nodedistro_set('f21', 'lxc')
+    def nodedistro_f22(self):
+        return self.nodedistro_set('f22', 'lxc')
+    def nodedistro_set(self, fcdistro, pldistro):
         "set the fcdistro tag to distro, passed in arg"
         self.test_plc.apiserver.SetNodeFcdistro(self.test_plc.auth_root(),
-                                               self.name(), distro)
+                                                self.name(), fcdistro)
+        self.test_plc.apiserver.SetNodePldistro(self.test_plc.auth_root(),
+                                                self.name(), pldistro)
         return True
-
-    def nodefcdistro_show(self):
+    def nodedistro_show(self):
         "display the fcdistro tag - or flavour actually - of node"
         if self.dry_run():
             print("Dry_run: would fetch node flavour")
@@ -285,6 +288,13 @@ class TestNode:
                      .format(self.name(), self.host_box()))
         return self.test_box().copy(self.nodedir(), recursive=True, dry_run=dry_run) == 0
             
+    def qemu_cleanlog(self):
+        "rename log.txt into log.txt.bak in the qemu dir"
+        test_box = self.test_box()
+        test_box.run_in_buildname("cd {}; mv -f log.txt log.txt.bak".
+                                  format(self.nodedir()), dry_run=self.dry_run())
+        return True
+
     def qemu_start(self):
         "all nodes: start the qemu instance (also runs qemu-bridge-init start)"
         model = self.node_spec['node_fields']['model']
@@ -305,6 +315,7 @@ class TestNode:
                                          .format(now, self.nodedir()), dry_run=self.dry_run()) == 0
 
     def qemu_nodefamily(self):
+        "write nodefamily stamp in qemu working dir"
         auth = self.test_plc.auth_root()
         hostname = self.node_spec['node_fields']['hostname']
         nodeflavour = self.test_plc.apiserver.GetNodeFlavour(auth, hostname)
@@ -399,7 +410,7 @@ class TestNode:
         test_ssh = self.create_test_ssh()
         if self.has_libvirt():
             utils.header("Checking system slice {} using virsh".format(slicename))
-            return test_ssh.run("virsh --connect lxc:// list | grep -q ' {} '".format(vservername),
+            return test_ssh.run("virsh --connect lxc:/// list | grep -q ' {} '".format(vservername),
                                 dry_run = dry_run) == 0
         else:
             retcod, output = \