Merge "HA testcase containerized Compass support"
[yardstick.git] / yardstick / benchmark / scenarios / availability / attacker / attacker_process.py
index bff4a6d..cb171ea 100644 (file)
@@ -38,8 +38,7 @@ class ProcessAttacker(BaseAttacker):
         self.recovery_script = self.get_script_fullpath(
             self.fault_cfg['recovery_script'])
 
-        if self.check():
-            self.setup_done = True
+        self.data[self.service_name] = self.check()
 
     def check(self):
         with open(self.check_script, "r") as stdin_file:
@@ -48,11 +47,11 @@ class ProcessAttacker(BaseAttacker):
                 stdin=stdin_file)
 
         if stdout:
-            LOG.info("check the envrioment success!")
-            return True
+            LOG.info("check the environment success!")
+            return int(stdout.strip('\n'))
         else:
             LOG.error(
-                "the host envrioment is error, stdout:%s, stderr:%s",
+                "the host environment is error, stdout:%s, stderr:%s",
                 stdout, stderr)
         return False
 
@@ -67,3 +66,5 @@ class ProcessAttacker(BaseAttacker):
             exit_status, stdout, stderr = self.connection.execute(
                 "sudo /bin/bash -s {0} ".format(self.service_name),
                 stdin=stdin_file)
+        if exit_status:
+            LOG.info("Fail to restart service!")