Bug 1964744

Summary: Should hit error when blockcopy disk with invalid --format value
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Meina Li <meili>
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Meina Li <meili>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.5CC: jdenemar, lmen, phrdina, virt-maint, xuzhang
Target Milestone: rcKeywords: Automation, Regression, Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.5.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 07:53:34 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.5.0
Embargoed:

Description Meina Li 2021-05-26 01:40:50 UTC
Description of problem:
Should hit error when blockcopy disk with invalid --format value

Version-Release number of selected component (if applicable):
libvirt-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

How reproducible:
100%

Steps to Reproduce:
1. Prepare a running guest.
# virsh domstate avocado-vt-vm1
running

2. Blockcopy the disk to a file with invalid format
# virsh blockcopy avocado-vt-vm1 vda /tmp/test.img --format fda --transient-job
Block Copy started

Actual results:
Can blockcopy successfully with invalid format for the destination

Expected results:
Should hit error:
error: unsupported configuration: unknown driver format value 'fda'

Additional info:

Comment 1 Pavel Hrdina 2021-05-26 13:10:28 UTC
Broken by upstream commit:

commit 0202467c4ba8663db2304b140af609f93a9b3091
Author: Peter Krempa <pkrempa>
Date:   Wed Apr 14 16:43:22 2021 +0200

    qemu: driver: Use virDomainDiskDefParseSource in qemuDomainBlockCopy

Comment 2 Pavel Hrdina 2021-06-01 13:33:56 UTC
Upstream commits:

9d225ea284 virDomainDiskDefParseSource: parse source bits from driver element
fe6ed00ef7 domain_conf: extract disk driver source bits to its own function

Will be fixed by the next rebase to libvirt-7.5.0.

Comment 3 Meina Li 2021-06-30 06:54:24 UTC
Verified:tested is passed on:
libvirt-7.0.0-4.fc34.x86_64
qemu-kvm-5.2.0-8.fc34.x86_64

Expected result:
# virsh blockcopy lmn vda /tmp/test.img --format fda --transient-job
error: unsupported configuration: unknown driver format value 'fda'

Comment 6 Meina Li 2021-07-14 03:11:27 UTC
Verified Version:
libvirt-7.5.0-1.module+el8.5.0+11664+59f87560.x86_64
qemu-kvm-6.0.0-23.module+el8.5.0+11740+35571f13.x86_64

Verified Steps:
1. Start a guest with the following disk:
# virsh dumpxml lmn | grep /disk -B5
    <disk type='file' device='disk' snapshot='no'>
      <driver name='qemu' type='qcow2' cache='none' detect_zeroes='on' queues='1024'/>
      <source file='/var/lib/libvirt/images/lmn.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
2. Blockcopy the disk to a file with invalid format
# virsh blockcopy lmn vda /tmp/test.img --format fda --transient-job
error: unsupported configuration: unknown driver format value 'fda'
3. Blockcopy the disk to a file with valid format.
# virsh blockcopy lmn vda /tmp/test.img --format raw --transient-job --pivot --wait --verbose
Block Copy: [100 %]
Successfully pivoted

Comment 8 errata-xmlrpc 2021-11-16 07:53:34 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