From 2dd7fe17d199cbc14c202206741fa2aca9e5e1ae Mon Sep 17 00:00:00 2001 From: jkilpatr Date: Wed, 26 Jul 2017 09:39:18 -0400 Subject: [PATCH] Handle subprocess issues with yoda and system openstacksdk So, when you pip install openstacksdk you all install some of the workflows for the openstack * commands, this means when you create a virtualenv with no system site packages commands like openstack node import don't work the same way and worse we're not testing the same stuff we ship. on the other hand the system version of openstacksdk often isn't sutible for the api call functionality yoda uses, so we need to be sure the command line functionality of yoda goes through the system opesntack client path whereas the api monitoring functions go through openstack sdk, to make this even more complex the subprocess function of python insists on not behaving like a normal shell. This prefixes all bommands with env -i bash -c "command" which runs bash with no way to inherit vars (like the python venv) from Browbeat itself which can then safely rely on the openstacksdk in it's venv Change-Id: I4da896ea793f44ecff8fa0caa82255259447facc --- ansible/install/browbeat.yml | 1 - ansible/install/roles/yoda/tasks/main.yml | 18 ------------------ ...baremetal-virt-undercloud-yoda-browbeat.yml | 1 - .../templates/browbeat-yoda-ci.yaml.j2 | 8 ++++---- lib/Yoda.py | 11 +++++------ 5 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 ansible/install/roles/yoda/tasks/main.yml diff --git a/ansible/install/browbeat.yml b/ansible/install/browbeat.yml index 9e31b7118..a431a7f49 100644 --- a/ansible/install/browbeat.yml +++ b/ansible/install/browbeat.yml @@ -19,7 +19,6 @@ - perfkitbenchmarker - rally - shaker - - yoda - flavors - images environment: "{{proxy_env}}" diff --git a/ansible/install/roles/yoda/tasks/main.yml b/ansible/install/roles/yoda/tasks/main.yml deleted file mode 100644 index a31081abf..000000000 --- a/ansible/install/roles/yoda/tasks/main.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# -# YODA Install -# - -- name: Create yoda virtualenv - command: virtualenv {{ yoda_venv }} creates={{ yoda_venv }} - -- name: Install yoda requirements - pip: name={{item}} virtualenv={{yoda_venv}} - with_items: - - openstacksdk - - python-heatclient - - python-tripleoclient - - elasticsearch - - pykwalify - - python-dateutil - - git+https://github.com/jkilpatr/ostag/#egg=ostag diff --git a/ansible/oooq/baremetal-virt-undercloud-yoda-browbeat.yml b/ansible/oooq/baremetal-virt-undercloud-yoda-browbeat.yml index 761243ed1..9801c7f64 100644 --- a/ansible/oooq/baremetal-virt-undercloud-yoda-browbeat.yml +++ b/ansible/oooq/baremetal-virt-undercloud-yoda-browbeat.yml @@ -78,7 +78,6 @@ roles: - browbeat/common - browbeat/browbeat - - browbeat/yoda - browbeat/template-configs - browbeat/statsd-ironic diff --git a/ansible/oooq/roles/template-configs/templates/browbeat-yoda-ci.yaml.j2 b/ansible/oooq/roles/template-configs/templates/browbeat-yoda-ci.yaml.j2 index 4e1456ec4..0febdb172 100644 --- a/ansible/oooq/roles/template-configs/templates/browbeat-yoda-ci.yaml.j2 +++ b/ansible/oooq/roles/template-configs/templates/browbeat-yoda-ci.yaml.j2 @@ -50,14 +50,14 @@ yoda: type: introspection enabled: true method: individual - times: 10 + times: 3 timeout: 1800 batch_size: 5 - name: introspect-{{ overcloud_size }}-bulk type: introspection enabled: true method: bulk - times: 10 + times: 3 timeout: 1800 - name: No-HA-Max-Compute-{{ overcloud_size }}-full-deploy type: overcloud @@ -68,7 +68,7 @@ yoda: enabled: true step: 5 keep_stack: false - times: 2 + times: 1 cloud: - node: "compute" start_scale: 1 @@ -86,7 +86,7 @@ yoda: enabled: true step: 5 keep_stack: true - times: 2 + times: 1 cloud: - node: "compute" start_scale: 1 diff --git a/lib/Yoda.py b/lib/Yoda.py index 0954fe6c5..15468ecbe 100644 --- a/lib/Yoda.py +++ b/lib/Yoda.py @@ -164,7 +164,7 @@ class Yoda(WorkloadBase.WorkloadBase): for node in nodes: cmd = cmd_base.format(env_setup, node) - self.tools.run_async_cmd(cmd) + self.tools.run_async_cmd(cmd + "\"") time.sleep(.5) # Gathers metrics on the instack env import @@ -174,7 +174,7 @@ class Yoda(WorkloadBase.WorkloadBase): cmd = "{} openstack overcloud node import {}".format(env_setup, filepath) start_time = datetime.datetime.utcnow() - out = self.tools.run_cmd(cmd) + out = self.tools.run_cmd(cmd + "\"") nodes = conn.bare_metal.nodes() for node in nodes: @@ -210,7 +210,7 @@ class Yoda(WorkloadBase.WorkloadBase): results['nodes'][node.id]["failures"] = 0 results['nodes'][node.id]["state_list"] = None - self.tools.run_async_cmd(cmd) + self.tools.run_async_cmd(cmd + "\"") out = self.watch_introspecting_nodes(nodes, timeout, conn, results) @@ -381,7 +381,7 @@ class Yoda(WorkloadBase.WorkloadBase): self.logger.debug("Openstack deployment command is " + cmd) results["overcloud_deploy_command"] = cmd - deploy_process = self.tools.run_async_cmd(cmd) + deploy_process = self.tools.run_async_cmd(cmd + "\"") results['cleaning_failures'] = self.failed_cleaning_count(conn) results['nodes'] = {} @@ -608,8 +608,7 @@ class Yoda(WorkloadBase.WorkloadBase): self.logger.debug("Time Stamp (Prefix): {}".format(dir_ts)) stackrc = self.config.get('yoda')['stackrc'] - # venv = self.config.get('yoda')['venv'] - env_setup = "source {};".format(stackrc) + env_setup = "env -i bash -c \"source {}; ".format(stackrc) auth_vars = self.tools.load_stackrc(stackrc) if 'OS_AUTH_URL' not in auth_vars: