From nobody Sun Feb 8 17:22:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571146522; cv=none; d=zoho.com; s=zohoarc; b=YKV9AGOaE/R93xs12Exug6aRoUeJOGbt/K9wBUJkPF4JmKQcmrWTYL9ojGqXR4sv2mD0/ugqTOfbt7RN7mrBDBGlLz6VYCzWvuvfMUdKOKtRc3nuoRJF6f8SxybyDufM0hVrUfvtjywEGPFQW5sQqnQ1ob6BLgWx6URR3Gx01WE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571146522; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3JISkN4/g+hiCiCXvbB4BJ3Gpa0t7dAfknxRFjQvS20=; b=mB92z5+H+wg0PRDVH/8zElcbuEsDC8o3v2HYp2e3sL98DVfmR1eawwyFC8e1vqnoum/+383AScAWrMxHWrZnFHe/grWqYa1OZbXfIoguV3NLfbuZlNJ6dtqjPy61DkVuncPVludgcPV9TFHMH6q/sJiJWC/z1UNbg/T0bIsu2xo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571146522975493.7183320292929; Tue, 15 Oct 2019 06:35:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06F577BDB0; Tue, 15 Oct 2019 13:35:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6D951001DE0; Tue, 15 Oct 2019 13:35:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7923E18037CD; Tue, 15 Oct 2019 13:35:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9FDZ9wf018331 for ; Tue, 15 Oct 2019 09:35:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2C0881001E75; Tue, 15 Oct 2019 13:35:09 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8B661001DE4 for ; Tue, 15 Oct 2019 13:35:08 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 15 Oct 2019 15:35:03 +0200 Message-Id: <096b6834c866a6fbf2a3c9ca33b5c8d4751d8fcd.1571146430.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] conf: Reset disk type if element is completely missing X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 15 Oct 2019 13:35:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The disk type is not part of source and thus it's parsed earlier. This bypasses the checks when parsing a disk type=3D'network' if it's completely missing the source. Since there are possible active users of this (it was reported as a problem with openstack) fix it by resetting the disk type to '_FILE' for an empty cdrom which is handled correctly. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 4 ++++ tests/qemuxml2xmloutdata/disk-source-pool.xml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c1705a07b6..399804dfbd 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10189,6 +10189,10 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xml= opt, } } + /* Reset def->src->type in case when 'source' was not present */ + if (!source) + def->src->type =3D VIR_STORAGE_TYPE_FILE; + /* Only CDROM and Floppy devices are allowed missing source path * to indicate no media present. LUN is for raw access CD-ROMs * that are not attached to a physical device presently */ diff --git a/tests/qemuxml2xmloutdata/disk-source-pool.xml b/tests/qemuxml2= xmloutdata/disk-source-pool.xml index 78e0449dfd..807d1099ed 100644 --- a/tests/qemuxml2xmloutdata/disk-source-pool.xml +++ b/tests/qemuxml2xmloutdata/disk-source-pool.xml @@ -25,7 +25,7 @@
- + --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list