From nobody Mon Feb 9 13:38:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1560265063; cv=none; d=zoho.com; s=zohoarc; b=YU8qDExbCCeOecx80ziDTdM++M6tVP/dOcoIPAz80tVxrAQ1kqJMqg7EelIzo+xbptzwtG9fzA2JJyr+NzVwyJ13ju/cFWERl9/nX9h+dRbKxab6TYesMzFp3siKCfx4U/QM0tg4mTuc6GKyv/6pc6lccf1FiXEzt2ruSJPI0Bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560265063; h=Content-Type:Content-Transfer-Encoding:Cc: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:ARC-Authentication-Results; bh=/bOisXVy8rwRpz9tXejQzhGOzPThg8viPtEBJmSBwXE=; b=D+3MX7bNQ14RqipdtK3n1PlxtZ3FGATmJGNH4sT/8X9uKV+Z4nNMEDyVuNj7eHraQjLv/9C1crg1xYZDO5D/TqgWORyyoDB1+wO9WkdWClPIP1uE3UbwogEO58cd9Yio4a2aMr2VHeMHj5CCS6kxf4tA7CnlSSruroUvqR1egQY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560265063099772.0486556738592; Tue, 11 Jun 2019 07:57:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C193F356D3; Tue, 11 Jun 2019 14:57:05 +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 56A285C219; Tue, 11 Jun 2019 14:56:50 +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 B18EC206D1; Tue, 11 Jun 2019 14:56:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5BEuXX5000794 for ; Tue, 11 Jun 2019 10:56:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 23ED25B095; Tue, 11 Jun 2019 14:56:33 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73405600CC; Tue, 11 Jun 2019 14:56:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 11 Jun 2019 16:56:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/3] qemu: Use proper block job name when reconnecting to VM 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 11 Jun 2019 14:57:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The hash table returned by qemuMonitorGetAllBlockJobInfo is organized by the frontend name (which skipps the 'drive-' prefix). While our code properly matches the jobs to the disk, qemu needs the full job name including the 'drive-' prefix to be able to identify jobs. Fix this by adding an argument to qemuMonitorGetAllBlockJobInfo which does not modify the job name before filling the hash. This fixes a regression where users would not be able to cancel/pivot block jobs after restarting libvirtd while a blockjob is running. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_migration.c | 2 +- src/qemu/qemu_monitor.c | 7 ++++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 12 ++++++++---- src/qemu/qemu_monitor_json.h | 3 ++- src/qemu/qemu_process.c | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 32b3040473..1ea817004d 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5545,7 +5545,7 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriverPtr dri= ver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; - blockinfo =3D qemuMonitorGetAllBlockJobInfo(priv->mon); + blockinfo =3D qemuMonitorGetAllBlockJobInfo(priv->mon, false); if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockinfo) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6b731cd91a..9826426b29 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3442,10 +3442,11 @@ qemuMonitorBlockJobSetSpeed(qemuMonitorPtr mon, virHashTablePtr -qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon) +qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon, + bool rawjobname) { QEMU_CHECK_MONITOR_NULL(mon); - return qemuMonitorJSONGetAllBlockJobInfo(mon); + return qemuMonitorJSONGetAllBlockJobInfo(mon, rawjobname); } @@ -3465,7 +3466,7 @@ qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, VIR_DEBUG("alias=3D%s, info=3D%p", alias, info); - if (!(all =3D qemuMonitorGetAllBlockJobInfo(mon))) + if (!(all =3D qemuMonitorGetAllBlockJobInfo(mon, false))) return -1; if ((data =3D virHashLookup(all, alias))) { diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index dee594fa66..cf4d567667 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -956,7 +956,8 @@ struct _qemuMonitorBlockJobInfo { int ready; /* -1 if unknown, 0 if not ready, 1 if ready */ }; -virHashTablePtr qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon); +virHashTablePtr qemuMonitorGetAllBlockJobInfo(qemuMonitorPtr mon, + bool rawjobname); int qemuMonitorGetBlockJobInfo(qemuMonitorPtr mon, const char *device, qemuMonitorBlockJobInfoPtr info) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 53a7de8b77..2873399dc3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4662,7 +4662,8 @@ int qemuMonitorJSONScreendump(qemuMonitorPtr mon, static int qemuMonitorJSONParseBlockJobInfo(virHashTablePtr blockJobs, - virJSONValuePtr entry) + virJSONValuePtr entry, + bool rawjobname) { qemuMonitorBlockJobInfoPtr info =3D NULL; const char *device; @@ -4674,7 +4675,9 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr bloc= kJobs, _("entry was missing 'device'")); return -1; } - device =3D qemuAliasDiskDriveSkipPrefix(device); + + if (!rawjobname) + device =3D qemuAliasDiskDriveSkipPrefix(device); if (VIR_ALLOC(info) < 0 || virHashAddEntry(blockJobs, device, info) < 0) { @@ -4724,7 +4727,8 @@ qemuMonitorJSONParseBlockJobInfo(virHashTablePtr bloc= kJobs, } virHashTablePtr -qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon) +qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon, + bool rawjobname) { virJSONValuePtr cmd =3D NULL; virJSONValuePtr reply =3D NULL; @@ -4756,7 +4760,7 @@ qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon) _("missing array element")); goto error; } - if (qemuMonitorJSONParseBlockJobInfo(blockJobs, entry) < 0) + if (qemuMonitorJSONParseBlockJobInfo(blockJobs, entry, rawjobname)= < 0) goto error; } diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index acef1a0a79..c8fde1d1b6 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -317,7 +317,8 @@ int qemuMonitorJSONBlockJobSetSpeed(qemuMonitorPtr mon, unsigned long long speed) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); -virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon) +virHashTablePtr qemuMonitorJSONGetAllBlockJobInfo(qemuMonitorPtr mon, + bool rawjobname) ATTRIBUTE_NONNULL(1); int qemuMonitorJSONSetLink(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 50a76aa0ed..f114611e02 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8011,7 +8011,7 @@ qemuProcessRefreshLegacyBlockjobs(virQEMUDriverPtr dr= iver, int ret =3D -1; qemuDomainObjEnterMonitor(driver, vm); - blockJobs =3D qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm)); + blockJobs =3D qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), = true); if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockJobs) goto cleanup; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list