From nobody Thu May 2 02:50:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1588846207; cv=none; d=zohomail.com; s=zohoarc; b=gYOc0je0zoADNV/zLZPU7PJ5wV03oUA1SiMDVZr+Hn3CyLdx9L66Qxpew24PBqd2QDTeAieeueXK1QhPJ0uiuaVZz+Z0z1LDHRGY+523sByYcIb5cnJQ862Yj2dYrTQTg8XtWEVvxuBFG+gw4DXkW2JHDuAA6hVcHJRUSKSzQ4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588846207; 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=Y/f8tlca/Kky3M7xH33Z5kFtzvrJhcXTVbjsRzamiSY=; b=R3FBpO/2/t/eRDFsPDzkYNEU5vKUUymQfV62Xi3e00oDB2i5D+Y8dCVHp0ya5BODrLYY6Y3WTFuvud6ow86j0h/yR54gxHH0cU2Svzra9S6/Djxp5IRSZOotY1tGqXACUXOIMmcfkPkhc6QuMx8NPK9pCSqllSLeKVXuElLgqE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588846207849937.7590693307654; Thu, 7 May 2020 03:10:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-356-_kbhsgGrNgWeo2z7lKTJwA-1; Thu, 07 May 2020 06:10:03 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F23645F; Thu, 7 May 2020 10:09:58 +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 4C14161527; Thu, 7 May 2020 10:09:58 +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 A8B6A4CAA0; Thu, 7 May 2020 10:09:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 047A9tcM003401 for ; Thu, 7 May 2020 06:09:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 50E3061527; Thu, 7 May 2020 10:09:55 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AABF562A9D for ; Thu, 7 May 2020 10:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588846206; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Y/f8tlca/Kky3M7xH33Z5kFtzvrJhcXTVbjsRzamiSY=; b=ipXjPj3UEzsWacY4LRUsfdQiAyygEqqbIIU8CYuF9PTc5DWAspIFWmOTZmhZt7odTpFmvg ta0HxVg2WTOERU/4DrenxGJsnZaUL1e16g/dOQXLpV5ddUBkdBbSQHZt8jKzknG4V8Epro AzzFm20NI1tgwPin1DdKbuizOXr921o= X-MC-Unique: _kbhsgGrNgWeo2z7lKTJwA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: Forbid non-raw images for disk type='lun' with vitio-blk frontend Date: Thu, 7 May 2020 12:09:48 +0200 Message-Id: <5d94d27b88a8c72400adb0f5e816155a4071add5.1588845754.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Historically the virtio-blk frontend by default enabled SCSI emulation and tried to do SCSI command passthrough. As this was enabled by default there's a fallback mechanism in place in cases when the backend doesn't support SCSI for any reason. This is not the case when disk type=3Dlun is used with 'scsi-block' via 'virtio-scsi'. We did not restrict configurations when the user picks 'qcow2' or any other format as format of the disk, in which case the emulation is disabled as such configuration doesn't make sense. This patch unifies the approach so that 'raw' is required both when used via 'virtio-blk' and 'virtio-scsi' so that the user is presented with the expected configuration. Note that use of is already very restrictive as it requires a block device or iSCSI storage. Additionally the scsi emulation is now deprecated by qemu with virtio-blk as it conflicts with virtio-1 and the alternative is to use 'virtio-scsi' which performs better and is along for a very long time. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- I'm aware that this will be perceived as regression. In my opinion disk type=3Dlun should not have existed in the first place, we do have the format !=3D VIR_STORAGE_FILE_RAW) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' must use 'raw' format")); + return -1; + } + return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 2cde678ca0..f789ed075a 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1997,14 +1997,6 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, return -1; } - if (disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_SCSI && - disk->src->format !=3D VIR_STORAGE_FILE_RAW) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("disk device 'lun' using target 'scsi' must u= se " - "'raw' format")); - return -1; - } - if (qemuDomainDefValidateDiskLunSource(disk->src) < 0) return -1; diff --git a/tests/qemuxml2argvdata/virtio-lun.args b/tests/qemuxml2argvdat= a/virtio-lun.args index 7df1512b9b..850501142a 100644 --- a/tests/qemuxml2argvdata/virtio-lun.args +++ b/tests/qemuxml2argvdata/virtio-lun.args @@ -27,10 +27,10 @@ server,nowait \ -boot menu=3Don \ -device virtio-serial-pci,id=3Dvirtio-serial0,bus=3Dpci.0,addr=3D0x6 \ -usb \ --drive file=3D/dev/sdfake,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio-disk0= \ +-drive file=3D/dev/sdfake,format=3Draw,if=3Dnone,id=3Ddrive-virtio-disk0 \ -device virtio-blk-pci,scsi=3Don,bus=3Dpci.0,addr=3D0x4,drive=3Ddrive-virt= io-disk0,\ id=3Dvirtio-disk0,bootindex=3D2 \ --drive file=3D/dev/sdfake2,format=3Dqcow2,if=3Dnone,id=3Ddrive-virtio-disk= 1 \ +-drive file=3D/dev/sdfake2,format=3Draw,if=3Dnone,id=3Ddrive-virtio-disk1 \ -device virtio-blk-pci,scsi=3Don,bus=3Dpci.0,addr=3D0x5,drive=3Ddrive-virt= io-disk1,\ id=3Dvirtio-disk1 \ -netdev user,id=3Dhostnet0 \ diff --git a/tests/qemuxml2argvdata/virtio-lun.xml b/tests/qemuxml2argvdata= /virtio-lun.xml index 303131fb61..c802da1838 100644 --- a/tests/qemuxml2argvdata/virtio-lun.xml +++ b/tests/qemuxml2argvdata/virtio-lun.xml @@ -17,13 +17,13 @@ /usr/bin/qemu-system-x86_64 - +
- +
diff --git a/tests/qemuxml2xmloutdata/virtio-lun.xml b/tests/qemuxml2xmlout= data/virtio-lun.xml index dbedd4edc0..23052cd519 100644 --- a/tests/qemuxml2xmloutdata/virtio-lun.xml +++ b/tests/qemuxml2xmloutdata/virtio-lun.xml @@ -17,13 +17,13 @@ /usr/bin/qemu-system-x86_64 - +
- +
--=20 2.26.2 From nobody Thu May 2 02:50:10 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1588846213; cv=none; d=zohomail.com; s=zohoarc; b=c4EIGKpwBPFhGkeb+sRVNqmRPg1HK8QUmklkWJcH3/uEdJ/cGe8FiCNhPRwtVLYHHs0w8u3ZeoUrUrR6nZxE2ZCWEA8tvt7f/vzqlvgw6tnLOomMT3X2yla/m0GJ8HEBCA/g+PTrHnsT1N9Gl0pSBeZq+chkH2aVzVKqNjTFi/4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588846213; 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=9T40yk41sbDKtoaqwdDV4Yhz+grNd91/ciX6M8i6ylg=; b=fvHEFeRLKUXQjydk9KUfm81YqhfSHut3b04sEp8O9Uu5u+iSo8/LzHOu3s25zyuA2i2LHECN4GthPaB6yty/09uxOZNUoPQT82oQOazpv7GuUzz7XmD6ReLBu8n3d3sH1F5anUnc+xLp6bYe+TSkpnQd6/BT5PdwI7dol7fJ4Gc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1588846213776583.1686185911507; Thu, 7 May 2020 03:10:13 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-RpXmnwPaPBaGGwUmaz06yw-1; Thu, 07 May 2020 06:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD5A2835B42; Thu, 7 May 2020 10:10:04 +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 8A950707B5; Thu, 7 May 2020 10:10:04 +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 1D9BC4CAAD; Thu, 7 May 2020 10:10:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 047A9u3t003411 for ; Thu, 7 May 2020 06:09:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 601E16298F; Thu, 7 May 2020 10:09:56 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA63A61527 for ; Thu, 7 May 2020 10:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588846212; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9T40yk41sbDKtoaqwdDV4Yhz+grNd91/ciX6M8i6ylg=; b=enHz6C/4jwfsdtKp1uZfMKVNMYL54PD23Drb8JMyIDClJwI91r8kohOwqjraxSfzb/tLcl EyNS+ahws9I2Hb27MxOEWBrgSJjDqaOazinDILGwKu7XIpSrNjqqI3BePgWJhR/8emEApe Y7M/dE17bUxh58xp8UUkZxhPy8hUAac= X-MC-Unique: RpXmnwPaPBaGGwUmaz06yw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: domain: Forbid slice/encryption/copy_on_read with disk type='lun' Date: Thu, 7 May 2020 12:09:49 +0200 Message-Id: <66822ea2f9a34a06b22afd7e3aa47fac9ee3da9d.1588845754.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Any non-raw block layer feature will not work with raw SCSI command passthrough via 'scsi-block'. Explicitly refuse use of luks encryption, storage slices and copy on read. https://bugzilla.redhat.com/show_bug.cgi?id=3D1820040 Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain.c | 13 +++++++++++++ src/qemu/qemu_validate.c | 7 +++++++ 2 files changed, 20 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c4ca93722f..18384be2af 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10491,6 +10491,19 @@ qemuDomainDefValidateDiskLunSource(const virStorag= eSource *src) return -1; } + if (src->sliceStorage) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' doesn't support storage slice"= )); + return -1; + } + + if (src->encryption && + src->encryption->format !=3D VIR_STORAGE_ENCRYPTION_FORMAT_DEFAULT= ) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("disk device 'lun' doesn't support encryption")); + return -1; + } + return 0; } diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index f789ed075a..d34151050f 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1997,6 +1997,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, return -1; } + if (disk->copy_on_read =3D=3D VIR_TRISTATE_SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("copy_on_read is not compatible with 'lun' di= sk '%s'"), + disk->dst); + return -1; + } + if (qemuDomainDefValidateDiskLunSource(disk->src) < 0) return -1; --=20 2.26.2