Add a workaround for a problem creating InfiniBand connections

It is currently not possible to create a connection where the
connection-type-specific NMSetting has all default values. This hasn't
been a problem in the past because each type had at least one property
that either had no default value or had a default value that didn't
pass verify(). But NMSettingInfiniband didn't have that property, so
it's impossible to create an InfiniBand connection unless you change
the value of at least InfiniBand-specific setting.

Work around this for now by making the default value of
NMSettingInfiniband:transport-mode be NULL, so it needs to be
overridden.
This commit is contained in:
Dan Winship 2012-03-16 13:48:11 -04:00
parent deb042c656
commit 04959c39aa
3 changed files with 6 additions and 1 deletions

View file

@ -285,7 +285,7 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class)
g_param_spec_string (NM_SETTING_INFINIBAND_TRANSPORT_MODE,
"Transport Mode",
"The IPoIB transport mode. Either 'datagram' or 'connected'.",
"datagram",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
}

View file

@ -331,6 +331,9 @@ real_complete_connection (NMDevice *device,
g_byte_array_free (mac, TRUE);
}
if (!nm_setting_infiniband_get_transport_mode (s_infiniband))
g_object_set (G_OBJECT (s_infiniband), NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram");
return TRUE;
}

View file

@ -3489,6 +3489,8 @@ make_infiniband_setting (shvarFile *ifcfg,
if (svTrueValue (ifcfg, "CONNECTED_MODE", FALSE))
g_object_set (s_infiniband, NM_SETTING_INFINIBAND_TRANSPORT_MODE, "connected", NULL);
else
g_object_set (s_infiniband, NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", NULL);
if (!nm_controlled && !*unmanaged) {
/* If NM_CONTROLLED=no but there wasn't a MAC address, notify