mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 18:44:58 -06:00
scripts/qom-fuse: Add docstrings
The methods inherited from fuse don't need docstrings; that's up to fusepy to handle. Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 20210603003719.1321369-12-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
7552823a36
commit
187be27c7b
1 changed files with 19 additions and 2 deletions
|
@ -1,7 +1,19 @@
|
||||||
#!/usr/bin/env python3
|
#!/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.
|
||||||
|
|
||||||
|
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 IBM, Corp. 2012
|
||||||
# Copyright (C) 2020 Red Hat, Inc.
|
# Copyright (C) 2020 Red Hat, Inc.
|
||||||
#
|
#
|
||||||
|
@ -30,6 +42,7 @@ fuse.fuse_python_api = (0, 2)
|
||||||
|
|
||||||
|
|
||||||
class QOMFS(Operations):
|
class QOMFS(Operations):
|
||||||
|
"""QOMFS implements fuse.Operations to provide a QOM filesystem."""
|
||||||
def __init__(self, qmp):
|
def __init__(self, qmp):
|
||||||
self.qmp = qmp
|
self.qmp = qmp
|
||||||
self.qmp.connect()
|
self.qmp.connect()
|
||||||
|
@ -37,6 +50,7 @@ class QOMFS(Operations):
|
||||||
self.ino_count = 1
|
self.ino_count = 1
|
||||||
|
|
||||||
def get_ino(self, path):
|
def get_ino(self, path):
|
||||||
|
"""Get an inode number for a given QOM path."""
|
||||||
if path in self.ino_map:
|
if path in self.ino_map:
|
||||||
return self.ino_map[path]
|
return self.ino_map[path]
|
||||||
self.ino_map[path] = self.ino_count
|
self.ino_map[path] = self.ino_count
|
||||||
|
@ -44,6 +58,7 @@ class QOMFS(Operations):
|
||||||
return self.ino_map[path]
|
return self.ino_map[path]
|
||||||
|
|
||||||
def is_object(self, path):
|
def is_object(self, path):
|
||||||
|
"""Is the given QOM path an object?"""
|
||||||
try:
|
try:
|
||||||
self.qmp.command('qom-list', path=path)
|
self.qmp.command('qom-list', path=path)
|
||||||
return True
|
return True
|
||||||
|
@ -51,6 +66,7 @@ class QOMFS(Operations):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_property(self, path):
|
def is_property(self, path):
|
||||||
|
"""Is the given QOM path a property?"""
|
||||||
path, prop = path.rsplit('/', 1)
|
path, prop = path.rsplit('/', 1)
|
||||||
if path == '':
|
if path == '':
|
||||||
path = '/'
|
path = '/'
|
||||||
|
@ -63,6 +79,7 @@ class QOMFS(Operations):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_link(self, path):
|
def is_link(self, path):
|
||||||
|
"""Is the given QOM path a link?"""
|
||||||
path, prop = path.rsplit('/', 1)
|
path, prop = path.rsplit('/', 1)
|
||||||
if path == '':
|
if path == '':
|
||||||
path = '/'
|
path = '/'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue