check system slice using 'drl' for now
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 13 Apr 2012 13:06:08 +0000 (15:06 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 13 Apr 2012 13:06:08 +0000 (15:06 +0200)
system/TestNode.py
system/TestPlc.py

index a1e3dac..4d684dc 100644 (file)
@@ -271,16 +271,24 @@ class TestNode:
             utils.header ("SUCCESS: node hook %s OK"%script_name)
             return True
 
-    def check_systemslice (self, slicename):
+    def has_libvirt (self):
+        test_ssh=self.create_test_ssh()
+        return test_ssh.run ("rpm -q libvirt-client")==0
+
+    def check_systemslice (self, slicename,dry_run=False):
         sitename=self.test_plc.plc_spec['PLC_SLICE_PREFIX']
         vservername="%s_%s"%(sitename,slicename)
         test_ssh=self.create_test_ssh()
-        (retcod,output)=utils.output_of(test_ssh.actual_command("cat /vservers/%s/etc/slicefamily")%vservername)
-        if retcod != 0: 
-            return False
-        # get last line only as ssh pollutes the output
-        slicefamily=output.split("\n")[-1]
-        utils.header("system slice %s has slicefamily %s"%(slicename, slicefamily))
-        return test_ssh.run("vserver-stat | grep %s"%vservername)==0
+        if self.has_libvirt():
+            return test_ssh.run("virsh --connect lxc:// list | grep -q ' %s '"%vservername,
+                                dry_run=dry_run)==0
+        else:
+            (retcod,output)=utils.output_of(test_ssh.actual_command("cat /vservers/%s/etc/slicefamily 2> /dev/null")%vservername)
+            # get last line only as ssh pollutes the output
+            slicefamily=output.split("\n")[-1]
+            utils.header("system slice %s has slicefamily %s"%(slicename, slicefamily))
+            if retcod != 0: 
+                return False
+            return test_ssh.run("vserver-stat | grep %s"%vservername,dry_run=dry_run)==0
         
         
index ab119a9..463e794 100644 (file)
@@ -98,7 +98,7 @@ class TestPlc:
         'ssh_node_debug@1', 'plcsh_stress_test@1', SEP,
         'ssh_node_boot@1', 'ssh_slice', 'check_initscripts', SEP,
         'ssh_slice_sfa@1', 'sfa_delete_slice@1', 'sfa_delete_user@1', SEPSFA,
-        'check_tcp', 'check_netflow', SEP,
+        'check_tcp', 'check_sys_slice', SEP,
         'force_gather_logs', SEP,
         ]
     other_steps = [ 
@@ -1125,9 +1125,12 @@ class TestPlc:
         return overall
 
     # painfully enough, we need to allow for some time as netflow might show up last
-    def check_netflow (self): 
-        "all nodes: check that the netflow slice is alive"
-        return self.check_systemslice ('netflow')
+    def check_sys_slice (self): 
+        "all nodes: check that a system slice is alive"
+# would probably make more sense to check for netflow, 
+# but that one is currently not working in the lxc distro        
+#        return self.check_systemslice ('netflow')
+        return self.check_systemslice ('drl')
     
     # we have the slices up already here, so it should not take too long
     def check_systemslice (self, slicename, timeout_minutes=5, period=15):
@@ -1135,7 +1138,7 @@ class TestPlc:
         test_nodes=self.all_nodes()
         while test_nodes:
             for test_node in test_nodes:
-                if test_node.check_systemslice (slicename):
+                if test_node.check_systemslice (slicename,dry_run=self.options.dry_run):
                     utils.header ("ok")
                     test_nodes.remove(test_node)
                 else: