[libvirt] [PATCH] bhyve: don't fail on busy tap devices

We use virBhyveTapGetRealDeviceName() to map network interface name to a real device path, trying to open possible devices and getting names by ioctl. Make it skip devices that fail to open with EBUSY because they're most likely already used by other VMs. --- src/bhyve/bhyve_command.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 6d64c27..e569aab 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -69,6 +69,8 @@ virBhyveTapGetRealDeviceName(char *name) goto cleanup; } if ((fd = open(devpath, O_RDWR)) < 0) { + if (errno == EBUSY) + continue; virReportSystemError(errno, _("Unable to open '%s'"), devpath); goto cleanup; } -- 1.8.4.2

On 03/23/2014 11:28 AM, Roman Bogorodskiy wrote:
We use virBhyveTapGetRealDeviceName() to map network interface name to a real device path, trying to open possible devices and getting names by ioctl.
Make it skip devices that fail to open with EBUSY because they're most likely already used by other VMs. --- src/bhyve/bhyve_command.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 6d64c27..e569aab 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -69,6 +69,8 @@ virBhyveTapGetRealDeviceName(char *name) goto cleanup; } if ((fd = open(devpath, O_RDWR)) < 0) { + if (errno == EBUSY) + continue; virReportSystemError(errno, _("Unable to open '%s'"), devpath); goto cleanup; }
This would leak devpath. ACK with VIR_FREE(devpath) added either before 'continue', or the virAsprintf allocating it. Jan
participants (2)
-
Ján Tomko
-
Roman Bogorodskiy