Bug 1540136

Summary: storage volumes with backing store specified via JSON pseudo-protocol are not handled correctly in the storage driver
Product: Red Hat Enterprise Linux 7 Reporter: Peter Krempa <pkrempa>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: gaojianan <jgao>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: dyuan, fjin, hhan, jiyan, lmen, pkrempa, virt-bugs, xuzhang, yafu, yalzhang, yisun
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1540022
: 1664924 (view as bug list) Environment:
Last Closed: 2019-04-24 12:29:02 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: 1540022    
Bug Blocks: 1664924    

Description Peter Krempa 2018-01-30 10:50:41 UTC
+++ This bug was initially created as a clone of Bug #1540022 +++

Description of problem:
As subject

Version-Release number of selected component (if applicable):
libvirt-3.9.0-9.el7.x86_64
qemu-kvm-rhev-2.10.0-18.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running dir storage pool:
# virsh pool-list 
 Name                 State      Autostart 
-------------------------------------------    
 default              active     no  

# 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'>108864774144</allocation>
  <available unit='bytes'>41432866816</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>

2. Create a json backing image with http backend and refresh the pool
# qemu-img create -f qcow2 -b 'json:{"file.driver":"http","file.url":"http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso"}' /var/lib/libvirt/images/http.img -o backing_fmt=raw
Formatting '/var/lib/libvirt/images/http.img', fmt=qcow2 size=797966336 backing_file=json:{"file.driver":"http",,"file.url":"http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso"} backing_fmt=raw cluster_size=65536 lazy_refcounts=off refcount_bits=16

# virsh pool-refresh default
Pool default refreshed

3. dump vol xml of the image
# virsh vol-dumpxml --pool default http.img
<volume type='file'>
  <name>http.img</name>
  <key>/var/lib/libvirt/images/http.img</key>
  <source>
  </source>
  <capacity unit='bytes'>797966336</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196624</physical>
  <target>
    <path>/var/lib/libvirt/images/http.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>1517293323.129138576</atime>
      <mtime>1517293310.520066855</mtime>
      <ctime>1517293310.520066855</ctime>
    </timestamps>
    <compat>1.1</compat>
    <features/>
  </target>
  <backingStore>
    <path>json:{&quot;file.driver&quot;:&quot;http&quot;,&quot;file.url&quot;:&quot;http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso&quot;}</path>
    <format type='raw'/>
  </backingStore>
</volume>

Comment 2 yafu 2018-08-10 09:57:12 UTC
Also failed to to get vol info for json backing image via glusterfs protocal with multiple hosts.

Test steps:
1.Create a json backing image via glusterfs protocal with multiple hosts:
# qemu-img create -f qcow2 -b 'json:{"file.driver":"gluster", "file.volume":"gluster-vol1", "file.path":"test.qcow2","file.server":[ { "type":"tcp", "host":"10.66.70.111", "port":"24007"}, { "type":"tcp", "host":"10.66.4.101", "port":"24007"},{ "type":"tcp", "host":"10.73.130.49", "port":"24007"}]}' /var/lib/libvirt/images/gluster_multi.img
Formatting '/var/lib/libvirt/images/gluster_multi.img', fmt=qcow2 size=1073741824 backing_file=json:{"file.driver":"gluster",, "file.volume":"gluster-vol1",, "file.path":"test.qcow2",,"file.server":[ { "type":"tcp",, "host":"10.66.70.111",, "port":"24007"},, { "type":"tcp",, "host":"10.66.4.101",, "port":"24007"},,{ "type":"tcp",, "host":"10.73.130.49",, "port":"24007"}]} cluster_size=65536 lazy_refcounts=off refcount_bits=16

2.Refresh default pool:
#virsh vol-refresh default

3.# virsh vol-dumpxml gluster_multi.img default
error: cannot stat file 'json:{"file.driver":"gluster", "file.volume":"gluster-vol1", "file.path":"test.qcow2","file.server":[ { "type":"tcp", "host":"10.66.70.111", "port":"24007"}, { "type":"tcp", "host":"10.66.4.101", "port":"24007"},{ "type":"tcp", "host":"10.73.130.49", "port":"24007"}]}': File name too long

Comment 3 Meina Li 2019-01-09 08:20:49 UTC
Reproduced on:
qemu-kvm-rhev-2.12.0-19.el7_6.2.x86_64
libvirt-4.5.0-10.el7_6.3.x86_64
kernel-3.10.0-986.el7.x86_64

Reproduced steps:
1. Prepare a running dir storage pool:
# virsh pool-list 
 Name                 State      Autostart 
-------------------------------------------    
 default              active     no  

2. Create a json backing image with http backend and refresh the pool
# qemu-img create -f qcow2 -b 'json:{"file.driver":"http","file.url":"http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso"}' /var/lib/libvirt/images/http.img -o backing_fmt=raw
Formatting '/var/lib/libvirt/images/http.img', fmt=qcow2 size=797966336 backing_file=json:{"file.driver":"http",,"file.url":"http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso"} backing_fmt=raw cluster_size=65536 lazy_refcounts=off refcount_bits=16
# virsh pool-refresh default
Pool default refreshed

3. dump vol xml of the image.
# virsh vol-dumpxml http.img default
<volume type='file'>
  <name>http.img</name>
  <key>/var/lib/libvirt/images/http.img</key>
  <source>
  </source>
  <capacity unit='bytes'>797966336</capacity>
  <allocation unit='bytes'>200704</allocation>
  <physical unit='bytes'>196624</physical>
  <target>
    <path>/var/lib/libvirt/images/http.img</path>
    <format type='qcow2'/>
    ...
    <features/>
  </target>
  <backingStore>
    <path>json:{&quot;file.driver&quot;:&quot;http&quot;,&quot;file.url&quot;:&quot;http://ftp.sjtu.edu.cn/ubuntu-cd/12.04/ubuntu-12.04.5-alternate-amd64.iso&quot;}</path>
    <format type='raw'/>
  </backingStore>
</volume>

Comment 5 Jaroslav Suchanek 2019-04-24 12:29:02 UTC
This bug is going to be addressed in next major release within existing cloned bug.