From nobody Wed May 15 18:31:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=zte.com.cn Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 16443769611661021.8602850447488; Tue, 8 Feb 2022 19:22:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-gRXlxVusOaGneOU6hPJF6w-1; Tue, 08 Feb 2022 22:22:38 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C441E814243; Wed, 9 Feb 2022 03:22:32 +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 197E55E482; Wed, 9 Feb 2022 03:22:31 +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 327D44BB7C; Wed, 9 Feb 2022 03:22:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 2193MMFU022799 for ; Tue, 8 Feb 2022 22:22:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2822A492D1A; Wed, 9 Feb 2022 03:22:22 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 23AD5492D18 for ; Wed, 9 Feb 2022 03:22:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 09E3F185A794 for ; Wed, 9 Feb 2022 03:22:22 +0000 (UTC) Received: from mxus.zte.com.cn (mxus.zte.com.cn [20.69.78.39]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-Z9pxr2rAMjeSyFV8WcBDag-1; Tue, 08 Feb 2022 22:22:20 -0500 Received: from mxhk.zte.com.cn (unknown [192.168.250.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4JtlM328N8zdmXXC for ; Wed, 9 Feb 2022 11:13:19 +0800 (CST) Received: from mse-fl1.zte.com.cn (unknown [10.30.14.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4JtlLt4Jl3z8PxDh for ; Wed, 9 Feb 2022 11:13:10 +0800 (CST) Received: from szxlzmapp01.zte.com.cn ([10.5.231.85]) by mse-fl1.zte.com.cn with SMTP id 2193D6d0097725 for ; Wed, 9 Feb 2022 11:13:06 +0800 (GMT-8) (envelope-from wang.yi59@zte.com.cn) Received: from fox-cloudhost8.localdomain (unknown [10.234.72.110]) by smtp (Zmail) with SMTP; Wed, 9 Feb 2022 11:13:06 +0800 X-MC-Unique: gRXlxVusOaGneOU6hPJF6w-1 X-MC-Unique: Z9pxr2rAMjeSyFV8WcBDag-1 X-Zmail-TransId: 3e8162033141009-a3a7d From: Yi Wang To: libvir-list@redhat.com Subject: [PATCH] virNetDevOpenvswitchUpdateVlan: fix vlan tag update error Date: Wed, 9 Feb 2022 18:59:34 +0800 Message-Id: <20220209105934.21551-1-wang.yi59@zte.com.cn> MIME-Version: 1.0 X-MAIL: mse-fl1.zte.com.cn 2193D6d0097725 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at 10-207-168-8 with ID 6203314D.000 by FangMail milter! X-FangMail-Envelope: 1644376399/4JtlM328N8zdmXXC/6203314D.000/192.168.250.137/[192.168.250.137]/mxhk.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6203314D.000/4JtlM328N8zdmXXC X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Mimecast-Spam-Signature: yes X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 2193MMFU022799 X-loop: libvir-list@redhat.com Cc: wang.yi59@zte.com.cn, wang.liang82@zte.com.cn, xue.zhihong@zte.com.cn, tuqiang 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.13 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-ZM-MESSAGEID: 1644376962614100001 Content-Type: text/plain; charset="utf-8" From: tuqiang We try to update vlan tag by running virsh update-device command, libvirtd will report ovs-vsctl arguments error. Vlan tag update funtion does't consider the xml with no vlan configured circumstances. The steps to reproduce the problem: 1 define and start domain with its vlan configured as: 2 define and run virsh update-device command with no vlan configured as: #virsh update-device dom-id novlan.xml 3 virsh command returned error, and we got an error in libvirtd.log: error : virCommandWait:2584 : internal error: exit status 1: ovs-vsctl: '= set' command requires at least 3 arguments . Child process (ovs-vsctl --timeout=3D5 -- --if-exists clear Port vnet4.= 0 tag -- --if-exists clear Port vnet4.0 trunk -- --if-exists clear Port vnet4.0 vlan_mode -- --if-exists set Port vnet4= .0) unexpected error : virNetDevOpenvswitchUpdateVlan:540 : internal error: Unable to se= t vlan configuration on port vnet4.0 Signed-off-by: Tu Qiang Signed-off-by: Yi Wang Reviewed-by: Michal Privoznik --- src/util/virnetdevopenvswitch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index bcdb7c4..227c040 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -605,8 +605,10 @@ int virNetDevOpenvswitchUpdateVlan(const char *ifname, virCommandAddArgList(cmd, "--", "--if-exists", "clear", "Port", ifname, "ta= g", "--", "--if-exists", "clear", "Port", ifname, "tr= unk", - "--", "--if-exists", "clear", "Port", ifname, "vl= an_mode", - "--", "--if-exists", "set", "Port", ifname, NULL); + "--", "--if-exists", "clear", "Port", ifname, "vl= an_mode", NULL); + + if (virtVlan && virtVlan->nTags > 0) + virCommandAddArgList(cmd, "--", "--if-exists", "set", "Port", ifname, NU= LL); =20 virNetDevOpenvswitchConstructVlans(cmd, virtVlan); =20 --=20 1.8.3.1