Skip to content

Commit

Permalink
Allow to set a specific port for VBMC daemon
Browse files Browse the repository at this point in the history
This port wasn't documented, and of course may conflict if you have a
pre-existing VBMC service running on the host (especially in devscripts
scenario).

This patch adds a minimalistic VirtualBMC configuration file to the
container, allowing to set a specific port for the main daemon.

The patch also updates the va-hci.yml scenario file to allow a smoother
deployment.
  • Loading branch information
cjeanner authored and openshift-merge-bot[bot] committed Mar 26, 2024
1 parent f3007af commit 370b0ff
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roles/libvirt_manager/tasks/create_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
cifmw_virtualbmc_machine: "cifmw-{{ vm_type }}-{{ index }}"
cifmw_virtualbmc_ipmi_port: >-
{{
cifmw_virtualbmc_ipmi_base_port + family_id + index
cifmw_virtualbmc_ipmi_base_port + (family_id*10) + index
}}
cifmw_virtualbmc_action: "add"
_ipmi_host: >-
Expand Down
3 changes: 2 additions & 1 deletion roles/virtualbmc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ None
## Parameters
* `cifmw_virtualbmc_image`: (String) VirtualBMC container image. Defaults to `quay.io/metal3-io/vbmc:latest`.
* `cifmw_virtualbmc_container_name`: (String) VirtualBMC container name. Defaults to `cifmw-vbmc`.
* `+cifmw_virtualbmc_listen_address`: (String) VirtualBMC listen address. Defaults to `127.0.0.1`.
* `cifmw_virtualbmc_listen_address`: (String) VirtualBMC listen address. Defaults to `127.0.0.1`.
* `cifmw_virtualbmc_daemon_port`: (Integer) VirtualBMC daemon listen port. Default to `50891`.
* `cifmw_virtualbmc_machine`: (String) Virtual machine to manage in VirtualBMC. Mandatory. Defaults to `null`.
* `cifmw_virtualbmc_action`: (String) VirtualBMC action. Must be either `add` or `delete`. Mandatory. Defaults to `null`.
* `cifmw_virtualbmc_sshkey_path`: (String) SSH keypair path for VirtualBMC. Defaults to `{{ ansible_user_dir }}/.ssh/vbmc-key`.
Expand Down
1 change: 1 addition & 0 deletions roles/virtualbmc/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
cifmw_virtualbmc_image: "quay.io/metal3-io/vbmc:latest"
cifmw_virtualbmc_container_name: "cifmw-vbmc"
cifmw_virtualbmc_listen_address: "127.0.0.1"
cifmw_virtualbmc_daemon_port: 50891

cifmw_virtualbmc_machine: null
cifmw_virtualbmc_action: null
Expand Down
5 changes: 4 additions & 1 deletion roles/virtualbmc/tasks/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@
key: "{{ _vbmc_key.content | b64decode }}"
state: absent

- name: Remove generated SSH keypair
- name: Remove vbmc files
vars:
dest_dir: "{{ cifmw_virtualbmc_sshkey_path | dirname }}"
ansible.builtin.file:
path: "{{ item }}"
state: absent
loop:
- "{{ cifmw_virtualbmc_sshkey_path }}"
- "{{ cifmw_virtualbmc_sshkey_path }}.pub"
- "{{ dest_dir }}/virtualbmc.conf"
13 changes: 13 additions & 0 deletions roles/virtualbmc/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,24 @@
key: "{{ _vbmc_key.public_key }}"
state: present

- name: Create vbmc server configuration file
vars:
dest_dir: "{{ cifmw_virtualbmc_sshkey_path | dirname }}"
ansible.builtin.copy:
dest: "{{ dest_dir }}/virtualbmc.conf"
content: |
[default]
server_port={{ cifmw_virtualbmc_daemon_port }}
mode: "0644"

- name: Create and start vbmc container
vars:
dest_dir: "{{ cifmw_virtualbmc_sshkey_path | dirname }}"
containers.podman.podman_container:
image: "{{ cifmw_virtualbmc_image }}"
name: "{{ cifmw_virtualbmc_container_name }}"
network: host
state: started
volumes:
- "{{ cifmw_virtualbmc_sshkey_path }}:{{ cifmw_virtualbmc_ipmi_key_path }}:ro,Z"
- "{{ dest_dir }}/virtualbmc.conf:/etc/virtualbmc/virtualbmc.conf:ro,Z"
1 change: 1 addition & 0 deletions scenarios/reproducers/va-hci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ cifmw_test_operator_tempest_include_list: |
# provides access to Internet. This will be the equivalent of the
# "public network" as seen in CI.
cifmw_use_libvirt: true
cifmw_virtualbmc_daemon_port: 50881
cifmw_libvirt_manager_compute_amount: 3
cifmw_libvirt_manager_configuration:
networks:
Expand Down

0 comments on commit 370b0ff

Please sign in to comment.