From nobody Mon Feb 9 13:37:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1571920554; cv=none; d=zoho.com; s=zohoarc; b=YccXomZaStQq+E1lvIzVp0OevP6/ZMyMvKpvYk+hZbxRvhB8n39WdNioQozd7OynxenUEsvskzBXrdWW1lUe0qWD6EYhU6gaHRF93IAtwc7xhoPhEadtDlVPbeEvcAzFe2FPszq9tGbIh8xQ5UPtDoU+wSZkn861fxCkDsJGLjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571920554; 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; bh=S69TMsW+44ZNoHHBTdNOkRsG725L6D61PrR4OwX1RDo=; b=mifolpuQ4e3cVxKjOXuJzyUAAYmtKsFgrHoTWuc4Q4yqoy1fBnrvojtO01JI8S7T6YsFClAYVUV2lhRn8wwArw5qqC2iECJp7V8R1N7j3fmvKURKw68/0OqLkiz0YxOBS7hg8FaRF/KhYEIuOJylX7ra6pvcioZHp93WiHITFeo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 157192055399914.163148469096427; Thu, 24 Oct 2019 05:35:53 -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-170-rDPnuhcbPry653iVyv1Orw-1; Thu, 24 Oct 2019 08:35:51 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B40E801E5C; Thu, 24 Oct 2019 12:35:46 +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 53B5B36F9; Thu, 24 Oct 2019 12:35: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 12533180BACE; Thu, 24 Oct 2019 12:35:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9OCZA7r004530 for ; Thu, 24 Oct 2019 08:35:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 905945B681; Thu, 24 Oct 2019 12:35:10 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.36.118.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AF245D713; Thu, 24 Oct 2019 12:35:07 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 27E981130341; Thu, 24 Oct 2019 14:34:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571920552; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=S69TMsW+44ZNoHHBTdNOkRsG725L6D61PrR4OwX1RDo=; b=K5ufTFtm/9f+ToosVidV0UFqQD15sSp1/qfldrwIiTNW9rDP42zt5MWxc8itOnNfhKJdZ8 ELs/i7NB+6pfW39xJX+AoO7Dnr4jH4hY5/yNLHMFjT9ELgMBVfxrWiqbNTuInhXsDXhkwZ 9EosbQwUDxSmPwfCoGAYfA8faPMG28M= From: Markus Armbruster To: qemu-devel@nongnu.org Date: Thu, 24 Oct 2019 14:34:53 +0200 Message-Id: <20191024123458.13505-15-armbru@redhat.com> In-Reply-To: <20191024123458.13505-1-armbru@redhat.com> References: <20191024123458.13505-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com Subject: [libvirt] [RFC PATCH 14/19] qemu-options: New -compat to set policy for "funny" interfaces 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.14 X-MC-Unique: rDPnuhcbPry653iVyv1Orw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" "Funny" interface policy is separate for input and output. Input policy can be "accept" (accept silently; default), "reject" (reject the request with an error), or "crash" (abort() the process). Output policy can be "accept" (pass on unchanged), or "hide" (filter out the deprecated parts). Policies other than "accept" are implemented later in this series. For now, the "funny" interfaces are just QMP commands and events with feature "deprecated". We'll want to extend this to arguments, returns, and the command line. Extending it to experimental interfaces may make sense. FIXME Documentation and help need some work Signed-off-by: Markus Armbruster --- qapi/common.json | 48 ++++++++++++++++++++++++++++++++++++ include/qapi/compat-policy.h | 20 +++++++++++++++ qapi/qmp-dispatch.c | 3 +++ vl.c | 17 +++++++++++++ qemu-options.hx | 18 ++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 include/qapi/compat-policy.h diff --git a/qapi/common.json b/qapi/common.json index 7b9cbcd97b..9fc3e6400c 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -144,3 +144,51 @@ ## { 'enum': 'PCIELinkWidth', 'data': [ '1', '2', '4', '8', '12', '16', '32' ] } + +## +# @CompatPolicyInput: +# +# Policy for handling "funny" input. +# +# @accept: Accept silently +# TODO @reject: Reject with an error +# TODO @crash: abort() the process +# +# FIXME Guidance on intended use. +# +# Since: 4.2 +## +{ 'enum': 'CompatPolicyInput', + 'data': [ 'accept' ] } + +## +# @CompatPolicyOutput: +# +# Policy for handling "funny" output. +# +# @accept: Pass on unchanged +# TODO @hide: Filter out +# +# FIXME Guidance on intended use. +# +# Since: 4.2 +## +{ 'enum': 'CompatPolicyOutput', + 'data': [ 'accept' ] } + +## +# @CompatPolicy: +# +# Policy for handling "funny" management interfaces. +# +# Limitation: covers only QMP commands and events. Argument support +# is not yet implemented. CLI is not yet implemented. +# +# @deprecated-input: how to handle deprecated input (default 'accept') +# @deprecated-output: how to handle deprecated output (default 'accept') +## +{ 'struct': 'CompatPolicy', + 'data': { '*deprecated-input': 'CompatPolicyInput', + '*deprecated-output': 'CompatPolicyOutput' } } + +# FIXME CompatPolicy & friends don't belong here diff --git a/include/qapi/compat-policy.h b/include/qapi/compat-policy.h new file mode 100644 index 0000000000..c491d74aac --- /dev/null +++ b/include/qapi/compat-policy.h @@ -0,0 +1,20 @@ +/* + * Policy for handling "funny" management interfaces + * + * Copyright (C) 2019 Red Hat, Inc. + * + * Authors: + * Markus Armbruster , + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#ifndef QAPI_COMPAT_POLICY_H +#define QAPI_COMPAT_POLICY_H + +#include "qapi/qapi-types-common.h" + +extern CompatPolicy qapi_compat_policy; + +#endif diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 55bc224c61..8fe59cf54d 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -12,6 +12,7 @@ */ =20 #include "qemu/osdep.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qapi/qmp/dispatch.h" #include "qapi/qmp/qdict.h" @@ -19,6 +20,8 @@ #include "sysemu/runstate.h" #include "qapi/qmp/qbool.h" =20 +CompatPolicy qapi_compat_policy; + static QDict *qmp_dispatch_check_obj(const QObject *request, bool allow_oo= b, QObject **id, Error **errp) { diff --git a/vl.c b/vl.c index 4489cfb2bb..300f2a01de 100644 --- a/vl.c +++ b/vl.c @@ -26,6 +26,7 @@ #include "qemu-common.h" #include "qemu/units.h" #include "hw/qdev-properties.h" +#include "qapi/compat-policy.h" #include "qapi/error.h" #include "qemu-version.h" #include "qemu/cutils.h" @@ -3783,6 +3784,22 @@ int main(int argc, char **argv, char **envp) qemu_opt_get_bool(opts, "mem-lock", false); enable_cpu_pm =3D qemu_opt_get_bool(opts, "cpu-pm", false); break; + case QEMU_OPTION_compat: + { + CompatPolicy *opts; + Visitor *v; + + v =3D qobject_input_visitor_new_str(optarg, NULL, + &error_fatal); + + visit_type_CompatPolicy(v, NULL, &opts, &error_fatal); + QAPI_CLONE_MEMBERS(CompatPolicy, &qapi_compat_policy, + opts); + + qapi_free_CompatPolicy(opts); + visit_free(v); + break; + } case QEMU_OPTION_msg: opts =3D qemu_opts_parse_noisily(qemu_find_opts("msg"), op= targ, false); diff --git a/qemu-options.hx b/qemu-options.hx index 996b6fba74..c43f768a15 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3319,6 +3319,24 @@ STEXI @table @option ETEXI =20 +DEF("compat", HAS_ARG, QEMU_OPTION_compat, + "-compat [deprecated-input=3Daccept][,deprecated-output=3Daccept]\n" + " Policy for handling deprecated management interfaces\= n", + QEMU_ARCH_ALL) +STEXI +@item -compat [deprecated-input=3D@var{input-policy}][,deprecated-output= =3D@var{output-policy}] +@findex -compat + +Set policy for handling deprecated management interfaces: +@table @option +@item deprecated-input=3Daccept (default) +Accept deprecated commands +@item deprecated-output=3Daccept (default) +Emit deprecated events +@end table +FIXME Guidance on intended use +ETEXI + DEF("fw_cfg", HAS_ARG, QEMU_OPTION_fwcfg, "-fw_cfg [name=3D],file=3D\n" " add named fw_cfg entry with contents from file\n" --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list