From nobody Mon Feb 9 03:48:24 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=1558361821; cv=none; d=zoho.com; s=zohoarc; b=X/wfCKE+CnIb6asemQeiKHDyWpaJyd580/1i2h1U/McSmuVLUTA2ahaArSXCrMiyhQnVav3cEqkEJsOxc7AUKnWQsqMxIp6/lizsXhVJTlEeavi48HTJI+FcMFWipaNu8OSTSAsPceE6O45uRnKbN3qvz7J1MT/loTi4QZCrYUc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558361821; 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=phGHLaz9rKXPMsZgVIRsMQ6LAt/WLG3vvkFt97relns=; b=HbtHzkFfk7+HBXJ6j0uPObwq96hHBTXF/UdS8XqTTU51y0QRKDvBrNRGDBTrTX24LcwUqpdFKbuWijN5ba3hz/+CMQkhnabXsimekzkBjZ5uSqaB5xRmKdKpX8YL2lV6y/nqsX5zwCVvW76idzLgmP/KzEW1y9TB8Vob4XqrYP8= 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 1558361821978399.81204499476496; Mon, 20 May 2019 07:17:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C1CAFFCBF; Mon, 20 May 2019 14:16:49 +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 8B6136085B; Mon, 20 May 2019 14:16:46 +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 45B835B426; Mon, 20 May 2019 14:16:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4KEGdw4021718 for ; Mon, 20 May 2019 10:16:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3F481001DD9; Mon, 20 May 2019 14:16:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23DB5105B1E8; Mon, 20 May 2019 14:16:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 20 May 2019 16:16:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 3/4] qemu: monitor: Don't pass full flags to qemuMonitorJSONDriveMirror 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 20 May 2019 14:16:51 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Split out the 'shallow' and 'reuse' flags as booleans rather than passing in flags and constructing them in irrelevant APIs. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 4 +++- src/qemu/qemu_migration.c | 6 +----- src/qemu/qemu_monitor.c | 9 +++++---- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 5 ++--- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 3 +-- 7 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9c0796b0a4..95c84b46ae 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17764,7 +17764,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, /* qemuMonitorDriveMirror needs to honor the REUSE_EXT flag as specifi= ed * by the user regardless of how @reuse was modified */ ret =3D qemuMonitorDriveMirror(priv->mon, device, mirror->path, format, - bandwidth, granularity, buf_size, flags); + bandwidth, granularity, buf_size, + flags & VIR_DOMAIN_BLOCK_COPY_SHALLOW, + flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); virDomainAuditDisk(vm, NULL, mirror, "mirror", ret >=3D 0); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 832f98346d..32b3040473 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -866,10 +866,6 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDrive= rPtr driver, char *nbd_dest =3D NULL; int mon_ret; int ret =3D -1; - unsigned int mirror_flags =3D VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT; - - if (mirror_shallow) - mirror_flags |=3D VIR_DOMAIN_BLOCK_REBASE_SHALLOW; if (strchr(host, ':')) { if (virAsprintf(&nbd_dest, "nbd:[%s]:%d:exportname=3D%s", @@ -887,7 +883,7 @@ qemuMigrationSrcNBDStorageCopyDriveMirror(virQEMUDriver= Ptr driver, mon_ret =3D qemuMonitorDriveMirror(qemuDomainGetMonitor(vm), diskAlias, nbd_dest, "raw", - mirror_speed, 0, 0, mirror_flags); + mirror_speed, 0, 0, mirror_shallow, t= rue); if (qemuDomainObjExitMonitor(driver, vm) < 0 || mon_ret < 0) goto cleanup; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 9a796db3cb..6b731cd91a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3244,17 +3244,18 @@ qemuMonitorDriveMirror(qemuMonitorPtr mon, const char *device, const char *file, const char *format, unsigned long long bandwidth, unsigned int granularity, unsigned long long buf_si= ze, - unsigned int flags) + bool shallow, + bool reuse) { VIR_DEBUG("device=3D%s, file=3D%s, format=3D%s, bandwidth=3D%lld, " - "granularity=3D%#x, buf_size=3D%lld, flags=3D0x%x", + "granularity=3D%#x, buf_size=3D%lld, shallow=3D%d, reuse=3D%= d", device, file, NULLSTR(format), bandwidth, granularity, - buf_size, flags); + buf_size, shallow, reuse); QEMU_CHECK_MONITOR(mon); return qemuMonitorJSONDriveMirror(mon, device, file, format, bandwidth, - granularity, buf_size, flags); + granularity, buf_size, shallow, reus= e); } diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 438c3c38ed..dee594fa66 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -884,7 +884,8 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon, unsigned long long bandwidth, unsigned int granularity, unsigned long long buf_size, - unsigned int flags) + bool shallow, + bool reuse) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int qemuMonitorBlockdevMirror(qemuMonitorPtr mon, const char *jobname, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index a75e660d07..4152d44331 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4277,13 +4277,12 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon, const char *format, unsigned long long speed, unsigned int granularity, unsigned long long buf_size, - unsigned int flags) + bool shallow, + bool reuse) { int ret =3D -1; virJSONValuePtr cmd; virJSONValuePtr reply =3D NULL; - bool shallow =3D (flags & VIR_DOMAIN_BLOCK_REBASE_SHALLOW) !=3D 0; - bool reuse =3D (flags & VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT) !=3D 0; cmd =3D qemuMonitorJSONMakeCommand("drive-mirror", "s:device", device, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 174db7a2e9..acef1a0a79 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -250,7 +250,8 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon, unsigned long long speed, unsigned int granularity, unsigned long long buf_size, - unsigned int flags) + bool shallow, + bool reuse) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon, const char *jobname, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c2bb3a6c4f..0894e748ae 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1341,8 +1341,7 @@ GEN_TEST_FUNC(qemuMonitorJSONAddNetdev, "id=3Dnet0,ty= pe=3Dtest") GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0") GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0") GEN_TEST_FUNC(qemuMonitorJSONAddDevice, "some_dummy_devicestr") -GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", "formatstr", = 1024, 1234, 31234, - VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_RE= USE_EXT) +GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", "formatstr", = 1024, 1234, 31234, true, true) GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", "vdb", "targetnode= ", 1024, 1234, 31234, true) GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "/foo/bar1", "backingfile= name", 1024) GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/foo/bar1", "/foo/bar2",= "backingfilename", 1024) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list