-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #37367 - Switch to 'network' directive instead of ifcfg #9961
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should get rid of this template. RHV is deprecated and going away and oVirt doesn't look too healthy these days. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's an issue that should be properly discussed in the community (started a thread: https://community.theforeman.org/t/proposal-to-drop-support-for-ovirt/36324) and anyway it's a matter for a separate PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant to only drop the kicjstart tenplate. The whole of oVirt is a separate discussion. I don't know if you even still can provision with this template or if we provide functionality for something that no longer exists. Having said that, I also noticed I can no longer compile the oVirt SDK on Fedora so that alone can be a reason to drop it. I'll weigh in on the RFC later, when I'm home |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<%# | ||
name: kickstart_network_interface | ||
model: ProvisioningTemplate | ||
snippet: true | ||
model: ProvisioningTemplate | ||
kind: snippet | ||
description: | | ||
Generates network directive for a given interface. It is not expected to be used directly. | ||
-%> | ||
<%# | ||
# Variables: iface, host, use_slaac, static, static6 | ||
-%> | ||
<%if @iface.managed? -%> | ||
<% | ||
network_options = [] | ||
nameservers = [] | ||
subnet4 = @iface.subnet | ||
subnet6 = @iface.subnet6 | ||
|
||
rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora' | ||
is_fedora = @host.operatingsystem.name == 'Fedora' | ||
os_major = @host.operatingsystem.major.to_i | ||
|
||
# device and hostname | ||
if @iface.bond? || @iface.bridge? | ||
network_options.push("--device=#{@iface.identifier}") | ||
else | ||
network_options.push("--device=#{@iface.mac || @iface.identifier}") | ||
end | ||
network_options.push("--hostname #{@host.name}") | ||
|
||
# single stack | ||
network_options.push("--noipv6") if subnet4 && !subnet6 | ||
network_options.push("--noipv4") if !subnet4 && subnet6 | ||
|
||
# dual stack MTU check | ||
raise("IPv4 and IPv6 subnets have different MTU") if subnet4 && subnet6 && subnet4.mtu.present? && subnet6.mtu.present? && subnet4.mtu != subnet6.mtu | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should implement this check in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created an issue: https://projects.theforeman.org/issues/37216 |
||
|
||
# mtu method is taking into account both ipv4 and ipv6 stacks | ||
if @iface.respond_to?(:mtu) && @iface.mtu | ||
network_options.push("--mtu=#{@iface.mtu}") | ||
end | ||
|
||
# IPv4 | ||
if subnet4 | ||
if !subnet4.dhcp_boot_mode? || @static | ||
network_options.push("--bootproto static") | ||
network_options.push("--ip=#{@iface.ip}") | ||
network_options.push("--netmask=#{subnet4.mask}") | ||
network_options.push("--gateway=#{subnet4.gateway}") | ||
elsif subnet4.dhcp_boot_mode? | ||
network_options.push("--bootproto dhcp") | ||
end | ||
|
||
nameservers.concat(subnet4.dns_servers) | ||
end | ||
|
||
# IPv6 | ||
if subnet6 | ||
if !subnet6.dhcp_boot_mode? || @static6 | ||
network_options.push("--ipv6=#{@iface.ip6}/#{subnet6.cidr}") | ||
network_options.push("--ipv6gateway=#{subnet6.gateway}") | ||
elsif subnet6.dhcp_boot_mode? | ||
if @use_slaac | ||
network_options.push("--ipv6 auto") | ||
else | ||
network_options.push("--ipv6 dhcp") | ||
end | ||
end | ||
|
||
nameservers.concat(subnet6.dns_servers) | ||
end | ||
|
||
# bond | ||
if @iface.bond? | ||
bond_slaves = @iface.attached_devices_identifiers.join(',') | ||
network_options.push("--bondslaves=#{bond_slaves}") | ||
network_options.push("--bondopts=mode=#{@iface.mode},#{@iface.bond_options.tr(' ', ',')}") | ||
end | ||
|
||
# bridge | ||
if @iface.bridge? | ||
bridge_slaves = @iface.attached_devices_identifiers.join(',') | ||
network_options.push("--bridgeslaves=#{bridge_slaves}") | ||
# Currently no support for bridge options in the interface. | ||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
|
||
# VLAN (only on physical is recognized) | ||
if @iface.virtual? && @iface.tag.present? && @iface.attached_to.present? | ||
stejskalleos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
network_options.push("--vlanid=#{@iface.tag}") | ||
network_options.push("--interfacename=vlan#{@iface.tag}") if (is_fedora && os_major >= 21) || (rhel_compatible && os_major >= 7) | ||
end | ||
|
||
# DNS | ||
if nameservers.empty? | ||
network_options.push("--nodns") | ||
else | ||
network_options.push("--nameserver=#{nameservers.join(',')}") | ||
end | ||
|
||
# Search domain - available from Fedora 39 (RHEL 10) | ||
if @iface.domain && ((is_fedora && os_major >= 39) || (rhel_compatible && os_major >= 10)) | ||
network_options.push("--ipv4-dns-search=#{@iface.domain}") if subnet4 | ||
network_options.push("--ipv6-dns-search=#{@iface.domain}") if subnet6 | ||
end | ||
-%> | ||
<%= "network #{network_options.join(' ')}\n" -%> | ||
<% end -%> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,6 @@ | |
|
||
|
||
|
||
service network restart | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to build a host with the right interfaces. I think it means
ipv4_interface
needs to be marked asmanaged
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
managed_interfaces
is based on DB scopes, it does not work correctly for non-saved hosts: