mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 07:40:08 +01:00
ifcfg-rh: update InfiniBand P_Key support to match latest initscripts
This commit is contained in:
parent
29d88b3b59
commit
f9016e203a
2 changed files with 18 additions and 18 deletions
|
|
@ -3520,44 +3520,44 @@ parse_infiniband_p_key (shvarFile *ifcfg,
|
|||
char **out_parent,
|
||||
GError **error)
|
||||
{
|
||||
char *device = NULL, *physdev = NULL, *vlan_id = NULL, *end;
|
||||
char *device = NULL, *physdev = NULL, *pkey_id = NULL, *end;
|
||||
char *ifname = NULL;
|
||||
guint32 id;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
device = svGetValue (ifcfg, "DEVICE", FALSE);
|
||||
if (!device) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified VLAN but not DEVICE");
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified PKEY but not DEVICE");
|
||||
goto done;
|
||||
}
|
||||
|
||||
physdev = svGetValue (ifcfg, "PHYSDEV", FALSE);
|
||||
if (!physdev) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified VLAN but not PHYSDEV");
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified PKEY but not PHYSDEV");
|
||||
goto done;
|
||||
}
|
||||
|
||||
vlan_id = svGetValue (ifcfg, "VLAN_ID", FALSE);
|
||||
if (!vlan_id) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified VLAN but not VLAN_ID");
|
||||
pkey_id = svGetValue (ifcfg, "PKEY_ID", FALSE);
|
||||
if (!pkey_id) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand connection specified PKEY but not PKEY_ID");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (g_str_has_prefix (vlan_id, "0x"))
|
||||
id = strtoul (vlan_id, &end, 16);
|
||||
else if (!g_str_has_prefix (vlan_id, "0"))
|
||||
id = strtoul (vlan_id, &end, 10);
|
||||
if (g_str_has_prefix (pkey_id, "0x"))
|
||||
id = strtoul (pkey_id, &end, 16);
|
||||
else if (!g_str_has_prefix (pkey_id, "0"))
|
||||
id = strtoul (pkey_id, &end, 10);
|
||||
else
|
||||
end = vlan_id;
|
||||
if (end == vlan_id || *end || id > 0xFFFF) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " invalid InfiniBand VLAN_ID '%s'", vlan_id);
|
||||
end = pkey_id;
|
||||
if (end == pkey_id || *end || id > 0xFFFF) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " invalid InfiniBand PKEY_ID '%s'", pkey_id);
|
||||
goto done;
|
||||
}
|
||||
id = (id | 0x8000);
|
||||
|
||||
ifname = g_strdup_printf ("%s.%04x", physdev, id);
|
||||
if (strcmp (device, ifname) != 0) {
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand DEVICE (%s) does not match PHYSDEV+VLAN_ID (%s)",
|
||||
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " InfiniBand DEVICE (%s) does not match PHYSDEV+PKEY_ID (%s)",
|
||||
device, ifname);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -3569,7 +3569,7 @@ parse_infiniband_p_key (shvarFile *ifcfg,
|
|||
done:
|
||||
g_free (device);
|
||||
g_free (physdev);
|
||||
g_free (vlan_id);
|
||||
g_free (pkey_id);
|
||||
g_free (ifname);
|
||||
|
||||
if (!ret) {
|
||||
|
|
@ -3628,7 +3628,7 @@ make_infiniband_setting (shvarFile *ifcfg,
|
|||
else
|
||||
g_object_set (s_infiniband, NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", NULL);
|
||||
|
||||
if (svTrueValue (ifcfg, "VLAN", FALSE)) {
|
||||
if (svTrueValue (ifcfg, "PKEY", FALSE)) {
|
||||
int p_key;
|
||||
char *parent;
|
||||
|
||||
|
|
|
|||
|
|
@ -991,9 +991,9 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e
|
|||
|
||||
p_key = nm_setting_infiniband_get_p_key (s_infiniband);
|
||||
if (p_key != -1) {
|
||||
svSetValue (ifcfg, "VLAN", "yes", FALSE);
|
||||
svSetValue (ifcfg, "PKEY", "yes", FALSE);
|
||||
tmp = g_strdup_printf ("%u", p_key);
|
||||
svSetValue (ifcfg, "VLAN_ID", tmp, FALSE);
|
||||
svSetValue (ifcfg, "PKEY_ID", tmp, FALSE);
|
||||
g_free (tmp);
|
||||
|
||||
parent = nm_setting_infiniband_get_parent (s_infiniband);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue