diff options
-rw-r--r-- | apex/common/utils.py | 43 | ||||
-rw-r--r-- | apex/overcloud/config.py | 3 | ||||
-rw-r--r-- | apex/overcloud/overcloud_deploy.py | 6 | ||||
-rw-r--r-- | apex/tests/playbooks/test_failed_playbook.yaml | 5 | ||||
-rw-r--r-- | apex/tests/test_apex_common_utils.py | 8 | ||||
-rwxr-xr-x | build/overcloud-opendaylight.sh | 3 | ||||
-rw-r--r-- | config/deploy/os-odl-sfc-ha.yaml | 2 | ||||
-rw-r--r-- | config/deploy/os-odl-sfc-noha.yaml | 2 |
8 files changed, 56 insertions, 16 deletions
diff --git a/apex/common/utils.py b/apex/common/utils.py index e21ab835..b1837b9b 100644 --- a/apex/common/utils.py +++ b/apex/common/utils.py @@ -95,13 +95,36 @@ def run_ansible(ansible_vars, playbook, host='localhost', user='root', with open(ansible_tmp, 'w') as fh: fh.write("ANSIBLE_HOST_KEY_CHECKING=FALSE {}".format( ' '.join(ansible_command))) - try: - my_env = os.environ.copy() - my_env['ANSIBLE_HOST_KEY_CHECKING'] = 'False' - logging.info("Executing playbook...this may take some time") - logging.info(subprocess.check_output(ansible_command, env=my_env, - stderr=subprocess.STDOUT).decode('utf-8')) - except subprocess.CalledProcessError as e: - logging.error("Error executing ansible: {}".format( - pprint.pformat(e.output.decode('utf-8')))) - raise + + my_env = os.environ.copy() + my_env['ANSIBLE_HOST_KEY_CHECKING'] = 'False' + logging.info("Executing playbook...this may take some time") + p = subprocess.Popen(ansible_command, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + bufsize=1, + env=my_env, + universal_newlines=True) + # read first line + x = p.stdout.readline() + # initialize task + task = '' + while x: + # append lines to task + task += x + # log the line and read another + x = p.stdout.readline() + # deliver the task to info when we get a blank line + if not x.strip(): + task += x + logging.info(task.replace('\\n', '\n')) + task = '' + x = p.stdout.readline() + # clean up and get return code + p.stdout.close() + rc = p.wait() + if rc: + # raise errors + e = "Ansible playbook failed. See Ansible logs for details." + logging.error(e) + raise Exception(e) diff --git a/apex/overcloud/config.py b/apex/overcloud/config.py index acec5323..e48b254f 100644 --- a/apex/overcloud/config.py +++ b/apex/overcloud/config.py @@ -62,6 +62,9 @@ def create_nic_template(network_settings, deploy_settings, role, template_dir, nets['tenant']['nic_mapping'][role]['interface-options'] =\ ds['performance'][role.title()]['vpp']['interface-options'] + if role == 'controller' and ds.get('sfc', None): + ext_net = 'interface' + template_output = template.render( nets=nets, role=role, diff --git a/apex/overcloud/overcloud_deploy.py b/apex/overcloud/overcloud_deploy.py index 60652146..d37d73ca 100644 --- a/apex/overcloud/overcloud_deploy.py +++ b/apex/overcloud/overcloud_deploy.py @@ -30,7 +30,7 @@ from cryptography.hazmat.backends import default_backend as \ SDN_FILE_MAP = { 'opendaylight': { - 'sfc': 'opendaylight_sfc.yaml', + 'sfc': 'neutron-sfc-opendaylight.yaml', 'vpn': 'neutron-bgpvpn-opendaylight.yaml', 'gluon': 'gluon.yaml', 'vpp': { @@ -220,7 +220,7 @@ def prep_image(ds, img, tmp_dir, root_pw=None): {con.VIRT_RUN_CMD: "yum -y install " "/root/ovs/rpm/rpmbuild/RPMS/x86_64/" "{}".format(OVS_NSH_KMOD_RPM)}, - {con.VIRT_RUN_CMD: "yum upgrade -y " + {con.VIRT_RUN_CMD: "yum downgrade -y " "/root/ovs/rpm/rpmbuild/RPMS/x86_64/" "{}".format(OVS_NSH_RPM)} ]) @@ -236,7 +236,7 @@ def prep_image(ds, img, tmp_dir, root_pw=None): virt_cmds.extend([ {con.VIRT_RUN_CMD: "yum -y remove opendaylight"}, {con.VIRT_RUN_CMD: "yum -y install /root/{}/*".format( - con.DEFAULT_ODL_VERSION)}, + ds_opts['odl_version'])}, {con.VIRT_RUN_CMD: "rm -rf /etc/puppet/modules/opendaylight"}, {con.VIRT_RUN_CMD: "cd /etc/puppet/modules && tar xzf " "/root/puppet-opendaylight-" diff --git a/apex/tests/playbooks/test_failed_playbook.yaml b/apex/tests/playbooks/test_failed_playbook.yaml new file mode 100644 index 00000000..d12cefb1 --- /dev/null +++ b/apex/tests/playbooks/test_failed_playbook.yaml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + tasks: + - fail: + msg: "Failure to test with" diff --git a/apex/tests/test_apex_common_utils.py b/apex/tests/test_apex_common_utils.py index 12aeaf2c..aee39a75 100644 --- a/apex/tests/test_apex_common_utils.py +++ b/apex/tests/test_apex_common_utils.py @@ -19,7 +19,8 @@ from apex.tests.constants import ( from nose.tools import ( assert_equal, assert_is_instance, - assert_not_is_instance) + assert_not_is_instance, + assert_raises) NET_SETS = os.path.join(TEST_CONFIG_DIR, 'network', 'network_settings.yaml') @@ -60,3 +61,8 @@ class TestCommonUtils: playbook = 'apex/tests/playbooks/test_playbook.yaml' assert_equal(utils.run_ansible(None, os.path.join(playbook), dry_run=True), None) + + def test_failed_run_ansible(self): + playbook = 'apex/tests/playbooks/test_failed_playbook.yaml' + assert_raises(Exception, utils.run_ansible, None, + os.path.join(playbook), dry_run=True) diff --git a/build/overcloud-opendaylight.sh b/build/overcloud-opendaylight.sh index 96b43d87..c850005e 100755 --- a/build/overcloud-opendaylight.sh +++ b/build/overcloud-opendaylight.sh @@ -42,6 +42,8 @@ pushd puppet-opendaylight > /dev/null git archive --format=tar.gz --prefix=opendaylight/ HEAD > ${BUILD_DIR}/puppet-opendaylight-carbon.tar.gz git checkout master git archive --format=tar.gz --prefix=opendaylight/ HEAD > ${BUILD_DIR}/puppet-opendaylight-master.tar.gz +git checkout stable/nitrogen +git archive --format=tar.gz --prefix=opendaylight/ HEAD > ${BUILD_DIR}/puppet-opendaylight-nitrogen.tar.gz popd > /dev/null # cache gluon @@ -71,6 +73,7 @@ LIBGUESTFS_BACKEND=direct virt-customize \ --upload ${BUILD_DIR}/puppet-opendaylight-carbon.tar.gz:/etc/puppet/modules/ \ --run-command "cd /etc/puppet/modules/ && tar xzf puppet-opendaylight-carbon.tar.gz" \ --upload ${BUILD_DIR}/puppet-opendaylight-master.tar.gz:/root/ \ + --upload ${BUILD_DIR}/puppet-opendaylight-nitrogen.tar.gz:/root/ \ --upload ${BUILD_DIR}/puppet-gluon.tar.gz:/etc/puppet/modules/ \ --run-command "cd /etc/puppet/modules/ && tar xzf puppet-gluon.tar.gz" \ --install python-click \ diff --git a/config/deploy/os-odl-sfc-ha.yaml b/config/deploy/os-odl-sfc-ha.yaml index 6cb153d3..3a87bfe3 100644 --- a/config/deploy/os-odl-sfc-ha.yaml +++ b/config/deploy/os-odl-sfc-ha.yaml @@ -4,7 +4,7 @@ global_params: deploy_options: sdn_controller: opendaylight - odl_version: carbon + odl_version: nitrogen tacker: true congress: true sfc: true diff --git a/config/deploy/os-odl-sfc-noha.yaml b/config/deploy/os-odl-sfc-noha.yaml index c3b3379c..2b08af6c 100644 --- a/config/deploy/os-odl-sfc-noha.yaml +++ b/config/deploy/os-odl-sfc-noha.yaml @@ -4,7 +4,7 @@ global_params: deploy_options: sdn_controller: opendaylight - odl_version: carbon + odl_version: nitrogen tacker: true congress: true sfc: true |