Bug 1804603

Summary: <backingStore type='volume'> reports wrong error and doesn't work
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Peter Krempa <pkrempa>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: gaojianan <jgao>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.2CC: jdenemar, jgao, jsuchane, lmen, virt-maint, xuzhang, yisun
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-6.0.0-6.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-05 09:57:19 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:

Description Peter Krempa 2020-02-19 09:13:26 UTC
Description of problem:
When explicitly specifying a <backingStore type='volume'> libvirt reports:

"An error occurred, but the cause is unknown" and 


How reproducible:
100%

Steps to Reproduce:
1.
    <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='test' volume='overlay'/>
      <backingStore type='volume'>
        <format type='qcow2'/>
        <source pool='test' volume='base'/>
        <backingStore/>
      </backingStore>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>

2. virsh start VM
3.

Actual results:
   $ virsh start VM
   error: Failed to start domain VM
   error: An error occurred, but the cause is unknown

Expected results:
   VM starts and uses the proper volume (in -blockdev mode)


Additional info:

Comment 1 Peter Krempa 2020-02-19 09:15:57 UTC
Fixed upstream by:

37f01262ee virDomainDiskTranslateSourcePool: Translate 'volume' disks in whole backing chain
63469116cc virDomainDiskTranslateSourcePool: split code to setup one storage source
bc42d88ffd virDomainDiskTranslateISCSIDirect: Take virStorageSourcePtr instead of virDomainDiskDefPtr
4fca8299c5 virDomainDiskTranslateSourcePoolAuth: Take virStorageSourcePtr instead of virDomainDiskDefPtr
47cad72553 virDomainDiskAddISCSIPoolSourceHost: Take virStorageSourcePtr instead of virDomainDiskDefPtr
e20c5b1703 virDomainDiskAddISCSIPoolSourceHost: Remove ternary operator
4d5093ef75 virDomainDiskAddISCSIPoolSourceHost: Remove 'cleanup' label
5eda34f2e1 virDomainDiskAddISCSIPoolSourceHost: use g_new0 instead of VIR_ALLOC_N
c5b1c14379 virDomainDiskAddISCSIPoolSourceHost: Sanitize handling of string list
4e3e69fed4 qemuBlockStorageSourceGetBackendProps: Report errors on all switch cases

Comment 5 gaojianan 2020-03-03 07:02:04 UTC
Verified on :
libvirt-6.0.0-7.virtcov.el8.x86_64

Step:
1.Edit the vm2 with the following xml:
...
   <disk type='volume' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source pool='default' volume='test.img'/>
      <backingStore type='volume'>
        <format type='qcow2'/>
        <source pool='default' volume='a.iso'/>
        <backingStore/>
      </backingStore>
      <target dev='vdb' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </disk>
...

2.Try to start the vm
# virsh start vm2
Domain vm2 started

Guest start without any error


qemu cmd line:
...
-blockdev '{"node-name":"libvirt-3-format","read-only":false,"driver":"qcow2","file":"libvirt-3-storage","backing":null}' -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x6,drive=libvirt-3-format,id=virtio-disk0,bootindex=1 -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/a.iso","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' -blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2","file":"libvirt-2-storage","backing":null}' -blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/test.img","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}' -blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}'
...


Work as expected.

Comment 7 errata-xmlrpc 2020-05-05 09:57:19 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/RHBA-2020:2017