From nobody Tue May 7 05:34:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1637078279; cv=none; d=zohomail.com; s=zohoarc; b=md9r3JHIWxwezJG8i8QlUuhgN77g0J6bcRmv/gdbg78kLL/6onUeVIkKpVJorsyk/wfRIzDZVCWFTbo/X6Z5jCZegbH91zmNmhf2PKcq1KmBorkrJhkiCWdfUh4t+xcEYpMTTuLCpL/h3adz4HiGgzxW5lwBAi7opGYrUzdnYwI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637078279; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=B2fm3Ft79jpg7CQw05RxF+m0RLK1em5Uruj4s+pwubQ=; b=bkWRRFXb8cycN9GdmE+CYbFUsquJu0L55CKwo+Od/kLGi6sKU3ilCWam05lAM9zLrVVVnheTUQ+Pw2a0jyxtb1lBZB71xSrVviMqKiJwwPm2a/mCeaS5dJvoLWAQAkSLrpKHfQWF6UYXJ/xQHG1vxe0xuSwoV4tQkJX2SFNeAgs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1637078279375734.133628661998; Tue, 16 Nov 2021 07:57:59 -0800 (PST) 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-533-GCOSrrdXNianomd1SoLrpA-1; Tue, 16 Nov 2021 10:57:54 -0500 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 0BE6D8799EE; Tue, 16 Nov 2021 15:57:48 +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 62B9A5BAE5; Tue, 16 Nov 2021 15:57:44 +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 75BCE1819AC1; Tue, 16 Nov 2021 15:57:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AGFsoGv015780 for ; Tue, 16 Nov 2021 10:54:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id AFA2B5FC13; Tue, 16 Nov 2021 15:54:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13FEA6788F for ; Tue, 16 Nov 2021 15:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637078278; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B2fm3Ft79jpg7CQw05RxF+m0RLK1em5Uruj4s+pwubQ=; b=WeQ+jNeFsQEZ3UHxBdt8aEn06FPPkAxfnWmGv/fr1PxLinQ98GX2xOsf6YuBW1H6qGlXGP B+Iigvr5tb63pgfGbF91s+oHDSNWc99AxgBqMTEsIpxq2SfC5YltxXyKFzAFwmzVmOSicK MNIYCbkYkC4KBwdEAGVEph/ONdDaeLc= X-MC-Unique: GCOSrrdXNianomd1SoLrpA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemuDomainPrepareStorageSourceBlockdev: Set default encryption engine also when preparing virStorageSource Date: Tue, 16 Nov 2021 16:54:40 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637078281582100001 Content-Type: text/plain; charset="utf-8" Originally the default encryption engine is populated in the disk post-parse callback code. This works for disks but for any additional images introduced either via the block copy API or via the backup API we don't populate the default. In case when the backup or block copy is requested on an encrypted image this would then lead to an error: error: internal error: Unexpected enum value 0 for virStorageEncryptionEng= ine This patch adds another point where we populate the default which is when setting up a virStorageSource for actual usage. We keep the original setting in the post-parse callback as that's the only point that is recorded in the XML file after definition. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2023674 Fixes: ab1d46d6128 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index fb203bc830..5aad321e36 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10651,6 +10651,9 @@ qemuDomainPrepareStorageSourceBlockdev(virDomainDis= kDef *disk, if (qemuBlockStorageSourceNeedsStorageSliceLayer(src)) src->sliceStorage->nodename =3D g_strdup_printf("libvirt-%u-slice-= sto", src->id); + if (src->encryption && src->encryption->engine =3D=3D VIR_STORAGE_ENCR= YPTION_ENGINE_DEFAULT) + src->encryption->engine =3D VIR_STORAGE_ENCRYPTION_ENGINE_QEMU; + if (qemuDomainValidateStorageSource(src, priv->qemuCaps, false) < 0) return -1; --=20 2.31.1