Resolves: rhbz#1061646
Default iface name in the form of <PARENT>.<VLANID> can hit kernel limit
on lenghth of interface name (15 chars), so offer an option to choose
another vlan name.
---
dracut/parse-kickstart | 4 ++--
pyanaconda/kickstart.py | 2 +-
pyanaconda/network.py | 12 ++++++++----
pyanaconda/ui/gui/spokes/network.py | 1 +
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index 044dce9..2c70078 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -109,7 +109,7 @@ class DriverDisk(commands.driverdisk.F14_DriverDisk):
# are processed later.
return "\n".join(dd_net)
-class Network(commands.network.F20_Network):
+class Network(commands.network.RHEL7_Network):
def dracut_args(self, args, lineno, net):
'''
NOTE: The first 'network' line get special treatment:
@@ -440,7 +440,7 @@ def ksnet_to_ifcfg(net, filename=None):
write_ifcfg(slave_filename, slave_ifcfg)
if net.vlanid:
- interface_name = "%s.%s" % (dev, net.vlanid)
+ interface_name = net.interfacename or "%s.%s" % (dev, net.vlanid)
ifcfg.pop('HWADDR')
ifcfg['TYPE'] = "Vlan"
ifcfg['VLAN'] = "yes"
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 4adf22e..bfaa276 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -891,7 +891,7 @@ class Logging(commands.logging.FC6_Logging):
remote_server = "%s:%s" %(self.host, self.port)
logger.updateRemote(remote_server)
-class Network(commands.network.F20_Network):
+class Network(commands.network.RHEL7_Network):
def execute(self, storage, ksdata, instClass):
network.write_network_config(storage, ksdata, instClass, ROOT_PATH)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 5db32ab..1b74fb3 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -524,8 +524,7 @@ def add_connection_for_ksdata(networkdata, devname):
dev_spec = None
# type "vlan"
elif networkdata.vlanid:
- parent, _sep, _vlanid = devname.partition(".")
- values.append(['vlan', 'parent', parent, 's'])
+ values.append(['vlan', 'parent', networkdata.parent, 's'])
values.append(['connection', 'type', 'vlan', 's'])
values.append(['connection', 'id', devname, 's'])
values.append(['vlan', 'interface-name', devname, 's'])
@@ -582,7 +581,8 @@ def ksdata_from_ifcfg(devname, uuid=None):
elif nm.nm_device_type_is_team(devname):
nd.device = devname
elif nm.nm_device_type_is_vlan(devname):
- nd.device = devname.split(".")[0]
+ if devname != default_ks_vlan_interface_name(nd.device, nd.vlanid):
+ nd.interfacename = devname
return nd
@@ -1097,7 +1097,8 @@ def get_device_name(network_data):
if not any((network_data.vlanid, network_data.bondslaves, network_data.teamslaves)):
return ""
if network_data.vlanid:
- dev_name = "%s.%s" % (dev_name, network_data.vlanid)
+ network_data.parent = dev_name
+ dev_name = network_data.interfacename or default_ks_vlan_interface_name(network_data.parent, network_data.vlanid)
return dev_name
@@ -1281,3 +1282,6 @@ def status_message():
msg = _("No network devices available")
return msg
+
+def default_ks_vlan_interface_name(parent, vlanid):
+ return "%s.%s" % (parent, vlanid)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index c7c6ce1..8e582a1 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -858,6 +858,7 @@ class NetworkControlBox(GObject.GObject):
vlanid = dev_cfg.setting_value("vlan", "id")
parent = dev_cfg.setting_value("vlan", "parent")
self._set_device_info_value("wired", "vlanid", str(vlanid))
+ self._set_device_info_value("wired", "parent", parent)
def _refresh_speed_hwaddr(self, dev_cfg, state=None):
dev_type = dev_cfg.device_type
--
1.7.11.7