From nobody Wed May 14 17:41:05 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152232429157725.47435500755637; Thu, 29 Mar 2018 04:51:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3363767EC1; Thu, 29 Mar 2018 11:51:30 +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 EA3F060F8C; Thu, 29 Mar 2018 11:51:29 +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 A2B074CAA0; Thu, 29 Mar 2018 11:51:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2TBpL8d016312 for ; Thu, 29 Mar 2018 07:51:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id E120910B00A0; Thu, 29 Mar 2018 11:51:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B84B10B00A2; Thu, 29 Mar 2018 11:51:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 29 Mar 2018 13:51:03 +0200 Message-Id: <83724c0c1a957b1923a8fdaf05855526c230605d.1522323985.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 06/14] qemu: domain: Forbid storage type 'cow' in qemu 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 29 Mar 2018 11:51:30 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" QEMU does not support it so save us hassle and forbid it right away. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 23 +++++++++++++++++++++++ tests/qemuxml2argvdata/disk-drive-fmt-cow.xml | 27 +++++++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 1 + 3 files changed, 51 insertions(+) create mode 100644 tests/qemuxml2argvdata/disk-drive-fmt-cow.xml diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 009fb9daf3..960a78f082 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4108,9 +4108,24 @@ qemuDomainDeviceDefValidateVideo(const virDomainVide= oDef *video) } +static int +qemuDomainValidateStorageSource(virStorageSourcePtr src) +{ + if (src->format =3D=3D VIR_STORAGE_FILE_COW) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'cow' storage format is not supported")); + return -1; + } + + return 0; +} + + static int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk) { + virStorageSourcePtr n; + if (disk->src->shared && !disk->src->readonly) { if (disk->src->format <=3D VIR_STORAGE_FILE_AUTO) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -4127,6 +4142,11 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskD= ef *disk) } } + for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt= ore) { + if (qemuDomainValidateStorageSource(n) < 0) + return -1; + } + return 0; } @@ -11837,6 +11857,9 @@ qemuDomainPrepareDiskSourceChain(virDomainDiskDefPt= r disk, n->debug =3D true; n->debugLevel =3D cfg->glusterDebugLevel; } + + if (qemuDomainValidateStorageSource(n) < 0) + return -1; } return 0; diff --git a/tests/qemuxml2argvdata/disk-drive-fmt-cow.xml b/tests/qemuxml2= argvdata/disk-drive-fmt-cow.xml new file mode 100644 index 0000000000..91c62ea055 --- /dev/null +++ b/tests/qemuxml2argvdata/disk-drive-fmt-cow.xml @@ -0,0 +1,27 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + + /usr/bin/qemu-system-i686 + + + + +
+ + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 308d71f725..5d7f2e15ba 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -912,6 +912,7 @@ mymain(void) QEMU_CAPS_NODEFCONFIG); DO_TEST("disk-drive-fmt-qcow", QEMU_CAPS_DRIVE_BOOT); + DO_TEST_PARSE_ERROR("disk-drive-fmt-cow", QEMU_CAPS_DRIVE_BOOT); DO_TEST("disk-drive-shared", QEMU_CAPS_DRIVE_SERIAL); DO_TEST_PARSE_ERROR("disk-drive-shared-qcow", NONE); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list