diff options
-rwxr-xr-x | ci/kolla-build-vm.sh | 2 | ||||
-rwxr-xr-x | ci/kolla-build.sh | 1 | ||||
-rw-r--r-- | deploy/post/execute.py | 16 | ||||
-rw-r--r-- | deploy/tempest.py | 22 | ||||
-rw-r--r-- | docs/conf.py | 1 | ||||
-rw-r--r-- | docs/conf.yaml | 3 | ||||
-rw-r--r-- | docs/index.rst | 20 | ||||
-rw-r--r-- | docs/release/configguide/installerconfig.rst | 2 | ||||
-rw-r--r-- | docs/release/installation/index.rst | 2 | ||||
-rw-r--r-- | docs/release/installation/upgrade.rst | 4 | ||||
-rw-r--r-- | docs/release/release-notes/release-notes.rst | 4 | ||||
-rw-r--r-- | docs/requirements.txt | 2 | ||||
-rw-r--r-- | tests/data/openrc_conf/globals_odl.yml | 2 | ||||
-rw-r--r-- | tests/unit/post/test_post_execute.py | 9 | ||||
-rw-r--r-- | tests/unit/test_placeholder.py | 1 | ||||
-rw-r--r-- | tests/unit/test_tempest.py | 16 | ||||
-rwxr-xr-x | tools/centos-img-modify.sh | 3 | ||||
-rwxr-xr-x | tools/daisy-img-modify.sh | 11 | ||||
-rw-r--r-- | tox.ini | 10 |
19 files changed, 113 insertions, 18 deletions
diff --git a/ci/kolla-build-vm.sh b/ci/kolla-build-vm.sh index 30113cfe..5609cd3c 100755 --- a/ci/kolla-build-vm.sh +++ b/ci/kolla-build-vm.sh @@ -186,6 +186,8 @@ function pre_check { yum install -y python2-pip pip install tox + # SELinux is not supported with the overlay2 graph driver on this kernel. + sed -i 's/--selinux-enabled /--selinux-enabled=false /g' /etc/sysconfig/docker || true # Just make sure docker is working. /usr/bin/systemctl restart docker } diff --git a/ci/kolla-build.sh b/ci/kolla-build.sh index cca98db5..fe7a6679 100755 --- a/ci/kolla-build.sh +++ b/ci/kolla-build.sh @@ -108,6 +108,7 @@ function create_daisy_vm_and_networks() { echo "====== Create Daisy VM ======" $CREATE_QCOW2_PATH/daisy-img-modify.sh -c $CREATE_QCOW2_PATH/centos-img-modify.sh -w $IMWORKDIR -a $DAISY_IP $PARAS_IMAGE + sed -i -e "/source * file/{s|source.*$|source file=\'$IMWORKDIR\/centos7.qcow2\'\/>|;}" $VMDEPLOY_DAISY_SERVER_VM virsh net-define $VMDELOY_DAISY_SERVER_NET virsh net-start daisy1 diff --git a/deploy/post/execute.py b/deploy/post/execute.py index 6acbe637..7b0293a2 100644 --- a/deploy/post/execute.py +++ b/deploy/post/execute.py @@ -21,10 +21,20 @@ def _config_kolla_admin_openrc(kolla_config_path): with open('%s/globals.yml' % kolla_config_path, 'r') as f: kolla_config = yaml.safe_load(f.read()) if kolla_config.get('enable_opendaylight', None) == 'yes': - sdn_controller_ip = kolla_config.get('kolla_internal_vip_address') openrc_file = file('%s/admin-openrc.sh' % kolla_config_path, 'a') - sdn_ctl_ip = 'export SDN_CONTROLLER_IP=' + sdn_controller_ip + '\n' - openrc_file.write(sdn_ctl_ip) + + v = kolla_config.get('kolla_internal_vip_address') + line = 'export SDN_CONTROLLER_IP=' + v + '\n' + openrc_file.write(line) + + v = kolla_config.get('opendaylight_haproxy_restconf_port_backup') + line = 'export SDN_CONTROLLER_WEBPORT=' + v + '\n' + openrc_file.write(line) + + v = kolla_config.get('opendaylight_haproxy_restconf_port') + line = 'export SDN_CONTROLLER_RESTCONFPORT=' + v + '\n' + openrc_file.write(line) + openrc_file.close() diff --git a/deploy/tempest.py b/deploy/tempest.py index 342a0205..93dabbe3 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -238,7 +238,7 @@ def update_hosts_interface(cluster_id, hosts_info, mac_address_map, if host['os_version'] == iso_path: print("do not have os iso file in /var/lib/daisy/kolla/.") if enable_dpdk: - host['hugepages'] = '80' + host['hugepages'] = str(get_hugepages(host)) host['hugepagesize'] = '1G' client.hosts.update(host['id'], **host) host_info = client.hosts.get(host['id']).to_dict() @@ -249,6 +249,26 @@ def update_hosts_interface(cluster_id, hosts_info, mac_address_map, add_host_role(cluster_id, host['id'], dha_host_name, vip, client) +def get_hugepages(host): + total_str = str(host['memory']['total']) + total = int(filter(str.isdigit, total_str)) + unit = filter(str.isalpha, total_str).lower() + + if unit == 'kb': + total = total / 1024 / 1024 + elif unit == 'mb': + total = total / 1024 + elif unit == 'gb': + pass + elif unit == 'b' or unit == '': + total = total / 1024 / 1024 / 1024 + num = total * 6 / 10 + if num % 2 != 0: + num = num + 1 + + return num + + def add_host_role(cluster_id, host_id, dha_host_name, vip, client): role_meta = {'filters': {'cluster_id': cluster_id}} role_list_generator = client.roles.list(**role_meta) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..eb12e74b --- /dev/null +++ b/docs/conf.py @@ -0,0 +1 @@ +from docs_conf.conf import * # noqa: F401,F403 diff --git a/docs/conf.yaml b/docs/conf.yaml new file mode 100644 index 00000000..bb1beaa1 --- /dev/null +++ b/docs/conf.yaml @@ -0,0 +1,3 @@ +--- +project_cfg: opnfv +project: daisy diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..e6ae4c9b --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,20 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 +.. International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. (c) Open Platform for NFV Project, Inc. and its contributors + +.. _daisy: + +========= +Daisy4NFV +========= + +.. toctree:: + :maxdepth: 2 + + release/installation/index + release/configguide/index + release/release-notes/index + development/design/index + development/requirement/multicast + test diff --git a/docs/release/configguide/installerconfig.rst b/docs/release/configguide/installerconfig.rst index a8ef8144..e5980dda 100644 --- a/docs/release/configguide/installerconfig.rst +++ b/docs/release/configguide/installerconfig.rst @@ -10,7 +10,7 @@ Abstract ======== -This document compiles the release notes for the E 1.0 release of +This document compiles the release notes for the Fraser release of OPNFV when using Daisy as a deployment tool. diff --git a/docs/release/installation/index.rst b/docs/release/installation/index.rst index 611ecf63..3080e14b 100644 --- a/docs/release/installation/index.rst +++ b/docs/release/installation/index.rst @@ -8,7 +8,7 @@ OPNFV Daisy4nfv Installation Guide ********************************** .. toctree:: - :numbered: + :numbered: :maxdepth: 4 introduction.rst diff --git a/docs/release/installation/upgrade.rst b/docs/release/installation/upgrade.rst index 65d49315..a74a4683 100644 --- a/docs/release/installation/upgrade.rst +++ b/docs/release/installation/upgrade.rst @@ -4,14 +4,14 @@ OpenStack Minor Version Update Guide ==================================== -Thanks for the Kolla's kolla-ansible upgrade function, Daisy enable to +Thanks to Kolla's kolla-ansible upgrade function, Daisy can update OpenStack minor version as the follows: 1. Get new version file only from Daisy team. Since Daisy's Kolla images are built by meeting the OPNFV requirements and have their own file packaging layout, Daisy requires user to always use Kolla image file built by Daisy team. Currently, it can be -got from http://artifacts.opnfv.org/daisy/upstream, or please +found at http://artifacts.opnfv.org/daisy/upstream, or please see :ref:`this chapter <daisy-build-kolla-image>` for how to build your own image. diff --git a/docs/release/release-notes/release-notes.rst b/docs/release/release-notes/release-notes.rst index 4d844c0b..9937bb2a 100644 --- a/docs/release/release-notes/release-notes.rst +++ b/docs/release/release-notes/release-notes.rst @@ -10,8 +10,8 @@ Abstract ======== -This document covers features, limitations and required system resources of -OPNFV E 1.0 release when using Daisy4nfv as a deployment tool. +This document covers features, limitations and required system resources for the +OPNFV Fraser release when using Daisy4nfv as a deployment tool. Introduction ============ diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..9fde2df2 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +lfdocs-conf +sphinx_opnfv_theme diff --git a/tests/data/openrc_conf/globals_odl.yml b/tests/data/openrc_conf/globals_odl.yml index 588dd927..2598ccbb 100644 --- a/tests/data/openrc_conf/globals_odl.yml +++ b/tests/data/openrc_conf/globals_odl.yml @@ -11,3 +11,5 @@ neutron_external_interface: ens8 openstack_release: 4.0.2 storage_interface: ens3 tunnel_interface: ens3 +opendaylight_haproxy_restconf_port: '8087' +opendaylight_haproxy_restconf_port_backup: '8181' diff --git a/tests/unit/post/test_post_execute.py b/tests/unit/post/test_post_execute.py index 55e345a2..0ca00941 100644 --- a/tests/unit/post/test_post_execute.py +++ b/tests/unit/post/test_post_execute.py @@ -169,9 +169,12 @@ def test__config_kolla_admin_openrc(globals_file_name, openrc_conf_file_dir, tmp elif globals_file_name == 'globals_odl.yml': diff = DeepDiff(src_openrc_lines, dst_openrc_lines, ignore_order=True) assert len(diff) == 1 and diff.get('iterable_item_added') is not None - assert len(diff['iterable_item_added']) == 1 - for val in diff['iterable_item_added'].values(): - assert 'export SDN_CONTROLLER_IP' in val + assert len(diff['iterable_item_added']) == 3 + diffvals = ','.join(diff['iterable_item_added'].values()) + assert 'export SDN_CONTROLLER_IP' in diffvals + assert 'export SDN_CONTROLLER_WEBPORT=' in diffvals + assert 'export SDN_CONTROLLER_RESTCONFPORT=' in diffvals + tmpdir.remove() diff --git a/tests/unit/test_placeholder.py b/tests/unit/test_placeholder.py index a5298e14..7fa104ff 100644 --- a/tests/unit/test_placeholder.py +++ b/tests/unit/test_placeholder.py @@ -7,5 +7,6 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## + def test_holder(): assert True diff --git a/tests/unit/test_tempest.py b/tests/unit/test_tempest.py index 3c616bcd..3e229dc9 100644 --- a/tests/unit/test_tempest.py +++ b/tests/unit/test_tempest.py @@ -35,6 +35,7 @@ from deploy.tempest import ( get_hosts, get_cluster, update_hosts_interface, + get_hugepages, add_host_role, enable_cinder_backend, enable_opendaylight @@ -173,7 +174,9 @@ def test_get_cluster(): @pytest.mark.parametrize('isbare', [ (False), (True)]) -def test_update_hosts_interface(isbare, tmpdir): +@mock.patch('deploy.tempest.get_hugepages') +def test_update_hosts_interface(mock_get_hugepages, isbare, tmpdir): + mock_get_hugepages.return_value = 80 res_old_val = deploy.tempest.iso_path deploy.tempest.iso_path = os.path.join(tmpdir.dirname, tmpdir.basename) + '/' iso_file_path = os.path.join(deploy.tempest.iso_path, 'test_os.iso') @@ -276,6 +279,17 @@ def test_update_hosts_interface(isbare, tmpdir): tmpdir.remove() +@pytest.mark.parametrize('host, exp', [ + ({'memory': {'total': ' 65938504 kB'}}, 38), + ({'memory': {'total': ' 131644068 kB'}}, 76), + ({'memory': {'total': ' 100 gB'}}, 60), + ({'memory': {'total': ' 102400 mB'}}, 60), + ({'memory': {'total': ' 107374182400 B'}}, 60), + ({'memory': {'total': ' 107374182400'}}, 60)]) +def test_get_hugepages(host, exp): + assert get_hugepages(host) == exp + + @pytest.mark.parametrize('dha_host_name, cluster_id, host_id, vip, exp', [ ('controller01', 1, 0x1234, '10.20.11.11', {'nodes': [0x1234], 'cluster_id': 1, 'vip': '10.20.11.11'}), ('computer01', 1, 0x2345, '10.20.11.11', {'nodes': [0x2345], 'cluster_id': 1}), diff --git a/tools/centos-img-modify.sh b/tools/centos-img-modify.sh index 5a2df82f..41c730cb 100755 --- a/tools/centos-img-modify.sh +++ b/tools/centos-img-modify.sh @@ -74,3 +74,6 @@ cd /etc if [ ! -z $localtime_file ] && [ -f $localtime_file ]; then ln -s -f $localtime_file /etc/localtime fi + +# https://review.openstack.org/#/c/568180/ +test -e /etc/yum/vars/contentdir || echo centos > /etc/yum/vars/contentdir diff --git a/tools/daisy-img-modify.sh b/tools/daisy-img-modify.sh index 8b3a21f3..6d2ff53f 100755 --- a/tools/daisy-img-modify.sh +++ b/tools/daisy-img-modify.sh @@ -99,7 +99,10 @@ raw_imgfile="${workdir}/centos7.raw" # download and checksum base image, conditionally if local copy is outdated download() { - test -d $workdir || mkdir -p $workdir + test -d $workdir || { + mkdir -p $workdir + test -z $SUDO_USER || chown -R $SUDO_USER:$SUDO_USER $workdir + } cd $workdir rm -f sha256sum.txt wget $sha256sum_url @@ -162,8 +165,8 @@ resize() { kpartx -av $raw_imgfile sleep 2 dmsetup ls - fdisk -l /dev/${loopdevice:0:5} || true - growpart /dev/${loopdevice:0:5} 1 + fdisk -l /dev/${loopdevice:0:-2} || true + growpart /dev/${loopdevice:0:-2} 1 dmsetup clear $loopdevice kpartx -dv $raw_imgfile || eliminate } @@ -176,7 +179,7 @@ setup() { kpartx -av $raw_imgfile sleep 2 dmsetup ls - fdisk -l /dev/${loopdevice:0:5} || true + fdisk -l /dev/${loopdevice:0:-2} || true if [ "xfs" = "$(blkid -o value -s TYPE /dev/mapper/$loopdevice)" ]; then mountopts="-o nouuid" @@ -25,9 +25,19 @@ setenv= PYTHONPATH = {toxinidir} [testenv:pep8] +usedevelop = False deps = flake8 commands = flake8 {toxinidir} +[testenv:docs] +usedevelop = False +deps = -rdocs/requirements.txt +commands = + sphinx-build -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html + +[testenv:docs-linkcheck] +commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck + [flake8] # H803 skipped on purpose per list discussion. # E123, E125 skipped as they are invalid PEP-8. |