From nobody Mon Feb 9 02:55:44 2026 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=1638543755; cv=none; d=zohomail.com; s=zohoarc; b=Dz6B5gCXTbgGmyYs4gyEfcj3MGnUKSwUOueAnC7AYRGZSA8wOK0Dpmm+XPOIcUT9SuDJ9+YfGcQmJ6YSy88vgOOg+1yxWK+4STUN5UE/rTm6OkJlNSeAw1rGCVSPuCYYBCDRtgX47kgnDItcV51FKssTITUExbVjc8LzVX0CGKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638543755; 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=36vW3jJHsS2A12/+vEH7Nldp0oTI5CHKjfo7vH1YLSU=; b=El1X3S1Li+dYrGk1G+/hyEyuaeXzAS5qNArFtT2Un0JrpkdaWk1bCmLjTIYUsaZd27wDApAfmAO5dJpxoXWuCE5wYzqxurAcDfbSMMz36cQkyKa6rlmDJXPMoJC4ON1TZbMIUOkBBfcCEu5HLUnD2n7NvUWnQHa/NPiRRLmBspg= 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 1638543755452894.5868321797916; Fri, 3 Dec 2021 07:02:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-44-mwHZCAF6MYmdBOrohZYYGA-1; Fri, 03 Dec 2021 10:02:29 -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 6A7AA18B9F1D; Fri, 3 Dec 2021 15:02:16 +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 4A7D35F4E1; Fri, 3 Dec 2021 15:02:16 +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 1DBCE1802E34; Fri, 3 Dec 2021 15:02: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 1B3F2B3S030701 for ; Fri, 3 Dec 2021 10:02:11 -0500 Received: by smtp.corp.redhat.com (Postfix) id F2DA85DAA5; Fri, 3 Dec 2021 15:02:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 526CC5D9D5 for ; Fri, 3 Dec 2021 15:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638543754; 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=36vW3jJHsS2A12/+vEH7Nldp0oTI5CHKjfo7vH1YLSU=; b=Ih3WE8Fhm8SBRcugh5OgxzSFJwkqg7wabl8VwmTfOGkaIkDDw7/ACVGdBWVLHjrfvVTkfJ HigqV8wWu1YWzeMCjR//Iyo27zABBX9ZtjRX274fxySHPED359I3BkAVVydExAeOnlEscS YsrLlIoov0vY3C8nmz6lkyETS6+cs+4= X-MC-Unique: mwHZCAF6MYmdBOrohZYYGA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/17] qemu: monitor: Avoid ternary operators in helpers for drive/blockdev-mirror Date: Fri, 3 Dec 2021 16:01:40 +0100 Message-Id: <8dbd11605d894414fb59f87b52af067035762528.1638543496.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) X-ZM-MESSAGEID: 1638543757878100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index c10ea583fd..1ecb06895c 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4262,6 +4262,14 @@ qemuMonitorJSONDriveMirror(qemuMonitor *mon, { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; + const char *syncmode =3D "full"; + const char *mode =3D "absolute-paths"; + + if (shallow) + syncmode =3D "top"; + + if (reuse) + mode =3D "existing"; cmd =3D qemuMonitorJSONMakeCommand("drive-mirror", "s:device", device, @@ -4269,8 +4277,8 @@ qemuMonitorJSONDriveMirror(qemuMonitor *mon, "Y:speed", speed, "z:granularity", granularity, "P:buf-size", buf_size, - "s:sync", shallow ? "top" : "full", - "s:mode", reuse ? "existing" : "absol= ute-paths", + "s:sync", syncmode, + "s:mode", mode, "S:format", format, NULL); if (!cmd) @@ -4298,6 +4306,10 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, g_autoptr(virJSONValue) reply =3D NULL; virTristateBool autofinalize =3D VIR_TRISTATE_BOOL_ABSENT; virTristateBool autodismiss =3D VIR_TRISTATE_BOOL_ABSENT; + const char *syncmode =3D "full"; + + if (shallow) + syncmode =3D "top"; if (persistjob) { autofinalize =3D VIR_TRISTATE_BOOL_YES; @@ -4311,7 +4323,7 @@ qemuMonitorJSONBlockdevMirror(qemuMonitor *mon, "Y:speed", speed, "z:granularity", granularity, "P:buf-size", buf_size, - "s:sync", shallow ? "top" : "full", + "s:sync", syncmode, "T:auto-finalize", autofinalize, "T:auto-dismiss", autodismiss, NULL); --=20 2.31.1