tcptest now explicitly passes a hostname along to the server side (before this change...
[tests.git] / system / TestPlc.py
index 4e90d13..6c74294 100644 (file)
@@ -177,7 +177,7 @@ class TestPlc:
         # but as the stress test might take a while, we sometimes missed the debug mode..
         'probe_kvm_iptables',
         'ping_node', 'ssh_node_debug', 'plcsh_stress_test@1', SEP,
-        'ssh_node_boot', 'node_bmlogs', 'ssh_slice', 'ssh_slice_basics', 'check_initscripts', SEP,
+        'ssh_node_boot', 'node_bmlogs', 'ssh_slice', 'ssh_slice_basics', SEP,
         'ssh_slice_sfa@1', SEPSFA,
         'sfa_rspec_empty@1', 'sfa_allocate_empty@1', 'sfa_provision_empty@1','sfa_check_slice_plc_empty@1', SEPSFA,
         'sfa_delete_slice@1', 'sfa_delete_user@1', SEPSFA,
@@ -207,7 +207,7 @@ class TestPlc:
         'sfa_get_expires', SEPSFA,
         'plc_db_dump' , 'plc_db_restore', SEP,
         'check_netflow','check_drl', SEP,
-        'slice_fs_present', SEP,
+        'slice_fs_present', 'check_initscripts', SEP,
         'standby_1_through_20','yes','no',SEP,
         'install_syslinux6', 'bonding_builds', 'bonding_nodes', SEP,
         ]
@@ -785,36 +785,22 @@ class TestPlc:
         utils.system('rm {}'.format(tmpname))
         return True
 
-# f14 is a bit odd in this respect, although this worked fine in guests up to f18
-# however using a vplc guest under f20 requires this trick
-# the symptom is this: service plc start
-# Starting plc (via systemctl):  Failed to get D-Bus connection: \
-#    Failed to connect to socket /org/freedesktop/systemd1/private: Connection refused
-# weird thing is the doc says f14 uses upstart by default and not systemd
-# so this sounds kind of harmless
-    def start_service(self, service):
-        return self.start_stop_service(service, 'start')
-    def stop_service(self, service):
-        return self.start_stop_service(service, 'stop')
-
+    # care only about f>=25
     def start_stop_service(self, service, start_or_stop):
-        "utility to start/stop a service with the special trick for f14"
-        if self.options.fcdistro != 'f14':
-            return self.run_in_guest("service {} {}".format(service, start_or_stop)) == 0
-        else:
-            # patch /sbin/service so it does not reset environment
-            self.run_in_guest('sed -i -e \\"s,env -i,env,\\" /sbin/service')
-            # this is because our own scripts in turn call service
-            return self.run_in_guest("SYSTEMCTL_SKIP_REDIRECT=true service {} {}"\
-                                     .format(service, start_or_stop)) == 0
+        "utility to start/stop an old-fashioned service (plc)"
+        return self.run_in_guest("service {} {}".format(service, start_or_stop)) == 0
+
+    def start_stop_systemd(self, service, start_or_stop):
+        "utility to start/stop a systemd-defined service (sfa)"
+        return self.run_in_guest("systemctl {} {}".format(start_or_stop, service)) == 0
 
     def plc_start(self):
         "service plc start"
-        return self.start_service('plc')
+        return self.start_stop_service('plc', 'start')
 
     def plc_stop(self):
         "service plc stop"
-        return self.stop_service('plc')
+        return self.start_stop_service('plc', 'stop')
 
     def plcvm_start(self):
         "start the PLC vserver"
@@ -1451,7 +1437,8 @@ class TestPlc:
             # the issue here is that we have the server run in background
             # and so we have no clue if it took off properly or not
             # looks like in some cases it does not
-            if not spec['s_sliver'].run_tcp_server(port, timeout=20):
+            address = spec['s_sliver'].test_node.name()
+            if not spec['s_sliver'].run_tcp_server(address, port, timeout=20):
                 overall = False
                 break
 
@@ -1514,7 +1501,9 @@ class TestPlc:
 
     def sfa_install_all(self):
         "yum install sfa sfa-plc sfa-sfatables sfa-client"
-        return self.yum_install("sfa sfa-plc sfa-sfatables sfa-client")
+        return (self.yum_install("sfa sfa-plc sfa-sfatables sfa-client") and
+                self.run_in_guest("systemctl enable sfa-registry")==0 and
+                self.run_in_guest("systemctl enable sfa-aggregate")==0)
 
     def sfa_install_core(self):
         "yum install sfa"
@@ -1703,7 +1692,8 @@ class TestPlc:
 
     def sfa_start(self):
         "service sfa start"
-        return self.start_service('sfa')
+        return (self.start_stop_systemd('sfa-registry', 'start') and
+                self.start_stop_systemd('sfa-aggregate', 'start'))
 
 
     def sfi_configure(self):
@@ -1800,7 +1790,8 @@ class TestPlc:
 
     def sfa_stop(self):
         "service sfa stop"
-        return self.stop_service('sfa')
+        return (self.start_stop_systemd('sfa-aggregate', 'stop') and
+                self.start_stop_systemd('sfa-registry', 'stop'))
 
     def populate(self):
         "creates random entries in the PLCAPI"