From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47521) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ykjzx-0005Wl-KS for qemu-devel@nongnu.org; Tue, 21 Apr 2015 22:02:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ykjzu-0005Kt-Re for qemu-devel@nongnu.org; Tue, 21 Apr 2015 22:02:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55146) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ykjzu-0005Kf-Kn for qemu-devel@nongnu.org; Tue, 21 Apr 2015 22:02:42 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3M22gn2017472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 Apr 2015 22:02:42 -0400 From: John Snow Date: Tue, 21 Apr 2015 22:02:32 -0400 Message-Id: <1429668155-1606-3-git-send-email-jsnow@redhat.com> In-Reply-To: <1429668155-1606-1-git-send-email-jsnow@redhat.com> References: <1429668155-1606-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PATCH 2/5] scripts: qmp-shell: add support for [] expressions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: lcapitulino@redhat.com, John Snow , kchamart@redhat.com qmp-shell currently allows you to describe values as JSON expressions: key={"key":{"key2":"val"}} But it does not currently support arrays, which are needed for serializing and deserializing transactions: key=[{"type":"drive-backup","data":{...}}] Add support for arrays. CAVEAT: The parser is still extremely rudimentary and does not expect to find spaces in {} nor [] expressions. This patch does not improve this functionality. Signed-off-by: John Snow --- scripts/qmp/qmp-shell | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/qmp/qmp-shell b/scripts/qmp/qmp-shell index a9632ec..5347f89 100755 --- a/scripts/qmp/qmp-shell +++ b/scripts/qmp/qmp-shell @@ -102,6 +102,8 @@ class QMPShell(qmp.QEMUMonitorProtocol): value = False elif opt[1].startswith('{'): value = json.loads(opt[1]) + elif opt[1].startswith('['): + value = json.loads(opt[1]) else: value = opt[1] optpath = opt[0].split('.') -- 2.1.0