Bug 1544325
| Summary: | libvirt cannot parse json backing file with nbd socket keys | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Han Han <hhan> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | Han Han <hhan> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.5 | CC: | dyuan, jdenemar, jiyan, lmen, pkrempa, xuzhang |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-4.3.0-1.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-10-30 09:52:39 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: | |||
Fixed upstream:
commit d70d07eef8001b55a5f6b18a2065da2b528d3679
Author: Peter Krempa <pkrempa>
Date: Mon Feb 12 16:16:42 2018 +0100
virstoragetest: Add test case for NBD over unix socket with new syntax
Use the new syntax which uses the 'UnixSocket' type in qemu.
Signed-off-by: Peter Krempa <pkrempa>
commit a3a3de9bc74aea9f56790210948cdb7cf579d84c
Author: Peter Krempa <pkrempa>
Date: Mon Feb 12 15:44:11 2018 +0100
storage: Fix formatting and parsing of qemu type 'UnixSocketAddress'
The documentation for the JSON/qapi type 'UnixSocketAddress' states that
the unix socket path field is named 'path'. Unfortunately qemu uses
'socket' in case of the gluster driver (despite documented otherwise).
Add logic which will format the correct fields while keeping support of
the old spelling.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1544325
Signed-off-by: Peter Krempa <pkrempa>
Verified on libvirt-4.5.0-2.el7.x86_64:
I. Verified on gluster socket:
1. Prepare a gluster volume and qcow2 file A.qcow2 on it.
2. Create json backing images, refresh pool
# qemu-img create -f qcow2 -b 'json:{"file.driver":"gluster","file.volume":"gv0","file.path":"A.qcow2","file.debug":9,"file.server":[{ "type":"unix", "socket":"/var/run/glusterd.socket"}]}' -o backing_fmt=qcow2 /var/lib/libvirt/images/gluster_unix.img
Formatting '/var/lib/libvirt/images/gluster_unix.img', fmt=qcow2 size=10737418240 backing_file=json:{"file.driver":"gluster",,"file.volume":"gv0",,"file.path":"A.qcow2",,"file.debug":9,,"file.server":[{ "type":"unix",, "socket":"/var/run/glusterd.socket"}]} backing_fmt=qcow2 cluster_size=65536 lazy_refcounts=off refcount_bits=16
# virsh pool-refresh default
Pool default refreshed
# virsh vol-dumpxml /var/lib/libvirt/images/gluster_unix.img
<volume type='file'>
<name>gluster_unix.img</name>
<key>/var/lib/libvirt/images/gluster_unix.img</key>
<source>
</source>
<capacity unit='bytes'>10737418240</capacity>
<allocation unit='bytes'>200704</allocation>
<physical unit='bytes'>196768</physical>
<target>
<path>/var/lib/libvirt/images/gluster_unix.img</path>
<format type='qcow2'/>
<permissions>
<mode>0644</mode>
<owner>0</owner>
<group>0</group>
<label>unconfined_u:object_r:virt_image_t:s0</label>
</permissions>
<timestamps>
<atime>1531214226.035902066</atime>
<mtime>1531214226.017901902</mtime>
<ctime>1531214226.017901902</ctime>
</timestamps>
<compat>1.1</compat>
<features/>
</target>
<backingStore>
<path>json:{"file.driver":"gluster","file.volume":"gv0","file.path":"A.qcow2","file.debug":9,"file.server":[{ "type":"unix", "socket":"/var/run/glusterd.socket"}]}</path>
<format type='raw'/>
</backingStore>
</volume>
II. Verified on nbd
1. Prepare a nbd server:
# qemu-nbd -t /tmp/nbd-common -k /var/lib/libvirt/images/nbd.socket
2. Create nbd socket backing file, refresh the pool
# qemu-img create -b 'json:{"file":{"driver":"nbd","server":{"path":"/var/lib/libvirt/images/nbd.socket", "type":"unix"}}}' -f qcow2 -o backing_fmt=raw /var/lib/libvirt/images/nbd4.qcow2
Formatting '/var/lib/libvirt/images/nbd4.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file":{"driver":"nbd",,"server":{"path":"/var/lib/libvirt/images/nbd.socket",, "type":"unix"}}} backing_fmt=raw cluster_size=65536 lazy_refcounts=off refcount_bits=16
# virsh pool-refresh default
Pool default refreshed
# virsh vol-dumpxml /var/lib/libvirt/images/nbd4.qcow2
<volume type='file'>
<name>nbd4.qcow2</name>
<key>/var/lib/libvirt/images/nbd4.qcow2</key>
<source>
</source>
<capacity unit='bytes'>104857600</capacity>
<allocation unit='bytes'>200704</allocation>
<physical unit='bytes'>196616</physical>
<target>
<path>/var/lib/libvirt/images/nbd4.qcow2</path>
<format type='qcow2'/>
<permissions>
<mode>0644</mode>
<owner>0</owner>
<group>0</group>
<label>system_u:object_r:virt_image_t:s0</label>
</permissions>
<timestamps>
<atime>1531214369.466212506</atime>
<mtime>1531214369.456212415</mtime>
<ctime>1531214369.456212415</ctime>
</timestamps>
<compat>1.1</compat>
<features/>
</target>
<backingStore>
<path>json:{"file":{"driver":"nbd","server":{"path":"/var/lib/libvirt/images/nbd.socket", "type":"unix"}}}</path>
<format type='raw'/>
</backingStore>
</volume>
Verified
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/RHSA-2018:3113 |
Description of problem: As subject Version-Release number of selected component (if applicable): qemu-kvm-rhev-2.10.0-20.el7.x86_64 libvirt-3.9.0-12.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1. Create a nbd server # qemu-img create /tmp/4 100M Formatting '/tmp/4', fmt=raw size=104857600 # qemu-nbd --format=raw /tmp/4 -x aa -k /tmp/nbd_4.socket -t 2. Prepare directory pool" # virsh pool-dumpxml default <pool type='dir'> <name>default</name> <uuid>03a38a8d-a7fc-4f6a-be13-b9c4b6935758</uuid> <capacity unit='bytes'>150297640960</capacity> <allocation unit='bytes'>117362593792</allocation> <available unit='bytes'>32935047168</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> 3. Create a json backing file in the dir pool # qemu-img create -b 'json:{"file":{"driver":"nbd","server":{"path":"/tmp/nbd_4.socket", "type":"unix"},"export":"aa"}}' -f qcow2 -o backing_fmt=raw /var/lib/libvirt/images/nbd4.qcow2 Formatting '/var/lib/libvirt/images/nbd4.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file":{"driver":"nbd",,"server":{"path":"/tmp/nbd_4.socket",, "type":"unix"},,"export":"aa"}} backing_fmt=raw cluster_size=65536 lazy_refcounts=off refcount_bits=16 4. Refresh the pool # virsh pool-refresh default error: Failed to refresh pool default error: invalid argument: missing socket path for udp backing server in JSON backing volume definition Actual results: As step4 Expected results: Pool refresh finished. Additional info: