aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>2023-10-06 18:41:15 +0300
committerJohn Snow <jsnow@redhat.com>2023-10-12 14:21:43 -0400
commit684750ab4f8a3ad69512b71532408be3ac2547d4 (patch)
tree30f6b76726f7307b908c22db995653936e542b7a /python
parent37274707f6f3868fae7e0055d9a703006fc142d0 (diff)
python/qemu: rename command() to cmd()
Use a shorter name. We are going to move in iotests from qmp() to command() where possible. But command() is longer than qmp() and don't look better. Let's rename. You can simply grep for '\.command(' and for 'def command(' to check that everything is updated (command() in tests/docker/docker.py is unrelated). Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-id: 20231006154125.1068348-6-vsementsov@yandex-team.ru [vsementsov: also update three occurrences in tests/avocado/machine_aspeed.py and keep r-b] Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/qemu/machine/machine.py8
-rw-r--r--python/qemu/qmp/legacy.py2
-rw-r--r--python/qemu/qmp/qmp_shell.py2
-rw-r--r--python/qemu/utils/qemu_ga_client.py2
-rw-r--r--python/qemu/utils/qom.py8
-rw-r--r--python/qemu/utils/qom_common.py2
-rw-r--r--python/qemu/utils/qom_fuse.py6
7 files changed, 15 insertions, 15 deletions
diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
index 50bba33729..eae193eb00 100644
--- a/python/qemu/machine/machine.py
+++ b/python/qemu/machine/machine.py
@@ -707,16 +707,16 @@ class QEMUMachine:
self._quit_issued = True
return ret
- def command(self, cmd: str,
- conv_keys: bool = True,
- **args: Any) -> QMPReturnValue:
+ def cmd(self, cmd: str,
+ conv_keys: bool = True,
+ **args: Any) -> QMPReturnValue:
"""
Invoke a QMP command.
On success return the response dict.
On failure raise an exception.
"""
qmp_args = self._qmp_args(conv_keys, args)
- ret = self._qmp.command(cmd, **qmp_args)
+ ret = self._qmp.cmd(cmd, **qmp_args)
if cmd == 'quit':
self._quit_issued = True
return ret
diff --git a/python/qemu/qmp/legacy.py b/python/qemu/qmp/legacy.py
index e5fa1ce9c4..22a2b5616e 100644
--- a/python/qemu/qmp/legacy.py
+++ b/python/qemu/qmp/legacy.py
@@ -207,7 +207,7 @@ class QEMUMonitorProtocol:
qmp_cmd['arguments'] = args
return self.cmd_obj(qmp_cmd)
- def command(self, cmd: str, **kwds: object) -> QMPReturnValue:
+ def cmd(self, cmd: str, **kwds: object) -> QMPReturnValue:
"""
Build and send a QMP command to the monitor, report errors if any
"""
diff --git a/python/qemu/qmp/qmp_shell.py b/python/qemu/qmp/qmp_shell.py
index 988d79c01b..98e684e9e8 100644
--- a/python/qemu/qmp/qmp_shell.py
+++ b/python/qemu/qmp/qmp_shell.py
@@ -202,7 +202,7 @@ class QMPShell(QEMUMonitorProtocol):
def _fill_completion(self) -> None:
try:
- cmds = cast(List[Dict[str, str]], self.command('query-commands'))
+ cmds = cast(List[Dict[str, str]], self.cmd('query-commands'))
for cmd in cmds:
self._completer.append(cmd['name'])
except ExecuteError:
diff --git a/python/qemu/utils/qemu_ga_client.py b/python/qemu/utils/qemu_ga_client.py
index d8411bb2d0..9a665e6e99 100644
--- a/python/qemu/utils/qemu_ga_client.py
+++ b/python/qemu/utils/qemu_ga_client.py
@@ -64,7 +64,7 @@ from qemu.qmp.legacy import QEMUMonitorProtocol
class QemuGuestAgent(QEMUMonitorProtocol):
def __getattr__(self, name: str) -> Callable[..., Any]:
def wrapper(**kwds: object) -> object:
- return self.command('guest-' + name.replace('_', '-'), **kwds)
+ return self.cmd('guest-' + name.replace('_', '-'), **kwds)
return wrapper
diff --git a/python/qemu/utils/qom.py b/python/qemu/utils/qom.py
index bcf192f477..426a0f245f 100644
--- a/python/qemu/utils/qom.py
+++ b/python/qemu/utils/qom.py
@@ -84,7 +84,7 @@ class QOMSet(QOMCommand):
self.value = args.value
def run(self) -> int:
- rsp = self.qmp.command(
+ rsp = self.qmp.cmd(
'qom-set',
path=self.path,
property=self.prop,
@@ -129,7 +129,7 @@ class QOMGet(QOMCommand):
self.prop = tmp[1]
def run(self) -> int:
- rsp = self.qmp.command(
+ rsp = self.qmp.cmd(
'qom-get',
path=self.path,
property=self.prop
@@ -231,8 +231,8 @@ class QOMTree(QOMCommand):
if item.child:
continue
try:
- rsp = self.qmp.command('qom-get', path=path,
- property=item.name)
+ rsp = self.qmp.cmd('qom-get', path=path,
+ property=item.name)
print(f" {item.name}: {rsp} ({item.type})")
except ExecuteError as err:
print(f" {item.name}: <EXCEPTION: {err!s}> ({item.type})")
diff --git a/python/qemu/utils/qom_common.py b/python/qemu/utils/qom_common.py
index 80da1b2304..dd2c8b1908 100644
--- a/python/qemu/utils/qom_common.py
+++ b/python/qemu/utils/qom_common.py
@@ -140,7 +140,7 @@ class QOMCommand:
"""
:return: a strongly typed list from the 'qom-list' command.
"""
- rsp = self.qmp.command('qom-list', path=path)
+ rsp = self.qmp.cmd('qom-list', path=path)
# qom-list returns List[ObjectPropertyInfo]
assert isinstance(rsp, list)
return [ObjectPropertyInfo.make(x) for x in rsp]
diff --git a/python/qemu/utils/qom_fuse.py b/python/qemu/utils/qom_fuse.py
index 8dcd59fcde..cf7e344bd5 100644
--- a/python/qemu/utils/qom_fuse.py
+++ b/python/qemu/utils/qom_fuse.py
@@ -137,7 +137,7 @@ class QOMFuse(QOMCommand, Operations):
if path == '':
path = '/'
try:
- data = str(self.qmp.command('qom-get', path=path, property=prop))
+ data = str(self.qmp.cmd('qom-get', path=path, property=prop))
data += '\n' # make values shell friendly
except ExecuteError as err:
raise FuseOSError(EPERM) from err
@@ -152,8 +152,8 @@ class QOMFuse(QOMCommand, Operations):
return False
path, prop = path.rsplit('/', 1)
prefix = '/'.join(['..'] * (len(path.split('/')) - 1))
- return prefix + str(self.qmp.command('qom-get', path=path,
- property=prop))
+ return prefix + str(self.qmp.cmd('qom-get', path=path,
+ property=prop))
def getattr(self, path: str,
fh: Optional[IO[bytes]] = None) -> Mapping[str, object]: