Red Hat Bugzilla – Bug 1367260
key mismatched in http protocol of json backing format
Last modified: 2016-11-03 14:53:25 EDT
Description of problem: For the http protocol of image json backing format, qemu uses file.url while libvirt uses file.uri, which causes mismatch. Version-Release number of selected component (if applicable): qemu-kvm-rhev-2.6.0-20.el7.x86_64 libvirt-2.0.0-5.el7.x86_64 How reproducible: 100% Steps to Reproduce: When using file.uri: # qemu-img create -f qcow2 -b 'json:{"file.driver":"http", "file.uri":"http://10.66.6.236/tune.qcow2"}' /tmp/http.img qemu-img: /tmp/http.img: curl block driver requires an 'url' option When using file.url: # qemu-img create -f qcow2 -b 'json:{"file.driver":"http", "file.url":"http://10.66.6.236/tune.qcow2"}' /tmp/http.img Formatting '/tmp/http.img', fmt=qcow2 size=3221225472 backing_file=json:{"file.driver":"http",, "file.url":"http://10.66.6.236/tune.qcow2"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 Prepare a running VM V-rh6. # virsh attach-disk V-rh6 /tmp/http.img vdb --subdriver qcow2 error: Failed to attach disk error: invalid argument: missing URI in JSON backing volume definition Actual results: As above Expected results: libvirt uses file.url as json key to match qemu. Additional info:
Fixed upstream: commit c2e12b01baaf660abcf87f4a6f470862ac7aca15 Author: Peter Krempa <pkrempa@redhat.com> Date: Tue Aug 16 09:24:12 2016 +0200 utils: storage: Fix JSON field name for uri based storage qemu uses 'url' instead of 'uri'. They unfortunately look very similar.
Verify it on libvirt-2.0.0-6.el7.x86_64 Since http is not whitelisted in current qemu-kvm-rhev, using https protocol to verify the bug. 1. Build up a https server and copy a qcow2 image to the https root dir. 2. Create a json backing image, use sslverify=off due to untrusted https certificate. # qemu-img create -f qcow2 -b 'json:{"file.driver":"https", "file.url":"https://lab.work.me/https", "file.sslverify":"off"}' /var/lib/libvirt/images/https.img Formatting '/var/lib/libvirt/images/https.img', fmt=qcow2 size=524288000 backing_file=json:{"file.driver":"https",, "file.url":"https://lab.work.me/https",, "file.sslverify":"off"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 3. Refresh the default pool # virsh pool-refresh default Pool default refreshed 4. Attach and detach the backing image # virsh list Id Name State ---------------------------------------------------- 15 V running # virsh attach-disk V /var/lib/libvirt/images/https.img vdb --subdriver Disk attached successfully In guest: [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 3G 0 disk ├─vda1 252:1 0 500M 0 part /boot └─vda2 252:2 0 2.5G 0 part ├─rhel-root 253:0 0 2.2G 0 lvm / └─rhel-swap 253:1 0 308M 0 lvm [SWAP] vdb 252:16 0 500M 0 disk # virsh detach-disk V vdb Disk detached successfully
Http protocol: # qemu-img create -f qcow2 -b 'json:{"file.driver":"http", "file.url":"http://10.66.6.236:81/tune.qcow2"}' /var/lib/libvirt/images/http.img Formatting '/var/lib/libvirt/images/http.img', fmt=qcow2 size=104857600 backing_file=json:{"file.driver":"http",, "file.url":"http://10.66.6.236:81/tune.qcow2"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 # virsh pool-refresh default Pool default refreshed
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-2577.html