From nobody Fri May 3 15:03:01 2024 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=1561473290; cv=none; d=zoho.com; s=zohoarc; b=bXZqhRUZ89+Wv6B2mH06qP018RFvB0c3zwceOBnv5IuKqdIwDa+rd5m67Xp+D37vtVXFSlVnHNFtYppRXETgxB5bont7e30A2xWo0VFh6Wv8pImvNgAfOM6ZCyuJkEIXXiI2OOHlhpp5d67CoQGBWtq0Z6Mb0fuJjiO8QXmcgQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561473290; 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=7vaun91NX/V9ubshlMSc88wPRTX37rG51udBjML0leU=; b=Aza2kPoy/vfuARpM6LkR0dHodg477HxId/iPmFooRvuZUFgSI50q3Ael8aQ20oJEstGTye04NZq6UvSgCYoRoyvDmw7jIC7PVR8j2yYjB5OMRrAbGHmS5fIQw8FWelYuGhBmqcm1b1THnz4Dwr0RNGOyjt+wz6Xu0TAy2qOx2JM= 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 1561473290072694.730413420235; Tue, 25 Jun 2019 07:34:50 -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 7A4707FDCC; Tue, 25 Jun 2019 14:34:35 +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 4829E1001E8C; Tue, 25 Jun 2019 14:34:35 +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 F07F21806B19; Tue, 25 Jun 2019 14:34:33 +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 x5PEUkuU005456 for ; Tue, 25 Jun 2019 10:30:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 863E6196E5; Tue, 25 Jun 2019 14:30:46 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1120F19732 for ; Tue, 25 Jun 2019 14:30:45 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 16:30:30 +0200 Message-Id: <21e4c3678fc2a7f1602641ad6954c7f7252e4830.1561472985.git.pkrempa@redhat.com> 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 1/4] util: storage: Fix virStorageSourceGetActualType if volume was not translated 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.27]); Tue, 25 Jun 2019 14:34:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virStorageSourceGetActualType would return VIR_STORAGE_TYPE_NONE in case when a virStorageSource of (top level) type VIR_STORAGE_TYPE_VOLUME was not prepared to use by the vm by calling virDomainDiskTranslateSourcePool. Fix this issue by returning VIR_STORAGE_TYPE_VOLUME in case when the volume was not translated yet. Additionally also add documentation for the function describing the quirk. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f7495ab6da..269d0050fd 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -2430,10 +2430,20 @@ virStorageSourcePoolDefFree(virStorageSourcePoolDef= Ptr def) } +/** + * virStorageSourceGetActualType: + * @def: storage source definition + * + * Returns type of @def. In case when the type is VIR_STORAGE_TYPE_VOLUME + * and virDomainDiskTranslateSourcePool was called on @def the actual type + * of the storage volume is returned rather than VIR_STORAGE_TYPE_VOLUME. + */ int virStorageSourceGetActualType(const virStorageSource *def) { - if (def->type =3D=3D VIR_STORAGE_TYPE_VOLUME && def->srcpool) + if (def->type =3D=3D VIR_STORAGE_TYPE_VOLUME && + def->srcpool && + def->srcpool->actualtype !=3D VIR_STORAGE_TYPE_NONE) return def->srcpool->actualtype; return def->type; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 15:03:01 2024 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=1561473211; cv=none; d=zoho.com; s=zohoarc; b=HOG693/P4dWqwX8Jp27YM1aSfYUGI9lJboJ+ubYtp0fbbFc2miPuWZ32moh6YanPdTTaoCyreZcI+p2P+ACPgXWjnmnWKVWMf9sm0Bj8GK6eMiUW6IAFpneHyxugvf54yZVqs+xLhMOUlG9nJ4aZ6BDFMQEeep1Hy4rn8bOg+rc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561473211; 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=YOpSAcFSBSAl6RKLTOfOTPwHoYRFxgGkJoinZtv/fps=; b=Q/qlvCM1A0MjduSY1AI0ZDPd6tOWl5yCjX2UUiMiF24K07sfWS089e6Gf7CFe+yNUaeaGBXreCsOXfWmGcHiGkv1xaF5PxDjOTKVFKi0fLBosYh/RkESDuk49nNQCNc16GD/G7kveI7u6TQbVfrC9jjOs4GLdJZuKEL5mLB3988= 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 15614732117891017.695358872322; Tue, 25 Jun 2019 07:33:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 920E130F1BC4; Tue, 25 Jun 2019 14:33:22 +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 1EF1019936; Tue, 25 Jun 2019 14:33:15 +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 F1A9F1806B19; Tue, 25 Jun 2019 14:33:08 +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 x5PEUllA005477 for ; Tue, 25 Jun 2019 10:30:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5528919732; Tue, 25 Jun 2019 14:30:47 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D2F87196E5 for ; Tue, 25 Jun 2019 14:30:46 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 16:30:31 +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 2/4] qemu: command: Use 'actualType' when deciding whether to use disk format 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 25 Jun 2019 14:33:30 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemuBuildDriveSourceStr omits the disk format string when we are emulating a 'fat' filesystem froma directory. The logic should decide based on the 'actualType' as a disk type=3Dpool may be converted to a directory. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b767a1e15f..c04bba4f02 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1730,7 +1730,7 @@ qemuBuildDriveSourceStr(virDomainDiskDefPtr disk, } if (disk->src->format > 0 && - disk->src->type !=3D VIR_STORAGE_TYPE_DIR) { + actualType !=3D VIR_STORAGE_TYPE_DIR) { const char *qemuformat =3D virStorageFileFormatTypeToString(disk->= src->format); if (rawluks) qemuformat =3D "luks"; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 15:03:01 2024 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=1561473254; cv=none; d=zoho.com; s=zohoarc; b=OIApcHbfajZ7gvef+e/ZEBXjhH7CpAKFlzG1gVFB8b06bAAaKX/CVaZLDK/8nqb0VfiYeQZeyqhSGveybLFdW9RSB9uN7ZDQtedDUyq9YR2BKOQNfFNHJQhnvJlGhplaseuSnXeOznnExucNJtW+7NCGRbOdk+cuAAd4e3+8oGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561473254; 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=WL2y+suuQaR8pWwJSuBsfUKWkz00BrNJbkaGKj6OPbA=; b=J4KIzm8gcfOrvNaOYeWLREIEGF8J/clIJWXEqo2bsPfGhbpxN2Jyw0laXo+Zjo9LUNh46jhUbfuE/lprWsU0ib5Ze66zdU6E5laz/RoLQo7zPJLdGtpD/Mt04aJTK4hTKLJdLxitdgnsIVKWcPRsUb82YKp09aNLE/S2rVwozHA= 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 1561473254095808.2300413787623; Tue, 25 Jun 2019 07:34:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6264999C1D; Tue, 25 Jun 2019 14:33:57 +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 39BD6600CD; Tue, 25 Jun 2019 14:33:52 +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 EB8EE206D2; Tue, 25 Jun 2019 14:33:48 +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 x5PEUmVD005500 for ; Tue, 25 Jun 2019 10:30:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 24150196E5; 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 A1F0C19732 for ; Tue, 25 Jun 2019 14:30:47 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 25 Jun 2019 16:30:32 +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 3/4] qemu: domain: Allow 'VIR_STORAGE_TYPE_VOLUME' disks with 'fat' format 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.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 25 Jun 2019 14:34:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The storage volume may in fact convert into a directory when starting the VM so that it may be actually possible to use it. This is a regression caused by c9b27af32d5 as moving the check to validation time without adjustment causes problems as the volumes are not translated yet. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 1 + tests/qemuxml2argvdata/disk-source-pool.args | 4 ++++ tests/qemuxml2argvdata/disk-source-pool.xml | 10 +++++++++- tests/qemuxml2xmloutdata/disk-source-pool.xml | 7 +++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1326c3d6b1..5b72b7f7bf 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5078,6 +5078,7 @@ qemuDomainValidateStorageSource(virStorageSourcePtr s= rc, } if (src->format =3D=3D VIR_STORAGE_FILE_FAT && + actualType !=3D VIR_STORAGE_TYPE_VOLUME && actualType !=3D VIR_STORAGE_TYPE_DIR) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("storage format 'fat' is supported only with 'dir= ' " diff --git a/tests/qemuxml2argvdata/disk-source-pool.args b/tests/qemuxml2a= rgvdata/disk-source-pool.args index 676ffb5768..65565fe49e 100644 --- a/tests/qemuxml2argvdata/disk-source-pool.args +++ b/tests/qemuxml2argvdata/disk-source-pool.args @@ -32,4 +32,8 @@ readonly=3Don \ -device ide-cd,bus=3Dide.1,unit=3D0,drive=3Ddrive-ide0-1-0,id=3Dide0-1-0 \ -drive file=3D/tmp/idedisk.img,format=3Draw,if=3Dnone,id=3Ddrive-ide0-0-2 \ -device ide-hd,bus=3Dide.0,unit=3D2,drive=3Ddrive-ide0-0-2,id=3Dide0-0-2,b= ootindex=3D1 \ +-drive file=3Dfat:/some/dir/device/vol1,if=3Dnone,id=3Ddrive-virtio-disk0,\ +readonly=3Don \ +-device virtio-blk-pci,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virtio-disk0,\ +id=3Dvirtio-disk0 \ -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 ed326d8d49..96bcae9a57 100644 --- a/tests/qemuxml2argvdata/disk-source-pool.xml +++ b/tests/qemuxml2argvdata/disk-source-pool.xml @@ -37,9 +37,17 @@
+ + + + + + - + +
+ diff --git a/tests/qemuxml2xmloutdata/disk-source-pool.xml b/tests/qemuxml2= xmloutdata/disk-source-pool.xml index 567b22db84..7e3961381e 100644 --- a/tests/qemuxml2xmloutdata/disk-source-pool.xml +++ b/tests/qemuxml2xmloutdata/disk-source-pool.xml @@ -37,6 +37,13 @@
+ + + + + +
+
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 15:03:01 2024 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