qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
	John Snow <jsnow@redhat.com>,
	"Niteesh G . S ." <niteesh.gs@gmail.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Cleber Rosa <crosa@redhat.com>
Subject: [PATCH v3 19/19] python/qmp: add fuse command to 'qom' tools
Date: Wed,  2 Jun 2021 20:37:19 -0400	[thread overview]
Message-ID: <20210603003719.1321369-20-jsnow@redhat.com> (raw)
In-Reply-To: <20210603003719.1321369-1-jsnow@redhat.com>

The 'fuse' command will be unavailable if 'fusepy' is not installed. It
will simply not load and subsequently be unavailable as a subcommand.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 python/qemu/qmp/qom.py | 14 ++++++++++++--
 python/setup.cfg       |  1 +
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/python/qemu/qmp/qom.py b/python/qemu/qmp/qom.py
index 7fe1448b5d9..7ec7843d57a 100644
--- a/python/qemu/qmp/qom.py
+++ b/python/qemu/qmp/qom.py
@@ -1,7 +1,7 @@
 """
 QEMU Object Model testing tools.
 
-usage: qom [-h] {set,get,list,tree} ...
+usage: qom [-h] {set,get,list,tree,fuse} ...
 
 Query and manipulate QOM data
 
@@ -9,11 +9,12 @@
   -h, --help           show this help message and exit
 
 QOM commands:
-  {set,get,list,tree}
+  {set,get,list,tree,fuse}
     set                Set a QOM property value
     get                Get a QOM property value
     list               List QOM properties at a given path
     tree               Show QOM tree from a given path
+    fuse               Mount a QOM tree as a FUSE filesystem
 """
 ##
 # Copyright John Snow 2020, for Red Hat, Inc.
@@ -35,6 +36,15 @@
 from .qom_common import QOMCommand
 
 
+try:
+    from .qom_fuse import QOMFuse
+except ModuleNotFoundError as err:
+    if err.name != 'fuse':
+        raise
+else:
+    assert issubclass(QOMFuse, QOMCommand)
+
+
 class QOMSet(QOMCommand):
     """
     QOM Command - Set a property to a given value.
diff --git a/python/setup.cfg b/python/setup.cfg
index aca6f311853..6b6be8b03c6 100644
--- a/python/setup.cfg
+++ b/python/setup.cfg
@@ -49,6 +49,7 @@ console_scripts =
     qom-get = qemu.qmp.qom:QOMGet.entry_point
     qom-list = qemu.qmp.qom:QOMList.entry_point
     qom-tree = qemu.qmp.qom:QOMTree.entry_point
+    qom-fuse = qemu.qmp.qom_fuse:QOMFuse.entry_point [fuse]
 
 [flake8]
 extend-ignore = E722  # Prefer pylint's bare-except checks to flake8's
-- 
2.31.1



  parent reply	other threads:[~2021-06-03  0:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03  0:37 [PATCH v3 00/19] Python: move /scripts/qmp/qom* to /python/qemu/qmp/qom* John Snow
2021-06-03  0:37 ` [PATCH v3 01/19] python/pipenv: Update Pipfile.lock John Snow
2021-06-03  0:37 ` [PATCH v3 02/19] python/qmp: Fix type of SocketAddrT John Snow
2021-06-03  7:07   ` Philippe Mathieu-Daudé
2021-06-03  0:37 ` [PATCH v3 03/19] python/qmp: add parse_address classmethod John Snow
2021-06-03  0:37 ` [PATCH v3 04/19] python/qmp: Add qom script rewrites John Snow
2021-06-03  0:37 ` [PATCH v3 05/19] python/qmp: add qom script entry points John Snow
2021-06-03  0:37 ` [PATCH v3 06/19] scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/ John Snow
2021-06-03  0:37 ` [PATCH v3 07/19] scripts/qom-fuse: apply isort rules John Snow
2021-06-03  0:37 ` [PATCH v3 08/19] scripts/qom-fuse: apply flake8 rules John Snow
2021-06-03  7:08   ` Philippe Mathieu-Daudé
2021-06-03  0:37 ` [PATCH v3 09/19] python: Add 'fh' to known-good variable names John Snow
2021-06-03  0:37 ` [PATCH v3 10/19] scripts/qom-fuse: Apply pylint rules John Snow
2021-06-03  0:37 ` [PATCH v3 11/19] scripts/qom-fuse: Add docstrings John Snow
2021-06-03  0:37 ` [PATCH v3 12/19] scripts/qom-fuse: Convert to QOMCommand John Snow
2021-06-03  0:37 ` [PATCH v3 13/19] scripts/qom-fuse: use QOMCommand.qom_list() John Snow
2021-06-03  7:09   ` Philippe Mathieu-Daudé
2021-06-03  0:37 ` [PATCH v3 14/19] scripts/qom-fuse: ensure QOMFuse.read always returns bytes John Snow
2021-06-03  0:37 ` [PATCH v3 15/19] scripts/qom-fuse: add static type hints John Snow
2021-06-03  0:37 ` [PATCH v3 16/19] python: add optional FUSE dependencies John Snow
2021-06-03  0:37 ` [PATCH v3 17/19] scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py John Snow
2021-06-03  0:37 ` [PATCH v3 18/19] scripts/qom-fuse: add redirection shim to python/qemu/qmp/qom-fuse.py John Snow
2021-06-03  0:37 ` John Snow [this message]
2021-06-03  7:11   ` [PATCH v3 19/19] python/qmp: add fuse command to 'qom' tools Philippe Mathieu-Daudé
2021-06-09 20:32 ` [PATCH v3 00/19] Python: move /scripts/qmp/qom* to /python/qemu/qmp/qom* John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210603003719.1321369-20-jsnow@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=niteesh.gs@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).