提交 7f33ca78 编写于 作者: L Lukáš Doktor 提交者: Eduardo Habkost

qemu.py: Use iteritems rather than keys()

Let's avoid creating an in-memory list of keys and query for each value
and use `iteritems` which is an iterator of key-value pairs.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
Reviewed-by: NEduardo Habkost <ehabkost@redhat.com>
Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170818142613.32394-4-ldoktor@redhat.com>
Reviewed-by: NCleber Rosa <crosa@redhat.com>
Signed-off-by: NEduardo Habkost <ehabkost@redhat.com>
上级 2782fc51
......@@ -200,11 +200,11 @@ class QEMUMachine(object):
def qmp(self, cmd, conv_keys=True, **args):
'''Invoke a QMP command and return the response dict'''
qmp_args = dict()
for key in args.keys():
for key, value in args.iteritems():
if conv_keys:
qmp_args[key.translate(self.underscore_to_dash)] = args[key]
qmp_args[key.translate(self.underscore_to_dash)] = value
else:
qmp_args[key] = args[key]
qmp_args[key] = value
return self._qmp.cmd(cmd, args=qmp_args)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册