From nobody Sat May 18 23:55:10 2024 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=1666623472; cv=none; d=zohomail.com; s=zohoarc; b=YIEtBL7zl4bpmSUwp0o2KY0ONB8Drk389+F+PQAVmuiZBkUh1K1Hn+RHOZD47Plgnrw4QKfp0Wm3xFfi++9WwjLbYE95WjJphaBBc8C4Ead/Jnhznc8QlxNsdcBBX/IxxaVtPTpUvi+FU42JZsbIdYDi1kTRY9FfYlepoY09DKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666623472; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Q5oJ3tIgOGq3GApyCeFz6JJ+/8Acb/LwvMKRp0VcNOo=; b=aHgxrYGm4ZAXHRHRkY6Bg/V3C0qTdNh3exJ0DhY2k17CpV72uqHKNisYA7s0smBiv6mmj2hU9d48nvGPVJGOzJJ99I/kbYVkViKGiA4lmPtwApODk5uG8i/w3gVWEAn157RLO3uC0vZ+g1Wg9nrK2qoDYrLoKuCfBsE4Q1kBZRg= 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 1666623472125783.3285032911366; Mon, 24 Oct 2022 07:57:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-LNCdSxavM3WD0RJSnQ9dvQ-1; Mon, 24 Oct 2022 10:57:47 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DFF0857020; Mon, 24 Oct 2022 14:57:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 43259492B0F; Mon, 24 Oct 2022 14:57:33 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5C3371946A7A; Mon, 24 Oct 2022 14:56:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 6F1031946A79 for ; Mon, 24 Oct 2022 14:56:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4538B40C6F75; Mon, 24 Oct 2022 14:56:38 +0000 (UTC) Received: from speedmetal.lan (ovpn-208-27.brq.redhat.com [10.40.208.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD54040C94AD for ; Mon, 24 Oct 2022 14:56:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666623471; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Q5oJ3tIgOGq3GApyCeFz6JJ+/8Acb/LwvMKRp0VcNOo=; b=gb0RMhkp7Pnrob9yDkD7tym/9A3N8v9dFEatWU/4siyX4E6nzJTskVtweWJfgTuDT8njn3 Sh1P4Z/vPnY02rQYCDKmgrHdesrMmTnIc3k3r0NMCiPUxeJ7Fgl+WCiYzWVW+ucIppRCg+ x0ijhzpgKNFPjAXW9Yzh6tiUYg/L9cI= X-MC-Unique: LNCdSxavM3WD0RJSnQ9dvQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemuAppendDomainMemoryMachineParams: Refactor formatting of 'dump-guest-core' Date: Mon, 24 Oct 2022 16:56:33 +0200 Message-Id: <6acc043ffbf6f42bb03fca5b7a1ee1a51f5f3025.1666623393.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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: 1666623472916100001 Content-Type: text/plain; charset="utf-8" Use virTristateSwitchFromBool to fill in the default if user didn't request it explicitly. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 150824f2e1..bb2a3ea82f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6625,15 +6625,13 @@ qemuAppendDomainMemoryMachineParams(virBuffer *buf, const virDomainDef *def, virQEMUCaps *qemuCaps) { + virTristateSwitch dump =3D def->mem.dump_core; size_t i; - if (def->mem.dump_core) { - virBufferAsprintf(buf, ",dump-guest-core=3D%s", - virTristateSwitchTypeToString(def->mem.dump_core= )); - } else { - virBufferAsprintf(buf, ",dump-guest-core=3D%s", - cfg->dumpGuestCore ? "on" : "off"); - } + if (dump =3D=3D VIR_TRISTATE_SWITCH_ABSENT) + dump =3D virTristateSwitchFromBool(cfg->dumpGuestCore); + + virBufferAsprintf(buf, ",dump-guest-core=3D%s", virTristateSwitchTypeT= oString(dump)); if (def->mem.nosharepages) virBufferAddLit(buf, ",mem-merge=3Doff"); --=20 2.37.3