Bugfix: Support HA test cases in TripleO
[yardstick.git] / yardstick / benchmark / scenarios / availability / attacker / attacker_baremetal.py
index f7683fd..22de0b6 100644 (file)
@@ -61,7 +61,7 @@ class BaremetalAttacker(BaseAttacker):
     def check(self):
         with open(self.check_script, "r") as stdin_file:
             exit_status, stdout, stderr = self.connection.execute(
-                "/bin/sh -s {0} -W 10".format(self.host_ip),
+                "sudo /bin/sh -s {0} -W 10".format(self.host_ip),
                 stdin=stdin_file)
 
         LOG.debug("check ret: %s out:%s err:%s",
@@ -74,7 +74,7 @@ class BaremetalAttacker(BaseAttacker):
 
     def inject_fault(self):
         exit_status, stdout, stderr = self.connection.execute(
-            "shutdown -h now")
+            "sudo shutdown -h now")
         LOG.debug("inject fault ret: %s out:%s err:%s",
                   exit_status, stdout, stderr)
         if not exit_status:
@@ -98,12 +98,12 @@ class BaremetalAttacker(BaseAttacker):
         if self.jump_connection is not None:
             with open(self.recovery_script, "r") as stdin_file:
                 self.jump_connection.execute(
-                    "/bin/bash -s {0} {1} {2} {3}".format(
+                    "sudo /bin/bash -s {0} {1} {2} {3}".format(
                         self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
                     stdin=stdin_file)
         else:
             _execute_shell_command(
-                "/bin/bash -s {0} {1} {2} {3}".format(
+                "sudo /bin/bash -s {0} {1} {2} {3}".format(
                     self.ipmi_ip, self.ipmi_user, self.ipmi_pwd, "on"),
                 stdin=open(self.recovery_script, "r"))