mirror of https://gitee.com/openkylin/libvirt.git
qemu: command: Report stderr from qemu-bridge-helper
There's a couple reports of things failing in this area (bug 1259070), but it's tough to tell what's going wrong without stderr from qemu-bridge-helper. So let's report stderr in the error message Couple new examples: virbr0 is inactive: internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=virbr0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected stderr=failed to get mtu of bridge `virbr0': No such device bridge isn't on the ACL: internal error: /usr/libexec/qemu-bridge-helper --use-vnet --br=br0 --fd=21: failed to communicate with bridge helper: Transport endpoint is not connected stderr=access denied by acl file
This commit is contained in:
parent
427067f7ed
commit
db35beaa1d
|
@ -285,6 +285,7 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virCommandPtr cmd;
|
virCommandPtr cmd;
|
||||||
|
char *errbuf = NULL, *cmdstr = NULL;
|
||||||
int pair[2] = { -1, -1 };
|
int pair[2] = { -1, -1 };
|
||||||
|
|
||||||
if ((flags & ~VIR_NETDEV_TAP_CREATE_VNET_HDR) != VIR_NETDEV_TAP_CREATE_IFUP)
|
if ((flags & ~VIR_NETDEV_TAP_CREATE_VNET_HDR) != VIR_NETDEV_TAP_CREATE_IFUP)
|
||||||
|
@ -306,6 +307,8 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
|
||||||
virCommandAddArgFormat(cmd, "--use-vnet");
|
virCommandAddArgFormat(cmd, "--use-vnet");
|
||||||
virCommandAddArgFormat(cmd, "--br=%s", brname);
|
virCommandAddArgFormat(cmd, "--br=%s", brname);
|
||||||
virCommandAddArgFormat(cmd, "--fd=%d", pair[1]);
|
virCommandAddArgFormat(cmd, "--fd=%d", pair[1]);
|
||||||
|
virCommandSetErrorBuffer(cmd, &errbuf);
|
||||||
|
virCommandDoAsyncIO(cmd);
|
||||||
virCommandPassFD(cmd, pair[1],
|
virCommandPassFD(cmd, pair[1],
|
||||||
VIR_COMMAND_PASS_FD_CLOSE_PARENT);
|
VIR_COMMAND_PASS_FD_CLOSE_PARENT);
|
||||||
virCommandClearCaps(cmd);
|
virCommandClearCaps(cmd);
|
||||||
|
@ -320,9 +323,24 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
|
||||||
do {
|
do {
|
||||||
*tapfd = recvfd(pair[0], 0);
|
*tapfd = recvfd(pair[0], 0);
|
||||||
} while (*tapfd < 0 && errno == EINTR);
|
} while (*tapfd < 0 && errno == EINTR);
|
||||||
|
|
||||||
if (*tapfd < 0) {
|
if (*tapfd < 0) {
|
||||||
virReportSystemError(errno, "%s",
|
char ebuf[1024];
|
||||||
_("failed to retrieve file descriptor for interface"));
|
char *errstr = NULL;
|
||||||
|
|
||||||
|
if (!(cmdstr = virCommandToString(cmd)))
|
||||||
|
goto cleanup;
|
||||||
|
virCommandAbort(cmd);
|
||||||
|
|
||||||
|
if (errbuf && *errbuf &&
|
||||||
|
virAsprintf(&errstr, "\nstderr=%s", errbuf) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("%s: failed to communicate with bridge helper: %s%s"),
|
||||||
|
cmdstr, virStrerror(errno, ebuf, sizeof(ebuf)),
|
||||||
|
errstr ? errstr : "");
|
||||||
|
VIR_FREE(errstr);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,6 +351,8 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg,
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
VIR_FREE(cmdstr);
|
||||||
|
VIR_FREE(errbuf);
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
VIR_FORCE_CLOSE(pair[0]);
|
VIR_FORCE_CLOSE(pair[0]);
|
||||||
return *tapfd < 0 ? -1 : 0;
|
return *tapfd < 0 ? -1 : 0;
|
||||||
|
|
Loading…
Reference in New Issue