From nobody Sat Feb 7 08:13:42 2026 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1667896203; cv=none; d=zohomail.com; s=zohoarc; b=V5tcgw1xj/vXeOxgSivZnYd6wMoO/mEPEb0KpcDn0SGmcLIttsmS8gXdPVfL5wo5N3SAyyZKN697cHr4ddfOwJXllmwKEdTIbURVZChZFVnUETh/1KrgQ8Vuu0YUQvYI8nRwFM/+ZJxq8h/eRvholpP/laggmJQQuK7OQjTDpLk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667896203; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G8tGMa5xmXysgwVbQX2qt0mi0ZkRk36RdQUYglrTgHU=; b=BSzD8WY5vR8je3hcLwdNUf2TXq8+ojcKodhoImjy0TDhBZ/Zc0CKSWG9+XukoDs9mqh95lA3SWlidzyifTQy76aMC7h7zkJTqXs4iaKBqvC67QjXz7rXmDnUOfV2i0y6g/eFttpSVZzpPG/i71lphu5AMimZfiODkm9taGp0Wqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1667896203461485.462904777311; Tue, 8 Nov 2022 00:30:03 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-jJe1NsRGOZK8tFbOEKzg7g-1; Tue, 08 Nov 2022 03:30:00 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 91FE6833A19; Tue, 8 Nov 2022 08:29:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C46320290A6; Tue, 8 Nov 2022 08:29:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 298BB1946A42; Tue, 8 Nov 2022 08:29:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 946B71946587 for ; Tue, 8 Nov 2022 08:29:54 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 882D735429; Tue, 8 Nov 2022 08:29:54 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2BAD410197 for ; Tue, 8 Nov 2022 08:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667896202; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=G8tGMa5xmXysgwVbQX2qt0mi0ZkRk36RdQUYglrTgHU=; b=eijOTMJfPnXrVac7lDnsDKL7fhjNRv/MUg2uogubOX9Pr7UlaJuxOs5rpzIUtKnSzV9d4C T3BoIIkHDQwLzJ2NLWW/dvt2MpgJLfXVrjyPOR3eYzQ/i/h6HrrSI4W4BzprTBpKdClpp1 G3wcB6Gh4QMLj+/hx/6iqalfSKq98Wk= X-MC-Unique: jJe1NsRGOZK8tFbOEKzg7g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 03/48] tests: Make qemuAgent single sync Date: Tue, 8 Nov 2022 09:29:05 +0100 Message-Id: <27f4f4882107d60cb44b57f67ac8d3bbb5ff8d73.1667896101.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1667896204689100003 Content-Type: text/plain; charset="utf-8"; x-default="true" The qemuAgent has option to issue guest-sync command before each intended command or issue the sync commend just once, right after the socked is opened and before the first intended command is issued. The latter is referred to as single sync agent and is enabled by VSERPORT_CHANGED event which allows us to detect when the agent (dis-)connects in the guest. Now, every QEMU that we support (4.2.0 or newer) has the event and thus will use single sync agent. Therefore, adjust qemuagenttest to make it test what's used in the real world, rather than old approach. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- tests/qemuagenttest.c | 50 +++--------------------------------- tests/qemumonitortestutils.c | 2 +- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index dd2d4984e2..7724df2742 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -56,16 +56,10 @@ testQemuAgentSSHKeys(const void *data) "}}") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-ssh-add-authorized-keys", "{ \"return\" : {} }") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-ssh-remove-authorized-keys", "{ \"return\" : {} }") < 0) return -1; @@ -121,9 +115,6 @@ testQemuAgentFSFreeze(const void *data) "{ \"return\" : 5 }") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-fsfreeze-freeze", "{ \"return\" : 7 }") < 0) return -1; @@ -168,9 +159,6 @@ testQemuAgentFSThaw(const void *data) "{ \"return\" : 5 }") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-fsfreeze-thaw", "{ \"return\" : 7 }") < 0) return -1; @@ -358,9 +346,6 @@ testQemuAgentGetFSInfo(const void *data) goto cleanup; } =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - goto cleanup; - if (qemuMonitorTestAddItem(test, "guest-get-fsinfo", "{\"error\":" " {\"class\":\"CommandDisabled\"," @@ -404,16 +389,10 @@ testQemuAgentSuspend(const void *data) "{ \"return\" : {} }") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-suspend-disk", "{ \"return\" : {} }") < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-suspend-hybrid", "{ \"return\" : {} }") < 0) return -1; @@ -505,9 +484,6 @@ testQemuAgentShutdown(const void *data) QEMU_AGENT_SHUTDOWN_HALT) < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - priv.event =3D QEMU_AGENT_EVENT_SHUTDOWN; priv.mode =3D "powerdown"; =20 @@ -520,9 +496,6 @@ testQemuAgentShutdown(const void *data) QEMU_AGENT_SHUTDOWN_POWERDOWN) < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - priv.event =3D QEMU_AGENT_EVENT_RESET; priv.mode =3D "reboot"; =20 @@ -539,9 +512,6 @@ testQemuAgentShutdown(const void *data) /* check negative response, so that we can verify that the agent breaks * out from sleep */ =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItem(test, "guest-shutdown", "{\"error\":" " {\"class\":\"CommandDisabled\"," @@ -628,9 +598,6 @@ testQemuAgentCPU(const void *data) if (qemuAgentUpdateCPUInfo(2, cpuinfo, nvcpus) < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", "{ \"return\" : 1 }", "vcpus", testQemuAgentCPUArguments1, @@ -641,18 +608,12 @@ testQemuAgentCPU(const void *data) return -1; =20 /* try to hotplug two, second one will fail */ - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", "{ \"return\" : 1 }", "vcpus", testQemuAgentCPUArguments2, NULL) < 0) return -1; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - return -1; - if (qemuMonitorTestAddItemParams(test, "guest-set-vcpus", "{ \"error\" : \"random error\" }", "vcpus", testQemuAgentCPUArguments3, @@ -1171,9 +1132,6 @@ testQemuAgentUsers(const void *data) checkUserInfo(params, nparams, 1, "test2", NULL, 1561739229190) < = 0) goto cleanup; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - goto cleanup; - if (qemuMonitorTestAddItem(test, "guest-get-users", testQemuAgentUsersResponse2) < 0) goto cleanup; @@ -1290,9 +1248,6 @@ testQemuAgentOSInfo(const void *data) nparams =3D 0; maxparams =3D 0; =20 - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) - goto cleanup; - if (qemuMonitorTestAddItem(test, "guest-get-osinfo", testQemuAgentOSInfoResponse2) < 0) goto cleanup; @@ -1347,13 +1302,14 @@ testQemuAgentTimezone(const void *data) if (!test) return -1; =20 + if (qemuMonitorTestAddAgentSyncResponse(test) < 0) + goto cleanup; + #define VALIDATE_TIMEZONE(response_, expected_name_, expected_offset_) \ do { \ int maxparams_ =3D 0; \ const char *name_ =3D NULL; \ int offset_; \ - if (qemuMonitorTestAddAgentSyncResponse(test) < 0) \ - goto cleanup; \ if (qemuMonitorTestAddItem(test, "guest-get-timezone", \ response_) < 0) \ goto cleanup; \ diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index db0f450e40..310c19dfde 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1418,7 +1418,7 @@ qemuMonitorTestNewAgent(virDomainXMLOption *xmlopt) &src, virEventThreadGetContext(test->event= Thread), &qemuMonitorTestAgentCallbacks, - false))) + true))) goto error; =20 virObjectLock(test->agent); --=20 2.37.4