From nobody Tue May 7 18:33:58 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1527608115090535.8533882539161; Tue, 29 May 2018 08:35:15 -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 03FA4F6867; Tue, 29 May 2018 15:35:13 +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 692AB170EB; Tue, 29 May 2018 15:35:12 +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 4B0A01800C9B; Tue, 29 May 2018 15:35:11 +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 w4TFZ8NX008431 for ; Tue, 29 May 2018 11:35:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D2DE1001F3C; Tue, 29 May 2018 15:35:08 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-116-133.phx2.redhat.com [10.3.116.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAD6A1001942 for ; Tue, 29 May 2018 15:35:02 +0000 (UTC) From: John Ferlan To: libvir-list@redhat.com Date: Tue, 29 May 2018 11:35:00 -0400 Message-Id: <20180529153500.16278-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] storage: Add specific check for LUKS encryption support 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.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.26]); Tue, 29 May 2018 15:35:14 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Modify virStorageBackendLogicalLVCreate to ensure if encryption is requested that only type LUKS is supported; otherwise, error. Signed-off-by: John Ferlan Reviewed-by: Erik Skultety --- src/storage/storage_backend_logical.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_ba= ckend_logical.c index edd4971f1f..67ca7f514d 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -938,6 +938,13 @@ virStorageBackendLogicalLVCreate(virStorageVolDefPtr v= ol, unsigned long long capacity =3D vol->target.capacity; virCommandPtr cmd =3D NULL; =20 + if (vol->target.encryption && + vol->target.encryption->format !=3D VIR_STORAGE_ENCRYPTION_FORMAT_= LUKS) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("storage pool only supports LUKS encrypted volume= s")); + return -1; + } + cmd =3D virCommandNewArgList(LVCREATE, "--name", vol->name, NULL); @@ -953,8 +960,7 @@ virStorageBackendLogicalLVCreate(virStorageVolDefPtr vo= l, =20 /* If we're going to encrypt using LUKS, then we could need up to * an extra 2MB for the LUKS header - so account for that now */ - if (vol->target.encryption && - vol->target.encryption->format =3D=3D VIR_STORAGE_ENCRYPTION_FORMA= T_LUKS) + if (vol->target.encryption) capacity +=3D 2 * 1024 * 1024; virCommandAddArgFormat(cmd, "%lluK", VIR_DIV_UP(capacity, 1024)); =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list