From nobody Sun May 12 15:46:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560947636; cv=none; d=zoho.com; s=zohoarc; b=I4KlZsYvJ+cnzN4hQ1MLTsur+Lu9wrV4VFuf0dII9PaKZOqod6jtoEVcamUnIquPq9lZsKXaeW4j3I9xzAomRNVG5fuXnDi1ueNKu3thafwX0AK5C5Ttf1WPEjwUG6Wo3jBNuZv52mqk9HSDT/Dv5xXl+k5UXHa2SCQpMQ4ZfMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560947636; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=jozFB0ctGaUjtpKGna3OuU7qYSP25GTS+AoCKSW0SxA=; b=Fef/nC5/qDbmMn3QAN2c/2PidcNS+VDsiS0MEw9mZzdVKcxnpRFPEHONzwZrqhfAnG3nU/LXekz4JsqTqbYYZbfbM9Gksruq/4UsdmybD0KcC1VmzzqBvbvc4Kt0DnpofFUpGQrx1BHgbKB4c//tHo3zqcY2EeduTTWkHisjo/E= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1560947636290455.7493209580641; Wed, 19 Jun 2019 05:33:56 -0700 (PDT) Received: from localhost ([::1]:37954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdZmf-0000kt-UT for importer@patchew.org; Wed, 19 Jun 2019 08:33:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55901) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hdZkL-0008Qb-Iq for qemu-devel@nongnu.org; Wed, 19 Jun 2019 08:31:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hdZkH-0004DH-Sh for qemu-devel@nongnu.org; Wed, 19 Jun 2019 08:31:25 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:40798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hdZk9-0003cY-IX for qemu-devel@nongnu.org; Wed, 19 Jun 2019 08:31:14 -0400 Received: by mail-wm1-f50.google.com with SMTP id v19so1639424wmj.5 for ; Wed, 19 Jun 2019 05:30:45 -0700 (PDT) Received: from pinea.redhat.com ([2001:861:3440:6a0:71b6:dd5f:657d:58e3]) by smtp.gmail.com with ESMTPSA id f24sm829265wmb.16.2019.06.19.05.30.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 19 Jun 2019 05:30:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jozFB0ctGaUjtpKGna3OuU7qYSP25GTS+AoCKSW0SxA=; b=SV3EpZfOVc8w14yPunppjX0d6IL2WvQJ6DHIiH9zs9Aq08dh0UkVVmF65KzOBjvOQ5 I281DxTyLg78ZjClh6kqdgBHj4vWJcmUfNsnoZ2etnJd6RnW+QANgwGs8/P0svkyTGZE S3ZpH2Yk2He2++g96lADCqMawpjZ+TtbbdrYw+76XHW1j5qWTfJadIhBL0XPdLbTi0Oy Nm1AxhTXvNfmRvPycsbcUrRBqn74p47crJTuElfjLECxQdqoXd/j4FnDntPcfiVrtHXI j6W1b2UKu71Mqy4aohxbNu1zFdwjIst/blPWRL0X6ANTYbsOcyr3Q+sv3rehCCpQadsD DXYg== X-Gm-Message-State: APjAAAX4H+2dVUzbGRidzf17KNT9r9wBvs5Qlg/mRAI9LxdiGdSiyzbx KOaPpkfJU8PZqyyFDshBfGtNiduVCAI= X-Google-Smtp-Source: APXvYqwJj4fFllL9TgYoq0bJcAbpw9ONOVt2ctWHFuhgABgL/bTlgki/Q4tEiLBVVFWCXAXeYOi36w== X-Received: by 2002:a05:600c:2199:: with SMTP id e25mr3494786wme.72.1560947444528; Wed, 19 Jun 2019 05:30:44 -0700 (PDT) From: Kevin Pouget To: qemu-devel@nongnu.org Date: Wed, 19 Jun 2019 14:30:42 +0200 Message-Id: <20190619123042.4822-1-kpouget@redhat.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.50 Subject: [Qemu-devel] [RFC] spice-core: allow setting properties from QMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc-Andre Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Hello, we're investigating the possibility to set some spice properties at runtime, through the QMP interface, but we're not sure what's the best way to proceed. I've prepared the patch below, that adds a new QMP command, but is there another way like with a QOM object, that could reuse an existing command? I searched but couldn't find an easy/not hacky way to create such objects ... thanks, Kevin --- This patch allows setting spice properties from the QMP interface. At the moment, only the 'video-codecs' property is supported. Signed-off-by: Kevin Pouget --- qapi/ui.json | 19 +++++++++++++++++++ ui/spice-core.c | 13 +++++++++++++ 2 files changed, 32 insertions(+) diff --git a/qapi/ui.json b/qapi/ui.json index 59e412139a..5483a9c003 100644 --- a/qapi/ui.json +++ b/qapi/ui.json @@ -265,6 +265,25 @@ { 'command': 'query-spice', 'returns': 'SpiceInfo', 'if': 'defined(CONFIG_SPICE)' } +## +# @set-spice: +# +# Set Spice properties. +# @property: the SPICE property to modify +# @value: the new value to affect to this property +# +# Since: ... +# +# Example: +# +# -> { "execute": "set-spice", "arguments": { "property": "video-codecs", +# "value": "spice:mjpeg;gst:mj= peg;" } } +# <- { "returns": {} } +## +{ 'command': 'set-spice', + 'data': {'property': 'str', 'value': 'str'}, + 'if': 'defined(CONFIG_SPICE)' } + ## # @SPICE_CONNECTED: # diff --git a/ui/spice-core.c b/ui/spice-core.c index 2ffc3335f0..5408b16684 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -503,6 +503,19 @@ static QemuOptsList qemu_spice_opts =3D { }, }; +void qmp_set_spice(const char *property, const char *value, Error **errp) { + if (strcmp(property, "video-codecs") =3D=3D 0) { + int invalid_codecs =3D spice_server_set_video_codecs(spice_server,= value); + + if (invalid_codecs) { + error_setg(errp, "Found %d invalic codecs while setting " + "the property %s=3D%s\n", invalid_codecs, property,= value); + } + } else { + error_setg(errp, "Setting an unknown spice property (%s=3D%s)\n", = property, value); + } +} + SpiceInfo *qmp_query_spice(Error **errp) { QemuOpts *opts =3D QTAILQ_FIRST(&qemu_spice_opts.head); -- 2.21.0