From 77d802f3d6709c98a03813cd55651b4f70fbb805 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 23 Aug 2022 17:55:24 +0200 Subject: [PATCH] Deprecate instance network boot Remove or update the corresponding CI jobs. Use the new custom Cirros image in the HTTP job to avoid relying on CentOS. Temporary increase complexity requirements while we have a deprecation warning in the provisioner. Change-Id: I5e65f9949ee3b78430309017800b88c1ba21dd02 --- .zuul.yaml | 25 ++++------------------- metalsmith/_provisioner.py | 6 ++++++ playbooks/integration/cirros-image.yaml | 27 ++++++++++++++++++------- tox.ini | 4 ++-- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 3556ebc..1ccd6e5 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -114,6 +114,7 @@ centos_glance_kernel_image: test-centos-kernel centos_glance_root_image: test-centos-partition centos_glance_whole_disk_image: test-centos-wholedisk + metalsmith_netboot: false metalsmith_root_size: 9 metalsmith_python: python3 @@ -138,7 +139,6 @@ s-object: false s-proxy: false configure_instance_user: metalsmith - metalsmith_netboot: false metalsmith_precreate_port: false metalsmith_partition_image: test-centos-partition metalsmith_whole_disk_image: test-centos-wholedisk @@ -159,27 +159,12 @@ metalsmith_boot_mode: bios - job: - name: metalsmith-integration-glance-netboot-cirros - description: | - Integration job using Glance as image source and direct deploy. - parent: metalsmith-integration-base - run: playbooks/integration/run.yaml - vars: - devstack_localrc: - IRONIC_BOOT_MODE: bios - metalsmith_netboot: true - metalsmith_precreate_port: false - -- job: - name: metalsmith-integration-http-netboot-cirros + name: metalsmith-integration-http-cirros description: | Integration job using HTTP as image source and direct deploy. parent: metalsmith-integration-base run: playbooks/integration/run.yaml vars: - devstack_localrc: - IRONIC_BOOT_MODE: bios - metalsmith_netboot: true metalsmith_precreate_port: true metalsmith_use_http: true @@ -194,13 +179,11 @@ jobs: - metalsmith-integration-glance-centos8-uefi - metalsmith-integration-glance-centos8-legacy - - metalsmith-integration-glance-netboot-cirros - - metalsmith-integration-http-netboot-cirros + - metalsmith-integration-http-cirros - openstack-tox-linters gate: jobs: - metalsmith-integration-glance-centos8-uefi - metalsmith-integration-glance-centos8-legacy - - metalsmith-integration-glance-netboot-cirros - - metalsmith-integration-http-netboot-cirros + - metalsmith-integration-http-cirros - openstack-tox-linters diff --git a/metalsmith/_provisioner.py b/metalsmith/_provisioner.py index 7ba0138..f37cc71 100644 --- a/metalsmith/_provisioner.py +++ b/metalsmith/_provisioner.py @@ -14,6 +14,7 @@ # limitations under the License. import logging +import warnings from openstack import connection from openstack import exceptions as os_exc @@ -350,6 +351,7 @@ class Provisioner(object): :param hostname: Hostname to assign to the instance. If provided, overrides the ``hostname`` passed to ``reserve_node``. :param netboot: Whether to use networking boot for final instances. + Deprecated and does not work in Ironic Zed. :param capabilities: Requested capabilities of the node. If present, overwrites the capabilities set by :meth:`reserve_node`. Note that the capabilities are not checked against the ones @@ -368,6 +370,10 @@ class Provisioner(object): is already finished. :raises: :py:class:`metalsmith.exceptions.Error` """ + if netboot: + warnings.warn("Network boot is deprecated and does not work in " + "Ironic Zed", DeprecationWarning) + if config is None: config = instance_config.GenericConfig() if isinstance(image, str): diff --git a/playbooks/integration/cirros-image.yaml b/playbooks/integration/cirros-image.yaml index 39bda3f..6ffd236 100644 --- a/playbooks/integration/cirros-image.yaml +++ b/playbooks/integration/cirros-image.yaml @@ -1,8 +1,8 @@ --- -- name: Find Cirros UEC image - shell: openstack image list -f value -c Name | grep 'cirros-.*-uec$' | sort | tail -n1 - register: cirros_uec_image_result - failed_when: cirros_uec_image_result.stdout == "" +- name: Find Cirros partition image + shell: openstack image list -f value -c Name | grep 'cirros-.*-partition$' | sort | tail -n1 + register: cirros_partition_image_result + failed_when: cirros_partition_image_result.stdout == "" - name: Find Cirros disk image shell: openstack image list -f value -c Name | grep 'cirros-.*-disk$' | sort | tail -n1 @@ -12,10 +12,15 @@ - name: Set image facts for Glance image set_fact: metalsmith_whole_disk_image: "{{ cirros_disk_image_result.stdout }}" - metalsmith_partition_image: "{{ cirros_uec_image_result.stdout }}" + metalsmith_partition_image: "{{ cirros_partition_image_result.stdout }}" when: not (metalsmith_use_http | default(false)) - block: + - name: Find Cirros UEC image + shell: openstack image list -f value -c Name | grep 'cirros-.*-uec$' | sort | tail -n1 + register: cirros_uec_image_result + failed_when: cirros_uec_image_result.stdout == "" + - name: Get baremetal HTTP endpoint shell: | source /opt/stack/devstack/openrc admin admin > /dev/null @@ -25,7 +30,7 @@ register: baremetal_endpoint_result failed_when: baremetal_endpoint_result.stdout == "" - - name: Copy partition images directory + - name: Copy UEC images directory command: > cp -r /opt/stack/devstack/files/images/{{ cirros_uec_image_result.stdout }} /opt/stack/data/ironic/httpboot/metalsmith @@ -41,6 +46,14 @@ creates: /opt/stack/data/ironic/httpboot/metalsmith/{{ cirros_disk_image_result.stdout }}.img become: yes + - name: Copy partition image + command: > + cp /opt/stack/data/ironic/{{ cirros_partition_image_result.stdout }}.img + /opt/stack/data/ironic/httpboot/metalsmith + args: + creates: /opt/stack/data/ironic/httpboot/metalsmith/{{ cirros_partition_image_result.stdout }}.img + become: yes + - name: Create MD5 checksums file for images shell: md5sum cirros-* > CHECKSUMS args: @@ -65,7 +78,7 @@ - name: Set facts for HTTP image set_fact: - metalsmith_partition_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_uec_image_result.stdout | replace('-uec', '-blank') }}.img" + metalsmith_partition_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_partition_image_result.stdout }}.img" metalsmith_partition_kernel_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_uec_image_result.stdout | replace('-uec', '-vmlinuz') }}" metalsmith_partition_ramdisk_image: "{{ baremetal_endpoint_result.stdout}}/metalsmith/{{ cirros_uec_image_result.stdout | replace('-uec', '-initrd') }}" metalsmith_partition_checksum: "{{ baremetal_endpoint_result.stdout}}/metalsmith/CHECKSUMS" diff --git a/tox.ini b/tox.ini index bbcf802..34ba99f 100644 --- a/tox.ini +++ b/tox.ini @@ -82,7 +82,7 @@ deps = [flake8] # [W503] Line break before binary operator. ignore = W503 -max-complexity=15 +max-complexity=16 import-order-style = pep8 application-import-names = metalsmith # [H106] Don't put vim configuration in source files. @@ -100,4 +100,4 @@ deps = ansible>=5,<6 ansible-lint>=5,<6 commands = - bash tools/ansible-lint.sh \ No newline at end of file + bash tools/ansible-lint.sh