diff options
17 files changed, 300 insertions, 131 deletions
diff --git a/docs/specs/infra_manager.rst b/docs/specs/infra_manager.rst new file mode 100644 index 00000000..a8ecb548 --- /dev/null +++ b/docs/specs/infra_manager.rst @@ -0,0 +1,130 @@ +PDF and IDF support in XCI +########################### +:date: 2018-04-30 + +This spec introduces the work required to adapt XCI to use PDF and IDF which +will be used for virtual and baremetal deployments + +Definition of Terms +=================== +* Baremetal deployment: Deployment on physical servers as opposed to deploying +software on virtual machines or containers running in the same physical server + +* Virtual deployment: Deployment on virtual machines, i.e. the servers where +nodes will be deployed are virtualized. For example, in OpenStack, computes and +controllers will be virtual machines. This deployment is normally done on just +one physical server + +* PDF: It stands for POD Descriptor File, which is a document that lists the +hardware characteristics of a set of physical or virtual machines which form +the infrastructure. Example: + +https://git.opnfv.org/pharos/tree/config/pdf/pod1.yaml + +* IDF: It stands for Installer Descriptor File, which is a document that +includes useful information for the installers to accomplish the baremetal +deployment. Example: + +https://git.opnfv.org/fuel/tree/mcp/config/labs/local/idf-pod1.yaml + +Problem description +=================== + +Currently, XCI only supports virtualized deployments running in one server. This +is good when the user has limited resources, however, baremetal is the preferred +way to deploy NFV platforms in lab or production environments. Besides, this +limits the scope of the testing greatly because we cannot test NFV hardware +specific features such as SRIOV. + +Proposed change +=============== + +Introduce the infra_manager tool which will prepare the infrastructure for XCI +to drive the deployment in a set of virtual or baremetal nodes. This tool will +execute two tasks: + +1 - Creation of virtual nodes or initialization of the preparations for +baremetal nodes +2 - OS provisioning on nodes, both virtual or baremetal + +Once those steps are ready, XCI will continue with the deployment of the +scenario on the provisioned nodes. + +The infra_manager tool will consume the PDF and IDF files describing the +infrastructure as input. It will then use a <yet-to-be-created-tool> to do +step 1 and bifrost to boot the Operating System in the nodes. + +Among other services Bifrost uses: +- Disk image builder (dib) to generate the OS images +- dnsmasq as the DHCP server which will provide the pxe boot mechanism +- ipmitool to manage the servers + +Bifrost will be deployed inside a VM in the jumphost. + +For the time being, we will create the infrastructure based on the defined XCI +flavors, however, the implementation should not hinder the possibility of +having one pdf and idf per scenario, defining the characteristics and the +number of nodes to be deployed. + +Code impact +----------- + +The new code will be introduced in a new directory called infra_manager under +releng-xci/xci/prototypes + +Tentative User guide +-------------------- + +Assuming the user cloned releng-xci in the jumphost, the following should be +done: + +1 - Move the idf and pdf files which describe the infrastructure to +releng-xci/xci/prototypes/infra_manager/var. There is an example under xci/var + +2 - Export the XCI_FLAVOR variable (e.g. export XCI_FLAVOR=noha) + +3 - Run the <yet-to-be-created-tool> to create the virtual nodes based on the +provided PDF information (cpu, ram, disk...) or initialize the preparations for +baremetal nodes + +4 - Start the bifrost process to boot the nodes + +5 - Run the VIM deployer script: +releng-xci/xci/installer/$inst/deploy.sh + +where $inst = {osa, kubespray, kolla} + +In case of problems, the best way to debug is accessing the bifrost vm and use: + +* bifrost-utils +* ipmitool +* check the DHCP messages in /var/log/syslog + + +Implementation +============== + +Assignee(s) +----------- + +Primary assignee: + Manuel Buil (mbuil) + Jack Morgan (jmorgan1) + Somebody_else_please (niceperson) + +Work items +---------- + +1. Provide support for a dynamically generated inventory based on PDF and IDF. +This mechanism could be used for both baremetal and virtual deployments. + +2. Contribute the servers-prepare.sh script + +3. Contribute the nodes-deploy.sh script + +4. Integrate the three previous components correctly + +5. Provide support for the XCI supported operating systems (opensuse, Ubuntu, +centos) + +6. Allow pdf and idf per scenario diff --git a/xci/config/pinned-versions b/xci/config/pinned-versions index 72a0ff61..ccfc2704 100755 --- a/xci/config/pinned-versions +++ b/xci/config/pinned-versions @@ -43,6 +43,5 @@ export KEEPALIVED_VERSION=$(grep -E '.*name: keepalived' -A 3 \ export HAPROXY_VERSION=$(grep -E '.*name: haproxy_server' -A 3 \ ${XCI_PATH}/xci/installer/osa/files/ansible-role-requirements.yml \ | tail -n1 | sed -n 's/\(^.*: \)\([0-9a-z].*$\)/\2/p') -# HEAD of kubspray "master" as of 27.02.2018 -# kubespray's bug Reference: https://github.com/kubernetes-incubator/kubespray/issues/2400 -export KUBESPRAY_VERSION=${KUBESPRAY_VERSION:-"5d9bb300d716880610c34dd680c167d2d728984d"} +# HEAD of kubspray "master" as of 16.05.2018 +export KUBESPRAY_VERSION=${KUBESPRAY_VERSION:-"38e727dbe1bdf5316fae8d645718cc8279fbda20"} diff --git a/xci/files/xci-destroy-env.sh b/xci/files/xci-destroy-env.sh index 97b76c7c..3de21795 100755 --- a/xci/files/xci-destroy-env.sh +++ b/xci/files/xci-destroy-env.sh @@ -21,6 +21,8 @@ rm -rf /opt/stack # HOME is normally set by sudo -H rm -rf ${HOME}/.config/openstack rm -rf ${HOME}/.ansible +# Wipe repos +rm -rf ${XCI_CACHE}/repos # bifrost installs everything on venv so we need to look there if virtualbmc is not installed on the host. if which vbmc &>/dev/null || { [[ -e ${XCI_VENV}/bifrost/bin/activate ]] && source ${XCI_VENV}/bifrost/bin/activate; }; then diff --git a/xci/files/install-lib.sh b/xci/files/xci-lib.sh index af86be41..7af0f236 100644 --- a/xci/files/install-lib.sh +++ b/xci/files/xci-lib.sh @@ -7,9 +7,24 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -# NOTE(hwoarang): Most parts of this this file were taken from the -# bifrost repository (scripts/install-deps.sh). This script contains all -# the necessary distro specific code to install ansible and it's dependencies. +# Avoid double sourcing the file +[[ -n ${XCI_LIB_SOURCED:-} ]] && return 0 || export XCI_LIB_SOURCED=1 + +function bootstrap_xci_env() { + # Declare our virtualenv + export XCI_VENV=${XCI_PATH}/venv/ + + # source user vars + source $XCI_PATH/xci/config/user-vars + # source pinned versions + source $XCI_PATH/xci/config/pinned-versions + # source flavor configuration + source "$XCI_PATH/xci/config/${XCI_FLAVOR}-vars" + # source installer configuration + source "$XCI_PATH/xci/installer/${INSTALLER_TYPE}/env" &>/dev/null || true + # source xci configuration + source $XCI_PATH/xci/config/env-vars +} function install_ansible() { set -eu @@ -200,4 +215,57 @@ collect_xci_logs() { sudo -H -E bash -c 'chown ${SUDO_UID}:${SUDO_GID} -R ${LOG_PATH}/' } +submit_bug_report() { + cd ${XCI_PATH} + echo "" + echo "-------------------------------------------------------------------------" + echo "Oh nooooo! The XCI deployment failed miserably :-(" + echo "" + echo "If you need help, please choose one of the following options" + echo "* #opnfv-pharos @ freenode network" + echo "* opnfv-tech-discuss mailing list (https://lists.opnfv.org/mailman/listinfo/opnfv-tech-discuss)" + echo " - Please prefix the subject with [XCI]" + echo "* https://jira.opnfv.org (Release Engineering project)" + echo "" + echo "Do not forget to submit the following information on your bug report:" + echo "" + git diff --quiet && echo "releng-xci tree status: clean" || echo "releng-xci tree status: local modifications" + echo "opnfv/releng-xci version: $(git rev-parse HEAD)" + echo "openstack/bifrost version: $OPENSTACK_BIFROST_VERSION" + echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" + echo "xci flavor: $XCI_FLAVOR" + echo "xci installer: $INSTALLER_TYPE" + echo "xci scenario: $DEPLOY_SCENARIO" + echo "Environment variables:" + env | grep --color=never '\(OPNFV\|XCI\|INSTALLER_TYPE\|OPENSTACK\|SCENARIO\|ANSIBLE\)' + echo "-------------------------------------------------------------------------" +} + +log_xci_information() { + local scenario_version scenario_sha + + cd ${XCI_SCENARIOS_CACHE}/${DEPLOY_SCENARIO} + scenario_sha=$(git rev-parse HEAD) + scenario_version=$(git describe --exact 2>/dev/null || echo "master") + cd - + echo "Info: Starting XCI Deployment" + echo "Info: Deployment parameters" + echo "-------------------------------------------------------------------------" + echo "OPNFV scenario: $DEPLOY_SCENARIO" + echo "Scenario version: ${scenario_version} (sha: ${scenario_sha})" + echo "xci flavor: $XCI_FLAVOR" + echo "xci installer: $INSTALLER_TYPE" + echo "infra deployment: $INFRA_DEPLOYMENT" + echo "opnfv/releng-xci version: $(git rev-parse HEAD)" + [[ "$INFRA_DEPLOYMENT" == "bifrost" ]] && echo "openstack/bifrost version: $OPENSTACK_BIFROST_VERSION" + [[ "$INSTALLER_TYPE" == "osa" ]] && echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" + [[ "$INSTALLER_TYPE" == "kubespray" ]] && echo "kubespray version: $KUBESPRAY_VERSION" + echo "-------------------------------------------------------------------------" +} + +exit_trap() { + submit_bug_report + collect_xci_logs +} + # vim: set ts=4 sw=4 expandtab: diff --git a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml index 5886d3e9..00a8053f 100644 --- a/xci/installer/kubespray/playbooks/configure-opnfvhost.yml +++ b/xci/installer/kubespray/playbooks/configure-opnfvhost.yml @@ -81,6 +81,7 @@ with_items: - { name: 'ansible', version: "{{ xci_kube_ansible_pip_version }}" } - { name: 'netaddr' } + - { name: 'ansible-modules-hashivault' } - name: Configure SSL certificates include_tasks: "{{ xci_path }}/xci/playbooks/manage-ssl-certs.yml" diff --git a/xci/opnfv-scenario-requirements.yml b/xci/opnfv-scenario-requirements.yml index f61bc021..8688d3cc 100644 --- a/xci/opnfv-scenario-requirements.yml +++ b/xci/opnfv-scenario-requirements.yml @@ -11,11 +11,13 @@ # OPNFV scenarios participating in XCI must create their own entry in this file so # XCI can make use of them. # -- scenario: os-odl-sfc + +# OpenStack based scenarios +- scenario: os-nosdn-nofeature scm: git - src: https://gerrit.opnfv.org/gerrit/sfc + src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios version: master - role: scenarios/os-odl-sfc/role/os-odl-sfc + role: scenarios/os-nosdn-nofeature/role/os-nosdn-nofeature installers: - installer: osa flavors: @@ -25,12 +27,13 @@ distros: - opensuse - ubuntu + - centos -- scenario: os-nosdn-nofeature +- scenario: os-odl-nofeature scm: git src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios version: master - role: scenarios/os-nosdn-nofeature/role/os-nosdn-nofeature + role: scenarios/os-odl-nofeature/role/os-odl-nofeature installers: - installer: osa flavors: @@ -40,13 +43,12 @@ distros: - opensuse - ubuntu - - centos -- scenario: os-odl-nofeature +- scenario: os-odl-sfc scm: git - src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios + src: https://gerrit.opnfv.org/gerrit/sfc version: master - role: scenarios/os-odl-nofeature/role/os-odl-nofeature + role: scenarios/os-odl-sfc/role/os-odl-sfc installers: - installer: osa flavors: @@ -57,37 +59,39 @@ - opensuse - ubuntu -- scenario: k8-nosdn-nofeature +- scenario: os-odl-bgpvpn scm: git - src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios + src: https://gerrit.opnfv.org/gerrit/sdnvpn version: master - role: scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature + role: scenarios/os-odl-bgpvpn/role/os-odl-bgpvpn installers: - - installer: kubespray + - installer: osa flavors: - - aio - ha - mini - noha distros: - ubuntu - centos - - opensuse -- scenario: os-odl-bgpvpn + +# Kubernetes based scenarios +- scenario: k8-nosdn-nofeature scm: git - src: https://gerrit.opnfv.org/gerrit/sdnvpn - version: 6.0.0 - role: scenarios/os-odl-bgpvpn/role/os-odl-bgpvpn + src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios + version: master + role: scenarios/k8-nosdn-nofeature/role/k8-nosdn-nofeature installers: - - installer: osa + - installer: kubespray flavors: + - aio - ha - mini - noha distros: - ubuntu - centos + - opensuse - scenario: k8-canal-nofeature scm: git @@ -139,3 +143,20 @@ - ubuntu - centos - opensuse + +- scenario: k8-contiv-nofeature + scm: git + src: https://gerrit.opnfv.org/gerrit/releng-xci-scenarios + version: master + role: scenarios/k8-contiv-nofeature/role/k8-contiv-nofeature + installers: + - installer: kubespray + flavors: + - aio + - ha + - noha + - mini + distros: + - ubuntu + - centos + - opensuse diff --git a/xci/playbooks/configure-localhost.yml b/xci/playbooks/configure-localhost.yml index 5f091c92..5b64c785 100644 --- a/xci/playbooks/configure-localhost.yml +++ b/xci/playbooks/configure-localhost.yml @@ -25,7 +25,6 @@ state: absent recurse: no with_items: - - "{{ xci_cache }}/repos" - "{{ log_path }} " - "{{ opnfv_ssh_host_keys_path }}" diff --git a/xci/playbooks/dynamic_inventory.py b/xci/playbooks/dynamic_inventory.py index 535dc259..6d9d217f 100755 --- a/xci/playbooks/dynamic_inventory.py +++ b/xci/playbooks/dynamic_inventory.py @@ -42,10 +42,15 @@ class XCIInventory(object): self.opnfv_networks = {} self.opnfv_networks['opnfv'] = {} - self.opnfv_networks['opnfv']['admin'] = '172.29.236.10' - self.opnfv_networks['opnfv']['public'] = '192.168.122.2' - self.opnfv_networks['opnfv']['private'] = '172.29.240.10' - self.opnfv_networks['opnfv']['storage'] = '172.29.244.10' + self.opnfv_networks['opnfv']['admin'] = {} + self.opnfv_networks['opnfv']['admin']['address'] = '172.29.236.10/22' + self.opnfv_networks['opnfv']['public'] = {} + self.opnfv_networks['opnfv']['public']['address'] = '192.168.122.2/24' + self.opnfv_networks['opnfv']['public']['gateway'] = '192.168.122.1' + self.opnfv_networks['opnfv']['private'] = {} + self.opnfv_networks['opnfv']['private']['address'] = '172.29.240.10/22' + self.opnfv_networks['opnfv']['storage'] = {} + self.opnfv_networks['opnfv']['storage']['address'] = '172.29.244.10/24' self.read_pdf_idf() @@ -99,9 +104,12 @@ class XCIInventory(object): self.add_hostvar(hostname, 'ip', native_vlan_if[0]['address']) host_networks[hostname] = {} # And now record the rest of the information - for network in idf['idf']['net_config'].keys(): + for network, ndata in idf['idf']['net_config'].items(): network_interface_num = idf['idf']['net_config'][network]['interface'] - host_networks[hostname][network] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + host_networks[hostname][network] = {} + host_networks[hostname][network]['address'] = pdf_host_info['interfaces'][int(network_interface_num)]['address'] + "/" + str(ndata['mask']) + if 'gateway' in ndata.keys(): + host_networks[hostname][network]['gateway'] = str(ndata['gateway']) + "/" + str(ndata['mask']) host_networks.update(self.opnfv_networks) diff --git a/xci/playbooks/get-opnfv-scenario-requirements.yml b/xci/playbooks/get-opnfv-scenario-requirements.yml index 945a7802..a9165709 100644 --- a/xci/playbooks/get-opnfv-scenario-requirements.yml +++ b/xci/playbooks/get-opnfv-scenario-requirements.yml @@ -86,8 +86,6 @@ state: directory become: true - # NOTE(hwoarang) We have to check all levels of the local fact before we add it - # otherwise Ansible will fail. - name: Record scenario information ini_file: create: yes @@ -97,10 +95,6 @@ value: "{{ xci_scenario.role | basename }}" path: "/etc/ansible/facts.d/xci.fact" become: true - when: ansible_local is not defined - or (ansible_local is defined and ansible_local.xci is not defined) - or (ansible_local is defined and ansible_local.xci is defined and ansible_local.xci.scenarios is not defined) - or (ansible_local is defined and ansible_local.xci is defined and ansible_local.xci.scenarios is defined and ansible_local.xci.scenarios.role is not defined) - name: Fail if {{ deploy_scenario }} is not supported fail: diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml index 380e4c52..3cac1e22 100644 --- a/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml +++ b/xci/playbooks/roles/bootstrap-host/tasks/network_debian.yml @@ -45,10 +45,10 @@ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", vlan_id: 10 } - { name: "{{ ansible_local.xci.network.xci_interface }}.30", vlan_id: 30 } - { name: "{{ ansible_local.xci.network.xci_interface }}.20", vlan_id: 20 } - - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", ip: "{{ host_info[inventory_hostname].admin }}", prefix: "255.255.252.0" } - - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", ip: "{{ host_info[inventory_hostname].private }}", prefix: "255.255.252.0" } - - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", ip: "{{ host_info[inventory_hostname].public }}", prefix: "255.255.255.0", gateway: "192.168.122.1" } - - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", ip: "{{ host_info[inventory_hostname].storage }}", prefix: "255.255.252.0" } + - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].admin }}" } + - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", network: "{{ host_info[inventory_hostname].private }}" } + - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", network: "{{ host_info[inventory_hostname].public }}" } + - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", network: "{{ host_info[inventory_hostname].storage }}" } loop_control: label: "{{ item.name }}" diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml index 9dce50b6..b06a8695 100644 --- a/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml +++ b/xci/playbooks/roles/bootstrap-host/tasks/network_redhat.yml @@ -17,17 +17,17 @@ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", bridge: "br-mgmt" , vlan_id: 10 } - { name: "{{ ansible_local.xci.network.xci_interface }}.20", bridge: "br-storage", vlan_id: 20 } - { name: "{{ ansible_local.xci.network.xci_interface }}.30", bridge: "br-vxlan" , vlan_id: 30 } - - { name: "br-vlan" , ip: "{{ host_info[inventory_hostname].public }}", prefix: 24 } - - { name: "br-mgmt" , ip: "{{ host_info[inventory_hostname].admin }}", prefix: 22 } - - { name: "br-storage", ip: "{{ host_info[inventory_hostname].storage }}", prefix: 22 } - - { name: "br-vxlan" , ip: "{{ host_info[inventory_hostname].private}}", prefix: 22 } + - { name: "br-vlan" , network: "{{ host_info[inventory_hostname].public }}" } + - { name: "br-mgmt" , network: "{{ host_info[inventory_hostname].admin }}" } + - { name: "br-storage", network: "{{ host_info[inventory_hostname].storage }}" } + - { name: "br-vxlan" , network: "{{ host_info[inventory_hostname].private }}" } loop_control: label: "{{ item.name }}" - name: Add default route through br-vlan lineinfile: path: "/etc/sysconfig/network-scripts/ifcfg-br-vlan" - line: "GATEWAY=192.168.122.1" + line: "GATEWAY={{ host_info[inventory_hostname]['public']['gateway'] | ipaddr('address') }}" - name: restart network service service: diff --git a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml index b1059c81..c9c9d83c 100644 --- a/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml +++ b/xci/playbooks/roles/bootstrap-host/tasks/network_suse.yml @@ -17,10 +17,10 @@ - { name: "{{ ansible_local.xci.network.xci_interface }}.10", vlan_id: 10 } - { name: "{{ ansible_local.xci.network.xci_interface }}.30", vlan_id: 30 } - { name: "{{ ansible_local.xci.network.xci_interface }}.20", vlan_id: 20 } - - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", ip: "{{ host_info[inventory_hostname].admin }}/22" } - - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", ip: "{{ host_info[inventory_hostname].private }}/22" } - - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", ip: "{{ host_info[inventory_hostname].public }}/24" } - - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", ip: "{{ host_info[inventory_hostname].storage }}/22" } + - { name: "br-mgmt", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.10", network: "{{ host_info[inventory_hostname].admin }}" } + - { name: "br-vxlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.30", network: "{{ host_info[inventory_hostname].private }}" } + - { name: "br-vlan", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}", network: "{{ host_info[inventory_hostname].public }}" } + - { name: "br-storage", bridge_ports: "{{ ansible_local.xci.network.xci_interface }}.20", network: "{{ host_info[inventory_hostname].storage }}" } loop_control: label: "{{ item.name }}" @@ -35,7 +35,7 @@ src: "{{ installer_type }}/{{ ansible_os_family | lower }}.routes.j2" dest: "/etc/sysconfig/network/ifroute-{{ item.name }}" with_items: - - { name: "br-vlan", gateway: "192.168.122.1", route: "default" } + - { name: "br-vlan", gateway: "{{ host_info[inventory_hostname]['public']['gateway'] }}", route: "default" } - name: restart network service service: diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 index 56db509b..3eddce45 100644 --- a/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 +++ b/xci/playbooks/roles/bootstrap-host/templates/osa/debian.interface.j2 @@ -25,14 +25,12 @@ iface {{ item.name }} inet static post-down ip link del br-vlan-veth || true bridge_ports br-vlan-veth {% endif %} -{% if item.ip is defined %} - address {{ item.ip }} +{% if item.network is defined %} + address {{ item.network.address | ipaddr('address') }} + netmask {{ item.network.address | ipaddr('netmask') }} {% endif %} -{% if item.prefix is defined %} - netmask {{ item.prefix }} -{% endif %} -{% if item.gateway is defined %} - gateway {{ item.gateway }} +{% if item.network is defined and item.network.gateway is defined %} + gateway {{ item.network.gateway | ipaddr('address') }} {% endif %} {% endif %} diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 index d3364385..fa957764 100644 --- a/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 +++ b/xci/playbooks/roles/bootstrap-host/templates/osa/redhat.interface.j2 @@ -14,9 +14,6 @@ TYPE=Bridge DELAY=0 STP=off {% endif %} -{% if item.ip is defined %} -IPADDR={{ item.ip }} -{% endif %} -{% if item.prefix is defined %} -PREFIX={{ item.prefix }} +{% if item.network is defined %} +IPADDR={{ item.network.address }} {% endif %} diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2 index 27b01eb4..70811a09 100644 --- a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2 +++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.interface.j2 @@ -10,8 +10,8 @@ BRIDGE_FORWARDDELAY='0' BRIDGE_STP=off BRIDGE_PORTS={{ item.bridge_ports }} {% endif %} -{% if item.ip is defined %} -IPADDR={{ item.ip }} +{% if item.network is defined %} +IPADDR={{ item.network.address }} {% endif %} PRE_UP_SCRIPT="compat:suse:network-config-suse" POST_DOWN_SCRIPT="compat:suse:network-config-suse" diff --git a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2 b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2 index 7c868447..93941fad 100644 --- a/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2 +++ b/xci/playbooks/roles/bootstrap-host/templates/osa/suse.routes.j2 @@ -1 +1 @@ -{{ item.route }} {{ item.gateway }} +{{ item.route }} {{ item.gateway | ipaddr('address') }} diff --git a/xci/xci-deploy.sh b/xci/xci-deploy.sh index c0c1a8ef..c1654151 100755 --- a/xci/xci-deploy.sh +++ b/xci/xci-deploy.sh @@ -3,37 +3,6 @@ set -o errexit set -o nounset set -o pipefail -submit_bug_report() { - cd ${XCI_PATH} - echo "" - echo "-------------------------------------------------------------------------" - echo "Oh nooooo! The XCI deployment failed miserably :-(" - echo "" - echo "If you need help, please choose one of the following options" - echo "* #opnfv-pharos @ freenode network" - echo "* opnfv-tech-discuss mailing list (https://lists.opnfv.org/mailman/listinfo/opnfv-tech-discuss)" - echo " - Please prefix the subject with [XCI]" - echo "* https://jira.opnfv.org (Release Engineering project)" - echo "" - echo "Do not forget to submit the following information on your bug report:" - echo "" - git diff --quiet && echo "releng-xci tree status: clean" || echo "releng-xci tree status: local modifications" - echo "opnfv/releng-xci version: $(git rev-parse HEAD)" - echo "openstack/bifrost version: $OPENSTACK_BIFROST_VERSION" - echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" - echo "xci flavor: $XCI_FLAVOR" - echo "xci installer: $INSTALLER_TYPE" - echo "xci scenario: $DEPLOY_SCENARIO" - echo "Environment variables:" - env | grep --color=never '\(OPNFV\|XCI\|INSTALLER_TYPE\|OPENSTACK\|SCENARIO\|ANSIBLE\)' - echo "-------------------------------------------------------------------------" -} - -exit_trap() { - submit_bug_report - collect_xci_logs -} - #------------------------------------------------------------------------------- # This script should not be run as root #------------------------------------------------------------------------------- @@ -59,20 +28,8 @@ fi #------------------------------------------------------------------------------- # find where are we export XCI_PATH="$(git rev-parse --show-toplevel)" -# Declare our virtualenv -export XCI_VENV=${XCI_PATH}/venv/ -# source user vars -source $XCI_PATH/xci/config/user-vars -# source pinned versions -source $XCI_PATH/xci/config/pinned-versions -# source flavor configuration -source "$XCI_PATH/xci/config/${XCI_FLAVOR}-vars" -# source installer configuration -source "$XCI_PATH/xci/installer/${INSTALLER_TYPE}/env" &>/dev/null || true -# source xci configuration -source $XCI_PATH/xci/config/env-vars # source helpers library -source ${XCI_PATH}/xci/files/install-lib.sh +source ${XCI_PATH}/xci/files/xci-lib.sh # Make sure we pass XCI_PATH everywhere export XCI_ANSIBLE_PARAMS+=" -e xci_path=${XCI_PATH}" @@ -92,6 +49,13 @@ for local_user_var in ${user_local_dev_vars[@]}; do done unset user_local_dev_vars local_user_var +# +# Bootstrap environment for XCI Deployment +# +echo "Info: Preparing host environment for the XCI deployment" +echo "-------------------------------------------------------------------------" +bootstrap_xci_env + # register our handler trap exit_trap ERR @@ -99,22 +63,6 @@ trap exit_trap ERR sudo sed -i "s/^Defaults.*env_reset/#&/" /etc/sudoers #------------------------------------------------------------------------------- -# Log info to console -#------------------------------------------------------------------------------- -echo "Info: Starting XCI Deployment" -echo "Info: Deployment parameters" -echo "-------------------------------------------------------------------------" -echo "OPNFV scenario: $DEPLOY_SCENARIO" -echo "xci flavor: $XCI_FLAVOR" -echo "xci installer: $INSTALLER_TYPE" -echo "infra deployment: $INFRA_DEPLOYMENT" -echo "opnfv/releng-xci version: $(git rev-parse HEAD)" -[[ "$INFRA_DEPLOYMENT" == "bifrost" ]] && echo "openstack/bifrost version: $OPENSTACK_BIFROST_VERSION" -[[ "$INSTALLER_TYPE" == "osa" ]] && echo "openstack/openstack-ansible version: $OPENSTACK_OSA_VERSION" -[[ "$INSTALLER_TYPE" == "kubespray" ]] && echo "kubespray version: $KUBESPRAY_VERSION" -echo "-------------------------------------------------------------------------" - -#------------------------------------------------------------------------------- # Clean up environment #------------------------------------------------------------------------------- echo "Info: Cleaning up previous XCI artifacts" @@ -150,11 +98,15 @@ echo "-------------------------------------------------------------------------" ansible_lint echo "-------------------------------------------------------------------------" -#------------------------------------------------------------------------------- # Get scenario variables overrides #------------------------------------------------------------------------------- -source $(find $XCI_PATH/xci/scenarios/${DEPLOY_SCENARIO} -name xci_overrides) &>/dev/null || \ - source $(find $XCI_SCENARIOS_CACHE/${DEPLOY_SCENARIO} -name xci_overrides) &>/dev/null || : +source $(find $XCI_SCENARIOS_CACHE/${DEPLOY_SCENARIO} -name xci_overrides) &>/dev/null && + echo "Sourced ${DEPLOY_SCENARIO} overrides files successfully!" || : + +#------------------------------------------------------------------------------- +# Log info to console +#------------------------------------------------------------------------------- +log_xci_information # Deploy infrastructure based on the selected deloyment method echo "Info: Deploying hardware using '${INFRA_DEPLOYMENT}'" |