[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.11 2/5] qmp-shell: Pass split cmdargs to __bui
From: |
Eduardo Habkost |
Subject: |
[Qemu-devel] [PATCH for-2.11 2/5] qmp-shell: Pass split cmdargs to __build_cmd() |
Date: |
Fri, 4 Aug 2017 18:36:22 -0300 |
This will allow us to implement a method to run a command that is
already split in a list.
Signed-off-by: Eduardo Habkost <address@hidden>
---
scripts/qmp/qmp-shell | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell
index c276b90..5fe6162 100755
--- a/scripts/qmp/qmp-shell
+++ b/scripts/qmp/qmp-shell
@@ -212,15 +212,13 @@ class QMPShell(qmp.QEMUMonitorProtocol):
raise QMPShellError('Cannot set "%s" multiple times' % key)
parent[optpath[-1]] = value
- def __build_cmd(self, cmdline):
+ def __build_cmd(self, cmdargs):
"""
Build a QMP input object from a user provided command-line in the
following format:
< command-name > [ arg-name1=arg1 ] ... [ arg-nameN=argN ]
"""
- cmdargs = cmdline.split()
-
# Transactional CLI entry/exit:
if cmdargs[0] == 'transaction(':
self._transmode = True
@@ -247,7 +245,7 @@ class QMPShell(qmp.QEMUMonitorProtocol):
finalize = True
self.__cli_expr(cmdargs[1:], action['data'])
self._actions.append(action)
- return self.__build_cmd(')') if finalize else None
+ return self.__build_cmd([')']) if finalize else None
# Standard command: parse and return it to be executed.
qmpcmd = { 'execute': cmdargs[0], 'arguments': {} }
@@ -262,8 +260,9 @@ class QMPShell(qmp.QEMUMonitorProtocol):
print str(jsobj)
def _execute_cmd(self, cmdline):
+ cmdargs = cmdline.split()
try:
- qmpcmd = self.__build_cmd(cmdline)
+ qmpcmd = self.__build_cmd(cmdargs)
except Exception as e:
print 'Error while parsing command line: %s' % e
print 'command format: <command-name> ',
--
2.9.4
- [Qemu-devel] [PATCH for-2.11 4/5] qmp-shell: Accept QMP command as argument, (continued)
- [Qemu-devel] [PATCH for-2.11 4/5] qmp-shell: Accept QMP command as argument, Eduardo Habkost, 2017/08/04
- [Qemu-devel] [PATCH for-2.11 3/5] qmp-shell: execute_cmdargs() method, Eduardo Habkost, 2017/08/04
- [Qemu-devel] [PATCH for-2.11 5/5] Remove scripts/qmp/qmp, Eduardo Habkost, 2017/08/04
- [Qemu-devel] [PATCH for-2.11 1/5] qmp-shell: Use argparse module, Eduardo Habkost, 2017/08/04
- [Qemu-devel] [PATCH for-2.11 2/5] qmp-shell: Pass split cmdargs to __build_cmd(),
Eduardo Habkost <=
- Re: [Qemu-devel] [PATCH for-2.11 0/5] qmp-shell non-interactive mode, delete scripts/qmp/qmp, Fam Zheng, 2017/08/05
- Re: [Qemu-devel] [PATCH for-2.11 0/5] qmp-shell non-interactive mode, delete scripts/qmp/qmp, John Snow, 2017/08/07