infiniband: check that the connection to be created is a partition first

No functional change. It will make it a bit easier to produce a good
error message in subsequent commit.
This commit is contained in:
Lubomir Rintel 2016-04-19 11:59:36 +02:00
parent dda8e24a21
commit 7eca706751

View file

@ -239,14 +239,8 @@ create_and_realize (NMDevice *device,
int parent_ifindex, p_key;
NMPlatformError plerr;
if (!NM_IS_DEVICE_INFINIBAND (parent)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
"Parent interface %s must be an InfiniBand interface",
nm_device_get_iface (parent));
return FALSE;
}
s_infiniband = nm_connection_get_setting_infiniband (connection);
g_assert (s_infiniband);
/* Can only create partitions at this time */
p_key = nm_setting_infiniband_get_p_key (s_infiniband);
@ -256,6 +250,13 @@ create_and_realize (NMDevice *device,
return FALSE;
}
if (!NM_IS_DEVICE_INFINIBAND (parent)) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
"Parent interface %s must be an InfiniBand interface",
nm_device_get_iface (parent));
return FALSE;
}
parent_ifindex = nm_device_get_ifindex (parent);
if (parent_ifindex <= 0) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,