[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 08/72] scripts/qom-fuse: Add docstrings
From: |
John Snow |
Subject: |
[PATCH v2 08/72] scripts/qom-fuse: Add docstrings |
Date: |
Tue, 3 Nov 2020 19:34:58 -0500 |
The methods inherited from fuse don't need docstrings; that's up to
fusepy to handle.
Signed-off-by: John Snow <jsnow@redhat.com>
---
scripts/qmp/qom-fuse | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/scripts/qmp/qom-fuse b/scripts/qmp/qom-fuse
index 805e99c8ecde..5b80da9df66b 100755
--- a/scripts/qmp/qom-fuse
+++ b/scripts/qmp/qom-fuse
@@ -1,7 +1,20 @@
#!/usr/bin/env python3
+"""
+QEMU Object Model FUSE filesystem tool
+
+This script offers a simple FUSE filesystem within which the QOM tree
+may be browsed, queried and edited using traditional shell tooling.
+
+This script requires the 'fusepy' python package;
+you may install it by using ``pip3 install --user fusepy``.
+
+ENV:
+ QMP_SOCKET: Path to the QMP server socket
+
+Usage:
+ qom-fuse /mount/to/here
+"""
##
-# QEMU Object Model test tools
-#
# Copyright IBM, Corp. 2012
# Copyright (C) 2020 Red Hat, Inc.
#
@@ -30,6 +43,7 @@ fuse.fuse_python_api = (0, 2)
class QOMFS(Operations):
+ """QOMFS implements fuse.Operations to provide a QOM filesystem."""
def __init__(self, qmp):
self.qmp = qmp
self.qmp.connect()
@@ -37,6 +51,7 @@ class QOMFS(Operations):
self.ino_count = 1
def get_ino(self, path):
+ """Get an inode number for a given QOM path."""
if path in self.ino_map:
return self.ino_map[path]
self.ino_map[path] = self.ino_count
@@ -44,6 +59,7 @@ class QOMFS(Operations):
return self.ino_map[path]
def is_object(self, path):
+ """Is the given QOM path an object?"""
try:
self.qmp.command('qom-list', path=path)
return True
@@ -51,6 +67,7 @@ class QOMFS(Operations):
return False
def is_property(self, path):
+ """Is the given QOM path a property?"""
path, prop = path.rsplit('/', 1)
if path == '':
path = '/'
@@ -63,6 +80,7 @@ class QOMFS(Operations):
return False
def is_link(self, path):
+ """Is the given QOM path a link?"""
path, prop = path.rsplit('/', 1)
if path == '':
path = '/'
--
2.26.2
- [PATCH v2 00/72] python: move scripts/qmp to python/qemu/qmp, John Snow, 2020/11/03
- [PATCH v2 03/72] scripts/qmp: redirect qom-xxx scripts to python/qemu/qmp/, John Snow, 2020/11/03
- [PATCH v2 02/72] python/qmp: add qom script entry points, John Snow, 2020/11/03
- [PATCH v2 04/72] scripts/qom-fuse: apply isort rules, John Snow, 2020/11/03
- [PATCH v2 05/72] scripts/qom-fuse: apply flake8 rules, John Snow, 2020/11/03
- [PATCH v2 01/72] python/qmp: Add qom script rewrites, John Snow, 2020/11/03
- [PATCH v2 08/72] scripts/qom-fuse: Add docstrings,
John Snow <=
- [PATCH v2 06/72] python: Add 'fh' to known-good variable names, John Snow, 2020/11/03
- [PATCH v2 07/72] scripts/qom-fuse: Apply pylint rules, John Snow, 2020/11/03
- [PATCH v2 09/72] scripts/qom-fuse: Convert to QOMCommand, John Snow, 2020/11/03
- [PATCH v2 12/72] scripts/qom-fuse: add static type hints, John Snow, 2020/11/03
- [PATCH v2 11/72] scripts/qom-fuse: ensure QOMFuse.read always returns bytes, John Snow, 2020/11/03
- [PATCH v2 16/72] python: add optional fuse dependency, John Snow, 2020/11/03
- [PATCH v2 10/72] scripts/qom-fuse: use QOMCommand.qom_list(), John Snow, 2020/11/03
- [PATCH v2 13/72] scripts/qom-fuse: move to python/qemu/qmp/qom_fuse.py, John Snow, 2020/11/03
- [PATCH v2 15/72] python: add fuse command to 'qom' tools, John Snow, 2020/11/03
- [PATCH v2 18/72] scripts/qemu-ga-client: apply (most) flake8 rules, John Snow, 2020/11/03