qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kashyap Chamarthy <kchamart@redhat.com>
To: qemu-devel@nongnu.org
Cc: jsnow@redhat.com, marcandre.lureau@redhat.com, armbru@redhat.com
Subject: [Qemu-devel] Regression: Nested JSON structs in 'qmp-shell'
Date: Mon, 4 Feb 2019 15:11:24 +0100	[thread overview]
Message-ID: <20190204141124.GJ5349@paraplu.home> (raw)

Hi,

Just noticed that this commit fcfab7541 ("qmp-shell: learn to send
commands with quoted arguments"), which introduces the usage of Python
'shlex' to handle quoted arguments, but it accidentally broke generation
of nested JSON structs.

With commit fcfab7541, you'll see the following brokenness:

    (QEMU) blockdev-create job-id=job0 options={"driver":"qcow2","size":16384,"file":{"driver":"file","filename":"foo.qcow2"}}
    {
        "execute": "blockdev-create", 
        "arguments": {
            "job-id": "job0", 
            "options": "{driver:qcow2,size:16384,file:{driver:file,filename:foo.qcow2}}"
        }
    }
    {
        "error": {
            "class": "GenericError", 
            "desc": "Invalid parameter type for 'options', expected: object"
        }
    }


If I revert commit fcfab7541, then the same 'qmp-shell' invocation
generates the _correct_ nested JSON:

    (QEMU) blockdev-create job-id=job0 options={"driver":"qcow2","size":16384,"file":{"driver":"file","filename":"foo.qcow2"}}                                                                    
    {                                                                                                                                                                                             
        "execute": "blockdev-create",                                                                                                                                                             
        "arguments": {                                                                                                                                                                            
            "job-id": "job000000000",                                                                                                                                                                     
            "options": {                                                                                                                                                                          
                "driver": "qcow2",                                                                                                                                                                
                "file": {                                                                                                                                                                         
                    "driver": "file",                                                                                                                                                             
                    "filename": "foo.qcow2"                                                                                                                                                       
                },                                                                                                                                                                                
                "size": 16384
            }                                                                                                                                                                                     
        }                                                                                                                                                                                         
    }                                                                                                                                                                                             
    {                                                                                                                                                                                             
        "return": {}                                                                                                                                                                              
    }                      


-- 
/kashyap

                 reply	other threads:[~2019-02-04 14:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190204141124.GJ5349@paraplu.home \
    --to=kchamart@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).