Run vbmcd as a Systemd service

Virtualbmc 2.0 dropped the daemon autostart feature. This means we need
to explicitly start it. Running it as a Systemd unit, code adapted from
Tenks.

In order to allow Systemd to execute the daemon on systems with SELinux
enabled, it must be installed to the system rather than a virtualenv.

Change-Id: I66e8e5f5a9c16ac90e132074c826d508458ae4d1
This commit is contained in:
Mark Goddard
2020-03-09 09:26:45 +00:00
parent 44dc37a6c2
commit 6513e5a6dc
3 changed files with 32 additions and 0 deletions

View File

@@ -166,3 +166,22 @@
name: virtualbmc
extra_args: "-c {{ upper_constraints_file }}"
virtualenv: "{{ enable_venv | bool | ternary(bifrost_venv_dir, omit) }}"
become: true
- name: ensure Virtual BMC systemd service is configured
template:
src: vbmcd.service.j2
dest: /etc/systemd/system/vbmcd.service
owner: root
group: root
mode: 0644
become: true
register: vbmcd_service_file
- name: ensure Virtual BMC systemd service is started and enabled
systemd:
name: vbmcd
enabled: yes
state: started
daemon_reload: "{{ vbmcd_service_file.changed }}"
become: true

View File

@@ -0,0 +1,12 @@
{% if enable_venv | bool %}
{% set vbmcd = bifrost_venv_dir ~ '/bin/vbmcd' %}
{% else %}
{% set vbmcd = '/usr/local/bin/vbmcd' %}
{% endif %}
[Unit]
Description=Virtual BMC daemon
[Service]
Type=simple
Restart=on-failure
ExecStart={{ vbmcd }} --foreground

View File

@@ -62,6 +62,7 @@ if $(journalctl --version &>/dev/null); then
sudo journalctl -u ironic-conductor &> ${LOG_LOCATION}/ironic-conductor.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
else
sudo cp /var/log/upstart/ironic-api.log ${LOG_LOCATION}/
sudo cp /var/log/upstart/ironic-conductor.log ${LOG_LOCATION}/