qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Regression: Nested JSON structs in 'qmp-shell'


From: Kashyap Chamarthy
Subject: [Qemu-devel] Regression: Nested JSON structs in 'qmp-shell'
Date: Mon, 4 Feb 2019 15:11:24 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]