X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fbenchmark%2Fscenarios%2Favailability%2Fattacker%2Fattacker_process.py;h=cb171eafad1d5eb64ea2dc2e8ed3862f10aed5b2;hb=c1a4f5028f88e7e97e3ae2cc3f8aae6bf67c07b2;hp=bff4a6dc3ec8078ee5345c6dca4271716235e919;hpb=87559e992c1f68559950b258146a530c49db9df0;p=yardstick.git diff --git a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py index bff4a6dc3..cb171eafa 100644 --- a/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py +++ b/yardstick/benchmark/scenarios/availability/attacker/attacker_process.py @@ -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!")