Hi All, I’m using qmp command via “virsh qemu-monitor-command” to perform block related jobs. And in my case, I execute block-commit to commit the changes in the top image to the base image which is encrypted. So in the base parameter, I need a json string which is single quoted to support the encryption parameters. However, the virsh is failed to parse the whole json qmp command. Attempt 1: Single quote without backflash, failed root@host:~# virsh qemu-monitor-command i-9wdfw2x8 "{\"execute\": \"block-commit\", \"arguments\": { \"device\": \"drive-virtio-disk2\", \"job-id\": \"job100\", \"base\":'json:{\"encrypt.key-secret\":\"vol-38973xjl.secret\",\"driver\":\"qcow2\",\"file\":{\"driver\":\"file\",\"filename\":\"/pitrix/data/container/vol-38973xjl.img\"}}', \"top\": \"/pitrix/data/container/vol-38973xjl_ss-2tw7v0mm.img\"}}" error: internal error: cannot parse json {"execute": "block-commit", "arguments": { "device": "drive-virtio-disk2", "job-id": "job100", "base":'json:{"encrypt.key-secret":"vol-38973xjl.secret","driver":"qcow2","file":{"driver":"file","filename":"/pitrix/data/container/vol-38973xjl.img"}}', "top": "/pitrix/data/container/vol-38973xjl_ss-2tw7v0mm.img"}}: lexical error: invalid char in json text. , "job-id": "job100", "base":'json:{"encrypt.key-secret":"vo (right here) ------^ Attempt 2: Single quote with backflash, failed root@host:~# virsh qemu-monitor-command i-9wdfw2x8 "{\"execute\": \"block-commit\", \"arguments\": { \"device\": \"drive-virtio-disk2\", \"job-id\": \"job100\", \"base\":\'json:{\"encrypt.key-secret\":\"vol-38973xjl.secret\",\"driver\":\"qcow2\",\"file\":{\"driver\":\"file\",\"filename\":\"/pitrix/data/container/vol-38973xjl.img\"}}\', \"top\": \"/pitrix/data/container/vol-38973xjl_ss-2tw7v0mm.img\"}}" error: internal error: cannot parse json {"execute": "block-commit", "arguments": { "device": "drive-virtio-disk2", "job-id": "job100", "base":\'json:{"encrypt.key-secret":"vol-38973xjl.secret","driver":"qcow2","file":{"driver":"file","filename":"/pitrix/data/container/vol-38973xjl.img"}}\', "top": "/pitrix/data/container/vol-38973xjl_ss-2tw7v0mm.img"}}: lexical error: invalid char in json text. , "job-id": "job100", "base":\'json:{"encrypt.key-secret":"v (right here) ------^ My libvirt version is 5.7.0, libyajl is 2.1.0. Thanks, Peter Luo |