Refactor #7456


Extract primary interface from host

Added by Marek Hulán about 9 years ago. Updated over 5 years ago.

Target version:
Fixed in Releases:
Found in Releases:


Extract MAC, IP, domain and subnet out of host object to the separate interface object. Related to this - properly detect primary interface among facts, never use ipaddress and macaddress facts. We should add primary and provisioning flags to interfaces.

Primary - this gives the host it's identity, and the DNS record for
this interface is how the host is referred to / displayed in the UI.
There must always be a primary, so that a host has a name (except for
unamanged, wher the is the fqdn as usual)

Provisioning - the interface used for writing tftp files based it's
mac, and configured as the primary during kickstart so it can reach
Foreman. Defaults to the Primary interface above if not set.

Some more details:

This is because we often hear of people having separate provisioning
networks, with hosts moved to the correct vlans/subnets after build.
As such, you want to see "" in Foreman, not

Few ideas that we agreed on * primary interface should always be managed (flag added recently) * same applies to provisioning interface * we can easily support moving of provisioning flag between interfaces * we don't want to enable primary interface flag to be moved (at least for now - we do it for now for hosts, so depending on complexity) * while flags on interface seems as simple solution for now, we should think
about subnet roles so by assigning a subnet with role "provisioning", we'd
know the default value for provisioning flag, this brings several things to
consider, like multiple provisioning subnets

Related issues 11 (2 open9 closed)

Related to Foreman - Tracker #2409: NetworkingNew

Related to Foreman - Bug #7405: FreeBSD bond interfaces lead to constant switching of primary interfaceClosed09/10/2014Actions
Related to Foreman - Feature #8556: Resolve when instantiating ProxyAPI::BMCNew12/03/2014Actions
Related to Foreman - Bug #9138: Intermittent HostTest/NIC integration test failuresDuplicateTomáš Strachota01/28/2015Actions
Related to Foreman - Bug #9170: Wrong nic order in libvirt domainClosed01/29/2015Actions
Related to Foreman - Bug #9461: undefined method domain_selected() when selecting Host group domain/subnetClosedTomer Brisker02/19/2015Actions
Related to Foreman - Bug #9966: Add debug logging when host interfaces cannot be matched to VM interfacesClosedTomáš Strachota03/31/2015Actions
Blocks Foreman - Feature #3695: Add a device name to additional host interfacesResolved11/19/2013Actions
Blocked by Foreman - Refactor #7733: Remove Host FixturesClosedGreg Sutcliffe09/29/2014Actions
Blocks Foreman - Feature #7458: Allow searching of hosts based on mac address (including all interfaces)ClosedMarek Hulán09/16/2014Actions
Blocks Foreman - Feature #5458: Make setting static IP more user friendlyClosedMarek Hulán04/25/2014Actions

Also available in: Atom PDF