+LOGGER = logging.getLogger(__name__)
+
+
+def create_rally_deployment():
+ """Create new rally deployment"""
+ # set the architecture to default
+ pod_arch = env.get("POD_ARCH")
+ arch_filter = ['aarch64']
+
+ if pod_arch and pod_arch in arch_filter:
+ LOGGER.info("Apply aarch64 specific to rally config...")
+ with open(RALLY_AARCH64_PATCH_PATH, "r") as pfile:
+ rally_patch_conf = pfile.read()
+
+ for line in fileinput.input(RALLY_CONF_PATH, inplace=1):
+ print line,
+ if "cirros|testvm" in line:
+ print rally_patch_conf
+
+ LOGGER.info("Creating Rally environment...")
+
+ cmd = "rally deployment destroy opnfv-rally"
+ ft_utils.execute_command(cmd, error_msg=(
+ "Deployment %s does not exist."
+ % getattr(config.CONF, 'rally_deployment_name')), verbose=False)
+
+ cmd = ("rally deployment create --fromenv --name={0}"
+ .format(getattr(config.CONF, 'rally_deployment_name')))
+ error_msg = "Problem while creating Rally deployment"
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
+
+ cmd = "rally deployment check"
+ error_msg = "OpenStack not responding or faulty Rally deployment."
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
+
+
+def create_verifier():
+ """Create new verifier"""
+ LOGGER.info("Create verifier from existing repo...")
+ cmd = ("rally verify delete-verifier --id '{0}' --force").format(
+ getattr(config.CONF, 'tempest_verifier_name'))
+ ft_utils.execute_command(cmd, error_msg=(
+ "Verifier %s does not exist."
+ % getattr(config.CONF, 'tempest_verifier_name')), verbose=False)
+ cmd = ("rally verify create-verifier --source {0} "
+ "--name {1} --type tempest --system-wide"
+ .format(getattr(config.CONF, 'dir_repo_tempest'),
+ getattr(config.CONF, 'tempest_verifier_name')))
+ ft_utils.execute_command_raise(cmd,
+ error_msg='Problem while creating verifier')