Bug 1451557
Summary: | Update json parsing in libvirt | ||||||
---|---|---|---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Yanqiu Zhang <yanqzhan> | ||||
Component: | libvirt | Assignee: | Peter Krempa <pkrempa> | ||||
Status: | CLOSED ERRATA | QA Contact: | Han Han <hhan> | ||||
Severity: | unspecified | Docs Contact: | |||||
Priority: | high | ||||||
Version: | 7.4 | CC: | dyuan, hhan, kuwei, lmen, mxie, mzhan, pkrempa, rbalakri, tzheng, xuzhang, yanqzhan, yisun | ||||
Target Milestone: | rc | ||||||
Target Release: | --- | ||||||
Hardware: | x86_64 | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | libvirt-3.7.0-1.el7 | Doc Type: | If docs needed, set a value | ||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2018-04-10 10:44:33 UTC | Type: | Bug | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 1473046 | ||||||
Attachments: |
|
Since the new json interfaces added in qemu-2.9, the former json formats in BZ1134878 and BZ1371758 don't work. Libvirt should update codes in json parsing to catch up with changes in qemu-2.9. Also reproduce for gluster ServerType is 'inet': Pkgs version: libvirt-3.2.0-10.virtcov.el7.x86_64 qemu-kvm-rhev-2.9.0-10.el7.x86_64 Steps: 1.# qemu-img create -f qcow2 -b 'json:{"file.driver":"gluster","file.volume":"gluster-vol1","file.path":"R.qcow2","file.logfile":"/tmp/log","file.debug":9,"file.server":[ {"type":"inet","host":"10.66.*.*","port":"24007"}]}' /var/lib/libvirt/images/gluster_socket.img Formatting '/var/lib/libvirt/images/gluster_socket.img', fmt=qcow2 size=104857600 backing_file=json:{"file.driver":"gluster",,"file.volume":"gluster-vol1",,"file.path":"R.qcow2",,"file.logfile":"/tmp/log",,"file.debug":9,,"file.server":[ {"type":"inet",,"host":"10.66.*.*",,"port":"24007"}]} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 # ls /var/lib/libvirt/images/ gluster_socket.img 2.# virsh pool-refresh default error: Failed to refresh pool default error: internal error: unknown backing store transport protocol 'inet' Inet type for gluster is added since commit fce5d538 in qemu-2.9. Upstream fixes the issues pointed out in this bug by: commit 1f915d40a220c6bb05d8630507eed045cabfba34 Author: Peter Krempa <pkrempa> Date: Mon Jun 19 14:37:47 2017 +0200 util: storage: Add support for type 'inet' in virStorageSourceParseBackingJSONSocketAddress 'SocketAddress' structure was changed to contain 'inet' instead of 'tcp' since qemu commit c5f1ae3ae7b. Existing entries have a backward compatibility layer. commit 4fac5a1935041254964313ed722fa8d59f8fa2de Author: Peter Krempa <pkrempa> Date: Thu Jun 15 17:44:18 2017 +0200 util: storage: adapt to changes in JSON format for ceph/rbd Since qemu 2.9 the options changed from a monolithic string into fine grained options for the json pseudo-protocol object. Hi Peter, Please add the patches 'util: storage: adapt to changes in JSON format for sheepdog' because libvirt also couldn't recognize the new json format in sheepdog. Well, here is the rest of the upstream commits not mentioned above: commit b16133b114fd0d787de1cda6bf2ff0110c523a32 Author: Peter Krempa <pkrempa> Date: Thu Jun 15 17:44:18 2017 +0200 util: storage: adapt to changes in JSON format for sheepdog Since qemu 2.9 the options changed from a monolithic string into fine grained options for the json pseudo-protocol object. commit ea2c418ac30628d1db021f351f0ea5440ba5e4e4 Author: Peter Krempa <pkrempa> Date: Thu Jun 15 17:44:18 2017 +0200 util: storage: adapt to changes in JSON format for ssh Since qemu 2.9 the options changed from a monolithic string into fine grained options for the json pseudo-protocol object. commit 35d23f90b2266adb93079755161515699a401932 Author: Peter Krempa <pkrempa> Date: Thu Jun 15 17:44:18 2017 +0200 util: storage: adapt to changes in JSON format for NBD Since 2.9 the host and port for NBD are no longer directly under the json pseudo-protocol object, but rather belong to a sub-object called 'server'. commit b24bc54080b4bc444e60560c0db00c5867e74000 Author: Peter Krempa <pkrempa> Date: Thu Jun 15 17:12:01 2017 +0200 util: storage: Add JSON parser for new options in iSCSI protocol Starting from qemu 2.9, more granular options are supported. Add parser for the relevant bits. With this patch libvirt is able to parse the host and target IQN of from the JSON pseudo-protocol specification. This corresponds to BlockdevOptionsIscsi in qemu qapi. Verified on qemu-kvm-rhev-2.10.0-5.el7.x86_64 libvirt-3.9.0-1.el7.x86_64 ################################################## Prepare json backing images #################### 1. On rbd protocol Build ceph server environment i. with "conf" key Prepare a ceoh conf file: # cat /tmp/ceph.conf [global] fsid = ab720744-845c-4f18-bd3c-fa61d62f0840 mon_initial_members = mon, osd1, osd2 mon_host = XX.XX.XX.XX,XX.XX.XX.XX,XX.XX.XX.XX auth_cluster_required = none auth_service_required = none auth_client_required = none filestore_xattr_use_omap = true # qemu-img create -b 'json:{"file": { "driver": "rbd", "pool": "rbd", "image": "lmen.img","conf": "/tmp/ceph.conf" } }' -f qcow2 /var/lib/libvirt/images/ceph-conf.qcow2 Formatting '/var/lib/libvirt/images/ceph-conf.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file": { "driver": "rbd",, "pool": "rbd",, "image": "lmen.img",,"conf": "/tmp/ceph.conf" } } cluster_size=65536 lazy_refcounts=off refcount_bits=16 ii. with "server" key # qemu-img create -b 'json:{"file": { "driver": "rbd", "pool": "rbd", "image": "lmen.img", "server": [{"host": "XX.XX.XX.XX", "port": "6789"}] } }' -f qcow2 /var/lib/libvir t/images/ceph-server.qcow2 Formatting '/var/lib/libvirt/images/ceph-server.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file": { "driver": "rbd",, "pool": "rbd",, "image": "lmen.img",, "serve r": [{"host": "XX.XX.XX.XX",, "port": "6789"}] } } cluster_size=65536 lazy_refcounts=off refcount_bits=16 iii. with snapshot # qemu-img create -b 'json:{"file": { "driver": "rbd", "pool": "rbd", "image": "lmen.img","conf": "/tmp/ceph.conf", "snapshot": "sn1" } }' -f qcow2 /var/lib/libvirt/images/ceph-server-snap.qcow2 Formatting '/var/lib/libvirt/images/ceph-server-snap.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file": { "driver": "rbd",, "pool": "rbd",, "image": "lmen.img",,"conf": "/tmp/ceph.conf",, "snapshot": "sn1" } } cluster_size=65536 lazy_refcounts=off refcount_bits=16 2. On sheepdog protocol: Build sheepdog server # qemu-img create -b 'json:{"file":{"driver":"sheepdog","server":{"host":"XX.XX.XX.XX","port":"7000","type":"inet"},"tag":"","vdi":"Alice"}}' -f qcow2 /var/lib/libvirt/images/sheepdog.qcow2 Formatting '/var/lib/libvirt/images/sheepdog.qcow2', fmt=qcow2 size=5368709120 backing_file=json:{"file":{"driver":"sheepdog",,"server":{"host":"XX.XX.XX.XX",,"port":"7000",,"type":"inet"},,"tag":"",,"vdi":"Alice"}} cluster_size=65536 lazy_refcounts=off refcount_bits=16 3. On ssh protocol: # eval ssh-agent # ssh-add /root/.ssh/id_rsa Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa) # qemu-img create -b 'json:{"file":{"driver":"ssh","server":{"host":"XX.XX.XX.XX","port":"22"},"path":"/tmp/ssh","user":"root","host_key_check":"no"}}' -f qcow2 /var/lib/libvirt/images/ssh.qcow2 Formatting '/var/lib/libvirt/images/ssh.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file":{"driver":"ssh",,"server":{"host":"XX.XX.XX.XX",,"port":"22"},,"path":"/tmp/ssh",,"user":"root",,"host_key_check":"no"}} cluster_size=65536 lazy_refcounts=off refcount_bits=16 4. On nbd protocol: Setup nbd server, one with exportname, one without exportname # qemu-img create -b 'json:{"file":{"driver":"nbd","server":{"host":"XX.XX.XX.XX","port":"10000", "type":"inet"}}}' -f qcow2 /var/lib/libvirt/images/nbd.qcow2 Formatting '/var/lib/libvirt/images/nbd.qcow2', fmt=qcow2 size=1073741824 backing_file=json:{"file":{"driver":"nbd",,"server":{"host":"XX.XX.XX.XX",,"port":"10000",, "type":"inet"}}} cluster_size=65536 lazy_refcounts=off refcount_bits=16 # qemu-img create -b 'json:{"file":{"driver":"nbd","server":{"host":"XX.XX.XX.XX","port":"10001", "type":"inet"}, "export": "nbd"}}' -f qcow2 /var/lib/libvirt/images/nbd-export.qcow2 Formatting '/var/lib/libvirt/images/nbd-export.qcow2', fmt=qcow2 size=1073741824 backing_file=json:{"file":{"driver":"nbd",,"server":{"host":"XX.XX.XX.XX",,"port":"10001",, "type":"inet"},, "export": "nbd"}} cluster_size=65536 lazy_refcounts=off refcount_bits=16 5. On iscsi protocol: Setup iscsi server # qemu-img create -b 'json:{"file":{"driver":"iscsi", "transport": "tcp", "portal": "XX.XX.XX.XX:3260", "target": "iqn.2017-08.com.virttest:emulated-iscsi-noauth.target1"}}' -f qcow2 /var/lib/libvirt/images/iscsi.qcow2 Formatting '/var/lib/libvirt/images/iscsi.qcow2', fmt=qcow2 size=0 backing_file=json:{"file":{"driver":"iscsi",, "transport": "tcp",, "portal": "XX.XX.XX.XX:3260",, "target": "iqn.2017-08.com.virttest:emulated-iscsi-noauth.target1"}} cluster_size=65536 lazy_refcounts=off refcount_bits=16 ################################################## Pool refresh #################### Refresh the pool where images are located in # virsh pool-dumpxml default <pool type='dir'> <name>default</name> <uuid>03a38a8d-a7fc-4f6a-be13-b9c4b6935758</uuid> <capacity unit='bytes'>107347968000</capacity> <allocation unit='bytes'>40656568320</allocation> <available unit='bytes'>66691399680</available> <source> </source> <target> <path>/var/lib/libvirt/images</path> <permissions> <mode>0711</mode> <owner>0</owner> <group>0</group> <label>system_u:object_r:virt_image_t:s0</label> </permissions> </target> </pool> # virsh pool-refresh default Pool default refreshed Pool refresh operation works well. ################################################## Attach/detach backing images #################### Images backing on rbd, nbd, iscsi supports attach/detach operations # virsh list Id Name State ---------------------------------------------------- 2 V running # virsh attach-disk V /var/lib/libvirt/images/ceph-conf.qcow2 vdb --subdriver qcow2 Disk attached successfully # virsh attach-disk V /var/lib/libvirt/images/ceph-server.qcow2 vdc --subdriver qcow2 Disk attached successfully # virsh attach-disk V /var/lib/libvirt/images/ceph-server-snap.qcow2 vdd --subdriver qcow2 Disk attached successfully # virsh attach-disk V /var/lib/libvirt/images/nbd.qcow2 vde --subdriver qcow2 Disk attached successfully # virsh attach-disk V /var/lib/libvirt/images/nbd-export.qcow2 vdf --subdriver qcow2 Disk attached successfully # virsh attach-disk V /var/lib/libvirt/images/iscsi.qcow2 vdg --subdriver qcow2 Disk attached successfully # virsh domblklist V Target Source ------------------------------------------------ vda /var/lib/libvirt/images/V.qcow2 vdb /var/lib/libvirt/images/ceph-conf.qcow2 vdc /var/lib/libvirt/images/ceph-server.qcow2 vdd /var/lib/libvirt/images/ceph-server-snap.qcow2 vde /var/lib/libvirt/images/nbd.qcow2 vdf /var/lib/libvirt/images/nbd-export.qcow2 vdg /var/lib/libvirt/images/iscsi.qcow2 # virsh domstats V Domain: 'V' state.state=1 state.reason=1 cpu.time=26280337141 cpu.user=2470000000 cpu.system=4630000000 balloon.current=1048576 balloon.maximum=1048576 balloon.swap_in=0 balloon.swap_out=0 balloon.major_fault=194 balloon.minor_fault=174428 balloon.unused=899064 balloon.available=1016140 balloon.usable=848020 balloon.last-update=1510294598 balloon.rss=493100 vcpu.current=1 vcpu.maximum=1 vcpu.0.state=1 vcpu.0.time=20610000000 vcpu.0.wait=0 vcpu.0.halted=yes net.count=1 net.0.name=vnet0 net.0.rx.bytes=2461498 net.0.rx.pkts=32506 net.0.rx.errs=0 net.0.rx.drop=0 net.0.tx.bytes=26284 net.0.tx.pkts=353 net.0.tx.errs=0 net.0.tx.drop=0 block.count=7 block.0.name=vda block.0.path=/var/lib/libvirt/images/V.qcow2 block.0.rd.reqs=5436 block.0.rd.bytes=134632960 block.0.rd.times=20979604363 block.0.wr.reqs=879 block.0.wr.bytes=15651328 block.0.wr.times=701348343 block.0.fl.reqs=325 block.0.fl.times=5570312840 block.0.allocation=1091702784 block.0.capacity=10737418240 block.0.physical=1336868864 block.1.name=vdb block.1.path=/var/lib/libvirt/images/ceph-conf.qcow2 block.1.rd.reqs=45 block.1.rd.bytes=1069056 block.1.rd.times=4312097 block.1.wr.reqs=0 block.1.wr.bytes=0 block.1.wr.times=0 block.1.fl.reqs=0 block.1.fl.times=0 block.1.allocation=0 block.1.capacity=104857600 block.1.physical=200704 block.2.name=vdc block.2.path=/var/lib/libvirt/images/ceph-server.qcow2 block.2.rd.reqs=45 block.2.rd.bytes=1069056 block.2.rd.times=4373913 block.2.wr.reqs=0 block.2.wr.bytes=0 block.2.wr.times=0 block.2.fl.reqs=0 block.2.fl.times=0 block.2.allocation=0 block.2.capacity=104857600 block.2.physical=200704 block.3.name=vdd [139/785] block.3.path=/var/lib/libvirt/images/ceph-server-snap.qcow2 block.3.rd.reqs=45 block.3.rd.bytes=1069056 block.3.rd.times=2498727 block.3.wr.reqs=0 block.3.wr.bytes=0 block.3.wr.times=0 block.3.fl.reqs=0 block.3.fl.times=0 block.3.allocation=0 block.3.capacity=104857600 block.3.physical=200704 block.4.name=vde block.4.path=/var/lib/libvirt/images/nbd.qcow2 block.4.rd.reqs=45 block.4.rd.bytes=1069056 block.4.rd.times=146089292 block.4.wr.reqs=0 block.4.wr.bytes=0 block.4.wr.times=0 block.4.fl.reqs=0 block.4.fl.times=0 block.4.allocation=0 block.4.capacity=1073741824 block.4.physical=200704 block.5.name=vdf block.5.path=/var/lib/libvirt/images/nbd-export.qcow2 block.5.rd.reqs=42 block.5.rd.bytes=1015808 block.5.rd.times=45997635 block.5.wr.reqs=0 block.5.wr.bytes=0 block.5.wr.times=0 block.5.fl.reqs=0 block.5.fl.times=0 block.5.allocation=0 block.5.capacity=1073741824 block.5.physical=200704 block.6.name=vdg block.6.path=/var/lib/libvirt/images/iscsi.qcow2 block.6.rd.reqs=0 block.6.rd.bytes=0 block.6.rd.times=0 block.6.wr.reqs=0 block.6.wr.bytes=0 block.6.wr.times=0 block.6.fl.reqs=0 block.6.fl.times=0 block.6.allocation=0 block.6.physical=196608 # virsh detach-disk V /var/lib/libvirt/images/ceph-conf.qcow2 Disk detached successfully # virsh detach-disk V /var/lib/libvirt/images/ceph-server.qcow2 Disk detached successfully # virsh detach-disk V /var/lib/libvirt/images/ceph-server-snap.qcow2 Disk detached successfully # virsh detach-disk V /var/lib/libvirt/images/nbd.qcow2 Disk detached successfully # virsh detach-disk V /var/lib/libvirt/images/nbd-export.qcow2 Disk detached successfully # virsh detach-disk V /var/lib/libvirt/images/iscsi.qcow2 Disk detached successfully Attach/detach works well. Bug fixed. 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://access.redhat.com/errata/RHEA-2018:0704 |
Created attachment 1279524 [details] libvirtd.log Description of problem: qemu involved in "pool image" json format for rbd protocol from 8a47e8eb, libvirt failed to parse it. Version-Release number of selected component (if applicable): libvirt-3.2.0-5.el7.x86_64 qemu-kvm-rhev-2.9.0-5.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.# qemu-img create -f qcow2 -b 'json:{"driver": "raw", "file": {"pool": "rbd", "image": "rbd.img", "driver": "rbd", "=keyvalue-pairs": "[\"mon_host\", \"10.73.75.52\"]"}}' /var/lib/libvirt/images/rbd.img Formatting '/var/lib/libvirt/images/rbd.img', fmt=qcow2 size=5368709120 backing_file=json:{"driver": "raw",, "file": {"pool": "rbd",, "image": "rbd.img",, "driver": "rbd",, "=keyvalue-pairs": "[\"mon_host\",, \"10.73.75.52\"]"}} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16 2.# virsh pool-refresh default error: Failed to refresh pool default error: invalid argument: missing RBD filename in JSON backing volume definition 3.# virsh pool-list --all Name State Autostart ------------------------------------------- default inactive yes Actual results: As in step2, libvirt failed to parse "pool image" json format for rbd protocol Expected results: qemu involved in "pool image" json format from 8a47e8eb, libvirt should support this. Additional info: # cat /var/log/libvirt/libvirtd.log|grep ' error ' 2017-05-17 03:22:33.848+0000: 59387: error : virStorageSourceParseBackingJSONRBD:3053 : invalid argument: missing RBD filename in JSON backing volume definition