theforeman / foreman_fog_proxmox

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

net[n] naming convention leads to problems with preseed #194

Closed ahoiroman closed 3 years ago

ahoiroman commented 3 years ago

Describe the bug

foreman_fog_proxmox requires the interface's name to be net[n], n integer >= 0.

Starting an unattended installation with Debian (preseed) leads to problems:

During the installation process, the interface's name is set to ens18 as required by predictable naming scheme .

The installation succeeds and boots up a system having an interface called ens18. Once puppet agent --test updates the interfaces, the host can not be edited, because the interface's name is ens18 where foreman_fog_proxmox requires net[n].

To Reproduce Steps to reproduce the behavior:

  1. Create a new host using PXE-boot and preseed installation with Debian 10.9, having fixed network-configuration before as shown in https://github.com/theforeman/foreman_fog_proxmox/issues/192
  2. Await installation and reboot
  3. Enter host using SSH and run puppet agent --test
  4. Edit host in foreman web UI
  5. Try to save the host
  6. Error shows up

Expected behavior I see two possibilities:

  1. Installation sets interface name to net[n], which is not recommended and I have to admit I am not sure if this is possible at all
  2. foreman_fog_proxmox allows other names as interface-names
ahoiroman commented 3 years ago

I guess the easiest solution would be to allow other names on VMs that are already existing or separate between interface-name in proxmox and on the VM.

tristanrobert commented 3 years ago

Proxmox VE API requires net[n] with n integer >= 0 as config qemu vm network devices. You can check it here: https://pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/{node}/qemu/{vmid}/config. Foreman_fog_proxmox uses this as the NIC identifier. How could it be possible to have both: net0 required as NIC identifier by the API and interface name ens18 in preseed NIC name? Your ideas are welcome. It is possible to set NIC name in foreman_fog_proxmox which is different from id, see fog-proxmox interface model: https://github.com/fog/fog-proxmox/blob/master/lib/fog/proxmox/compute/models/interface.rb

ahoiroman commented 3 years ago

Hi Tristan,

thanks a lot for your answer.

Being aware that Proxmox expects a network device with that name, the predictable naming scheme - as quoted above - is not really following this expectation. If I am not mistaken, the device name in Proxmox does not have anything to do with the device name in - let's say - Linux. Even a manually installed Debian 10 sets ens18 as interface name, while Proxmox calls the network device net0.

So I only see two possibilities:

  1. Store the network device name somewhere else (db?) and do not use the network identifier shown in the host details page at all
  2. Create a configuration entry that says something like "allow generic interface names on deployed hosts"

As I am no expert in Foreman plugin development I am not sure whether these are good ideas, but in general it would be great if this problem could be solved somehow.

tristanrobert commented 3 years ago

Hi Tristan,

thanks a lot for your answer.

Being aware that Proxmox expects a network device with that name, the predictable naming scheme - as quoted above - is not really following this expectation. If I am not mistaken, the device name in Proxmox does not have anything to do with the device name in - let's say - Linux. Even a manually installed Debian 10 sets ens18 as interface name, while Proxmox calls the network device net0.

So I only see two possibilities:

1. Store the network device name somewhere else (db?) and do not use the network identifier shown in the host details page at all

2. Create a configuration entry that says something like "allow generic interface names on deployed hosts"

As I am no expert in Foreman plugin development I am not sure whether these are good ideas, but in general it would be great if this problem could be solved somehow.

  1. -> Maybe it could be possible to simply remove the nic identifier check (net[n]) and let permit anything else (not empty). But if we do, it is used to identify NIC in Proxmox, so if you remove it it will be very difficult to sync config with proxmox. Maybe 1. would be necessary to keep this information. In the foreman all specific compute resource informations are stored in compute_attributes args. It is possible but it is a big move and needs lot of tests to be sure not to break features.
ahoiroman commented 3 years ago

This would be okay for me. Thanks for your work :-)