From a47c553e0559ec3ec392dfd2e83c6a12ecaba369 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Wed, 11 Mar 2020 11:10:00 +0100 Subject: [PATCH] Fix dhcp job Change-Id: Ibb1d32ae8b69e9ad47db55d455fb3d7f0cfc4219 --- .../roles/bifrost-deploy-nodes-dynamic/tasks/main.yml | 7 ++++++- playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py | 3 +-- playbooks/roles/bifrost-test-dhcp/tasks/main.yml | 2 ++ scripts/test-bifrost.sh | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml index ff3bf0768..b9839e2c9 100644 --- a/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml +++ b/playbooks/roles/bifrost-deploy-nodes-dynamic/tasks/main.yml @@ -51,6 +51,7 @@ mode: 0644 when: inventory_dhcp | bool == true become: yes + - name: "Setup DNS address for nodes." template: src: dns-address.j2 @@ -60,12 +61,14 @@ mode: 0644 when: inventory_dns | bool == true become: yes + - name: "Restarting dnsmasq" service: name: dnsmasq state: restarted become: yes when: (inventory_dhcp | bool == true) or (inventory_dns | bool == true) + - name: "Deploy to hardware - Using custom instance_info." os_ironic_node: auth_type: "{{ auth_type | default(omit) }}" @@ -78,6 +81,7 @@ wait: "{{ wait_for_node_deploy }}" timeout: " {{ wait_timeout | default(1800) }}" when: instance_info is defined and instance_info | to_json != '{}' + - name: "Collect the checksum of the deployment image." stat: path: "{{ deploy_image }}" @@ -86,9 +90,11 @@ register: test_deploy_image become: yes when: instance_info is not defined or ( instance_info is defined and instance_info | to_json == '{}' ) + - name: "Error if deploy_image is not present, and instance_info is not defined" fail: msg="The user-defined deploy_image, which is the image to be written to the remote node(s) upon deployment, was not found. Cannot proceed." when: instance_info is not defined and test_deploy_image.stat.exists | bool == false + - name: "Deploy to hardware - bifrost default" os_ironic_node: cloud: "{{ cloud_name | default(omit) }}" @@ -102,7 +108,6 @@ image_source: "{{ deploy_url_protocol }}://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:{{ file_url_port }}/{{deploy_image_filename}}" image_checksum: "{{ test_deploy_image.stat.checksum }}" image_disk_format: "qcow2" - root_gb: 10 wait: "{{ wait_for_node_deploy }}" timeout: " {{ wait_timeout | default(1800) }}" when: instance_info is not defined or ( instance_info is defined and instance_info | to_json == '{}' ) diff --git a/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py b/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py index 2c508c60b..f8567a91e 100644 --- a/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py +++ b/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python -# # Copyright (c) 2016 Hewlett-Packard Enterprise Development Company LP # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -121,5 +119,6 @@ def main(argv): sys.exit(0) + if __name__ == "__main__": main(sys.argv[1:]) diff --git a/playbooks/roles/bifrost-test-dhcp/tasks/main.yml b/playbooks/roles/bifrost-test-dhcp/tasks/main.yml index 870513973..764b59565 100644 --- a/playbooks/roles/bifrost-test-dhcp/tasks/main.yml +++ b/playbooks/roles/bifrost-test-dhcp/tasks/main.yml @@ -15,3 +15,5 @@ - name: Execute python dhcp check file become: true script: test-dhcp.py "{{inventory_dhcp}}" "{{inventory_dhcp_static_ip}}" + args: + executable: "{{ansible_python.executable}}" diff --git a/scripts/test-bifrost.sh b/scripts/test-bifrost.sh index 584d41f19..79726ab2a 100755 --- a/scripts/test-bifrost.sh +++ b/scripts/test-bifrost.sh @@ -106,10 +106,11 @@ if [ ${USE_DHCP} = "true" ]; then VM_MEMORY_SIZE="1024" ENABLE_INSPECTOR=false INSPECT_NODES=false - TEST_VM_NUM_NODES=5 + TEST_VM_NUM_NODES=3 INVENTORY_DHCP=true INVENTORY_DHCP_STATIC_IP=true WRITE_INTERFACES_FILE=false + VM_DISK=12 elif [ ${BUILD_IMAGE} = "true" ]; then USE_CIRROS=false TESTING_USER=root @@ -152,16 +153,15 @@ ${ANSIBLE} -vvvv \ -e test_vm_num_nodes=${TEST_VM_NUM_NODES} \ -e test_vm_memory_size=${VM_MEMORY_SIZE} \ -e test_vm_domain_type=${VM_DOMAIN_TYPE} \ + -e test_vm_disk_gib=${VM_DISK:-10} \ -e baremetal_json_file=${BAREMETAL_DATA_FILE} \ -e enable_venv=${ENABLE_VENV} \ -e bifrost_venv_dir=${VENV} - - if [ ${USE_DHCP} = "true" ]; then # reduce the number of nodes in JSON file # to limit number of nodes to enroll for testing purposes - python $BIFROST_HOME/scripts/split_json.py 3 \ + python $BIFROST_HOME/scripts/split_json.py 2 \ ${BAREMETAL_DATA_FILE} \ ${BAREMETAL_DATA_FILE}.new \ ${BAREMETAL_DATA_FILE}.rest \