theforeman / foreman_fog_proxmox

Foreman plugin to add Proxmox compute resource based on fog-proxmox gem
GNU General Public License v3.0
106 stars 33 forks source link

OVS bridges are not listed when creating a new host in Foreman #43

Closed rogerfachini closed 6 years ago

rogerfachini commented 6 years ago

Describe the bug When creating a new host, under the Nic section the dropdown menu for selecting a bridge is empty, even though the Proxmox node has an OpenVirtualSwitch (OVS) bridge in its network config.

To Reproduce Steps to reproduce the behavior:

  1. Go through the process of creating a new host within Foreman, up until the interfaces tab is reached.
  2. Click on the Edit button for the first interface
  3. Scroll down to the Nic section
  4. The bridge section is empty, and does not list the OVS bridges available to the system.

Expected behavior OVS bridges available to the node should be listed in the dropdown menu.

Screenshots

nic The OVS bridge is not listed under Foreman.

proxnic The OVS bridge is listed under Proxmox.

Desktop

Foreman

Proxmox

Additional context I read through the plugin's code, and this issue appears to be caused on line 89 of app/models/foreman_fog_proxmox/proxmox.rb. In this function, only interfaces of type bridge are returned, however OVS bridges have the type OVSBridge. According to Proxmox's API documentation there also appears to be a type of any_bridge, which I assume would return bridges of both types.

rogerfachini commented 6 years ago

I just stumbled through the process of getting a dev environment set up (I've never done ruby development before) and I can confirm that changing the type to any_bridge does allow the OVS bridge to be present in the list. I'll do further testing to verify it works with normal bridges as well, and if that is successful I'll submit a pull request with the fix.

tristanrobert commented 6 years ago

Hello, you are right and your contribution is welcome!