From patchwork Thu Sep 10 16:35:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 53389 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id DF5F822DC0 for ; Thu, 10 Sep 2015 16:39:40 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf9382777wic.1 for ; Thu, 10 Sep 2015 09:39:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:subject :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=PMI5sKn4D5em1G6/PpLfMUy+ou6oAaNaQ4NyXRb8FmM=; b=RwGpogi9rcCPEN0hAYt1yeY1hEgICwSgrLE8uwJ84RfQPOrFZ5B3+SQzVwsDBy3Y5B k3MMj4uTSZ9F08gYZydFRnkwnm4GE/9eK1C6pJAOi07LkC0y3YK8qmFhDYHecmL5wkVk LUYPO+36NJikKYtnk9E6j/1dEj4c+X5oxc7iugDIvGLwPGlo/JStviA0FT4gfRTeOj65 H1dBLFM/ptGFUmpTIWOwPpSROC7V1HfmfF1q2uZTdqpLGTOMzQ5eASiYYVYbHrYjMot2 hX2SqumFcg87GwgeIij3JG8RPYGrtQnKDY9H9qLkN+yIToond3uIgjC3d0dRhhTDXMaW Wzow== X-Gm-Message-State: ALoCoQnkUzJkI0cFMS8XhBiqlj7wbA7qiu3j0BddczdXKAJ+zBuZ8LI6A2D/ObCTA45bvVBhXgOu X-Received: by 10.180.81.165 with SMTP id b5mr1114260wiy.1.1441903180154; Thu, 10 Sep 2015 09:39:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.9 with SMTP id j9ls233693lae.39.gmail; Thu, 10 Sep 2015 09:39:39 -0700 (PDT) X-Received: by 10.112.204.162 with SMTP id kz2mr36810814lbc.115.1441903179840; Thu, 10 Sep 2015 09:39:39 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id wc4si10926611lbb.123.2015.09.10.09.39.39 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Sep 2015 09:39:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcao8 with SMTP id ao8so26337633lbc.3 for ; Thu, 10 Sep 2015 09:39:39 -0700 (PDT) X-Received: by 10.112.219.70 with SMTP id pm6mr36034491lbc.41.1441903179709; Thu, 10 Sep 2015 09:39:39 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1082321lbq; Thu, 10 Sep 2015 09:39:38 -0700 (PDT) X-Received: by 10.140.101.119 with SMTP id t110mr57011986qge.71.1441903177970; Thu, 10 Sep 2015 09:39:37 -0700 (PDT) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id r82si14012556qkh.18.2015.09.10.09.39.36 (version=TLSv1 cipher=AES128-SHA bits=128/128); Thu, 10 Sep 2015 09:39:37 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t8AGZ68s018524; Thu, 10 Sep 2015 12:35:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t8AGZ5Cg000476 for ; Thu, 10 Sep 2015 12:35:05 -0400 Received: from worklaptop.bos.redhat.com. (wlan-196-14.bos.redhat.com [10.16.196.14]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8AGZ5OE024375; Thu, 10 Sep 2015 12:35:05 -0400 From: Cole Robinson To: libvir-list@redhat.com Date: Thu, 10 Sep 2015 12:35:00 -0400 Message-Id: <1bc27ba6677ec493ae1a6b9865c4aca0559f1363.1441902900.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] qemu: command: Report stderr from qemu-bridge-helper X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: crobinso@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 retrieve file descriptor: 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 retrieve file descriptor: Transport endpoint is not connected stderr=access denied by acl file --- src/qemu/qemu_command.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ec5e3d4..fc22f36 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -285,6 +285,7 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg, unsigned int flags) { virCommandPtr cmd; + char *errbuf = NULL, *cmdstr = NULL; int pair[2] = { -1, -1 }; 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, "--br=%s", brname); virCommandAddArgFormat(cmd, "--fd=%d", pair[1]); + virCommandSetErrorBuffer(cmd, &errbuf); + virCommandDoAsyncIO(cmd); virCommandPassFD(cmd, pair[1], VIR_COMMAND_PASS_FD_CLOSE_PARENT); virCommandClearCaps(cmd); @@ -320,9 +323,24 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg, do { *tapfd = recvfd(pair[0], 0); } while (*tapfd < 0 && errno == EINTR); + if (*tapfd < 0) { - virReportSystemError(errno, "%s", - _("failed to retrieve file descriptor for interface")); + char ebuf[1024]; + 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 retrieve file descriptor: %s%s"), + cmdstr, virStrerror(errno, ebuf, sizeof(ebuf)), + errstr ? errstr : ""); + VIR_FREE(errstr); goto cleanup; } @@ -333,6 +351,8 @@ static int qemuCreateInBridgePortWithHelper(virQEMUDriverConfigPtr cfg, } cleanup: + VIR_FREE(cmdstr); + VIR_FREE(errbuf); virCommandFree(cmd); VIR_FORCE_CLOSE(pair[0]); return *tapfd < 0 ? -1 : 0;