From nobody Mon Feb 9 08:00:11 2026 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=1638543845; cv=none; d=zohomail.com; s=zohoarc; b=lJBjXXJwaUUjvV5LcdGXowTUt1kkTrvv8UhkG4hNOKjHCnPA2ctSB7tdUiyQmR/X5tD2B5cwUVYHSzZ7uYpznRoBI34gFVEYSH099U4NU2akJ6JROuAZhSG1xDBJ3xOrXMYPpJZRPyn1Oc3u5YeAaYE8e2ME3tP8caSRZJgRbIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638543845; 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=UZCZ+JW2LPJWQqGkmR0MeiJAhuc2CuiP9aF+G9fks2I=; b=mTEnI2hsgDJ6Pu9dRm/1rI1pIi4kyH7NY6Ewtn07k3P1VfsegjOCDxYkRvsYyKBDHE82c6C7TIbIY5CvOOCY/VytrdM8TnLK7Ev8CtmURTKjJe19Fm5tZTfHieZIRdVM5eWH9eqT+Zr1dR3ubu2bcMK1/1DIyh2hxYfhu9C+nX4= 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) 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 1638543845636518.6286538756932; Fri, 3 Dec 2021 07:04:05 -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-95-tKc7PIumO6S2ODDqSLCVTg-1; Fri, 03 Dec 2021 10:04:02 -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 B5FA01006AA9; Fri, 3 Dec 2021 15:03:56 +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 8F0725F4E9; Fri, 3 Dec 2021 15:03:56 +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 64E031802E2E; Fri, 3 Dec 2021 15:03:56 +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 1B3F3slB031118 for ; Fri, 3 Dec 2021 10:03:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 64B475E275; Fri, 3 Dec 2021 15:03:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0E635ED2D for ; Fri, 3 Dec 2021 15:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638543844; 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=UZCZ+JW2LPJWQqGkmR0MeiJAhuc2CuiP9aF+G9fks2I=; b=bBHasBmsd2Vy/UCBAmFmjR+o/J+CvAlQ4crSX1J608WInkZSYG4+Xsc/BZ+y6ID/tZ0pAE 4LJcV9f1Qx71Htks4q3zKw932JQ8V1r8CpXlxo3QwEgSBCxJG9aCtV0YrcibTyUt1rJgeM 1fVqrMqsQDhOsaAA+G5FdNrWFqEbADE= X-MC-Unique: tKc7PIumO6S2ODDqSLCVTg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/17] qemuMonitorJSONMigrate: Extract flags prior to constructing command Date: Fri, 3 Dec 2021 16:01:43 +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.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: 1638543847812100003 Content-Type: text/plain; charset="utf-8" The migration API takes specific flags which are then converted to boolean parameters for the command. Extract the flag into helper variables rather than using ternary operatirs while constructing the command itself. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index da14eee964..82631e30e0 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -3440,13 +3440,15 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon, unsigned int flags, const char *uri) { - g_autoptr(virJSONValue) cmd =3D - qemuMonitorJSONMakeCommand("migrate", - "b:detach", flags & QEMU_MONITOR_MIGRATE_= BACKGROUND ? 1 : 0, - "b:blk", flags & QEMU_MONITOR_MIGRATE_NON= _SHARED_DISK ? 1 : 0, - "b:inc", flags & QEMU_MONITOR_MIGRATE_NON= _SHARED_INC ? 1 : 0, - "s:uri", uri, - NULL); + bool detach =3D !!(flags & QEMU_MONITOR_MIGRATE_BACKGROUND); + bool blk =3D !!(flags & QEMU_MONITOR_MIGRATE_NON_SHARED_DISK); + bool inc =3D !!(flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC); + g_autoptr(virJSONValue) cmd =3D qemuMonitorJSONMakeCommand("migrate", + "b:detach", d= etach, + "b:blk", blk, + "b:inc", inc, + "s:uri", uri, + NULL); g_autoptr(virJSONValue) reply =3D NULL; if (!cmd) --=20 2.31.1