Bug 1937204

Summary: Refresh pool failed when storage pool contains volume with broken backing store
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Meina Li <meili>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Meina Li <meili>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: jdenemar, knoel, pkrempa, virt-maint, xuzhang
Target Milestone: rcKeywords: Triaged
Target Release: 8.5   
Hardware: Unspecified   
OS: Unspecified   
URL: ARRAY(0x55723a2c5110)
Whiteboard:
Fixed In Version: libvirt-7.3.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 07:51:47 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: 7.2.0
Embargoed:

Description Meina Li 2021-03-10 06:51:29 UTC
Description of problem:
Refresh pool failed when storage pool contains volume with broken backing store

Version-Release number of selected component (if applicable):
libvirt-7.0.0-8.module+el8.4.0+10233+8b7fd9eb.x86_64
qemu-kvm-5.2.0-10.module+el8.4.0+10217+cbdd2152.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a dir pool.
# virsh pool-dumpxml default 
<pool type='dir'>
  <name>default</name>
  <uuid>7932d41a-daec-4522-b405-d3f0e92b3092</uuid>
  <capacity unit='bytes'>75125227520</capacity>
  <allocation unit='bytes'>17200705536</allocation>
  <available unit='bytes'>57924521984</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 an image with a broken backing store in the storage pool path.
# qemu-img create -f qcow2 -F qcow2 -b 'json:{' -u /var/lib/libvirt/images/test.img 200M
Formatting '/var/lib/libvirt/images/test.img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=209715200 backing_file=json:{ backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16

3. Refresh the default pool.
# virsh pool-refresh default 
error: Failed to refresh pool default
error: internal error: cannot parse json {: parse error: premature EOF
                                       {
                     (right here) ------^


Actual results:
Refresh the pool failed

Expected results:
Refresh the pool successfully

Additional info:
According to https://bugzilla.redhat.com/show_bug.cgi?id=1933050#c8, use this new bug to track the upstream fixes:
commit 104db1951d3abfd8cb363b8e8070f712044bc645
Author: Peter Krempa <pkrempa>
Date:   Thu Feb 25 13:51:51 2021 +0100

    storageBackendProbeTarget: Don't fail if backing store can't be parsed
    
    When the backing store of the image can't be parsed
    virStorageSourceNewFromBacking returns -1. storageBackendProbeTarget
    then also fails which makes the pool refresh fail or even the storage
    pool becomes inactive after (re)start of libvirtd.
    
    In situations when we can't access the backing store via network we
    just report the backing store string, thus we can do the same thing for
    unparsable backing store to prevent the pool from going offline.

Comment 4 Meina Li 2021-05-18 08:49:18 UTC
Verified Version:
virt-7.3.0-1.module+el8.5.0+11004+f4810536.x86_64
qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64

Verified Steps:
1. Prepare a dir pool.
# virsh pool-dumpxml default 
<pool type='dir'>
  <name>default</name>
  <uuid>7932d41a-daec-4522-b405-d3f0e92b3092</uuid>Pool default refreshed

  <capacity unit='bytes'>75125227520</capacity>
  <allocation unit='bytes'>17200705536</allocation>
  <available unit='bytes'>57924521984</available>
  <source>
  </source>
  <target>
    <path>/var/lib/libvirt/images</path>
  </target>
</pool>

2. Create an image with a broken backing store in the storage pool path.
# qemu-img create -f qcow2 -F qcow2 -b 'json:{' -u /var/lib/libvirt/images/test.img 200M
Formatting '/var/lib/libvirt/images/test.img', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=209715200 backing_file=json:{ backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16

3. Refresh the default pool.
# virsh pool-refresh default 
Pool default refreshed

Comment 5 Meina Li 2021-05-18 08:49:53 UTC
Pool default refreshed

Comment 7 errata-xmlrpc 2021-11-16 07:51:47 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 (virt:av bug fix and enhancement update), 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/RHBA-2021:4684