mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
nodeinfo: Check for SYSFS_INFINIBAND_DIR before open
Commit id 'ac3ed2085' causes 'virsh nodedev-list --cap net' to fail on any system without SYSFS_INFINIBAND_DIR (/sys/class/infiniband). Rather than assume it's there and fail on the attempt to open the non-existent directory, check if it's there - if not, return success and move on. Also fix caller to check < 0 upon return. As reported by Suren Hajyan <shajyan@redhat.com> from run of unit tests
This commit is contained in:
parent
c1c5eb6fad
commit
136f17efd1
@ -2976,6 +2976,9 @@ virNetDevRDMAFeature(const char *ifname,
|
|||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
|
if (!virFileExists(SYSFS_INFINIBAND_DIR))
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (!(dirp = opendir(SYSFS_INFINIBAND_DIR))) {
|
if (!(dirp = opendir(SYSFS_INFINIBAND_DIR))) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("Failed to opendir path '%s'"),
|
_("Failed to opendir path '%s'"),
|
||||||
@ -3191,7 +3194,7 @@ virNetDevGetFeatures(const char *ifname,
|
|||||||
ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
|
ignore_value(virBitmapSetBit(*out, VIR_NET_DEV_FEAT_TXUDPTNL));
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (virNetDevRDMAFeature(ifname, out))
|
if (virNetDevRDMAFeature(ifname, out) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user