RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1544325 - libvirt cannot parse json backing file with nbd socket keys
Summary: libvirt cannot parse json backing file with nbd socket keys
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: Unspecified
OS: Linux
medium
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-02-12 07:23 UTC by Han Han
Modified: 2018-10-30 09:54 UTC (History)
6 users (show)

Fixed In Version: libvirt-4.3.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-10-30 09:52:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:54:42 UTC

Description Han Han 2018-02-12 07:23:57 UTC
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:

Comment 1 Peter Krempa 2018-02-14 15:01:53 UTC
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>

Comment 3 Han Han 2018-07-10 09:21:38 UTC
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:{&quot;file.driver&quot;:&quot;gluster&quot;,&quot;file.volume&quot;:&quot;gv0&quot;,&quot;file.path&quot;:&quot;A.qcow2&quot;,&quot;file.debug&quot;:9,&quot;file.server&quot;:[{ &quot;type&quot;:&quot;unix&quot;, &quot;socket&quot;:&quot;/var/run/glusterd.socket&quot;}]}</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:{&quot;file&quot;:{&quot;driver&quot;:&quot;nbd&quot;,&quot;server&quot;:{&quot;path&quot;:&quot;/var/lib/libvirt/images/nbd.socket&quot;, &quot;type&quot;:&quot;unix&quot;}}}</path>
    <format type='raw'/>
  </backingStore>
</volume>

Verified

Comment 5 errata-xmlrpc 2018-10-30 09:52:39 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://access.redhat.com/errata/RHSA-2018:3113


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