From ea2d2a37a45fcf9912b487263558b08e0d1dc4d2 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Fri, 3 Dec 2021 16:54:28 +0100 Subject: [PATCH] Use the combined Ironic service instead of API+conductor Change-Id: I9faecfe6ece6d3c35396e3378c1e3930a487e130 Depends-On: https://review.opendev.org/c/openstack/ironic/+/819620 Depends-On: https://review.opendev.org/c/openstack/kolla-ansible/+/820513 --- doc/source/contributor/testenv.rst | 2 +- doc/source/user/troubleshooting.rst | 4 +-- .../tasks/bootstrap.yml | 27 ++++++++++--------- .../tasks/inspector_bootstrap.yml | 12 ++++----- .../bifrost-ironic-install/tasks/start.yml | 20 ++++++++++---- .../templates/systemd_template.j2 | 8 +++--- .../notes/allinone-5fc5355f46192351.yaml | 9 +++++++ scripts/collect-test-info.sh | 4 +-- 8 files changed, 53 insertions(+), 33 deletions(-) create mode 100644 releasenotes/notes/allinone-5fc5355f46192351.yaml diff --git a/doc/source/contributor/testenv.rst b/doc/source/contributor/testenv.rst index cd9d5d16e..39c6043f1 100644 --- a/doc/source/contributor/testenv.rst +++ b/doc/source/contributor/testenv.rst @@ -22,7 +22,7 @@ Additionally, the following parameters can be useful: .. note:: You still need to restart services to apply any changes, e.g.:: - sudo systemctl restart ironic-conductor + sudo systemctl restart ironic ``--driver=[ipmi|redfish]`` Choose the default driver for the generated nodes inventory. diff --git a/doc/source/user/troubleshooting.rst b/doc/source/user/troubleshooting.rst index 0a542a9f5..0d29cb61e 100644 --- a/doc/source/user/troubleshooting.rst +++ b/doc/source/user/troubleshooting.rst @@ -106,8 +106,8 @@ Obtaining IPA logs via the console the video mode, defines the console as ttyS0 or the first serial port, and instructs systemd to direct logs to the console. -2) Once set, restart the ironic-conductor service, e.g. - ``service ironic-conductor restart`` and attempt to redeploy the node. +2) Once set, restart the ironic service, e.g. + ``systemctl restart ironic`` and attempt to redeploy the node. You will want to view the system console occurring. If possible, you may wish to use ``ipmitool`` and write the output to a log file. diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index 3f94a3799..351e1c41e 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -230,26 +230,29 @@ include: inspector_bootstrap.yml when: enable_inspector | bool -- name: "Get ironic-api & ironic-conductor install location" - shell: echo $(dirname $(which ironic-api)) +- name: "Get ironic install location" + shell: echo $(dirname $(which ironic)) register: ironic_install_prefix environment: "{{ bifrost_venv_env }}" -- name: "Place ironic services" +- name: "Place ironic service" template: src: systemd_template.j2 - dest: "{{ init_dest_dir }}{{ item.service_name }}.service" + dest: "{{ init_dest_dir }}ironic.service" owner: "root" group: "root" + vars: + service_path: "{{ ironic_install_prefix.stdout | default('') }}" + service_name: 'ironic' + config_file: '/etc/ironic/ironic.conf' + +- name: "Remove old ironic services" + file: + path: "{{ init_dest_dir }}{{ item }}.service" + state: absent loop: - - service_path: "{{ ironic_install_prefix.stdout | default('') }}" - service_name: 'ironic-api' - username: 'ironic' - args: '--config-file /etc/ironic/ironic.conf' - - service_path: "{{ ironic_install_prefix.stdout | default('') }}" - service_name: 'ironic-conductor' - username: 'ironic' - args: '--config-file /etc/ironic/ironic.conf' + - ironic-api + - ironic-conductor - name: "Create and populate /tftpboot" import_tasks: create_tftpboot.yml diff --git a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml index c1c887e8c..a2727eff2 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/inspector_bootstrap.yml @@ -134,15 +134,13 @@ - name: "Inspector - Place service" template: src: systemd_template.j2 - dest: "{{ init_dest_dir }}{{ item.service_name }}.service" + dest: "{{ init_dest_dir }}ironic-inspector.service" owner: root group: root - # FIXME(dtantsur): this is an awkward way to use loop... - loop: - - service_path: "{{ ironic_install_prefix.stdout | default('') }}" - service_name: 'ironic-inspector' - username: 'ironic' - args: '--config-file /etc/ironic-inspector/inspector.conf' + vars: + service_path: "{{ ironic_install_prefix.stdout | default('') }}" + service_name: 'ironic-inspector' + config_file: '/etc/ironic-inspector/inspector.conf' - name: "Inspector - Explicitly permit TCP/5050 for ironic-inspector callback" iptables: chain: INPUT diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index ca2e4bf14..da388d054 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -26,15 +26,25 @@ - name: "Start database service" service: name={{ mysql_service_name }} state=started enabled=yes -- name: "start ironic-inspector" +- name: "Start ironic-inspector" include: inspector_start.yml when: enable_inspector | bool -- name: "Start ironic-conductor" - service: name=ironic-conductor state=restarted enabled=yes +- name: "Stop old ironic services" + service: + name: "{{ item }}" + state: stopped + enabled: no + ignore_errors: true + loop: + - ironic-api + - ironic-conductor -- name: "Start ironic-api" - service: name=ironic-api state=restarted enabled=yes +- name: "Start ironic" + service: + name: ironic + state: restarted + enabled: yes - name: "Start ironic-prometheus-exporter" include: prometheus_exporter_start.yml diff --git a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 index e9120ce44..0aa9ab1fd 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/systemd_template.j2 @@ -1,10 +1,10 @@ [Unit] -Description={{ item.service_name }} service +Description={{ service_name }} service [Service] -ExecStart={{ item.service_path }}/{{ item.service_name }} {{ item.args }} -User={{ item.username }} +ExecStart={{ service_path }}/{{ service_name }} --config-file {{ config_file }} +User=ironic [Install] WantedBy=multi-user.target -Alias={{ item.service_name }}.service +Alias={{ service_name }}.service diff --git a/releasenotes/notes/allinone-5fc5355f46192351.yaml b/releasenotes/notes/allinone-5fc5355f46192351.yaml new file mode 100644 index 000000000..f742f3649 --- /dev/null +++ b/releasenotes/notes/allinone-5fc5355f46192351.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + Bifrost now starts a single Ironic process rather than separate API + and conductor. +upgrade: + - | + On upgrade, the existing API and conductor services will be disabled and + a single combined ``ironic`` process will be started instead. diff --git a/scripts/collect-test-info.sh b/scripts/collect-test-info.sh index 1becd0100..c846f4163 100755 --- a/scripts/collect-test-info.sh +++ b/scripts/collect-test-info.sh @@ -71,9 +71,9 @@ mkdir -p ${LOG_LOCATION}/all sudo cp -a /var/log/* ${LOG_LOCATION}/all/. sudo chown -R $USER ${LOG_LOCATION}/all +sudo systemctl > ${LOG_LOCATION}/all-services.txt sudo journalctl -u libvirtd &> ${LOG_LOCATION}/libvirtd.log -sudo journalctl -u ironic-api &> ${LOG_LOCATION}/ironic-api.log -sudo journalctl -u ironic-conductor &> ${LOG_LOCATION}/ironic-conductor.log +sudo journalctl -u ironic &> ${LOG_LOCATION}/ironic.log sudo journalctl -u ironic-inspector &> ${LOG_LOCATION}/ironic-inspector.log sudo journalctl -u dnsmasq &> ${LOG_LOCATION}/dnsmasq.log sudo journalctl -u vbmcd &> ${LOG_LOCATION}/vbmcd.log