From nobody Fri Mar 29 07:06:12 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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=1667842069; cv=none; d=zohomail.com; s=zohoarc; b=N9BrF1I/jSI5nUQtPaJTJKI4MWYFGRQKRyzljxAL2GbTFlKnejQ57sq6B+N1HQr/8m19WFqxTfkJDYLT02gd+gh0Uswbx9rFUQgj1NSVzYtK8LXy5WWBWxsNPlWvlzEAcMjG2Q5Qi0vbN2DUKe3I82ypmAEHPD+1NkZc+A5XXR0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667842069; 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=XSgLhN2/J3F4R2b10oummoXaKMKj/9KsYejQlyCTAgs=; b=DEXDEP4Agv5hukr5z/UiRqSmk7gsbhb7UCO9qzbMSjh4ztkHLQslgC6UuxC51nFHbDEJ7F9hbreRkAqTN+w+1OvfueFilxL85lR+fYf4LiPOm26lX/AuOPnX1NhOzB7dXXgYGKcQIWz34O+DACnL1jZcrzSwa9+w3MPxLRlPGuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1667842069120642.3496195035493; Mon, 7 Nov 2022 09:27:49 -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-578-siBFSPEoMjOMlIYiNANukA-1; Mon, 07 Nov 2022 12:27:44 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03EB5802530; Mon, 7 Nov 2022 17:27:42 +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 43B77477F5E; Mon, 7 Nov 2022 17:27:41 +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 2DF381946588; Mon, 7 Nov 2022 17:27:41 +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 7ADCE1946587 for ; Mon, 7 Nov 2022 17:27:40 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 28A4A49AFD; Mon, 7 Nov 2022 17:27:40 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id C0EA242222 for ; Mon, 7 Nov 2022 17:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667842068; 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=XSgLhN2/J3F4R2b10oummoXaKMKj/9KsYejQlyCTAgs=; b=SM9tH/hsi477Qby0JQoPd0+Brd02HcYtSmLKBwl58sI5KaHlTyYrz/Ak9Pc0vroZ33VYAQ FwZ9JJL5qf7uV6ffjrscglwTwauXe/jcduYaeOYjJU+qfi2MtaOAk+on5yf3Tz6FF+XdmI nufNWPaziwHFir0Yzuwoc8LDgwNjxng= X-MC-Unique: siBFSPEoMjOMlIYiNANukA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] qemu_agent: Bring back single sync Date: Mon, 7 Nov 2022 18:27:34 +0100 Message-Id: <1850be598d882c548648f416fef0847a0d148333.1667842042.git.mprivozn@redhat.com> 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.9 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: 1667842070020100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Historically, we had no idea whether the qemu-ga running inside the guest was running or not. Or whether it crashed in the middle of reading of a command. That's why we issued guest-sync prior any intended command, to make the agent flush any partially read JSON and reset its state machine. But with VSERPORT_CHANGE event we know when the guest agent (dis-)connects and thus can issue the sync command just once for each 'connection'. Whether the agent is synced is tracked in agent->inSync member, which used to be set to true upon successful sync. But after rework in v8.0.0-rc1~361 that line is gone, leaving us with using the historic approach basically. Fixes: cad84fd51eaac5e3bfdf441f9986e1f2639a0828 Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_agent.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 0d77a2f90d..94782f2bc9 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -869,16 +869,20 @@ qemuAgentGuestSync(qemuAgent *agent) return -1; =20 /* successfully sync'd */ - if (rc =3D=3D 1) + if (rc =3D=3D 1) { + agent->inSync =3D true; return 0; + } =20 /* send another sync */ if ((rc =3D qemuAgentGuestSyncSend(agent, timeout, false)) < 0) return -1; =20 /* successfully sync'd */ - if (rc =3D=3D 1) + if (rc =3D=3D 1) { + agent->inSync =3D true; return 0; + } =20 if (agent->running) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", --=20 2.37.4