From nobody Fri Apr 26 04:08:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1610375287; cv=none; d=zohomail.com; s=zohoarc; b=YTheyzuvtnnYWJtDl9L24KHBz186goEAlUA/oli2QKl1BQWEkJl7iFbfl1cmvmycZ9v+FjnLw36VtX5UBDoEq0cuV/xIkIK6blT9vO7qy2p8+3j4fXeKMDp98hic/lMdbbgbNoZD6L3Zid4PFhKScZy2n9zSEJ/+m/1AgL/Xgtk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610375287; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mJ+r7CQlERUBZl5yOpMcOl2huMUwgZiNcTFlC7diJKM=; b=UP3z7yOfb9wM8RR+ZA7VwM3NeEjWxpIxNtxk7h1Z6r3EkRsR2rNslhW/NeBoHPI2apSCYBjGWUt59hCSW5IOoRo89aYFy0ykb+gZJ6KEqrMXolV9EymjNTiLnEnp+pWIDysRYtggR0NlTgSOVrekD0xvPXOU/XkqvSKMVeTgHkM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610375287240334.19398053789473; Mon, 11 Jan 2021 06:28:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-436-G9xazM7nNlqVV2jVgs4Hyw-1; Mon, 11 Jan 2021 09:28:04 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B8F5100628F; Mon, 11 Jan 2021 14:27:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8EF685D9F8; Mon, 11 Jan 2021 14:27:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DE2EB4A7C6; Mon, 11 Jan 2021 14:27:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BERn50010960 for ; Mon, 11 Jan 2021 09:27:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 547D1646DC; Mon, 11 Jan 2021 14:27:49 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C89A750F7D for ; Mon, 11 Jan 2021 14:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610375286; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mJ+r7CQlERUBZl5yOpMcOl2huMUwgZiNcTFlC7diJKM=; b=ene5VBEIHLLlYdFJQuyTA8ilsg35KVu8jLPWrFoHuSqgnF1t49aFO9jDAEXBHhAO+XwGDP oTxC5pIU0OM9cg1RIsB+bR5aMxWLDkJsVdPvickVL5LeWKk1YrkG6vK/PkcoUvE3Vccihh D3/fr9BhoRfXZ6iKKENfvFq2Tg+qFng= X-MC-Unique: G9xazM7nNlqVV2jVgs4Hyw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] openvswitch: Check if OVS_VSCTL exists when getting interface name Date: Mon, 11 Jan 2021 15:27:43 +0100 Message-Id: <47f3ce1847b544cde25734c9c60c9b8958e30811.1610375263.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" So far we assumed that any vhostuser interface is plugged into an OVS bridge and thus 'ovs-vsctl' exists. But this is not always true. In testing scenarios it is possible to create a vhostuser interface with this tool dpdk-testpmd (part of dpdk RPM) which creates/connects to UNIX socket needed for vhostuser. Of course, since there is no OVS then there is no interface name in which case virNetDevOpenvswitchGetVhostuserIfname() should return 0. The rest of APIs that assume OVS are not 'fixed' because we still want them to fail (e.g. getting statistics, plugging interface into an OVS bridge, unplugging it from an OVS bridge, ...). The only API that is fixed is virNetDevOpenvswitchGetVhostuserIfname() because it is called explicitly when starting a guest (and callers are okay if no name was found). The other way to fix this bug seems to be to simply require 'ovs-vsctl' on spec file level, but that is too heavy gun given that vhostuser is used by a small set of our users (assumption made on requirements for vhostuser). Also, this way would drag in yet another dependency for all users (even those who want minimal libvirt). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1913156 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/util/virnetdevopenvswitch.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index 896c1bd917..f9b3369b2a 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -29,6 +29,7 @@ #include "virstring.h" #include "virlog.h" #include "virjson.h" +#include "virfile.h" =20 #define VIR_FROM_THIS VIR_FROM_NONE =20 @@ -529,9 +530,19 @@ virNetDevOpenvswitchGetVhostuserIfname(const char *pat= h, bool server, char **ifname) { - g_autoptr(virCommand) cmd =3D virNetDevOpenvswitchCreateCmd(); + g_autoptr(virCommand) cmd =3D NULL; + g_autofree char *absoluteOvsVsctlPath =3D NULL; int status; =20 + if (!(absoluteOvsVsctlPath =3D virFindFileInPath(OVS_VSCTL))) { + /* If there is no 'ovs-vsctl' then the interface is + * probably not an OpenVSwitch interface and the @path to + * socket was created by some DPDK testing script (e.g. + * dpdk-testpmd). */ + return 0; + } + + cmd =3D virNetDevOpenvswitchCreateCmd(); =20 if (server) { virCommandAddArgList(cmd, "--no-headings", "--columns=3Dname", "fi= nd", --=20 2.26.2