Project

General

Profile

Actions

Bug #33322

open

VLAN tagging on provision interface

Added by Gerald Vogt over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

I have noticed that the template "Preseed default PXELinux" doesn't work nicely for ubuntu 20.04 lts in our network. It's due to these lines:

  if @host.provision_interface.vlanid.present?
    options << "netcfg/use_vlan=true netcfg/vlan_id=#{@host.provision_interface.vlanid}" 
  end

We have many networks and a network is access tagged on some clients and untagged on others, depending how they are connected to the switch.

However, checking for vlanid.present? means that a vlanid is present, but doesn't check for the virtual flag on the interface. Looking at the interface configuration I think it should check for the virtual flag on the interface and not if the network assigned has a vlanid assigned.

In other words: instead of "@host.provision_interface.vlanid.present?" the condition should be "@host.provision_interface.virtual?" or maybe check for both. Only an interface which has been configured as virtual should use tagging. If it's not configured virtual, it's untagged.

Actions #1

Updated by Lukas Zapletal over 2 years ago

Hello,

this is the method which is called (from the NIC):

      def vlanid
        # Determine a vlanid according to the following cascading rules:
        # 1. if the interface has a tag, use that as the vlanid
        # 2. if the interface has a v4 subnet with a non-blank vlanid, use that
        # 3. if the interface has a v6 subnet with a non-blank vlanid, use that
        # 4. if no reasonable vlanid was determined, then return an empty string
        #
        # In case the v4 and v6 subnet are both present, they should have the same
        # vlanid. If they have a different vlanid, this is probably an error in the
        # user's database. There is no way of determining the real vlanid, so we
        # pick the v4 one unless it turns out to be blank.

        return tag if tag.present?
        return subnet.vlanid if subnet && subnet.vlanid.present?
        return subnet6.vlanid if subnet6 && subnet6.vlanid.present?
        ''
      end

So it looks like the method does not check if the nic is virtual or not, I agree with your assesment. Feel free to contribute a change via github! Cheers.

Actions #2

Updated by The Foreman Bot over 2 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8735 added
Actions #3

Updated by The Foreman Bot over 2 years ago

  • Status changed from Ready For Testing to New
  • Pull request deleted (https://github.com/theforeman/foreman/pull/8735)
Actions

Also available in: Atom PDF