Fix PKEY_ID value in ifcfg file of infiniband child interface
In the current implementation of ifcfg file in os-net-config, the high bit of the PKEY_ID setting is not being set, while the high bit of the pkey in the DEVICE setting is being set. However, due to a change in NetworkManager [1], it is no longer necessary to set the high bit of the pkey in the DEVICE setting, but applying this change in os-net-config is causing compatibility issues with older versions of NetworkManager. To address this issue, this patch proposes setting the high bit for both the PKEY_ID and pkey in DEVICE settings in the ifcfg file. This approach would work for all versions of NetworkManager and maintain compatibility with older versions. [1]33f2f82a09Closes-Bug: #2007372 Change-Id: I7b4f063508c4d9518ca706e62cf1368fba2d069e (cherry picked from commit3e73bd8c83)
This commit is contained in:
@@ -431,7 +431,7 @@ class IfcfgNetConfig(os_net_config.NetConfig):
|
||||
data += "TYPE=Infiniband\n"
|
||||
data += "PKEY=yes\n"
|
||||
data += "PHYSDEV=%s\n" % base_opt.parent
|
||||
data += "PKEY_ID=%d\n" % base_opt.pkey_id
|
||||
data += "PKEY_ID=%s\n" % base_opt.pkey_id
|
||||
elif re.match(r'\w+\.\d+$', base_opt.name):
|
||||
data += "VLAN=yes\n"
|
||||
elif isinstance(base_opt, objects.Interface):
|
||||
|
||||
@@ -1269,9 +1269,9 @@ class IbChildInterface(_BaseOpts):
|
||||
routes = routes or []
|
||||
rules = rules or []
|
||||
dns_servers = dns_servers or []
|
||||
self.pkey_id = pkey_id
|
||||
self.parent = parent
|
||||
full_pkey_id = 0x8000 | pkey_id
|
||||
self.pkey_id = hex(full_pkey_id)
|
||||
self.parent = parent
|
||||
name = "%s.%04x" % (parent, full_pkey_id)
|
||||
nm_controlled = True
|
||||
super(IbChildInterface, self).__init__(name, use_dhcp, use_dhcpv6,
|
||||
|
||||
@@ -191,7 +191,7 @@ PEERDNS=no
|
||||
TYPE=Infiniband
|
||||
PKEY=yes
|
||||
PHYSDEV=ib0
|
||||
PKEY_ID=1
|
||||
PKEY_ID=0x8001
|
||||
BOOTPROTO=none
|
||||
"""
|
||||
|
||||
|
||||
@@ -1622,14 +1622,14 @@ class TestIbChildInterface(base.TestCase):
|
||||
|
||||
def test_ib_child_interface_pkey_id_valid(self):
|
||||
ib_child_interface = objects.IbChildInterface('foo', pkey_id=100)
|
||||
self.assertEqual(100, ib_child_interface.pkey_id)
|
||||
self.assertEqual("0x8064", ib_child_interface.pkey_id)
|
||||
|
||||
def test_ib_child_interface_pkey_id_hexa(self):
|
||||
data = '{"type": "ib_child_interface", ' \
|
||||
'"parent": "foo", "pkey_id": "0x64"}'
|
||||
ib_child_interface = \
|
||||
objects.IbChildInterface.from_json(json.loads(data))
|
||||
self.assertEqual(100, ib_child_interface.pkey_id)
|
||||
self.assertEqual("0x8064", ib_child_interface.pkey_id)
|
||||
|
||||
def test_ib_child_interface_pkey_id_invalid_base(self):
|
||||
data = '{"type": "ib_child_interface", ' \
|
||||
|
||||
Reference in New Issue
Block a user