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 2001627 - Crash if defining a guest XML with a disk missing the <target> element
Summary: Crash if defining a guest XML with a disk missing the <target> element
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-06 15:11 UTC by Daniel Berrangé
Modified: 2022-05-17 13:03 UTC (History)
6 users (show)

Fixed In Version: libvirt-7.8.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 12:45:32 UTC
Type: Bug
Target Upstream Version: 7.8.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-96331 0 None None None 2021-09-06 15:14:09 UTC
Red Hat Product Errata RHBA-2022:2390 0 None None None 2022-05-17 12:45:58 UTC

Description Daniel Berrangé 2021-09-06 15:11:52 UTC
Description of problem:

Define a new guest XML containing a <disk> that lacks a <target> element e.g.

# cat demo.xml
...
<disk type='block' device='disk'>
 <driver name='qemu' type='raw'/>
 <source dev='/dev/loop0'/>
</disk>
...

# virsh define demo.xml
error: Disconnected from qemu:///system due to end of file
error: Failed to define domain from demo.xml
error: End of file while reading data: Input/output error

Previously this would result in

# virsh define demo.xml
error: Failed to define domain from demo.xml
error: missing target information for device /dev/loop0


This regression was introduced in 7.3.0 upstream libvirt with

commit 61fd7174c2afbe128ef1896198919429bcaca3d7
Author: Peter Krempa <pkrempa>
Date:   Thu Apr 15 17:27:01 2021 +0200

    conf: domain: Move checks from virDomainDiskDefParseXML to virDomainDiskDefValidate
    
    Move the rest of the validations to the vaidation code.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>


Version-Release number of selected component (if applicable):
libvirt-7.6.0-2.el9

How reproducible:
Always

Comment 1 Daniel Berrangé 2021-09-06 15:15:26 UTC
Stack trace is

#1  0x00007fc9afe7fdbe in virDiskNameParse (name=0x0, disk=disk@entry=0x7fc99fe89544, partition=partition@entry=0x0) at ../src/util/virutil.c:377
#2  0x00007fc9afe7ff10 in virDiskNameToIndex (name=<optimized out>) at ../src/util/virutil.c:427
#3  0x00007fc9afeb7b89 in virDomainDiskDefAssignAddress (xmlopt=xmlopt@entry=0x7fc948083010, def=def@entry=0x7fc980019830, vmdef=vmdef@entry=0x7fc980016c40) at ../src/conf/domain_conf.c:7660
#4  0x00007fc9afed5f9a in virDomainDiskDefPostParse (xmlopt=0x7fc948083010, def=0x7fc980016c40, disk=0x7fc980019830) at ../src/conf/domain_conf.c:5416
#5  virDomainDeviceDefPostParseCommon (parseFlags=<optimized out>, xmlopt=0x7fc948083010, def=0x7fc980016c40, dev=0x7fc99fe89640) at ../src/conf/domain_conf.c:5536
#6  virDomainDeviceDefPostParse (dev=0x7fc99fe89640, def=0x7fc980016c40, flags=<optimized out>, xmlopt=0x7fc948083010, parseOpaque=<optimized out>) at ../src/conf/domain_conf.c:5795
#7  0x00007fc9afeb05e9 in virDomainDeviceInfoIterateFlags (def=def@entry=0x7fc980016c40, cb=cb@entry=0x7fc9afed64d0 <virDomainDefPostParseDeviceIterator>, iteratorFlags=iteratorFlags@entry=3, opaque=opaque@entry=0x7fc99fe896d0) at ../src/conf/domain_conf.c:4373
#8  0x00007fc9afedc838 in virDomainDefPostParse (def=0x7fc980016c40, parseFlags=130, xmlopt=0x7fc948083010, parseOpaque=<optimized out>) at ../src/conf/domain_conf.c:6156
#9  0x00007fc9afedd74d in virDomainDefParseNode (xml=<optimized out>, root=<optimized out>, xmlopt=0x7fc948083010, parseOpaque=0x0, flags=130) at ../src/conf/domain_conf.c:20442
#10 0x00007fc9afedd876 in virDomainDefParse (xmlStr=<optimized out>, filename=<optimized out>, xmlopt=0x7fc948083010, parseOpaque=0x0, flags=130) at ../src/conf/domain_conf.c:20397
#11 0x00007fc99c576958 in qemuDomainDefineXMLFlags (conn=0x7fc948015170, xml=0x7fc980003300 "<domain type='kvm'>\n  <name>demo</name>\n  <uuid>87f959c1-c999-4f58-a694-9351676ba49d</uuid>\n  <memory unit='KiB'>2048000</memory>\n  <currentMemory unit='KiB'>2048000</currentMemory>\n  <vcpu placement="..., flags=0) at ../src/qemu/qemu_driver.c:6683
#12 0x00007fc9b0054961 in virDomainDefineXML (conn=0x7fc948015170, xml=0x7fc980003300 "<domain type='kvm'>\n  <name>demo</name>\n  <uuid>87f959c1-c999-4f58-a694-9351676ba49d</uuid>\n  <memory unit='KiB'>2048000</memory>\n  <currentMemory unit='KiB'>2048000</currentMemory>\n  <vcpu placement="...) at ../src/libvirt-domain.c:6314

Comment 2 Peter Krempa 2021-09-09 08:30:29 UTC
5a3c35dc83 qemuxml2argvtest: Add test case for missing disk '<target>'
0404d4fc38 virDomainDiskDefValidate: Move validation of disk target
cf6b34c683 conf: Don't call 'virDomainDiskDefAssignAddress' when disk->dst is NULL
002de683c6 conf: validate: Run global device definition validation before callbacks
7dee442677 conf: validate: Move qemu-specific LUN disk validation to global validation
5ccb39616f qemuDomainDefValidateDiskLunSource: Unbreak error messages

v7.7.0-55-g5a3c35dc83

Comment 4 Han Han 2021-09-30 07:29:30 UTC
Works on libvirt v7.8.0-rc2
➜  ~ virsh define /tmp/xml
error: Failed to define domain from /tmp/xml
error: missing target information for device /dev/sda

Comment 7 Han Han 2021-10-25 02:14:22 UTC
Works on libvirt-7.8.0-1.el9.x86_64:
# virsh define rhel.xml
error: Failed to define domain from rhel.xml
error: missing target information for device /var/lib/libvirt/images/tzimages/RHEL-9.0.0-20210820.3-x86_64.qcow2

Comment 9 errata-xmlrpc 2022-05-17 12:45:32 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 (new packages: libvirt), 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-2022:2390


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