From nobody Sat May 18 16:18:08 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1607094508; cv=none; d=zohomail.com; s=zohoarc; b=BAMElNwOqnvhd/97BWYp6++3/AG5v08m1qVnx8VvEqjcBmO5NYJi7GRGskNZ6q2S1DtSwAfC8lxMZsLwoFkousGF3pyp5s23xBMjA8wlfTMSAmvJtPstSI9mprrNyi0y5b3DfTJcvFSCKgc4iVPCbII/y46PcCDW5mZNBx6V+Aw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094508; 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=BEsN+ajnu+O6ZJZPDgHjjX1u4i239dZmnzo5inzq1W4=; b=Q3aj75GVILY8mvJKMEHZJFyBfvcw17ElXsJrvIsUe5NenFPHx1k2u53PalFtmA6bmAKbxgLNoco4iVIW6z/YynT9EQ/+wVqr/L7L/Hrt/7aImw5Zcy/jYdsOQJxJCoV7d2oLNSBj2XbMdqWHvuQmSVYLpTRMhmerxXJ4LLULwGg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1607094506967632.6453595394942; Fri, 4 Dec 2020 07:08:26 -0800 (PST) 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-197-NsHK7mVGPOiTYpUkrKORCg-1; Fri, 04 Dec 2020 10:08:19 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A5B1100F342; Fri, 4 Dec 2020 15:08:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DE581349A; Fri, 4 Dec 2020 15:08:13 +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 396A51809C9F; Fri, 4 Dec 2020 15:08:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F89PT031246 for ; Fri, 4 Dec 2020 10:08:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 63E765D9D7; Fri, 4 Dec 2020 15:08:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAED65D9CA for ; Fri, 4 Dec 2020 15:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094502; 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=BEsN+ajnu+O6ZJZPDgHjjX1u4i239dZmnzo5inzq1W4=; b=WXR/AtrKwb2SdilBCUw/uJ3+rtpgVXG8kCPzWoIieCA677WPIxECifjQby2gRqPhBTbB9P ej7pGYig7w54GA/ZkQZ20Wdp0iEkJ+pVZVnRsc1ec1j4ndTQDKRxVeRzRX6VpMSq/MXCYx LZSZ0RuQKsFCNBuaZQUrUYf6NI6rdZY= X-MC-Unique: NsHK7mVGPOiTYpUkrKORCg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/7] virDomainGetBlockJobInfo: Discourage polling for block job completion detection Date: Fri, 4 Dec 2020 16:07:56 +0100 Message-Id: <17d34540160ab086e97adb4b026de5842f554ed4.1607094319.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.11 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a note saying that polling virDomainGetBlockJobInfo is not a good idea. Use events instead. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index f5cd43ecea..5d3747fd39 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -9947,6 +9947,11 @@ virDomainBlockJobAbort(virDomainPtr dom, const char = *disk, * and was no-op. In this case libvirt reports cur =3D 1 and end =3D 1. * Since 2.3.0. * + * Applications looking for a reliable and low-overhead way to determine w= hether + * a block job already finished or reached synchronised phase should regis= ter a + * handler for the VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 event instead of pollin= g this + * API. + * * Note that the progress reported for blockjobs corresponding to a pull-m= ode * backup don't report progress of the backup but rather usage of temporary * space required for the backup. --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1607094545; cv=none; d=zohomail.com; s=zohoarc; b=mpkYBMRBfyYXbmLYwIrVFnbntlJJpSnhs4zFni4K6mkTV17tA4eyJWtxr1ewzaQBAIzSI+p9aHVe9THFStEgnlbRJ6ntbpLykswKu8alwx7qZqh29sW2x33lHSqQawnq1EEq1/ahhwF4UgLMM96Fq0bTO0CSAlCZJ7hvMz8AFwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094545; 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=xtHpEz897l8O7KGNkMxgPguZ9vy7ZmR9onKlbJcK6lI=; b=c8t/94QW3T6ogregTv9bVxWLEl4Yxv3Z2Lqjcix7q1AGBdmeRibPnAcIp+WZEJ7JeygH1reDvD+OhbvaRN0wSiuI+jhtFmZ54p6jVip1Gmle6i2scf4Bw1LTiHP04TAB2GE7KRsiCL9Jt3q1FkC8dQkwtQCiN9k4AZAj9LBHG3A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1607094545607738.9455779187003; Fri, 4 Dec 2020 07:09:05 -0800 (PST) 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-197-SzHbOofaM-WK8kNyqpTJEA-1; Fri, 04 Dec 2020 10:08:19 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CBCE100F346; Fri, 4 Dec 2020 15:08:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7539A60C64; Fri, 4 Dec 2020 15:08:13 +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 CB5751809CA0; Fri, 4 Dec 2020 15:08:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8ASj031257 for ; Fri, 4 Dec 2020 10:08:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9071B5D9D7; Fri, 4 Dec 2020 15:08:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id D66B55D9CA for ; Fri, 4 Dec 2020 15:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094543; 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=xtHpEz897l8O7KGNkMxgPguZ9vy7ZmR9onKlbJcK6lI=; b=b5DYt2Pp0VZ8YJ3HK6m4UwvUOMo9Bcr8VtGiiobLq3cH/OXwlx0AMAmK40MHIJK3ATCWXT mQBa/7p6Lmn41RVqaif+ZO5CGNBwrfvvBeqBr+G0ah0TLDNikbLNKUvsbbsoRATN5VbnI5 FfBDnmPmFvk4HD3+jlaPkxfyuiVAi2s= X-MC-Unique: SzHbOofaM-WK8kNyqpTJEA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/7] virDomainGetBlockJobInfo: Reword docs for fallback values Date: Fri, 4 Dec 2020 16:07:57 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.12 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Explicitly state that if 'end =3D=3D 1' the data doesn't represent actual progress in most cases. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/libvirt-domain.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 5d3747fd39..5edc73ecad 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -9940,12 +9940,18 @@ virDomainBlockJobAbort(virDomainPtr dom, const char= *disk, * can be found by calling virDomainGetXMLDesc() and inspecting * elements within //domain/devices/disk. * - * As a corner case underlying hypervisor may report cur =3D=3D 0 and - * end =3D=3D 0 when the block job hasn't been started yet. In this - * case libvirt reports cur =3D 0 and end =3D 1. However, hypervisor - * may return cur =3D=3D 0 and end =3D=3D 0 if the block job has finished - * and was no-op. In this case libvirt reports cur =3D 1 and end =3D 1. - * Since 2.3.0. + * In cases when libvirt can't determine actual progress of the block job = from + * the underlying hypervisor due to corner cases such as the job wasn't yet + * fully initialized, or finalized and thus the progress can't be queried, + * libvirt reports 'cur =3D 0, end =3D 1'. + * + * For jobs requiring finalizing via qemuDomainBlockJobAbort() with + * VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT flag which reached synchronised phase,= but + * were empty, or the progress can't be determined libvirt returns + * 'cur =3D 1, end =3D 1'. + * + * Users thus should not consider any data where 'end =3D 1' as absolute p= rogress + * value. * * Applications looking for a reliable and low-overhead way to determine w= hether * a block job already finished or reached synchronised phase should regis= ter a --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607094567; cv=none; d=zohomail.com; s=zohoarc; b=oAKgnROh4m/kfJBcPxWeFBZIFJSr9c7N5Rc5z/tDqZqPDZitusYRsJoejOhk6O2lz9n9v7QFQ9cDtwjySLdP+eOwauWGaAGd4li/hRyukajAz84H9WPeJjgx8HmkJ2rws7gIEP9bZAvneG+KXV9K9iEgSJuSmip0E0ATGS4zFEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094567; 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=VbiNYvX2IoRtLA8g0W3ERVZHgLU8JlYCgEspZSevQG0=; b=AaebqCcdydn9zJS77Lkw1Co3jzf1PYGus0m9WQNyGSprsoMgc8YSN+cHRlFlxCYi7C7LyvI8CwNdlseDGfEECTji0YBMKXE8Jl/QI7VJ6WqE6aAD2k0WX7fTLaq3LeUasjaGoj1nw7f/o27dp1JI6OUggC4dEyFeUMjCT+C1Ibk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607094567206162.61661110591137; Fri, 4 Dec 2020 07:09:27 -0800 (PST) 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-468-hh9eA2n2PSysZur2DvkGkg-1; Fri, 04 Dec 2020 10:09:23 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 49F36180A094; Fri, 4 Dec 2020 15:09:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 19FE327C5E; Fri, 4 Dec 2020 15:09:17 +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 CF6F6180954D; Fri, 4 Dec 2020 15:09:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8EVR031272 for ; Fri, 4 Dec 2020 10:08:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 53E965D9CA; Fri, 4 Dec 2020 15:08:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9913C5D9D7 for ; Fri, 4 Dec 2020 15:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094565; 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=VbiNYvX2IoRtLA8g0W3ERVZHgLU8JlYCgEspZSevQG0=; b=LLgTcknBoA9ZC+XHJaEyb30M6YcAiFPuG+kXAhdzk8WGC9RbUNZw8GOzUYObCXDPLPj1tB ++GBCbQKFXAmU25J+aluWJfr2mVDXRYdUPuW77OqTWMg0abLD6wokwrbJy4xGSFwjR43Fs IBc19lxgWhMyymxHU4+4zJ2viFYPfyY= X-MC-Unique: hh9eA2n2PSysZur2DvkGkg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/7] qemuMonitorBlockJobInfo: Store 'ready' and 'ready_present' separately Date: Fri, 4 Dec 2020 16:07:58 +0100 Message-Id: <570ec93798f82eb551aaab8a4eb11f625e6c62e1.1607094319.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.23 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Don't make the logic confusing by representing the 3 options using an integer with negative values. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 9 +++++---- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 8 ++------ src/qemu/qemu_process.c | 4 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4fd70ed300..800f98e474 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14650,17 +14650,18 @@ qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfo= Ptr rawInfo, * and end are zero, in which case qemu hasn't started the * job yet. */ if (!info->cur && !info->end) { - if (rawInfo->ready > 0) { - info->cur =3D info->end =3D 1; - } else if (!rawInfo->ready) { + if (rawInfo->ready_present) { info->end =3D 1; + if (rawInfo->ready) + info->cur =3D 1; } } /* If qemu reports that it's not ready yet don't make the job go to * cur =3D=3D end as some apps wrote code polling this instead of wait= ing for * the ready event */ - if (rawInfo->ready =3D=3D 0 && + if (rawInfo->ready_present && + !rawInfo->ready && info->cur =3D=3D info->end && info->cur > 0) info->cur -=3D 1; diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 49be2d5412..a2f28f9492 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1117,7 +1117,8 @@ struct _qemuMonitorBlockJobInfo { unsigned long long bandwidth; /* in bytes/s */ virDomainBlockJobCursor cur; virDomainBlockJobCursor end; - int ready; /* -1 if unknown, 0 if not ready, 1 if ready */ + bool ready_present; + bool ready; }; GHashTable *qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 4db00e284a..94e482cc97 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5049,7 +5049,6 @@ qemuMonitorJSONParseBlockJobInfo(GHashTable *blockJob= s, qemuMonitorBlockJobInfoPtr info =3D NULL; const char *device; const char *type; - bool ready; if (!(device =3D virJSONValueObjectGetString(entry, "device"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -5067,9 +5066,6 @@ qemuMonitorJSONParseBlockJobInfo(GHashTable *blockJob= s, return -1; } - /* assume we don't know the state */ - info->ready =3D -1; - if (!(type =3D virJSONValueObjectGetString(entry, "type"))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("entry was missing 'type'")); @@ -5104,8 +5100,8 @@ qemuMonitorJSONParseBlockJobInfo(GHashTable *blockJob= s, return -1; } - if (virJSONValueObjectGetBoolean(entry, "ready", &ready) =3D=3D 0) - info->ready =3D ready; + if (virJSONValueObjectGetBoolean(entry, "ready", &info->ready) =3D=3D = 0) + info->ready_present =3D true; return 0; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9d83825190..cbd29d867b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8176,8 +8176,8 @@ qemuProcessRefreshLegacyBlockjob(void *payload, return -1; if (disk->mirror) { - if (info->ready =3D=3D 1 || - (info->ready =3D=3D -1 && info->end =3D=3D info->cur)) { + if ((!info->ready_present && info->end =3D=3D info->cur) || + info->ready) { disk->mirrorState =3D VIR_DOMAIN_DISK_MIRROR_STATE_READY; job->state =3D VIR_DOMAIN_BLOCK_JOB_READY; } --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1607094515; cv=none; d=zohomail.com; s=zohoarc; b=IFU0DdMp8AzWjhmahhton87feoXdrPKtOD6HROxiQYUl5pmjOXGH/cGFa9kG0/30TFI1VwslxlYnFXc+5JvhhkYgnRCKqOAEm4KpxPsFwwqiYj4h7EedJzOhtS9F90kaLYFeoC35fPixKM1kFaFxE9P6qBZ2dG2EZ8VsruF0U94= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094515; 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=UhPp9E9ta74b7gGH9obxfPPwz8bsBfvBlbycydIVKt8=; b=UHQS3qO3PjJQLQyc33zDf9b4pkUxG1x7vdcbboKbesQFGtfyNefW7qso5B7P6BQKgsZa07WnTofOqxM/BAFb7etDEWjGMBE8uKlPUu9Z87ZXwARQ26NDuxyg6OTu7KZfj8WaD8T7t0tazeOPM3Dc+cMWhlQ9iuipFbOzPV8YDKs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= 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 1607094515958696.7977244272532; Fri, 4 Dec 2020 07:08:35 -0800 (PST) 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-387-a0oOvXj-M4G7rKuXo4iUQw-1; Fri, 04 Dec 2020 10:08:27 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DB919C2A0; Fri, 4 Dec 2020 15:08:21 +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 B8B795D6D1; Fri, 4 Dec 2020 15:08:21 +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 828484A7C6; Fri, 4 Dec 2020 15:08:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8FpH031284 for ; Fri, 4 Dec 2020 10:08:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7F71C5D9DB; Fri, 4 Dec 2020 15:08:15 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD37D5D9D7 for ; Fri, 4 Dec 2020 15:08:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094509; 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=UhPp9E9ta74b7gGH9obxfPPwz8bsBfvBlbycydIVKt8=; b=duCrQWNs/74NQZ+CRGEo0jo7LyeByPfLbwLRGYxiK5jmIg7s3Jt/kCP3FVcncfXnoQ7HBy BefqHtYM/bOEiQY4xKPdx/pc3FcjORCqQNc1vDMTIRkml0hCIg4jtIn8uL65ZoI7TVgmw2 g4HjWY3E3qQxF6r237vu0Gw8HgehFuY= X-MC-Unique: a0oOvXj-M4G7rKuXo4iUQw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/7] qemuBlockJobInfoTranslate: Use explicit comparison against 0 Date: Fri, 4 Dec 2020 16:07:59 +0100 Message-Id: <855cf72cdcaaa406c738013b689251eb10cfa4ec.1607094319.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.15 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Using ! on integers is misleading. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 800f98e474..b82f7e249a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14649,7 +14649,7 @@ qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfoPt= r rawInfo, * applications think job is completed. Except when both cur * and end are zero, in which case qemu hasn't started the * job yet. */ - if (!info->cur && !info->end) { + if (info->cur =3D=3D 0 && info->end =3D=3D 0) { if (rawInfo->ready_present) { info->end =3D 1; if (rawInfo->ready) --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607094570; cv=none; d=zohomail.com; s=zohoarc; b=k1b9Vxv3L1rsH32syEzaylwibSxzdvKHVzu476neClIUVBvM2GQcCaiW0nbBUhu0Mivh4UknTzSsaKQyk8uBPYyMEVxip0xTVMISEbPDaHxZzxDmbPWML4WzYsmbpvQJRp4BQBLFCNccprLCDAeH6zPsDthIf3h3Vp5hfXQq2Js= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094570; 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=9z4l3GwRF1Xjj2I4i5LbNVJPja+kqpJC3SgmJ5zrMz8=; b=mEja+nLlc14Xo6xyv9GzV/mxroYX2hAusbkNSydhTn4g7s6V9RSLmVhbGxRir/7UpWUAbK/XypIWW9+AaE6Eppkr7u5KOdcUFLqtTHNZKRKplalS8kh5tU1LxIlm8Hf9SYxrqOLzr4i92AqGh2YADi/zKyy06rXtFeXLhqWDW88= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607094570749500.54241525451835; Fri, 4 Dec 2020 07:09:30 -0800 (PST) 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-456-QYgOJ17sNhWaC47h2q09SA-1; Fri, 04 Dec 2020 10:09:25 -0500 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 76E71100F340; Fri, 4 Dec 2020 15:09:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 54A3A5D9D7; Fri, 4 Dec 2020 15:09:20 +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 185EE1809CA2; Fri, 4 Dec 2020 15:09:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8G26031292 for ; Fri, 4 Dec 2020 10:08:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id AAA925D9DB; Fri, 4 Dec 2020 15:08:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0013A5D9D7 for ; Fri, 4 Dec 2020 15:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094568; 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=9z4l3GwRF1Xjj2I4i5LbNVJPja+kqpJC3SgmJ5zrMz8=; b=THccSjyQz+oj5jV5IQEU9+upleS6R+e0yc/vm+48fHhTELFXc+sSKuQoBWfkzCDc2+lsQZ YZHb9Fydba7rUoM2N3RdEZqEgt1n7OPzXFQRtd9xc0P/Orr0EBa4aqS9hzq4EEsRY75dAX wlelGhXTp1gYwfp2ONGFmzuGGdDPPvM= X-MC-Unique: QYgOJ17sNhWaC47h2q09SA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/7] qemuDomainGetBlockJobInfo: Use qemuMonitorGetAllBlockJobInfo Date: Fri, 4 Dec 2020 16:08:00 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Replace qemuMonitorGetBlockJobInfo by qemuMonitorGetAllBlockJobInfo and hash table lookup. This basically open-codes qemuMonitorGetBlockJobInfo, but it will be removed in next patch. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b82f7e249a..e2fde6c76f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14695,8 +14695,9 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, virDomainObjPtr vm; virDomainDiskDefPtr disk; int ret =3D -1; - qemuMonitorBlockJobInfo rawInfo; + qemuMonitorBlockJobInfoPtr rawInfo; g_autoptr(qemuBlockJobData) job =3D NULL; + g_autoptr(GHashTable) blockjobstats =3D NULL; virCheckFlags(VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES, -1); @@ -14722,18 +14723,21 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, } qemuDomainObjEnterMonitor(driver, vm); - ret =3D qemuMonitorGetBlockJobInfo(qemuDomainGetMonitor(vm), job->name= , &rawInfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; - if (ret <=3D 0) + blockjobstats =3D qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(v= m), true); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockjobstats) goto endjob; - if (qemuBlockJobInfoTranslate(&rawInfo, info, disk, - flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWI= DTH_BYTES) < 0) { - ret =3D -1; + if (!(rawInfo =3D g_hash_table_lookup(blockjobstats, job->name))) { + ret =3D 0; goto endjob; } + if (qemuBlockJobInfoTranslate(rawInfo, info, disk, + flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWI= DTH_BYTES) < 0) + goto endjob; + + ret =3D 1; + endjob: qemuDomainObjEndJob(driver, vm); --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607094574; cv=none; d=zohomail.com; s=zohoarc; b=Nwaop1JTmeCi1vNCDbM72AqkDDbqlxGn0jH26C9oEJchLxbPSfYUGkua00wN6dcWo42zyw95RaEPhJrVKqYCra0EPPROhEMOUprM2eC5S+ucEeHp4E/G57WBpZoOPPaTjbLgFnEV/8gnmfuHBi2uxfr+U7nsDuPosQWO7RRE11w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094574; 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=PLBGP93lBADQ43HvAHeG7p8V5qeNl+Gs5vhB0luhVKM=; b=BAuG6BGQFKmx23FM8h7B7ibaY2GMTy8Kq/0QjL1Li9FtqZZql3rZfVMfVH0fkTj62/Yh9o7J+SV1RoCPRdL23FUWPkMQHbfVKvxluqrDdWuoTQ5fobh4B+0i4JLkibm9NhIxmXjB6Q7xwe9kahd0jUrQEFQuD9coKc7JPrudJnM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607094574373181.63203698862435; Fri, 4 Dec 2020 07:09:34 -0800 (PST) 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-482-S2lG_2pvOx202n6X1C6IeA-1; Fri, 04 Dec 2020 10:09:28 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 35E9D180A09A; Fri, 4 Dec 2020 15:09:23 +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 0D5991002391; Fri, 4 Dec 2020 15:09:23 +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 CC5C74EA6C; Fri, 4 Dec 2020 15:09:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8HZY031299 for ; Fri, 4 Dec 2020 10:08:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id D6CC45D9DB; Fri, 4 Dec 2020 15:08:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3140A5D9D7 for ; Fri, 4 Dec 2020 15:08:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094572; 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=PLBGP93lBADQ43HvAHeG7p8V5qeNl+Gs5vhB0luhVKM=; b=UPNtu/R2qk/yERvidyvGB0uoAc8HYfHEmZHLMtXXFqI1Uo0AhNykYtSXmwqyWMaFVuupaT mKHGaBdGy9fexZX5IX2N315naG5rKIJpM/lTtlPQqp7bmBC+f6J4unGxM6LbPAUaa/iqsW D61gcplZlSNE23BAvR47BFJupic69iw= X-MC-Unique: S2lG_2pvOx202n6X1C6IeA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/7] qemu: monitor: Remove unused qemuMonitorGetBlockJobInfo Date: Fri, 4 Dec 2020 16:08:01 +0100 Message-Id: <69dbec4a000b2a3639f05c4940065895a27eae5d.1607094319.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_monitor.c | 29 ----------------------------- src/qemu/qemu_monitor.h | 4 ---- 2 files changed, 33 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 551b65e778..40f2997cb6 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3393,35 +3393,6 @@ qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon, } -/** - * qemuMonitorGetBlockJobInfo: - * Parse Block Job information, and populate info for the named device. - * Return 1 if info available, 0 if device has no block job, and -1 on err= or. - */ -int -qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, - const char *alias, - qemuMonitorBlockJobInfoPtr info) -{ - GHashTable *all; - qemuMonitorBlockJobInfoPtr data; - int ret =3D 0; - - VIR_DEBUG("alias=3D%s, info=3D%p", alias, info); - - if (!(all =3D qemuMonitorGetAllBlockJobInfo(mon, true))) - return -1; - - if ((data =3D virHashLookup(all, alias))) { - *info =3D *data; - ret =3D 1; - } - - virHashFree(all); - return ret; -} - - int qemuMonitorJobDismiss(qemuMonitorPtr mon, const char *jobname) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index a2f28f9492..3a09b995ce 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1123,10 +1123,6 @@ struct _qemuMonitorBlockJobInfo { GHashTable *qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon, bool rawjobname); -int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, - const char *device, - qemuMonitorBlockJobInfoPtr info) - ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int qemuMonitorJobDismiss(qemuMonitorPtr mon, const char *jobname) --=20 2.28.0 From nobody Sat May 18 16:18:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607094816; cv=none; d=zohomail.com; s=zohoarc; b=i9Y7FMBwHl9juLFMZ5eSoZyLEbmg9vekileiiQjQhJIVZX6y3/C1zpszid2+RWw0FOFnIj3L00/0awJ7xs8LkZEmEG0MOpCFg1cl6Hqj6iHo+NJafYnwrHd7qZE6bcBT4zZSMNA/OuhPzp5dXHDAVuCjyanWh52Mt5mAaha66Ks= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607094816; 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=UkBqfwW3FgIw4gQW3x45cjTncUouBf1kuHFRSRt6xlg=; b=b+rMRDo/q59moAmXHmi7HOUFfcIqhKq92RR4R62x7nBTUmvMLf8h51N/WNk4Dm5EF3eWE24Uoqt/VVKVgBOjsZUnkvC98JOJSMY1xvb/KkC6a+VYIZuZ7PzsO1dP2CBWYlcjf75HG1CFY5EIfdKZpxAO3TyUWkTNpXVRjKxyZvA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTP id 1607094816489392.0533407723882; Fri, 4 Dec 2020 07:13:36 -0800 (PST) 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-572-W-387mA1Oxu77y-SrZgUNg-1; Fri, 04 Dec 2020 10:08:30 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE311C292; Fri, 4 Dec 2020 15:08:23 +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 B747E5D6D3; Fri, 4 Dec 2020 15:08:23 +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 825C24E58E; Fri, 4 Dec 2020 15:08:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4F8MQA031322 for ; Fri, 4 Dec 2020 10:08:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1DBD65D9DC; Fri, 4 Dec 2020 15:08:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EFE65D9CA for ; Fri, 4 Dec 2020 15:08:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607094512; 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=UkBqfwW3FgIw4gQW3x45cjTncUouBf1kuHFRSRt6xlg=; b=IKql6qN4OroHVbMOMK+6IRnXarQDZ8iWLEPbkSx+0Y1Au1xOZK2kNBTjG9AckWnpx7LZCA bJluyE/aFcI56+oFbuRrfQA9P3umn6vVOluO7HfYW31ZaD9BKZvNJWVCLTzhqK/NtQ4qmF fqUtSuW3Q3wJaZOrquKDinj65zIPikM= X-MC-Unique: W-387mA1Oxu77y-SrZgUNg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/7] qemuDomainGetBlockJobInfo: Work stats for unfinished pre-blockdev blockjob Date: Fri, 4 Dec 2020 16:08:02 +0100 Message-Id: <20ea8af8126d47887423a1cea869b964a2909f6a.1607094319.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.15 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" If the job has finished, but we didn't yet process the completion fake that it's still incomplete so that apps which decided to poll qemuDomainGetBlockJobInfo rather than use events can be sure that the XML update was completed. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e2fde6c76f..3051d2c7ca 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14642,6 +14642,15 @@ qemuBlockJobInfoTranslate(qemuMonitorBlockJobInfoP= tr rawInfo, virDomainDiskDefPtr disk, bool reportBytes) { + /* If the job data is no longer present this means that the job already + * disappeared in qemu (pre-blockdev) but libvirt didn't process the + * finishing yet. Fake a incomplete job. */ + if (!rawInfo) { + info->cur =3D 0; + info->end =3D 1; + return 0; + } + info->cur =3D rawInfo->cur; info->end =3D rawInfo->end; @@ -14727,10 +14736,7 @@ qemuDomainGetBlockJobInfo(virDomainPtr dom, if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockjobstats) goto endjob; - if (!(rawInfo =3D g_hash_table_lookup(blockjobstats, job->name))) { - ret =3D 0; - goto endjob; - } + rawInfo =3D g_hash_table_lookup(blockjobstats, job->name); if (qemuBlockJobInfoTranslate(rawInfo, info, disk, flags & VIR_DOMAIN_BLOCK_JOB_INFO_BANDWI= DTH_BYTES) < 0) --=20 2.28.0