From nobody Tue Feb 10 23:01:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1634292512664814.6536603290177; Fri, 15 Oct 2021 03:08:32 -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-10-4FuDcIITOJOfDQaJY-mh4Q-1; Fri, 15 Oct 2021 06:08:27 -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 7ED5710A8E0B; Fri, 15 Oct 2021 10:08:22 +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 5E447ADCB; Fri, 15 Oct 2021 10:08:22 +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 2C5B04EA37; Fri, 15 Oct 2021 10:08:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19FA89dj003638 for ; Fri, 15 Oct 2021 06:08:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id ECA9D40CFD13; Fri, 15 Oct 2021 10:08:08 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6ACA40CFD0D for ; Fri, 15 Oct 2021 10:08:08 +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 D0A5E802814 for ; Fri, 15 Oct 2021 10:08:08 +0000 (UTC) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-mQl6ZqkwNsez5kUmq_ldLg-1; Fri, 15 Oct 2021 06:08:07 -0400 Received: by mail-pg1-f181.google.com with SMTP id r2so8131342pgl.10 for ; Fri, 15 Oct 2021 03:08:06 -0700 (PDT) Received: from zhanglei-dev.zelin.local ([2a09:bac0:23::815:bc4]) by smtp.gmail.com with ESMTPSA id c25sm4613388pfn.159.2021.10.15.03.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 03:08:05 -0700 (PDT) X-MC-Unique: 4FuDcIITOJOfDQaJY-mh4Q-1 X-MC-Unique: mQl6ZqkwNsez5kUmq_ldLg-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=vhCaiTRCib+G/hiST51k6WHN8AK8hjuMz4b+VPOyTvo=; b=o+tvxyb6RkvHEb7TWFHG8IHYmtu2CGLdpbUxEM/tiAOyW8xjr4I2CFcNX+grQToloX tlTdKgRWSQ5z/AEzpqJIsmDFIUlvcFvZPN4gvw3QrDi73/sh0opMKG5ob8C0ZNQPi9ro i/qsn8llLhtcz+QRg6Euj3Rl/5XBcutZo3uIksbNvyZo53fG1cPhnotQKLeXDA8ddOyX Lbm21cCJ+fvRxFTW2YzsAUW2DrM4eGSpij2SVLz3smpeUe9suFEeEYXcsFHbWL0mhli7 2JX+NxjEBWn0l45vmFcxfPhVkC3VedPVaSiEDlVa/cAvHbMhhYr/6uT8AhwmF0ykbnUf jASQ== X-Gm-Message-State: AOAM530bS0O38cJ+c0KxvIS/D54hd07kJNhCVA0KRH2wUZpAH7FrVJsH jTQ4npWkbBiuaxMPYw2KzCdPuvI3emXNBPXZ0O1M/Q== X-Google-Smtp-Source: ABdhPJzZ5zkzPgc26zEeUv2vd4MNdQVHWywE6F0v8bZU15Og6lDWPwjq6CmYJomTSNWD8SMroQ1a3w== X-Received: by 2002:a65:62d1:: with SMTP id m17mr8389575pgv.370.1634292485861; Fri, 15 Oct 2021 03:08:05 -0700 (PDT) From: zhanglei To: zhanglei@smartx.com, libvir-list@redhat.com Subject: [libvirt PATCH v4 3/5] qemu: refactor 'qemuAgentGetInterfaces' Date: Fri, 15 Oct 2021 18:07:49 +0800 Message-Id: <20211015100751.1492806-4-zhanglei@smartx.com> In-Reply-To: <20211015100751.1492806-1-zhanglei@smartx.com> References: <20211015100751.1492806-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.84 on 10.11.54.1 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: 1634292513700100001 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 2b759f5719..7e058a9309 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -19090,7 +19090,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