Closed cfconrad closed 4 months ago
I'd change the "foo or bar, I don't know" + checking pkey & device twice and use instead (pasted diff):
- if ((pkey == NULL) != (device == NULL)) {
- ni_error("ifcfg-%s: Missing one of IPOIB_DEVICE or IPOIB_PKEY variable",
- dev->name);
- ni_string_free(&device);
- return -1;
- }
-
- if (pkey) {
+ if (pkey || device) {
unsigned long tmp = ~0UL;
if (ni_parse_ulong(pkey, &tmp, 16) < 0 || tmp > 0xffff) {
- ni_error("ifcfg-%s: Cannot parse infiniband child key number",
- dev->name);
+ ni_error("ifcfg-%s: %s %s partition key (IPOIB_PKEY)", dev->name,
+ pkey ? "Cannot parse" : "Missing",
+ ni_linktype_type_to_name(NI_IFTYPE_INFINIBAND_CHILD));
ni_string_free(&device);
return -1;
}
if (!ni_netdev_name_is_valid(device)) {
- ni_error("ifcfg-%s: %s parent device name is not valid",
- dev->name, ni_linktype_type_to_name(NI_IFTYPE_INFINIBAND_CHILD));
+ ni_error("ifcfg-%s: %s %s parent device name (IPOIB_DEVICE)", dev->name,
+ device ? "Invalid" : "Missing",
+ ni_linktype_type_to_name(NI_IFTYPE_INFINIBAND_CHILD));
ni_string_free(&device);
return -1;
}
/^ib[0-9]+(\.[a-fA-F0-9]+)?$/
IPOIB_DEVICE
and the pkey viaIPOIB_PKEY
separately. These variables take precedence over the pkey and device in the ifcfg filename.