Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1367260 - key mismatched in http protocol of json backing format
Summary: key mismatched in http protocol of json backing format
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1134878
TreeView+ depends on / blocked
 
Reported: 2016-08-16 05:21 UTC by Han Han
Modified: 2016-11-03 18:53 UTC (History)
5 users (show)

Fixed In Version: libvirt-2.0.0-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:53:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Han Han 2016-08-16 05:21:01 UTC
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:

Comment 2 Peter Krempa 2016-08-16 11:33:50 UTC
Fixed upstream:

commit c2e12b01baaf660abcf87f4a6f470862ac7aca15
Author: Peter Krempa <pkrempa>
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.

Comment 6 Han Han 2016-08-30 02:20:34 UTC
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

Comment 7 Han Han 2016-08-30 09:48:26 UTC
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

Comment 9 errata-xmlrpc 2016-11-03 18:53:25 UTC
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


Note You need to log in before you can comment on or make changes to this bug.