From nobody Tue Feb 10 06:04:35 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1631620151138585.4710646949638; Tue, 14 Sep 2021 04:49:11 -0700 (PDT) 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-295-ZgvRmOjxOSmAsqAQ0Rr30A-1; Tue, 14 Sep 2021 07:49:08 -0400 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 C802F8B9EB6; Tue, 14 Sep 2021 11:48:37 +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 0724180FDE; Tue, 14 Sep 2021 11:48:37 +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 73D894E58E; Tue, 14 Sep 2021 11:48:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18EBmXTH032243 for ; Tue, 14 Sep 2021 07:48:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 475AB203B7AC; Tue, 14 Sep 2021 11:48:33 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4341A2038BBA for ; Tue, 14 Sep 2021 11:48:32 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 25581811E76 for ; Tue, 14 Sep 2021 11:48:32 +0000 (UTC) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-553-XhevVgCwOtWTe5mgDMj-OQ-1; Tue, 14 Sep 2021 07:48:30 -0400 Received: by mail-pg1-f170.google.com with SMTP id f129so12460903pgc.1 for ; Tue, 14 Sep 2021 04:48:30 -0700 (PDT) Received: from fedora.zelin.local ([106.161.68.221]) by smtp.gmail.com with ESMTPSA id k22sm10330883pfi.149.2021.09.14.04.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Sep 2021 04:48:29 -0700 (PDT) X-MC-Unique: ZgvRmOjxOSmAsqAQ0Rr30A-1 X-MC-Unique: XhevVgCwOtWTe5mgDMj-OQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=85bNVl2eN/p2UQFFHOfG3yUWONQ7iI8ljIueSG0Xmtw=; b=JoACtSHszQew4OwoEYomipkUkHZm+zHaGoqtBXVmmfk82OyjEpyYQfCCgZ4WU3jHFi XTMD28cgYS4Ejj1ClhDxYaBxQp523Fy/N9f4Yn3sZ53+xX8ziUWCFUPN51N6CZaZLKiO 7q0yr71tgOWjQUMTRy87qYJyhUathS4T1iZx/fX4wuJJDnIs0xVjQEnUrk9CJ3qDEzQO vPvn9nMoRr6R1AQaqY9DM2N5O0oS9zW3wV9cy8JWfAFgfHhXBhwRCzNWrpGPdgFirTXD b/en0qTA/Cl3ID8EyHjiJHmlyMGkS6F+daYZXEJyIYnFtR6tzu7GoFyEtAROmKfikTU3 jUww== X-Gm-Message-State: AOAM532NQHVDoeMKIbXtUAb7HW3Ib40TLlNKYRo0Tf6BvYao29huEIDe mCEiQoXA06Zs/BqAlPX9Y4jecKUQ88Y023hMo0g9RJsP X-Google-Smtp-Source: ABdhPJy8VblosVdVdXsbftC4MgtxK65IDxph4Ekz+i/kSAYbkaHg6P5wX+XAdp51SnFtK5iKaPnmQA== X-Received: by 2002:a63:1902:: with SMTP id z2mr15271542pgl.312.1631620109352; Tue, 14 Sep 2021 04:48:29 -0700 (PDT) From: zhanglei To: libvir-list@redhat.com, zhanglei@smartx.com Subject: [libvirt PATCH v3 3/5] qemu: refactor 'qemuAgentGetInterfaces' Date: Tue, 14 Sep 2021 19:47:08 +0800 Message-Id: <20210914114710.270816-4-zhanglei@smartx.com> In-Reply-To: <20210914114710.270816-1-zhanglei@smartx.com> References: <20210914114710.270816-1-zhanglei@smartx.com> MIME-Version: 1.0 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-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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-ZM-MESSAGEID: 1631620152780100001 Content-Type: text/plain; charset="utf-8" Add report_unsupported parameter to qemuAgentGetInterfaces Signed-off-by: zhanglei --- src/qemu/qemu_agent.c | 9 ++++++--- src/qemu/qemu_agent.h | 3 ++- src/qemu/qemu_driver.c | 2 +- tests/qemuagenttest.c | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 5f421be6f6..a7f943e0dc 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -2245,17 +2245,20 @@ qemuAgentGetAllInterfaceAddresses(virDomainInterfac= ePtr **ifaces_ret, */ int qemuAgentGetInterfaces(qemuAgent *agent, - virDomainInterfacePtr **ifaces) + virDomainInterfacePtr **ifaces, + bool report_unsupported) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; virJSONValue *ret_array =3D NULL; + int rc; =20 if (!(cmd =3D qemuAgentMakeCommand("guest-network-get-interfaces", NUL= L))) return -1; =20 - if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0) - return -1; + if ((rc =3D qemuAgentCommandFull(agent, cmd, &reply, agent->timeout, + report_unsupported)) < 0) + return rc; =20 if (!(ret_array =3D virJSONValueObjectGetArray(reply, "return"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_agent.h b/src/qemu/qemu_agent.h index 81b45b8e5d..94eab9de9f 100644 --- a/src/qemu/qemu_agent.h +++ b/src/qemu/qemu_agent.h @@ -151,7 +151,8 @@ int qemuAgentSetTime(qemuAgent *mon, bool sync); =20 int qemuAgentGetInterfaces(qemuAgent *mon, - virDomainInterfacePtr **ifaces); + virDomainInterfacePtr **ifaces, + bool report_unsupported); =20 int qemuAgentSetUserPassword(qemuAgent *mon, const char *user, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index dfc27572c4..5071faab5e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18950,7 +18950,7 @@ qemuDomainInterfaceAddresses(virDomainPtr dom, goto endjob; =20 agent =3D qemuDomainObjEnterAgent(vm); - ret =3D qemuAgentGetInterfaces(agent, ifaces); + ret =3D qemuAgentGetInterfaces(agent, ifaces, true); qemuDomainObjExitAgent(vm, agent); =20 endjob: diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index bef6dfd152..8fb3da7fef 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -907,7 +907,7 @@ testQemuAgentGetInterfaces(const void *data) goto cleanup; =20 if ((ifaces_count =3D qemuAgentGetInterfaces(qemuMonitorTestGetAgent(t= est), - &ifaces)) < 0) + &ifaces, true)) < 0) goto cleanup; =20 if (ifaces_count !=3D 4) { --=20 2.31.1