From nobody Mon Feb 9 01:22:43 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=1561473257; cv=none; d=zoho.com; s=zohoarc; b=PwPzoK04Bf0lhQqQ63e0mxBGqg0V2MwT2lBJnr9stBemMvWXi0W6xmbFDLzlb8ZrooqDwGHimXqYi0eIgpFNosCvJUtOCLz6vesk5V2G/1SnQpOeVrVVUjRpWgIge43RbxPMsWq+vo7JVOsSznVvUvG8wzb7uOr/FmzZYAWpSik= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561473257; 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:ARC-Authentication-Results; bh=IeFV/mFQzKEP7VQxV+m7p359OTSiU1sY8FsPKqnrknY=; b=ZGAe+6tP27415gBeswq2KBiOh51Ss4Tn4HrRQb7oCTnuam0J8Bz6Inb+1Iucd+capyNq75L1xubMbUMvaNicXzkQHG32vhm+wlaEQjjdbUPzGRHpJ1xcVKAeyD5v7fvZuO/Xjs4k+5yqj/0rprj3PcKRs88TDMPU7pj/nKC8VEc= 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 1561473257965266.7408418410663; Tue, 25 Jun 2019 07:34:17 -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 5B5CE301E132; Tue, 25 Jun 2019 14:34:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2815310027D6; Tue, 25 Jun 2019 14:34:07 +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 D4237206D5; Tue, 25 Jun 2019 14:34:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5PEUm9m005524 for ; Tue, 25 Jun 2019 10:30:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id E7464196E5; Tue, 25 Jun 2019 14:30:48 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 71DF719732 for ; Tue, 25 Jun 2019 14:30:48 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 16:30:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/4] qemu: Supply correct default type for 'dir' based VIR_STORAGE_TYPE_VOLUME 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.41]); Tue, 25 Jun 2019 14:34:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Our code would skip adding the default type in this cases, but since we know that the only reasonable option here is 'fat' we can add it while starting the VM. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 12 +++++++++--- tests/qemuxml2argvdata/disk-source-pool.args | 4 ++++ tests/qemuxml2argvdata/disk-source-pool.xml | 6 ++++++ tests/qemuxml2xmloutdata/disk-source-pool.xml | 7 +++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5b72b7f7bf..d71d9b3273 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -14217,10 +14217,16 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr d= isk, { qemuDomainPrepareDiskCachemode(disk); - /* add raw file format if the storage pool did not fill it in */ + /* set default format for storage pool based disks */ if (disk->src->type =3D=3D VIR_STORAGE_TYPE_VOLUME && - disk->src->format <=3D VIR_STORAGE_FILE_NONE) - disk->src->format =3D VIR_STORAGE_FILE_RAW; + disk->src->format <=3D VIR_STORAGE_FILE_NONE) { + int actualType =3D virStorageSourceGetActualType(disk->src); + + if (actualType =3D=3D VIR_STORAGE_TYPE_DIR) + disk->src->format =3D VIR_STORAGE_FILE_FAT; + else + disk->src->format =3D VIR_STORAGE_FILE_RAW; + } if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV)) { if (qemuDomainPrepareDiskSourceBlockdev(disk, priv, cfg) < 0) diff --git a/tests/qemuxml2argvdata/disk-source-pool.args b/tests/qemuxml2a= rgvdata/disk-source-pool.args index 65565fe49e..7c05599822 100644 --- a/tests/qemuxml2argvdata/disk-source-pool.args +++ b/tests/qemuxml2argvdata/disk-source-pool.args @@ -36,4 +36,8 @@ readonly=3Don \ readonly=3Don \ -device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk0,\ id=3Dvirtio-disk0 \ +-drive file=3Dfat:/some/dir/device/vol2,if=3Dnone,id=3Ddrive-virtio-disk1,\ +readonly=3Don \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x5,drive=3Ddrive-virtio-disk1,\ +id=3Dvirtio-disk1 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/disk-source-pool.xml b/tests/qemuxml2ar= gvdata/disk-source-pool.xml index 96bcae9a57..31b148b4bb 100644 --- a/tests/qemuxml2argvdata/disk-source-pool.xml +++ b/tests/qemuxml2argvdata/disk-source-pool.xml @@ -43,6 +43,12 @@ + + + + + + diff --git a/tests/qemuxml2xmloutdata/disk-source-pool.xml b/tests/qemuxml2= xmloutdata/disk-source-pool.xml index 7e3961381e..78e0449dfd 100644 --- a/tests/qemuxml2xmloutdata/disk-source-pool.xml +++ b/tests/qemuxml2xmloutdata/disk-source-pool.xml @@ -44,6 +44,13 @@
+ + + + + +
+
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list