From nobody Mon Feb 9 02:51:50 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=1616178857; cv=none; d=zohomail.com; s=zohoarc; b=gMtcAZcLcsucO1L90I7cdJnQjkY8V+l7wD1wk2jxUexYAE+5+ChTrxXYXuFb1XRFovFeAScyPMFiMf0tt0ob17DGE8gBdpQrI4949t5I4HqtolSboFn3GLqmc3nYhofWzoCeIywvC3Od4zgtgy/1h8kvc2aBrRLoKqeP7dS2/+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616178857; 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=vyfwtjZyH3CepP4RpKkphXESxGqQZdwsEpUTd3DsQaQ=; b=mLJkfoXQzWqdqPm0SLZBxm+YGaY64OCwnYtjQDKELHpr84TZK1n2vVHbeXbazzT1EfXUebLH1cvTYgLlquJ8t+bK0VrpR8LeylmpjfswW6zzOOOqVy0zFwthx62ywPRK0PdPKGiF2gnPmqhrEwSjGbFOYzWvp/Ns2CvvGdCY1a0= 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) header.from= 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 1616178857470552.1531596811996; Fri, 19 Mar 2021 11:34:17 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-143-xOfIFkJ7Pwu-UqufoN7VxA-1; Fri, 19 Mar 2021 14:34:13 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id BB97C1084D68; Fri, 19 Mar 2021 18:34:06 +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 6E7DC60CEC; Fri, 19 Mar 2021 18:34:06 +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 1FD401809C83; Fri, 19 Mar 2021 18:34:05 +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 12JIY3Fl024608 for ; Fri, 19 Mar 2021 14:34:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8DB55DAA5; Fri, 19 Mar 2021 18:34:03 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 201EA5D9E3 for ; Fri, 19 Mar 2021 18:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616178856; 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=vyfwtjZyH3CepP4RpKkphXESxGqQZdwsEpUTd3DsQaQ=; b=aO32NfARZddqjU8L1p+Y8w1P95loo0+5YVZPn67updgo8juxL3oyUhGFMFzfQIRcMdYBiR l95Cd0NMhdRxYMoIrCvZMNCPysbDS2lY9P5uLDKPVvyVwRAaAnXJjZQToMzto9Lh+iFqaW NU2oklNmBh0z72HyTiKIuQE9bT1Jpag= X-MC-Unique: xOfIFkJ7Pwu-UqufoN7VxA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] qemu: conf: Add 'deprecation_behavior' setting to qemu.conf Date: Fri, 19 Mar 2021 19:33:51 +0100 Message-Id: <65906c042e4f55e4d3f01cb46bc82000306e4aa4.1616173918.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.13 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) Content-Type: text/plain; charset="utf-8" New QEMU supports an harsh, but hard to ignore way to notify that the QMP user used an deprecated command. This is useful e.g. for developers to see that something needs to be fixed. This patch introduces a qemu.conf option to enable the setting in cases when qemu supports it so that developers and continiuous integration efforts are notified about use of deprecated fields while it's not late. The option is deliberately stored as string and not validated to prevent failures when downgrading qemu or libvirt versions. While we don't support this, the knob isn't meant for public consumption anyways. Signed-off-by: Peter Krempa --- src/qemu/libvirtd_qemu.aug | 1 + src/qemu/qemu.conf | 31 ++++++++++++++++++++++++++++++ src/qemu/qemu_conf.c | 4 ++++ src/qemu/qemu_conf.h | 2 ++ src/qemu/test_libvirtd_qemu.aug.in | 1 + 5 files changed, 39 insertions(+) diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug index 3c1045858b..0f18775121 100644 --- a/src/qemu/libvirtd_qemu.aug +++ b/src/qemu/libvirtd_qemu.aug @@ -131,6 +131,7 @@ module Libvirtd_qemu =3D let debug_level_entry =3D int_entry "gluster_debug_level" | bool_entry "virtiofsd_debug" + | str_entry "deprecation_behavior" let memory_entry =3D str_entry "memory_backing_dir" diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 0c1054f198..086d7d2296 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -922,3 +922,34 @@ # may change across versions. # #capability_filters =3D [ "capname" ] + +# 'deprecation_behavior' setting controls how the qemu process behaves tow= ards +# deprecated commands and arguments used by libvirt. +# +# This setting is meant for developers and CI efforts to make it obvious w= hen +# libvirt relies on fields which are deprecated so that it can be fixes as= soon +# as possible. +# +# Possible options are: +# "none" - (default) qemu is supposed to accept and output deprecated fi= elds +# and commands +# "omit" - qemu is instructed to omit deprecated fields on output, behav= iour +# towards fields and commadns from qemu is not changed +# "reject" - qemu is instructed to report an error if a deprecated command= or +# field is used by libvirtd +# "crash" - qemu crashes when an deprecated command or field is used by l= ibvirtd +# +# For both "reject" and "crash" qemu is instructed to omit any deprecated = fields +# on output. +# +# The "reject" option is less harsh towards the VMs but some code paths ig= nore +# errors reported by qemu and thus it may not be obvious that a deprecated +# command/field was used, thus it's suggested to use the "crash" option in= stead. +# +# In cases when qemu doesn't support configuring the behaviour this settin= g is +# silently ignored to allow testing older qemu versions without having to +# reconfigure libvirtd. +# +# DO NOT use in production. +# +#deprecation_behavior =3D "none" diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 2bbc75024c..4f7c85cda1 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -380,6 +380,8 @@ static void virQEMUDriverConfigDispose(void *obj) g_free(cfg->swtpmStorageDir); g_strfreev(cfg->capabilityfilters); + + g_free(cfg->deprecationBehavior); } @@ -869,6 +871,8 @@ virQEMUDriverConfigLoadDebugEntry(virQEMUDriverConfigPt= r cfg, return -1; if (virConfGetValueBool(conf, "virtiofsd_debug", &cfg->virtiofsdDebug)= < 0) return -1; + if (virConfGetValueString(conf, "deprecation_behavior", &cfg->deprecat= ionBehavior) < 0) + return -1; return 0; } diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 7025b5222e..e62cd88950 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -223,6 +223,8 @@ struct _virQEMUDriverConfig { gid_t swtpm_group; char **capabilityfilters; + + char *deprecationBehavior; }; G_DEFINE_AUTOPTR_CLEANUP_FUNC(virQEMUDriverConfig, virObjectUnref); diff --git a/src/qemu/test_libvirtd_qemu.aug.in b/src/qemu/test_libvirtd_qe= mu.aug.in index 9310dcec1c..20a89ade32 100644 --- a/src/qemu/test_libvirtd_qemu.aug.in +++ b/src/qemu/test_libvirtd_qemu.aug.in @@ -115,3 +115,4 @@ module Test_libvirtd_qemu =3D { "capability_filters" { "1" =3D "capname" } } +{ "deprecation_behavior" =3D "none" } --=20 2.29.2