From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609441; cv=none; d=zohomail.com; s=zohoarc; b=KNsNXgYQNtIIhHxs59+Kf5AgqOCrM/oMV/IlOeFH3OTTTBTgYKBekeHzn1pJLMf9Jy/46r+Ry9C1MyrUCuXwFXrPrGUdocfcdgSji7a7VHqkhKtmu+ySPy2TAj92eR1MjmZXU5kBVnKYJpdpvQWPUiHlEgQLixOFL531Gy3XSe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609441; h=Content-Type:Content-Transfer-Encoding:Cc: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=m/x2yp1Zom7TibLzciJu4Stg8OPWQzuVY8t0Vy7LY2k=; b=f6hxRiocx+0iu23LL/90zaGcRvq8HEz499Py+7d+hKOrcWazY1Sof7ppPT32DpkJ13IDUYZQYEJsf+LJg4rRCyWaIKehp5k//Qid2VA/25ZVp7gazyVawy2IzcfSM7UY4+MJutylFVcj3cfJ0Q8TtqhPWiDnhtPj6KKwIxGehZk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15916094417667.253022105965783; Mon, 8 Jun 2020 02:44:01 -0700 (PDT) Received: from localhost ([::1]:51116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEK0-0002L4-AD for importer@patchew.org; Mon, 08 Jun 2020 05:44:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEGp-0005u6-Cu for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:43 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:32190 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEGo-00023p-Ao for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:43 -0400 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-42-l094Qc-tOWe5fdZm-x8PqQ-1; Mon, 08 Jun 2020 05:40:39 -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 6D23C1940925; Mon, 8 Jun 2020 09:40:38 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0268D1CA; Mon, 8 Jun 2020 09:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609241; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m/x2yp1Zom7TibLzciJu4Stg8OPWQzuVY8t0Vy7LY2k=; b=URMga0c5j1UEKuF6kMsRM8Q2eIgCBZe6lEhMigHg+9WqCXcD42seBqsdYxlhgk+RFIPSuf tXEvVZy6B2RQrjy2EyvyCsEFw0AwGVlBBkkMA0RqOjZsD+s4PAdJ2WGdOxZUSNcTuluq0U 66XcnpcEM8ZX9h24avwbRkIKWIgP/7E= X-MC-Unique: l094Qc-tOWe5fdZm-x8PqQ-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 01/14] qcrypto/core: add generic infrastructure for crypto options amendment Date: Mon, 8 Jun 2020 12:40:17 +0300 Message-Id: <20200608094030.670121-2-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:20:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This will be used first to implement luks keyslot management. block_crypto_amend_opts_init will be used to convert qemu-img cmdline to QCryptoBlockAmendOptions Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- block/crypto.c | 17 +++++++++++++++++ block/crypto.h | 3 +++ crypto/block.c | 29 +++++++++++++++++++++++++++++ crypto/blockpriv.h | 8 ++++++++ include/crypto/block.h | 22 ++++++++++++++++++++++ qapi/crypto.json | 16 ++++++++++++++++ 6 files changed, 95 insertions(+) diff --git a/block/crypto.c b/block/crypto.c index 973b57b3eb..dcf8b42bb2 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -202,6 +202,23 @@ block_crypto_create_opts_init(QDict *opts, Error **err= p) return ret; } =20 +QCryptoBlockAmendOptions * +block_crypto_amend_opts_init(QDict *opts, Error **errp) +{ + Visitor *v; + QCryptoBlockAmendOptions *ret; + + v =3D qobject_input_visitor_new_flat_confused(opts, errp); + if (!v) { + return NULL; + } + + visit_type_QCryptoBlockAmendOptions(v, NULL, &ret, errp); + + visit_free(v); + return ret; +} + =20 static int block_crypto_open_generic(QCryptoBlockFormat format, QemuOptsList *opts_spec, diff --git a/block/crypto.h b/block/crypto.h index b935695e79..06e044c9be 100644 --- a/block/crypto.h +++ b/block/crypto.h @@ -91,6 +91,9 @@ QCryptoBlockCreateOptions * block_crypto_create_opts_init(QDict *opts, Error **errp); =20 +QCryptoBlockAmendOptions * +block_crypto_amend_opts_init(QDict *opts, Error **errp); + QCryptoBlockOpenOptions * block_crypto_open_opts_init(QDict *opts, Error **errp); =20 diff --git a/crypto/block.c b/crypto/block.c index 6f42b32f1e..eb057948b5 100644 --- a/crypto/block.c +++ b/crypto/block.c @@ -150,6 +150,35 @@ qcrypto_block_calculate_payload_offset(QCryptoBlockCre= ateOptions *create_opts, return crypto !=3D NULL; } =20 +int qcrypto_block_amend_options(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptions *options, + bool force, + Error **errp) +{ + if (options->format !=3D block->format) { + error_setg(errp, + "Cannot amend encryption format"); + return -1; + } + + if (!block->driver->amend) { + error_setg(errp, + "Crypto format %s doesn't support format options amendm= ent", + QCryptoBlockFormat_str(block->format)); + return -1; + } + + return block->driver->amend(block, + readfunc, + writefunc, + opaque, + options, + force, + errp); +} =20 QCryptoBlockInfo *qcrypto_block_get_info(QCryptoBlock *block, Error **errp) diff --git a/crypto/blockpriv.h b/crypto/blockpriv.h index 71c59cb542..3c7ccea504 100644 --- a/crypto/blockpriv.h +++ b/crypto/blockpriv.h @@ -62,6 +62,14 @@ struct QCryptoBlockDriver { void *opaque, Error **errp); =20 + int (*amend)(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptions *options, + bool force, + Error **errp); + int (*get_info)(QCryptoBlock *block, QCryptoBlockInfo *info, Error **errp); diff --git a/include/crypto/block.h b/include/crypto/block.h index c77ccaf9c0..d274819791 100644 --- a/include/crypto/block.h +++ b/include/crypto/block.h @@ -144,6 +144,28 @@ QCryptoBlock *qcrypto_block_create(QCryptoBlockCreateO= ptions *options, void *opaque, Error **errp); =20 +/** + * qcrypto_block_amend_options: + * @block: the block encryption object + * + * @readfunc: callback for reading data from the volume header + * @writefunc: callback for writing data to the volume header + * @opaque: data to pass to @readfunc and @writefunc + * @options: the new/amended encryption options + * @force: hint for the driver to allow unsafe operation + * @errp: error pointer + * + * Changes the crypto options of the encryption format + * + */ +int qcrypto_block_amend_options(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptions *options, + bool force, + Error **errp); + =20 /** * qcrypto_block_calculate_payload_offset: diff --git a/qapi/crypto.json b/qapi/crypto.json index b2a4cff683..aeb6c7ef7b 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -309,3 +309,19 @@ 'base': 'QCryptoBlockInfoBase', 'discriminator': 'format', 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } + + + +## +# @QCryptoBlockAmendOptions: +# +# The options that are available for all encryption formats +# when amending encryption settings +# +# Since: 5.1 +## +{ 'union': 'QCryptoBlockAmendOptions', + 'base': 'QCryptoBlockOptionsBase', + 'discriminator': 'format', + 'data': { + } } --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609345; cv=none; d=zohomail.com; s=zohoarc; b=d9wStKtmriMWFYXohK/WDBXwhCwwAffPWf4i5c6VpqaXyCvCu4CxEjUQXDbB5OaiHmk/K2Uf4/2Kk5nMwmMZ06vvyKotBShbXedbMqjgOvlcmUwmg3+upE+zvja4ENQ0KhmBa9CCrM3JBqG4961HG1MSfXUUBTztVH1fXNEx+Rg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609345; h=Content-Type:Content-Transfer-Encoding:Cc: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=JzB9/YuEGfXOM63SP5spdOICrUPmoFVoPdTPMhIdKHw=; b=Jzg/oHx2snfW19EcKGnaufhExb73vntWI6bm5t7hxQmcIVo3q3lxtsWL/KTTASffWAiLserhoTz0Hw1FiUPblW97mh292KpyccHpmpqzY7qItCs1DJa2+z6youfGF/jFBt2ZEE2CULpNiFmfcqNDtwXuyenXKnh1ndTJuDdUWDI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609345886369.8956864443836; Mon, 8 Jun 2020 02:42:25 -0700 (PDT) Received: from localhost ([::1]:44022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEIS-0007s0-IW for importer@patchew.org; Mon, 08 Jun 2020 05:42:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEGu-0005zy-BS for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:48 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:24479 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEGs-00027G-OX for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:47 -0400 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-229-HlMqXz6OPbare_39926jEw-1; Mon, 08 Jun 2020 05:40:42 -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 82399461; Mon, 8 Jun 2020 09:40:41 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id D40EB1CA; Mon, 8 Jun 2020 09:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609246; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JzB9/YuEGfXOM63SP5spdOICrUPmoFVoPdTPMhIdKHw=; b=UrH+aCXgZPkVqCNwo/k5xpkn/IVW9hxlcxXnyPlOExsPUPX7iRgSGxjbbHAHFYMRe8oBys 8NDGH7ayUWD7TBiwL8gQgKxXOSHKsUACH0IaEg6GkR744SnttBd9p0IP3w9ZgOZ0GRcNAk QjAAnuOKVg8w6DY7e//sfR4Fe/e1sik= X-MC-Unique: HlMqXz6OPbare_39926jEw-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 02/14] qcrypto/luks: implement encryption key management Date: Mon, 8 Jun 2020 12:40:18 +0300 Message-Id: <20200608094030.670121-3-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Next few patches will expose that functionality to the user. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- crypto/block-luks.c | 416 +++++++++++++++++++++++++++++++++++++++++++- qapi/crypto.json | 59 ++++++- 2 files changed, 469 insertions(+), 6 deletions(-) diff --git a/crypto/block-luks.c b/crypto/block-luks.c index 4861db810c..564caa1094 100644 --- a/crypto/block-luks.c +++ b/crypto/block-luks.c @@ -32,6 +32,7 @@ #include "qemu/uuid.h" =20 #include "qemu/coroutine.h" +#include "qemu/bitmap.h" =20 /* * Reference for the LUKS format implemented here is @@ -70,6 +71,9 @@ typedef struct QCryptoBlockLUKSKeySlot QCryptoBlockLUKSKe= ySlot; =20 #define QCRYPTO_BLOCK_LUKS_SECTOR_SIZE 512LL =20 +#define QCRYPTO_BLOCK_LUKS_DEFAULT_ITER_TIME_MS 2000 +#define QCRYPTO_BLOCK_LUKS_ERASE_ITERATIONS 40 + static const char qcrypto_block_luks_magic[QCRYPTO_BLOCK_LUKS_MAGIC_LEN] = =3D { 'L', 'U', 'K', 'S', 0xBA, 0xBE }; @@ -219,6 +223,9 @@ struct QCryptoBlockLUKS { =20 /* Hash algorithm used in pbkdf2 function */ QCryptoHashAlgorithm hash_alg; + + /* Name of the secret that was used to open the image */ + char *secret; }; =20 =20 @@ -720,7 +727,7 @@ qcrypto_block_luks_store_key(QCryptoBlock *block, Error **errp) { QCryptoBlockLUKS *luks =3D block->opaque; - QCryptoBlockLUKSKeySlot *slot =3D &luks->header.key_slots[slot_idx]; + QCryptoBlockLUKSKeySlot *slot; g_autofree uint8_t *splitkey =3D NULL; size_t splitkeylen; g_autofree uint8_t *slotkey =3D NULL; @@ -730,6 +737,8 @@ qcrypto_block_luks_store_key(QCryptoBlock *block, uint64_t iters; int ret =3D -1; =20 + assert(slot_idx < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); + slot =3D &luks->header.key_slots[slot_idx]; if (qcrypto_random_bytes(slot->salt, QCRYPTO_BLOCK_LUKS_SALT_LEN, errp) < 0) { @@ -890,7 +899,7 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, Error **errp) { QCryptoBlockLUKS *luks =3D block->opaque; - const QCryptoBlockLUKSKeySlot *slot =3D &luks->header.key_slots[slot_i= dx]; + const QCryptoBlockLUKSKeySlot *slot; g_autofree uint8_t *splitkey =3D NULL; size_t splitkeylen; g_autofree uint8_t *possiblekey =3D NULL; @@ -900,6 +909,8 @@ qcrypto_block_luks_load_key(QCryptoBlock *block, g_autoptr(QCryptoIVGen) ivgen =3D NULL; size_t niv; =20 + assert(slot_idx < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); + slot =3D &luks->header.key_slots[slot_idx]; if (slot->active !=3D QCRYPTO_BLOCK_LUKS_KEY_SLOT_ENABLED) { return 0; } @@ -1069,6 +1080,126 @@ qcrypto_block_luks_find_key(QCryptoBlock *block, return -1; } =20 +/* + * Returns true if a slot i is marked as active + * (contains encrypted copy of the master key) + */ +static bool +qcrypto_block_luks_slot_active(const QCryptoBlockLUKS *luks, + unsigned int slot_idx) +{ + uint32_t val; + + assert(slot_idx < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); + val =3D luks->header.key_slots[slot_idx].active; + return val =3D=3D QCRYPTO_BLOCK_LUKS_KEY_SLOT_ENABLED; +} + +/* + * Returns the number of slots that are marked as active + * (slots that contain encrypted copy of the master key) + */ +static unsigned int +qcrypto_block_luks_count_active_slots(const QCryptoBlockLUKS *luks) +{ + size_t i =3D 0; + unsigned int ret =3D 0; + + for (i =3D 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { + if (qcrypto_block_luks_slot_active(luks, i)) { + ret++; + } + } + return ret; +} + +/* + * Finds first key slot which is not active + * Returns the key slot index, or -1 if it doesn't exist + */ +static int +qcrypto_block_luks_find_free_keyslot(const QCryptoBlockLUKS *luks) +{ + size_t i; + + for (i =3D 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { + if (!qcrypto_block_luks_slot_active(luks, i)) { + return i; + } + } + return -1; +} + +/* + * Erases an keyslot given its index + * Returns: + * 0 if the keyslot was erased successfully + * -1 if a error occurred while erasing the keyslot + * + */ +static int +qcrypto_block_luks_erase_key(QCryptoBlock *block, + unsigned int slot_idx, + QCryptoBlockWriteFunc writefunc, + void *opaque, + Error **errp) +{ + QCryptoBlockLUKS *luks =3D block->opaque; + QCryptoBlockLUKSKeySlot *slot; + g_autofree uint8_t *garbagesplitkey =3D NULL; + size_t splitkeylen; + size_t i; + Error *local_err =3D NULL; + int ret; + + assert(slot_idx < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); + slot =3D &luks->header.key_slots[slot_idx]; + + splitkeylen =3D luks->header.master_key_len * slot->stripes; + assert(splitkeylen > 0); + + garbagesplitkey =3D g_new0(uint8_t, splitkeylen); + + /* Reset the key slot header */ + memset(slot->salt, 0, QCRYPTO_BLOCK_LUKS_SALT_LEN); + slot->iterations =3D 0; + slot->active =3D QCRYPTO_BLOCK_LUKS_KEY_SLOT_DISABLED; + + ret =3D qcrypto_block_luks_store_header(block, writefunc, + opaque, &local_err); + + if (ret < 0) { + error_propagate(errp, local_err); + } + /* + * Now try to erase the key material, even if the header + * update failed + */ + for (i =3D 0; i < QCRYPTO_BLOCK_LUKS_ERASE_ITERATIONS; i++) { + if (qcrypto_random_bytes(garbagesplitkey, + splitkeylen, &local_err) < 0) { + /* + * If we failed to get the random data, still write + * at least zeros to the key slot at least once + */ + error_propagate(errp, local_err); + + if (i > 0) { + return -1; + } + } + if (writefunc(block, + slot->key_offset_sector * QCRYPTO_BLOCK_LUKS_SECTOR_= SIZE, + garbagesplitkey, + splitkeylen, + opaque, + &local_err) !=3D splitkeylen) { + error_propagate(errp, local_err); + return -1; + } + } + return ret; +} =20 static int qcrypto_block_luks_open(QCryptoBlock *block, @@ -1099,6 +1230,7 @@ qcrypto_block_luks_open(QCryptoBlock *block, =20 luks =3D g_new0(QCryptoBlockLUKS, 1); block->opaque =3D luks; + luks->secret =3D g_strdup(options->u.luks.key_secret); =20 if (qcrypto_block_luks_load_header(block, readfunc, opaque, errp) < 0)= { goto fail; @@ -1164,6 +1296,7 @@ qcrypto_block_luks_open(QCryptoBlock *block, fail: qcrypto_block_free_cipher(block); qcrypto_ivgen_free(block->ivgen); + g_free(luks->secret); g_free(luks); return -1; } @@ -1204,7 +1337,7 @@ qcrypto_block_luks_create(QCryptoBlock *block, =20 memcpy(&luks_opts, &options->u.luks, sizeof(luks_opts)); if (!luks_opts.has_iter_time) { - luks_opts.iter_time =3D 2000; + luks_opts.iter_time =3D QCRYPTO_BLOCK_LUKS_DEFAULT_ITER_TIME_MS; } if (!luks_opts.has_cipher_alg) { luks_opts.cipher_alg =3D QCRYPTO_CIPHER_ALG_AES_256; @@ -1244,6 +1377,8 @@ qcrypto_block_luks_create(QCryptoBlock *block, optprefix ? optprefix : ""); goto error; } + luks->secret =3D g_strdup(options->u.luks.key_secret); + password =3D qcrypto_secret_lookup_as_utf8(luks_opts.key_secret, errp); if (!password) { goto error; @@ -1471,10 +1606,278 @@ qcrypto_block_luks_create(QCryptoBlock *block, qcrypto_block_free_cipher(block); qcrypto_ivgen_free(block->ivgen); =20 + g_free(luks->secret); g_free(luks); return -1; } =20 +static int +qcrypto_block_luks_amend_add_keyslot(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptionsLUKS *opts_lu= ks, + bool force, + Error **errp) +{ + QCryptoBlockLUKS *luks =3D block->opaque; + uint64_t iter_time =3D opts_luks->has_iter_time ? + opts_luks->iter_time : + QCRYPTO_BLOCK_LUKS_DEFAULT_ITER_TIME_MS; + int keyslot; + g_autofree char *old_password =3D NULL; + g_autofree char *new_password =3D NULL; + g_autofree uint8_t *master_key =3D NULL; + + char *secret =3D opts_luks->has_secret ? opts_luks->secret : luks->sec= ret; + + if (!opts_luks->has_new_secret) { + error_setg(errp, "'new-secret' is required to activate a keyslot"); + return -1; + } + if (opts_luks->has_old_secret) { + error_setg(errp, + "'old-secret' must not be given when activating keyslot= s"); + return -1; + } + + if (opts_luks->has_keyslot) { + keyslot =3D opts_luks->keyslot; + if (keyslot < 0 || keyslot >=3D QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS) { + error_setg(errp, + "Invalid keyslot %u specified, must be between 0 an= d %u", + keyslot, QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS - 1); + return -1; + } + } else { + keyslot =3D qcrypto_block_luks_find_free_keyslot(luks); + if (keyslot =3D=3D -1) { + error_setg(errp, + "Can't add a keyslot - all keyslots are in use"); + return -1; + } + } + + if (!force && qcrypto_block_luks_slot_active(luks, keyslot)) { + error_setg(errp, + "Refusing to overwrite active keyslot %i - " + "please erase it first", + keyslot); + return -1; + } + + /* Locate the password that will be used to retrieve the master key */ + old_password =3D qcrypto_secret_lookup_as_utf8(secret, errp); + if (!old_password) { + return -1; + } + + /* Retrieve the master key */ + master_key =3D g_new0(uint8_t, luks->header.master_key_len); + + if (qcrypto_block_luks_find_key(block, old_password, master_key, + readfunc, opaque, errp) < 0) { + error_append_hint(errp, "Failed to retrieve the master key"); + return -1; + } + + /* Locate the new password*/ + new_password =3D qcrypto_secret_lookup_as_utf8(opts_luks->new_secret, = errp); + if (!new_password) { + return -1; + } + + /* Now set the new keyslots */ + if (qcrypto_block_luks_store_key(block, keyslot, new_password, master_= key, + iter_time, writefunc, opaque, errp)) { + error_append_hint(errp, "Failed to write to keyslot %i", keyslot); + return -1; + } + return 0; +} + +static int +qcrypto_block_luks_amend_erase_keyslots(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptionsLUKS *opts= _luks, + bool force, + Error **errp) +{ + QCryptoBlockLUKS *luks =3D block->opaque; + g_autofree uint8_t *tmpkey =3D NULL; + g_autofree char *old_password =3D NULL; + + if (opts_luks->has_new_secret) { + error_setg(errp, + "'new-secret' must not be given when erasing keyslots"); + return -1; + } + if (opts_luks->has_iter_time) { + error_setg(errp, + "'iter-time' must not be given when erasing keyslots"); + return -1; + } + if (opts_luks->has_secret) { + error_setg(errp, + "'secret' must not be given when erasing keyslots"); + return -1; + } + + /* Load the old password if given */ + if (opts_luks->has_old_secret) { + old_password =3D qcrypto_secret_lookup_as_utf8(opts_luks->old_secr= et, + errp); + if (!old_password) { + return -1; + } + + /* + * Allocate a temporary key buffer that we will need when + * checking if slot matches the given old password + */ + tmpkey =3D g_new0(uint8_t, luks->header.master_key_len); + } + + /* Erase an explicitly given keyslot */ + if (opts_luks->has_keyslot) { + int keyslot =3D opts_luks->keyslot; + + if (keyslot < 0 || keyslot >=3D QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS) { + error_setg(errp, + "Invalid keyslot %i specified, must be between 0 an= d %i", + keyslot, QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS - 1); + return -1; + } + + if (opts_luks->has_old_secret) { + int rv =3D qcrypto_block_luks_load_key(block, + keyslot, + old_password, + tmpkey, + readfunc, + opaque, + errp); + if (rv =3D=3D -1) { + return -1; + } else if (rv =3D=3D 0) { + error_setg(errp, + "Given keyslot %i doesn't contain the given " + "old password for erase operation", + keyslot); + return -1; + } + } + + if (!force && !qcrypto_block_luks_slot_active(luks, keyslot)) { + error_setg(errp, + "Given keyslot %i is already erased (inactive) ", + keyslot); + return -1; + } + + if (!force && qcrypto_block_luks_count_active_slots(luks) =3D=3D 1= ) { + error_setg(errp, + "Attempt to erase the only active keyslot %i " + "which will erase all the data in the image " + "irreversibly - refusing operation", + keyslot); + return -1; + } + + if (qcrypto_block_luks_erase_key(block, keyslot, + writefunc, opaque, errp)) { + error_append_hint(errp, "Failed to erase keyslot %i", keyslot); + return -1; + } + + /* Erase all keyslots that match the given old password */ + } else if (opts_luks->has_old_secret) { + + unsigned long slots_to_erase_bitmap =3D 0; + size_t i; + int slot_count; + + assert(QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS <=3D + sizeof(slots_to_erase_bitmap) * 8); + + for (i =3D 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { + int rv =3D qcrypto_block_luks_load_key(block, + i, + old_password, + tmpkey, + readfunc, + opaque, + errp); + if (rv =3D=3D -1) { + return -1; + } else if (rv =3D=3D 1) { + bitmap_set(&slots_to_erase_bitmap, i, 1); + } + } + + slot_count =3D bitmap_count_one(&slots_to_erase_bitmap, + QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS); + if (slot_count =3D=3D 0) { + error_setg(errp, + "No keyslots match given (old) password for erase o= peration"); + return -1; + } + + if (!force && + slot_count =3D=3D qcrypto_block_luks_count_active_slots(luks))= { + error_setg(errp, + "All the active keyslots match the (old) password t= hat " + "was given and erasing them will erase all the data= in " + "the image irreversibly - refusing operation"); + return -1; + } + + /* Now apply the update */ + for (i =3D 0; i < QCRYPTO_BLOCK_LUKS_NUM_KEY_SLOTS; i++) { + if (!test_bit(i, &slots_to_erase_bitmap)) { + continue; + } + if (qcrypto_block_luks_erase_key(block, i, writefunc, + opaque, errp)) { + error_append_hint(errp, "Failed to erase keyslot %zu", i); + return -1; + } + } + } else { + error_setg(errp, + "To erase keyslot(s), either explicit keyslot index " + "or the password currently contained in them must be gi= ven"); + return -1; + } + return 0; +} + +static int +qcrypto_block_luks_amend_options(QCryptoBlock *block, + QCryptoBlockReadFunc readfunc, + QCryptoBlockWriteFunc writefunc, + void *opaque, + QCryptoBlockAmendOptions *options, + bool force, + Error **errp) +{ + QCryptoBlockAmendOptionsLUKS *opts_luks =3D &options->u.luks; + + switch (opts_luks->state) { + case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_ACTIVE: + return qcrypto_block_luks_amend_add_keyslot(block, readfunc, + writefunc, opaque, + opts_luks, force, errp= ); + case Q_CRYPTO_BLOCKLUKS_KEYSLOT_STATE_INACTIVE: + return qcrypto_block_luks_amend_erase_keyslots(block, readfunc, + writefunc, opaque, + opts_luks, force, e= rrp); + default: + g_assert_not_reached(); + } +} =20 static int qcrypto_block_luks_get_info(QCryptoBlock *block, QCryptoBlockInfo *info, @@ -1523,7 +1926,11 @@ static int qcrypto_block_luks_get_info(QCryptoBlock = *block, =20 static void qcrypto_block_luks_cleanup(QCryptoBlock *block) { - g_free(block->opaque); + QCryptoBlockLUKS *luks =3D block->opaque; + if (luks) { + g_free(luks->secret); + g_free(luks); + } } =20 =20 @@ -1560,6 +1967,7 @@ qcrypto_block_luks_encrypt(QCryptoBlock *block, const QCryptoBlockDriver qcrypto_block_driver_luks =3D { .open =3D qcrypto_block_luks_open, .create =3D qcrypto_block_luks_create, + .amend =3D qcrypto_block_luks_amend_options, .get_info =3D qcrypto_block_luks_get_info, .cleanup =3D qcrypto_block_luks_cleanup, .decrypt =3D qcrypto_block_luks_decrypt, diff --git a/qapi/crypto.json b/qapi/crypto.json index aeb6c7ef7b..5a68e0db25 100644 --- a/qapi/crypto.json +++ b/qapi/crypto.json @@ -297,7 +297,6 @@ 'uuid': 'str', 'slots': [ 'QCryptoBlockInfoLUKSSlot' ] }} =20 - ## # @QCryptoBlockInfo: # @@ -310,7 +309,63 @@ 'discriminator': 'format', 'data': { 'luks': 'QCryptoBlockInfoLUKS' } } =20 +## +# @QCryptoBlockLUKSKeyslotState: +# +# Defines state of keyslots that are affected by the update +# +# @active: The slots contain the given password and marked as active +# @inactive: The slots are erased (contain garbage) and marked as inactive +# +# Since: 5.1 +## +{ 'enum': 'QCryptoBlockLUKSKeyslotState', + 'data': [ 'active', 'inactive' ] } + =20 +## +# @QCryptoBlockAmendOptionsLUKS: +# +# This struct defines the update parameters that activate/de-activate set +# of keyslots +# +# @state: the desired state of the keyslots +# +# @new-secret: The ID of a QCryptoSecret object providing the password = to be +# written into added active keyslots +# +# @old-secret: Optional (for deactivation only) +# If given will deactive all keyslots that +# match password located in QCryptoSecret with this ID +# +# @iter-time: Optional (for activation only) +# Number of milliseconds to spend in +# PBKDF passphrase processing for the newly activated keys= lot. +# Currently defaults to 2000. +# +# @keyslot: Optional. ID of the keyslot to activate/deactivate. +# For keyslot activation, keyslot should not be active alr= eady +# (this is unsafe to update an active keyslot), +# but possible if 'force' parameter is given. +# If keyslot is not given, first free keyslot will be writ= ten. +# +# For keyslot deactivation, this parameter specifies the e= xact +# keyslot to deactivate +# +# @secret: Optional. The ID of a QCryptoSecret object providing the +# password to use to retrive current master key. +# Defaults to the same secret that was used to open the im= age +# +# +# Since 5.1 +## +{ 'struct': 'QCryptoBlockAmendOptionsLUKS', + 'data': { 'state': 'QCryptoBlockLUKSKeyslotState', + '*new-secret': 'str', + '*old-secret': 'str', + '*keyslot': 'int', + '*iter-time': 'int', + '*secret': 'str' } } =20 ## # @QCryptoBlockAmendOptions: @@ -324,4 +379,4 @@ 'base': 'QCryptoBlockOptionsBase', 'discriminator': 'format', 'data': { - } } + 'luks': 'QCryptoBlockAmendOptionsLUKS' } } --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609338; cv=none; d=zohomail.com; s=zohoarc; b=Wl5vL3ksSbuo7AEbkumv/Hs1F/PGeAw4npMz0VQCPb9GhsCQNc3qfSSlQo5iGI4xNNcRNlt6uI8PLz1srbdGw0Lxaa0VSFhpaMB+Qici4AJkShIUlIFdHaPeMc8whukBAUUWsEbGu1khfaTbmgibLqx51TudsP2DtcuKBPaqQ5o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609338; h=Content-Type:Content-Transfer-Encoding:Cc: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=Z27I+HY6VPAfFMmgll0XPBu+3KpkGD8DTHKSpDskB+Y=; b=Ror+mCTfpIUyNvs8IXu1A4CfAjqEd1QSqPatbKz/MJH/7XAJk72DvckdGLhnY2lVoi1HX7KQ3StBaGsjTz4EmGYywdz7SVNrpgZjEpjsQb8bBKYGXEwmXVkLIai9IvGHTzwhTDhZiGri8QIt49X1J7m/aAzUbI72MZEODWYfgM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609338901617.7907821923296; Mon, 8 Jun 2020 02:42:18 -0700 (PDT) Received: from localhost ([::1]:43692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEIL-0007jk-Lz for importer@patchew.org; Mon, 08 Jun 2020 05:42:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEGv-000616-Gt for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:49 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:23025 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEGt-00027e-UA for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:48 -0400 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-313-30O_YRyDMiqideFQbKkFSA-1; Mon, 08 Jun 2020 05:40:45 -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 5DF16107ACF4; Mon, 8 Jun 2020 09:40:44 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id E915B1CA; Mon, 8 Jun 2020 09:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z27I+HY6VPAfFMmgll0XPBu+3KpkGD8DTHKSpDskB+Y=; b=fmDEX+t+vxNBfJ3VEWmcY4M8y/NI6RRAQQcWfyD5qQ7CazwMIj1k61duWS6/NtamMHqgcx iQWyIxIziFqk8aRRoCotjblwT0l317KpBpRzw7/TYE01A5PO0C5VT6aj9POA7h741Xfdje PYtEY+WrDg6U0VHUhyqR93zlECeX34Q= X-MC-Unique: 30O_YRyDMiqideFQbKkFSA-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 03/14] block/amend: add 'force' option Date: Mon, 8 Jun 2020 12:40:19 +0300 Message-Id: <20200608094030.670121-4-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 'force' option will be used for some unsafe amend operations. This includes things like erasing last keyslot in luks based formats (which destroys the data, unless the master key is backed up by external means), but that _might_ be desired result. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block.c | 4 +++- block/qcow2.c | 1 + docs/tools/qemu-img.rst | 5 ++++- include/block/block.h | 1 + include/block/block_int.h | 1 + qemu-img-cmds.hx | 4 ++-- qemu-img.c | 8 +++++++- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/block.c b/block.c index 8416376c9b..10a1e87d1e 100644 --- a/block.c +++ b/block.c @@ -6482,6 +6482,7 @@ void bdrv_remove_aio_context_notifier(BlockDriverStat= e *bs, =20 int bdrv_amend_options(BlockDriverState *bs, QemuOpts *opts, BlockDriverAmendStatusCB *status_cb, void *cb_opaqu= e, + bool force, Error **errp) { if (!bs->drv) { @@ -6493,7 +6494,8 @@ int bdrv_amend_options(BlockDriverState *bs, QemuOpts= *opts, bs->drv->format_name); return -ENOTSUP; } - return bs->drv->bdrv_amend_options(bs, opts, status_cb, cb_opaque, err= p); + return bs->drv->bdrv_amend_options(bs, opts, status_cb, + cb_opaque, force, errp); } =20 /* diff --git a/block/qcow2.c b/block/qcow2.c index 0cd2e6757e..2ab0c382f7 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -5340,6 +5340,7 @@ static void qcow2_amend_helper_cb(BlockDriverState *b= s, static int qcow2_amend_options(BlockDriverState *bs, QemuOpts *opts, BlockDriverAmendStatusCB *status_cb, void *cb_opaque, + bool force, Error **errp) { BDRVQcow2State *s =3D bs->opaque; diff --git a/docs/tools/qemu-img.rst b/docs/tools/qemu-img.rst index 69cd9a3037..f14332ea50 100644 --- a/docs/tools/qemu-img.rst +++ b/docs/tools/qemu-img.rst @@ -253,11 +253,14 @@ Command description: =20 .. program:: qemu-img-commands =20 -.. option:: amend [--object OBJECTDEF] [--image-opts] [-p] [-q] [-f FMT] [= -t CACHE] -o OPTIONS FILENAME +.. option:: amend [--object OBJECTDEF] [--image-opts] [-p] [-q] [-f FMT] [= -t CACHE] [--force] -o OPTIONS FILENAME =20 Amends the image format specific *OPTIONS* for the image file *FILENAME*. Not all file formats support this operation. =20 + --force allows some unsafe operations. Currently for -f luks, it allows = to + erase the last encryption key, and to overwrite an active encryption key. + .. option:: bench [-c COUNT] [-d DEPTH] [-f FMT] [--flush-interval=3DFLUSH= _INTERVAL] [-i AIO] [-n] [--no-drain] [-o OFFSET] [--pattern=3DPATTERN] [-q= ] [-s BUFFER_SIZE] [-S STEP_SIZE] [-t CACHE] [-w] [-U] FILENAME =20 Run a simple sequential I/O benchmark on the specified image. If ``-w`` = is diff --git a/include/block/block.h b/include/block/block.h index 25e299605e..86f9728f00 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -450,6 +450,7 @@ typedef void BlockDriverAmendStatusCB(BlockDriverState = *bs, int64_t offset, int64_t total_work_size, void *opaqu= e); int bdrv_amend_options(BlockDriverState *bs_new, QemuOpts *opts, BlockDriverAmendStatusCB *status_cb, void *cb_opaqu= e, + bool force, Error **errp); =20 /* check if a named node can be replaced when doing drive-mirror */ diff --git a/include/block/block_int.h b/include/block/block_int.h index 791de6a59c..066b9eaa40 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -440,6 +440,7 @@ struct BlockDriver { int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts, BlockDriverAmendStatusCB *status_cb, void *cb_opaque, + bool force, Error **errp); =20 void (*bdrv_debug_event)(BlockDriverState *bs, BlkdebugEvent event); diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx index 10b910b67c..b89c019b76 100644 --- a/qemu-img-cmds.hx +++ b/qemu-img-cmds.hx @@ -10,9 +10,9 @@ HXCOMM When amending the rST sections, please remember to= copy the usage HXCOMM over to the per-command sections in docs/tools/qemu-img.rst. =20 DEF("amend", img_amend, - "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cach= e] -o options filename") + "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cach= e] [--force] -o options filename") SRST -.. option:: amend [--object OBJECTDEF] [--image-opts] [-p] [-q] [-f FMT] [= -t CACHE] -o OPTIONS FILENAME +.. option:: amend [--object OBJECTDEF] [--image-opts] [-p] [-q] [-f FMT] [= -t CACHE] [--force] -o OPTIONS FILENAME ERST =20 DEF("bench", img_bench, diff --git a/qemu-img.c b/qemu-img.c index d7e846e607..10d81f09db 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -79,6 +79,7 @@ enum { OPTION_DISABLE =3D 273, OPTION_MERGE =3D 274, OPTION_BITMAPS =3D 275, + OPTION_FORCE =3D 276, }; =20 typedef enum OutputFormat { @@ -4099,6 +4100,7 @@ static int img_amend(int argc, char **argv) BlockBackend *blk =3D NULL; BlockDriverState *bs =3D NULL; bool image_opts =3D false; + bool force =3D false; =20 cache =3D BDRV_DEFAULT_CACHE; for (;;) { @@ -4106,6 +4108,7 @@ static int img_amend(int argc, char **argv) {"help", no_argument, 0, 'h'}, {"object", required_argument, 0, OPTION_OBJECT}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, + {"force", no_argument, 0, OPTION_FORCE}, {0, 0, 0, 0} }; c =3D getopt_long(argc, argv, ":ho:f:t:pq", @@ -4153,6 +4156,9 @@ static int img_amend(int argc, char **argv) case OPTION_IMAGE_OPTS: image_opts =3D true; break; + case OPTION_FORCE: + force =3D true; + break; } } =20 @@ -4230,7 +4236,7 @@ static int img_amend(int argc, char **argv) =20 /* In case the driver does not call amend_status_cb() */ qemu_progress_print(0.f, 0); - ret =3D bdrv_amend_options(bs, opts, &amend_status_cb, NULL, &err); + ret =3D bdrv_amend_options(bs, opts, &amend_status_cb, NULL, force, &e= rr); qemu_progress_print(100.f, 0); if (ret < 0) { error_report_err(err); --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609342; cv=none; d=zohomail.com; s=zohoarc; b=l0Bemv2D3goWkaUeAZErdLeKKhj/Zz5rBwchGuRT97KOhngiuKpSCEAJZhlzVFS6UAhlgn6jkzc4Vr4SHM3aF3jhlgPZoxHKNiQJ984U1N1RfeJjJCXEYU5ldacZFkmTISrSblFv76z1g2ZM1SPjeWBYzbk8bsHeGwJt2rcUBl8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609342; h=Content-Type:Content-Transfer-Encoding:Cc: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=dSqSMTm3xEze74IeDBuJQBBTmq5lHm1prF9nOKlWs4Y=; b=XEa5HFqs+JbpxHacskSmkconO9ZKUOuFpnNLx8uRJKbM9DEDhV48f6kh6yZ9A9Z4lPkk1VcU2zDh7/lQBW44BtDfqC3I6gVNMe3hsm8ubtHLrtkYiVW6YOFIR8BXlrOs6bAQepGxCt+0Os4pR4qu/dJu8boli/xHQLWST9deOvg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609342312488.3868634027059; Mon, 8 Jun 2020 02:42:22 -0700 (PDT) Received: from localhost ([::1]:43894 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEIO-0007op-V2 for importer@patchew.org; Mon, 08 Jun 2020 05:42:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEGy-00064U-6u for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:20724 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEGw-00029i-Oq for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:40:51 -0400 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-38-tV2IJ-P7NVaeg7QyFuHlGw-1; Mon, 08 Jun 2020 05:40:48 -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 3F1BB1940920; Mon, 8 Jun 2020 09:40:47 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id C55CA1CA; Mon, 8 Jun 2020 09:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dSqSMTm3xEze74IeDBuJQBBTmq5lHm1prF9nOKlWs4Y=; b=QiUa+XTYnlDqv0Oaj8UnVpZJsiu7gHRwQxLrInF8rUPyas7X9m7d91mhIkclZjWJQ5SnCy 3uDO5b2KmtLrMfXnID6P31LkK+a/eh7P/IzvH5HC6SYLp47AyY/kt4f0/2Fi1Jx+K4HqRq tT60uu4ZM2WZ7R96MJuUxMfdwz7EJ3Q= X-MC-Unique: tV2IJ-P7NVaeg7QyFuHlGw-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 04/14] block/amend: separate amend and create options for qemu-img Date: Mon, 8 Jun 2020 12:40:20 +0300 Message-Id: <20200608094030.670121-5-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mlevitsk@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:05:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Some options are only useful for creation (or hard to be amended, like cluster size for qcow2), while some other options are only useful for amend, like upcoming keyslot management options for luks Since currently only qcow2 supports amend, move all its options to a common macro and then include it in each action option list. In future it might be useful to remove some options which are not supported anyway from amend list, which currently cause an error message if amended. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block/qcow2.c | 173 +++++++++++++++++++++----------------- include/block/block_int.h | 4 + qemu-img.c | 18 ++-- 3 files changed, 107 insertions(+), 88 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 2ab0c382f7..fcfd90f2e2 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -5649,89 +5649,103 @@ void qcow2_signal_corruption(BlockDriverState *bs,= bool fatal, int64_t offset, s->signaled_corruption =3D true; } =20 +#define QCOW_COMMON_OPTIONS \ + { \ + .name =3D BLOCK_OPT_SIZE, \ + .type =3D QEMU_OPT_SIZE, \ + .help =3D "Virtual disk size" \ + }, \ + { \ + .name =3D BLOCK_OPT_COMPAT_LEVEL, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Compatibility level (v2 [0.10] or v3 [1.1])" \ + }, \ + { \ + .name =3D BLOCK_OPT_BACKING_FILE, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "File name of a base image" \ + }, \ + { \ + .name =3D BLOCK_OPT_BACKING_FMT, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Image format of the base image" \ + }, \ + { \ + .name =3D BLOCK_OPT_DATA_FILE, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "File name of an external data file" \ + }, \ + { \ + .name =3D BLOCK_OPT_DATA_FILE_RAW, \ + .type =3D QEMU_OPT_BOOL, \ + .help =3D "The external data file must stay valid " \ + "as a raw image" \ + }, \ + { \ + .name =3D BLOCK_OPT_ENCRYPT, \ + .type =3D QEMU_OPT_BOOL, \ + .help =3D "Encrypt the image with format 'aes'. (Deprecated " \ + "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=3Daes)", \ + }, \ + { \ + .name =3D BLOCK_OPT_ENCRYPT_FORMAT, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Encrypt the image, format choices: 'aes', 'luks'", \ + }, \ + BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", \ + "ID of secret providing qcow AES key or LUKS passphrase"), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), \ + { \ + .name =3D BLOCK_OPT_CLUSTER_SIZE, \ + .type =3D QEMU_OPT_SIZE, \ + .help =3D "qcow2 cluster size", \ + .def_value_str =3D stringify(DEFAULT_CLUSTER_SIZE) \ + }, \ + { \ + .name =3D BLOCK_OPT_PREALLOC, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Preallocation mode (allowed values: off, " \ + "metadata, falloc, full)" \ + }, \ + { \ + .name =3D BLOCK_OPT_LAZY_REFCOUNTS, \ + .type =3D QEMU_OPT_BOOL, \ + .help =3D "Postpone refcount updates", \ + .def_value_str =3D "off" \ + }, \ + { \ + .name =3D BLOCK_OPT_REFCOUNT_BITS, \ + .type =3D QEMU_OPT_NUMBER, \ + .help =3D "Width of a reference count entry in bits", \ + .def_value_str =3D "16" \ + }, \ + { \ + .name =3D BLOCK_OPT_COMPRESSION_TYPE, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Compression method used for image cluster " \ + "compression", \ + .def_value_str =3D "zlib" \ + } + static QemuOptsList qcow2_create_opts =3D { .name =3D "qcow2-create-opts", .head =3D QTAILQ_HEAD_INITIALIZER(qcow2_create_opts.head), .desc =3D { - { - .name =3D BLOCK_OPT_SIZE, - .type =3D QEMU_OPT_SIZE, - .help =3D "Virtual disk size" - }, - { - .name =3D BLOCK_OPT_COMPAT_LEVEL, - .type =3D QEMU_OPT_STRING, - .help =3D "Compatibility level (v2 [0.10] or v3 [1.1])" - }, - { - .name =3D BLOCK_OPT_BACKING_FILE, - .type =3D QEMU_OPT_STRING, - .help =3D "File name of a base image" - }, - { - .name =3D BLOCK_OPT_BACKING_FMT, - .type =3D QEMU_OPT_STRING, - .help =3D "Image format of the base image" - }, - { - .name =3D BLOCK_OPT_DATA_FILE, - .type =3D QEMU_OPT_STRING, - .help =3D "File name of an external data file" - }, - { - .name =3D BLOCK_OPT_DATA_FILE_RAW, - .type =3D QEMU_OPT_BOOL, - .help =3D "The external data file must stay valid as a raw ima= ge" - }, - { - .name =3D BLOCK_OPT_ENCRYPT, - .type =3D QEMU_OPT_BOOL, - .help =3D "Encrypt the image with format 'aes'. (Deprecated " - "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=3Daes)", - }, - { - .name =3D BLOCK_OPT_ENCRYPT_FORMAT, - .type =3D QEMU_OPT_STRING, - .help =3D "Encrypt the image, format choices: 'aes', 'luks'", - }, - BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", - "ID of secret providing qcow AES key or LUKS passphrase"), - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), - BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), - BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), - { - .name =3D BLOCK_OPT_CLUSTER_SIZE, - .type =3D QEMU_OPT_SIZE, - .help =3D "qcow2 cluster size", - .def_value_str =3D stringify(DEFAULT_CLUSTER_SIZE) - }, - { - .name =3D BLOCK_OPT_PREALLOC, - .type =3D QEMU_OPT_STRING, - .help =3D "Preallocation mode (allowed values: off, metadata, " - "falloc, full)" - }, - { - .name =3D BLOCK_OPT_LAZY_REFCOUNTS, - .type =3D QEMU_OPT_BOOL, - .help =3D "Postpone refcount updates", - .def_value_str =3D "off" - }, - { - .name =3D BLOCK_OPT_REFCOUNT_BITS, - .type =3D QEMU_OPT_NUMBER, - .help =3D "Width of a reference count entry in bits", - .def_value_str =3D "16" - }, - { - .name =3D BLOCK_OPT_COMPRESSION_TYPE, - .type =3D QEMU_OPT_STRING, - .help =3D "Compression method used for image cluster compressi= on", - .def_value_str =3D "zlib" - }, + QCOW_COMMON_OPTIONS, + { /* end of list */ } + } +}; + +static QemuOptsList qcow2_amend_opts =3D { + .name =3D "qcow2-amend-opts", + .head =3D QTAILQ_HEAD_INITIALIZER(qcow2_amend_opts.head), + .desc =3D { + QCOW_COMMON_OPTIONS, { /* end of list */ } } }; @@ -5792,6 +5806,7 @@ BlockDriver bdrv_qcow2 =3D { .bdrv_inactivate =3D qcow2_inactivate, =20 .create_opts =3D &qcow2_create_opts, + .amend_opts =3D &qcow2_amend_opts, .strong_runtime_opts =3D qcow2_strong_runtime_opts, .mutable_opts =3D mutable_opts, .bdrv_co_check =3D qcow2_co_check, diff --git a/include/block/block_int.h b/include/block/block_int.h index 066b9eaa40..ed335519cc 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -420,6 +420,10 @@ struct BlockDriver { =20 /* List of options for creating images, terminated by name =3D=3D NULL= */ QemuOptsList *create_opts; + + /* List of options for image amend */ + QemuOptsList *amend_opts; + /* * If this driver supports reopening images this contains a * NULL-terminated list of the runtime options that can be diff --git a/qemu-img.c b/qemu-img.c index 10d81f09db..0c4541b017 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4077,11 +4077,11 @@ static int print_amend_option_help(const char *form= at) return 1; } =20 - /* Every driver supporting amendment must have create_opts */ - assert(drv->create_opts); + /* Every driver supporting amendment must have amend_opts */ + assert(drv->amend_opts); =20 printf("Creation options for '%s':\n", format); - qemu_opts_print_help(drv->create_opts, false); + qemu_opts_print_help(drv->amend_opts, false); printf("\nNote that not all of these options may be amendable.\n"); return 0; } @@ -4091,7 +4091,7 @@ static int img_amend(int argc, char **argv) Error *err =3D NULL; int c, ret =3D 0; char *options =3D NULL; - QemuOptsList *create_opts =3D NULL; + QemuOptsList *amend_opts =3D NULL; QemuOpts *opts =3D NULL; const char *fmt =3D NULL, *filename, *cache; int flags; @@ -4222,11 +4222,11 @@ static int img_amend(int argc, char **argv) goto out; } =20 - /* Every driver supporting amendment must have create_opts */ - assert(bs->drv->create_opts); + /* Every driver supporting amendment must have amend_opts */ + assert(bs->drv->amend_opts); =20 - create_opts =3D qemu_opts_append(create_opts, bs->drv->create_opts); - opts =3D qemu_opts_create(create_opts, NULL, 0, &error_abort); + amend_opts =3D qemu_opts_append(amend_opts, bs->drv->amend_opts); + opts =3D qemu_opts_create(amend_opts, NULL, 0, &error_abort); qemu_opts_do_parse(opts, options, NULL, &err); if (err) { error_report_err(err); @@ -4249,7 +4249,7 @@ out: out_no_progress: blk_unref(blk); qemu_opts_del(opts); - qemu_opts_free(create_opts); + qemu_opts_free(amend_opts); g_free(options); =20 if (ret) { --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609472; cv=none; d=zohomail.com; s=zohoarc; b=mD+mxySYsMKgIP0pODsRI7SbUhuzgMc8TnspKN7zx6iV00OQtvVH6I2POxAXHJJbBndqwwaYrTIYr7n8gmzRDGA05LsaeUJIqnMtDpqrVPi8aX7XxSqMC5/ORMaH/Z04PEO2JErQ4wd90TPC4M7nh0beBcdCZq54WQyp271BbGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609472; h=Content-Type:Content-Transfer-Encoding:Cc: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=bgA7cj03JiBAhxINk8s8nnfNrrgiUmFUgzgXmHyszXQ=; b=d3j138Tkf59DbvI9mjFPpMbBlfm8u+hwbMLO/V0Ws3eLiXAn44lPUet+zdZK+nrDOz/5UoSPI9iHyka4swrxcC3XRMjTO5r953whZZkgt7PcbPbqirkrye44akuU7flOa1sDsZnOS+jN4+fLtR9VHbDJyjyskrdtpskNa3oB8zg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609472640331.2100517791955; Mon, 8 Jun 2020 02:44:32 -0700 (PDT) Received: from localhost ([::1]:52930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEKU-00039I-Sf for importer@patchew.org; Mon, 08 Jun 2020 05:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHC-0006Po-Jf for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:06 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:55864 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEH3-0002AA-RH for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:06 -0400 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-235-teI6CbVzPG2NDKw0IDTnJQ-1; Mon, 08 Jun 2020 05:40:53 -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 D3A6B461; Mon, 8 Jun 2020 09:40:52 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6620891E0; Mon, 8 Jun 2020 09:40:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609256; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bgA7cj03JiBAhxINk8s8nnfNrrgiUmFUgzgXmHyszXQ=; b=Jvm+b9wWheS38hLavGFMGzMEk5ETOE/b+IbKfCi3+Eg+Wp2A7JIgZEhd1QibSOZ14GDtRq +mr4ASRBSWQo69Wq/UIJEuIoAtXireTVAbuEE1HXA5mtFAWzftxY1Sk0hfUVNv0nDYO1tB y3hm7rIY064mVnE5OAHXJoiDrirEPB4= X-MC-Unique: teI6CbVzPG2NDKw0IDTnJQ-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 05/14] block/amend: refactor qcow2 amend options Date: Mon, 8 Jun 2020 12:40:21 +0300 Message-Id: <20200608094030.670121-6-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Some qcow2 create options can't be used for amend. Remove them from the qcow2 create options and add generic logic to detect such options in qemu-img Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- block/qcow2.c | 138 ++++++++------------------ qemu-img.c | 18 +++- tests/qemu-iotests/049.out | 102 ++++++++++---------- tests/qemu-iotests/061.out | 12 ++- tests/qemu-iotests/079.out | 18 ++-- tests/qemu-iotests/082.out | 158 ++++-------------------------- tests/qemu-iotests/085.out | 38 ++++---- tests/qemu-iotests/087.out | 6 +- tests/qemu-iotests/115.out | 2 +- tests/qemu-iotests/121.out | 4 +- tests/qemu-iotests/125.out | 192 ++++++++++++++++++------------------- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/144.out | 4 +- tests/qemu-iotests/158.out | 4 +- tests/qemu-iotests/182.out | 2 +- tests/qemu-iotests/185.out | 8 +- tests/qemu-iotests/188.out | 2 +- tests/qemu-iotests/189.out | 4 +- tests/qemu-iotests/198.out | 4 +- tests/qemu-iotests/243.out | 16 ++-- tests/qemu-iotests/250.out | 2 +- tests/qemu-iotests/255.out | 8 +- tests/qemu-iotests/259.out | 2 +- tests/qemu-iotests/263.out | 4 +- tests/qemu-iotests/274.out | 46 ++++----- tests/qemu-iotests/280.out | 2 +- tests/qemu-iotests/284.out | 6 +- 27 files changed, 317 insertions(+), 487 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index fcfd90f2e2..b3ed173a9b 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3042,17 +3042,6 @@ static int qcow2_change_backing_file(BlockDriverStat= e *bs, return qcow2_update_header(bs); } =20 -static int qcow2_crypt_method_from_format(const char *encryptfmt) -{ - if (g_str_equal(encryptfmt, "luks")) { - return QCOW_CRYPT_LUKS; - } else if (g_str_equal(encryptfmt, "aes")) { - return QCOW_CRYPT_AES; - } else { - return -EINVAL; - } -} - static int qcow2_set_up_encryption(BlockDriverState *bs, QCryptoBlockCreateOptions *cryptoopts, Error **errp) @@ -5350,9 +5339,6 @@ static int qcow2_amend_options(BlockDriverState *bs, = QemuOpts *opts, bool lazy_refcounts =3D s->use_lazy_refcounts; bool data_file_raw =3D data_file_is_raw(bs); const char *compat =3D NULL; - uint64_t cluster_size =3D s->cluster_size; - bool encrypt; - int encformat; int refcount_bits =3D s->refcount_bits; int ret; QemuOptDesc *desc =3D opts->list->desc; @@ -5377,44 +5363,12 @@ static int qcow2_amend_options(BlockDriverState *bs= , QemuOpts *opts, error_setg(errp, "Unknown compatibility level %s", compat); return -EINVAL; } - } else if (!strcmp(desc->name, BLOCK_OPT_PREALLOC)) { - error_setg(errp, "Cannot change preallocation mode"); - return -ENOTSUP; } else if (!strcmp(desc->name, BLOCK_OPT_SIZE)) { new_size =3D qemu_opt_get_size(opts, BLOCK_OPT_SIZE, 0); } else if (!strcmp(desc->name, BLOCK_OPT_BACKING_FILE)) { backing_file =3D qemu_opt_get(opts, BLOCK_OPT_BACKING_FILE); } else if (!strcmp(desc->name, BLOCK_OPT_BACKING_FMT)) { backing_format =3D qemu_opt_get(opts, BLOCK_OPT_BACKING_FMT); - } else if (!strcmp(desc->name, BLOCK_OPT_ENCRYPT)) { - encrypt =3D qemu_opt_get_bool(opts, BLOCK_OPT_ENCRYPT, - !!s->crypto); - - if (encrypt !=3D !!s->crypto) { - error_setg(errp, - "Changing the encryption flag is not supported"= ); - return -ENOTSUP; - } - } else if (!strcmp(desc->name, BLOCK_OPT_ENCRYPT_FORMAT)) { - encformat =3D qcow2_crypt_method_from_format( - qemu_opt_get(opts, BLOCK_OPT_ENCRYPT_FORMAT)); - - if (encformat !=3D s->crypt_method_header) { - error_setg(errp, - "Changing the encryption format is not supporte= d"); - return -ENOTSUP; - } - } else if (g_str_has_prefix(desc->name, "encrypt.")) { - error_setg(errp, - "Changing the encryption parameters is not supporte= d"); - return -ENOTSUP; - } else if (!strcmp(desc->name, BLOCK_OPT_CLUSTER_SIZE)) { - cluster_size =3D qemu_opt_get_size(opts, BLOCK_OPT_CLUSTER_SIZ= E, - cluster_size); - if (cluster_size !=3D s->cluster_size) { - error_setg(errp, "Changing the cluster size is not support= ed"); - return -ENOTSUP; - } } else if (!strcmp(desc->name, BLOCK_OPT_LAZY_REFCOUNTS)) { lazy_refcounts =3D qemu_opt_get_bool(opts, BLOCK_OPT_LAZY_REFC= OUNTS, lazy_refcounts); @@ -5444,22 +5398,6 @@ static int qcow2_amend_options(BlockDriverState *bs,= QemuOpts *opts, "images"); return -EINVAL; } - } else if (!strcmp(desc->name, BLOCK_OPT_COMPRESSION_TYPE)) { - const char *ct_name =3D - qemu_opt_get(opts, BLOCK_OPT_COMPRESSION_TYPE); - int compression_type =3D - qapi_enum_parse(&Qcow2CompressionType_lookup, ct_name, -1, - NULL); - if (compression_type =3D=3D -1) { - error_setg(errp, "Unknown compression type: %s", ct_name); - return -ENOTSUP; - } - - if (compression_type !=3D s->compression_type) { - error_setg(errp, "Changing the compression type " - "is not supported"); - return -ENOTSUP; - } } else { /* if this point is reached, this probably means a new option = was * added without having it covered here */ @@ -5681,37 +5619,6 @@ void qcow2_signal_corruption(BlockDriverState *bs, b= ool fatal, int64_t offset, .help =3D "The external data file must stay valid " \ "as a raw image" \ }, \ - { \ - .name =3D BLOCK_OPT_ENCRYPT, \ - .type =3D QEMU_OPT_BOOL, \ - .help =3D "Encrypt the image with format 'aes'. (Deprecated " \ - "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=3Daes)", \ - }, \ - { \ - .name =3D BLOCK_OPT_ENCRYPT_FORMAT, \ - .type =3D QEMU_OPT_STRING, \ - .help =3D "Encrypt the image, format choices: 'aes', 'luks'", \ - }, \ - BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", \ - "ID of secret providing qcow AES key or LUKS passphrase"), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), \ - BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), \ - { \ - .name =3D BLOCK_OPT_CLUSTER_SIZE, \ - .type =3D QEMU_OPT_SIZE, \ - .help =3D "qcow2 cluster size", \ - .def_value_str =3D stringify(DEFAULT_CLUSTER_SIZE) \ - }, \ - { \ - .name =3D BLOCK_OPT_PREALLOC, \ - .type =3D QEMU_OPT_STRING, \ - .help =3D "Preallocation mode (allowed values: off, " \ - "metadata, falloc, full)" \ - }, \ { \ .name =3D BLOCK_OPT_LAZY_REFCOUNTS, \ .type =3D QEMU_OPT_BOOL, \ @@ -5723,19 +5630,50 @@ void qcow2_signal_corruption(BlockDriverState *bs, = bool fatal, int64_t offset, .type =3D QEMU_OPT_NUMBER, \ .help =3D "Width of a reference count entry in bits", \ .def_value_str =3D "16" \ - }, \ - { \ - .name =3D BLOCK_OPT_COMPRESSION_TYPE, \ - .type =3D QEMU_OPT_STRING, \ - .help =3D "Compression method used for image cluster " \ - "compression", \ - .def_value_str =3D "zlib" \ } =20 static QemuOptsList qcow2_create_opts =3D { .name =3D "qcow2-create-opts", .head =3D QTAILQ_HEAD_INITIALIZER(qcow2_create_opts.head), .desc =3D { + { \ + .name =3D BLOCK_OPT_ENCRYPT, \ + .type =3D QEMU_OPT_BOOL, \ + .help =3D "Encrypt the image with format 'aes'. (Deprecated " \ + "in favor of " BLOCK_OPT_ENCRYPT_FORMAT "=3Daes)", \ + }, \ + { \ + .name =3D BLOCK_OPT_ENCRYPT_FORMAT, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Encrypt the image, format choices: 'aes', 'luks'", \ + }, \ + BLOCK_CRYPTO_OPT_DEF_KEY_SECRET("encrypt.", \ + "ID of secret providing qcow AES key or LUKS passphrase"), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_CIPHER_MODE("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_IVGEN_HASH_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_HASH_ALG("encrypt."), \ + BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), \ + { \ + .name =3D BLOCK_OPT_CLUSTER_SIZE, \ + .type =3D QEMU_OPT_SIZE, \ + .help =3D "qcow2 cluster size", \ + .def_value_str =3D stringify(DEFAULT_CLUSTER_SIZE) \ + }, \ + { \ + .name =3D BLOCK_OPT_PREALLOC, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Preallocation mode (allowed values: off, " \ + "metadata, falloc, full)" \ + }, \ + { \ + .name =3D BLOCK_OPT_COMPRESSION_TYPE, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Compression method used for image cluster " \ + "compression", \ + .def_value_str =3D "zlib" \ + }, QCOW_COMMON_OPTIONS, { /* end of list */ } } diff --git a/qemu-img.c b/qemu-img.c index 0c4541b017..381271a74e 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4080,9 +4080,8 @@ static int print_amend_option_help(const char *format) /* Every driver supporting amendment must have amend_opts */ assert(drv->amend_opts); =20 - printf("Creation options for '%s':\n", format); + printf("Amend options for '%s':\n", format); qemu_opts_print_help(drv->amend_opts, false); - printf("\nNote that not all of these options may be amendable.\n"); return 0; } =20 @@ -4228,7 +4227,22 @@ static int img_amend(int argc, char **argv) amend_opts =3D qemu_opts_append(amend_opts, bs->drv->amend_opts); opts =3D qemu_opts_create(amend_opts, NULL, 0, &error_abort); qemu_opts_do_parse(opts, options, NULL, &err); + if (err) { + /* Try to parse options using the create options */ + Error *err1 =3D NULL; + amend_opts =3D qemu_opts_append(amend_opts, bs->drv->create_opts); + qemu_opts_del(opts); + opts =3D qemu_opts_create(amend_opts, NULL, 0, &error_abort); + qemu_opts_do_parse(opts, options, NULL, &err1); + + if (!err1) { + error_append_hint(&err, + "This option is only supported for image cre= ation\n"); + } else { + error_free(err1); + } + error_report_err(err); ret =3D -1; goto out; diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out index c54ae21b86..e77966446b 100644 --- a/tests/qemu-iotests/049.out +++ b/tests/qemu-iotests/049.out @@ -4,90 +4,90 @@ QA output created by 049 =3D=3D 1. Traditional size parameter =3D=3D =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024b -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1k -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1K -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1048576 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1048576 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1G -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1073741824 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1073741824 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1T -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1099511627776 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1099511627776 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1024.0b -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5k -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1536 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1536 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5K -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1536 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1536 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1572864 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1572864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5G -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1610612736 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1610612736 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 TEST_DIR/t.qcow2 1.5T -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1649267441664 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1649267441664 lazy_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D 2. Specifying size via -o =3D=3D =20 qemu-img create -f qcow2 -o size=3D1024 TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1024b TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1k TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1K TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1M TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1048576 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1048576 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1G TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1073741824 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1073741824 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1T TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1099511627776 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1099511627776 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1024.0 TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1024.0b TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1024 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1024 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1.5k TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1536 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1536 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1.5K TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1536 cluster_size=3D6553= 6 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1536 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1.5M TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1572864 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1572864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1.5G TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1610612736 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1610612736 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o size=3D1.5T TEST_DIR/t.qcow2 -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D1649267441664 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1649267441664 lazy_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D 3. Invalid sizes =3D=3D =20 @@ -129,84 +129,84 @@ qemu-img: TEST_DIR/t.qcow2: The image size must be sp= ecified only once =3D=3D Check correct interpretation of suffixes for cluster size =3D=3D =20 qemu-img create -f qcow2 -o cluster_size=3D1024 TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1024b TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1k TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1K TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1M TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1048576 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1048576 compress= ion_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1024.0 TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D1024.0b TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 1024 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D1024 compression= _type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D0.5k TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 512 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D512 compression_= type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D0.5K TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 512 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D512 compression_= type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 qemu-img create -f qcow2 -o cluster_size=3D0.5M TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 524288 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D524288 compressi= on_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D Check compat level option =3D=3D =20 qemu-img create -f qcow2 -o compat=3D0.10 TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D0.10 c= luster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_typ= e=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D0.10 lazy_refcounts=3Doff refcount_b= its=3D16 =20 qemu-img create -f qcow2 -o compat=3D1.1 TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D1.1 cl= uster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type= =3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D1.1 lazy_refcounts=3Doff refcount_bi= ts=3D16 =20 qemu-img create -f qcow2 -o compat=3D0.42 TEST_DIR/t.qcow2 64M qemu-img: TEST_DIR/t.qcow2: Invalid parameter '0.42' -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D0.42 c= luster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_typ= e=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D0.42 lazy_refcounts=3Doff refcount_b= its=3D16 =20 qemu-img create -f qcow2 -o compat=3Dfoobar TEST_DIR/t.qcow2 64M qemu-img: TEST_DIR/t.qcow2: Invalid parameter 'foobar' -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3Dfoobar= cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_t= ype=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3Dfoobar lazy_refcounts=3Doff refcount= _bits=3D16 =20 =3D=3D Check preallocation option =3D=3D =20 qemu-img create -f qcow2 -o preallocation=3Doff TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 65536 preallocation=3Doff lazy_refcounts=3Doff refcount_bits=3D16 compressi= on_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 preallocat= ion=3Doff compression_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refc= ount_bits=3D16 =20 qemu-img create -f qcow2 -o preallocation=3Dmetadata TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 65536 preallocation=3Dmetadata lazy_refcounts=3Doff refcount_bits=3D16 comp= ression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 preallocat= ion=3Dmetadata compression_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff= refcount_bits=3D16 =20 qemu-img create -f qcow2 -o preallocation=3D1234 TEST_DIR/t.qcow2 64M qemu-img: TEST_DIR/t.qcow2: Invalid parameter '1234' -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 cluster_size=3D= 65536 preallocation=3D1234 lazy_refcounts=3Doff refcount_bits=3D16 compress= ion_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 preallocat= ion=3D1234 compression_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff ref= count_bits=3D16 =20 =3D=3D Check encryption option =3D=3D =20 qemu-img create -f qcow2 -o encryption=3Doff TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 encryption=3Dof= f cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_= type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 encryption=3Doff cluster_size= =3D65536 compression_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refco= unt_bits=3D16 =20 qemu-img create -f qcow2 --object secret,id=3Dsec0,data=3D123456 -o encryp= tion=3Don,encrypt.key-secret=3Dsec0 TEST_DIR/t.qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 encryption=3Don= encrypt.key-secret=3Dsec0 cluster_size=3D65536 lazy_refcounts=3Doff refcou= nt_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 encryption=3Don encrypt.key-sec= ret=3Dsec0 cluster_size=3D65536 compression_type=3Dzlib size=3D67108864 laz= y_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D Check lazy_refcounts option (only with v3) =3D=3D =20 qemu-img create -f qcow2 -o compat=3D1.1,lazy_refcounts=3Doff TEST_DIR/t.q= cow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D1.1 cl= uster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type= =3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D1.1 lazy_refcounts=3Doff refcount_bi= ts=3D16 =20 qemu-img create -f qcow2 -o compat=3D1.1,lazy_refcounts=3Don TEST_DIR/t.qc= ow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D1.1 cl= uster_size=3D65536 lazy_refcounts=3Don refcount_bits=3D16 compression_type= =3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D1.1 lazy_refcounts=3Don refcount_bit= s=3D16 =20 qemu-img create -f qcow2 -o compat=3D0.10,lazy_refcounts=3Doff TEST_DIR/t.= qcow2 64M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D0.10 c= luster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_typ= e=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D0.10 lazy_refcounts=3Doff refcount_b= its=3D16 =20 qemu-img create -f qcow2 -o compat=3D0.10,lazy_refcounts=3Don TEST_DIR/t.q= cow2 64M qemu-img: TEST_DIR/t.qcow2: Lazy refcounts only supported with compatibili= ty level 1.1 and above (use version=3Dv3 or greater) -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 compat=3D0.10 c= luster_size=3D65536 lazy_refcounts=3Don refcount_bits=3D16 compression_type= =3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 compat=3D0.10 lazy_refcounts=3Don refcount_bi= ts=3D16 =20 *** done diff --git a/tests/qemu-iotests/061.out b/tests/qemu-iotests/061.out index a51ad1b5ba..65204f41c5 100644 --- a/tests/qemu-iotests/061.out +++ b/tests/qemu-iotests/061.out @@ -381,16 +381,20 @@ qemu-img: Lazy refcounts only supported with compatib= ility level 1.1 and above ( qemu-img: Lazy refcounts only supported with compatibility level 1.1 and a= bove (use compat=3D1.1 or greater) qemu-img: Unknown compatibility level 0.42 qemu-img: Invalid parameter 'foo' -qemu-img: Changing the cluster size is not supported -qemu-img: Changing the encryption flag is not supported -qemu-img: Cannot change preallocation mode +qemu-img: Invalid parameter 'cluster_size' +This option is only supported for image creation +qemu-img: Invalid parameter 'encryption' +This option is only supported for image creation +qemu-img: Invalid parameter 'preallocation' +This option is only supported for image creation =20 =3D=3D=3D Testing correct handling of unset value =3D=3D=3D =20 Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 Should work: Should not work: -qemu-img: Changing the cluster size is not supported +qemu-img: Invalid parameter 'cluster_size' +This option is only supported for image creation =20 =3D=3D=3D Testing zero expansion on inactive clusters =3D=3D=3D =20 diff --git a/tests/qemu-iotests/079.out b/tests/qemu-iotests/079.out index aab922fb36..c7e37152f4 100644 --- a/tests/qemu-iotests/079.out +++ b/tests/qemu-iotests/079.out @@ -1,14 +1,14 @@ QA output created by 079 =3D=3D=3D Check option preallocation and cluster_size =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 qemu-img: TEST_DIR/t.IMGFMT: Cluster size must be a power of two between 5= 12 and 2048k -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D4294967296 preallocati= on=3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D4294967296 *** done diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out index 529a1214e1..b1cf5dfe43 100644 --- a/tests/qemu-iotests/082.out +++ b/tests/qemu-iotests/082.out @@ -3,14 +3,14 @@ QA output created by 082 =3D=3D=3D create: Options specified more than once =3D=3D=3D =20 Testing: create -f foo -f qcow2 TEST_DIR/t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 128 MiB (134217728 bytes) cluster_size: 65536 =20 Testing: create -f qcow2 -o cluster_size=3D4k -o lazy_refcounts=3Don TEST_= DIR/t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_size= =3D4096 lazy_refcounts=3Don refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D4096 compression= _type=3Dzlib size=3D134217728 lazy_refcounts=3Don refcount_bits=3D16 image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 128 MiB (134217728 bytes) @@ -23,7 +23,7 @@ Format specific information: corrupt: false =20 Testing: create -f qcow2 -o cluster_size=3D4k -o lazy_refcounts=3Don -o cl= uster_size=3D8k TEST_DIR/t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_size= =3D8192 lazy_refcounts=3Don refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D8192 compression= _type=3Dzlib size=3D134217728 lazy_refcounts=3Don refcount_bits=3D16 image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 128 MiB (134217728 bytes) @@ -36,7 +36,7 @@ Format specific information: corrupt: false =20 Testing: create -f qcow2 -o cluster_size=3D4k,cluster_size=3D8k TEST_DIR/t= .qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_size= =3D8192 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D8192 compression= _type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 128 MiB (134217728 bytes) @@ -237,10 +237,10 @@ Supported options: size=3D - Virtual disk size =20 Testing: create -f qcow2 -u -o backing_file=3DTEST_DIR/t.qcow2,,help TEST_= DIR/t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 backing_file= =3DTEST_DIR/t.qcow2,,help cluster_size=3D65536 lazy_refcounts=3Doff refcoun= t_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/t.qcow2,,help lazy_r= efcounts=3Doff refcount_bits=3D16 =20 Testing: create -f qcow2 -u -o backing_file=3DTEST_DIR/t.qcow2,,? TEST_DIR= /t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 backing_file= =3DTEST_DIR/t.qcow2,,? cluster_size=3D65536 lazy_refcounts=3Doff refcount_b= its=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/t.qcow2,,? lazy_refc= ounts=3Doff refcount_bits=3D16 =20 Testing: create -f qcow2 -o backing_file=3DTEST_DIR/t.qcow2, -o help TEST_= DIR/t.qcow2 128M qemu-img: Invalid option list: backing_file=3DTEST_DIR/t.qcow2, @@ -290,7 +290,7 @@ qemu-img: Format driver 'bochs' does not support image = creation =3D=3D=3D convert: Options specified more than once =3D=3D=3D =20 Testing: create -f qcow2 TEST_DIR/t.qcow2 128M -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 =20 Testing: convert -f foo -f qcow2 TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base image: TEST_DIR/t.IMGFMT.base @@ -639,205 +639,93 @@ cluster_size: 65536 =3D=3D=3D amend: help for -o =3D=3D=3D =20 Testing: amend -f qcow2 -o help TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o ? TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o cluster_size=3D4k,help TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o cluster_size=3D4k,? TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o help,cluster_size=3D4k TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o ?,cluster_size=3D4k TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o cluster_size=3D4k -o help TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o cluster_size=3D4k -o ? TEST_DIR/t.qcow2 -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -f qcow2 -o backing_file=3DTEST_DIR/t.qcow2,,help TEST_DIR/= t.qcow2 =20 Testing: rebase -u -b -f qcow2 TEST_DIR/t.qcow2 @@ -856,30 +744,16 @@ Testing: amend -f qcow2 -o backing_file=3DTEST_DIR/t.= qcow2 -o ,, -o help TEST_DIR/ qemu-img: Invalid option list: ,, =20 Testing: amend -f qcow2 -o help -Creation options for 'qcow2': +Amend options for 'qcow2': backing_file=3D - File name of a base image backing_fmt=3D - Image format of the base image - cluster_size=3D - qcow2 cluster size compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) - compression_type=3D - Compression method used for image cluster com= pression data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image - encrypt.cipher-alg=3D - Name of encryption cipher algorithm - encrypt.cipher-mode=3D - Name of encryption cipher mode - encrypt.format=3D - Encrypt the image, format choices: 'aes', 'lu= ks' - encrypt.hash-alg=3D - Name of encryption hash algorithm - encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds - encrypt.ivgen-alg=3D - Name of IV generator algorithm - encrypt.ivgen-hash-alg=3D - Name of IV generator hash algorithm - encrypt.key-secret=3D - ID of secret providing qcow AES key or LUKS= passphrase - encryption=3D - Encrypt the image with format 'aes'. (Dep= recated in favor of encrypt.format=3Daes) lazy_refcounts=3D - Postpone refcount updates - preallocation=3D - Preallocation mode (allowed values: off, meta= data, falloc, full) refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size =20 -Note that not all of these options may be amendable. - Testing: amend -o help qemu-img: Expecting one image file name =20 diff --git a/tests/qemu-iotests/085.out b/tests/qemu-iotests/085.out index a822ff4ef6..d68c06efdf 100644 --- a/tests/qemu-iotests/085.out +++ b/tests/qemu-iotests/085.out @@ -13,7 +13,7 @@ Formatting 'TEST_DIR/t.IMGFMT.2', fmt=3DIMGFMT size=3D134= 217728 =3D=3D=3D Create a single snapshot on virtio0 =3D=3D=3D =20 { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0',= 'snapshot-file':'TEST_DIR/1-snapshot-v0.IMGFMT', 'format': 'IMGFMT' } } -Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/t.qcow2.1 backing_fmt=3Dqcow2 cluster_size=3D65536 la= zy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/t.qcow2.= 1 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} =20 =3D=3D=3D Invalid command - missing device and nodename =3D=3D=3D @@ -30,40 +30,40 @@ Formatting 'TEST_DIR/1-snapshot-v0.qcow2', fmt=3Dqcow2 = size=3D134217728 backing_file =3D=3D=3D Create several transactional group snapshots =3D=3D=3D =20 { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /2-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/2-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/2-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/1-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/2-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/t.qcow2.2 backing_fmt=3Dqcow2 cluster_size=3D65536 la= zy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/2-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/1-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/2-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/t.qcow2.= 2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /3-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/3-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/3-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/2-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/3-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/2-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/3-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/2-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/3-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/2-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /4-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/4-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/4-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/3-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/4-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/3-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/4-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/3-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/4-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/3-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /5-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/5-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/5-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/4-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/5-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/4-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/5-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/4-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/5-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/4-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /6-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/6-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/6-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/5-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/6-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/5-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/6-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/5-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/6-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/5-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /7-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/7-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/7-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/6-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/7-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/6-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/7-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/6-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/7-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/6-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /8-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/8-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/8-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/7-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/8-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/7-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/8-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/7-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/8-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/7-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /9-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : { = 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/9-snapshot-v1.IMGFMT' } } ]= } } -Formatting 'TEST_DIR/9-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/8-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/9-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 ba= cking_file=3DTEST_DIR/8-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/9-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/8-snapsh= ot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/9-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D6553= 6 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/8-snapsh= ot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'transaction', 'arguments': {'actions': [ { 'type': 'blockdev= -snapshot-sync', 'data' : { 'device': 'virtio0', 'snapshot-file': 'TEST_DIR= /10-snapshot-v0.IMGFMT' } }, { 'type': 'blockdev-snapshot-sync', 'data' : {= 'device': 'virtio1', 'snapshot-file': 'TEST_DIR/10-snapshot-v1.IMGFMT' } }= ] } } -Formatting 'TEST_DIR/10-snapshot-v0.qcow2', fmt=3Dqcow2 size=3D134217728 b= acking_file=3DTEST_DIR/9-snapshot-v0.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib -Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=3Dqcow2 size=3D134217728 b= acking_file=3DTEST_DIR/9-snapshot-v1.qcow2 backing_fmt=3Dqcow2 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/10-snapshot-v0.qcow2', fmt=3Dqcow2 cluster_size=3D655= 36 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/9-snaps= hot-v0.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 +Formatting 'TEST_DIR/10-snapshot-v1.qcow2', fmt=3Dqcow2 cluster_size=3D655= 36 compression_type=3Dzlib size=3D134217728 backing_file=3DTEST_DIR/9-snaps= hot-v1.qcow2 backing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} =20 =3D=3D=3D Create a couple of snapshots using blockdev-snapshot =3D=3D=3D diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out index 2d92ea847b..f23bffbbf1 100644 --- a/tests/qemu-iotests/087.out +++ b/tests/qemu-iotests/087.out @@ -34,7 +34,7 @@ QMP_VERSION =20 =3D=3D=3D Encrypted image QCow =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 encryption= =3Don encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 Testing: QMP_VERSION {"return": {}} @@ -46,7 +46,7 @@ QMP_VERSION =20 =3D=3D=3D Encrypted image LUKS =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 encrypt.form= at=3Dluks encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 size=3D134217728 Testing: QMP_VERSION {"return": {}} @@ -58,7 +58,7 @@ QMP_VERSION =20 =3D=3D=3D Missing driver =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 encryption= =3Don encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 Testing: -S QMP_VERSION {"return": {}} diff --git a/tests/qemu-iotests/115.out b/tests/qemu-iotests/115.out index dbdad17b27..074b5cc84d 100644 --- a/tests/qemu-iotests/115.out +++ b/tests/qemu-iotests/115.out @@ -2,7 +2,7 @@ QA output created by 115 =20 =3D=3D=3D Testing large refcount and L1 table =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D268435456 preallocatio= n=3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D268435456 No errors were found on the image. 100.00% allocated clusters *** done diff --git a/tests/qemu-iotests/121.out b/tests/qemu-iotests/121.out index 613d56185e..fbe4b575f7 100644 --- a/tests/qemu-iotests/121.out +++ b/tests/qemu-iotests/121.out @@ -4,7 +4,7 @@ QA output created by 121 =20 --- Test 1 --- =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D66060288 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D66060288 Image resized. wrote 1049600/1049600 bytes at offset 65011712 1.001 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -14,7 +14,7 @@ No errors were found on the image. =20 --- Test 2 --- =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D66061312 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D66061312 Image resized. wrote 133120/133120 bytes at offset 66060288 130 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/125.out b/tests/qemu-iotests/125.out index 596905f533..767c52d622 100644 --- a/tests/qemu-iotests/125.out +++ b/tests/qemu-iotests/125.out @@ -1,6 +1,6 @@ QA output created by 125 --- cluster_size=3D512 growth_size=3D16 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -8,7 +8,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -16,7 +16,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -24,7 +24,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -32,7 +32,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -40,7 +40,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -48,7 +48,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -56,7 +56,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -64,7 +64,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -72,7 +72,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -80,7 +80,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -88,7 +88,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -96,7 +96,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -104,7 +104,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -112,7 +112,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -120,7 +120,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D16 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -128,7 +128,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -136,7 +136,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -144,7 +144,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -152,7 +152,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -160,7 +160,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -168,7 +168,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -176,7 +176,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -184,7 +184,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -192,7 +192,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -200,7 +200,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -208,7 +208,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -216,7 +216,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -224,7 +224,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -232,7 +232,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -240,7 +240,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -248,7 +248,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D48 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -256,7 +256,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -264,7 +264,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -272,7 +272,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -280,7 +280,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -288,7 +288,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -296,7 +296,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -304,7 +304,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -312,7 +312,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -320,7 +320,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -328,7 +328,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -336,7 +336,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -344,7 +344,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -352,7 +352,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -360,7 +360,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -368,7 +368,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -376,7 +376,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D512 growth_size=3D80 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -384,7 +384,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -392,7 +392,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -400,7 +400,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -408,7 +408,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -416,7 +416,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -424,7 +424,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -432,7 +432,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -440,7 +440,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -448,7 +448,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -456,7 +456,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -464,7 +464,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -472,7 +472,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -480,7 +480,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -488,7 +488,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -496,7 +496,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -504,7 +504,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D16 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -512,7 +512,7 @@ wrote 16384/16384 bytes at offset 2048000 16 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -520,7 +520,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -528,7 +528,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -536,7 +536,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -544,7 +544,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -552,7 +552,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -560,7 +560,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -568,7 +568,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -576,7 +576,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -584,7 +584,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -592,7 +592,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -600,7 +600,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -608,7 +608,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -616,7 +616,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -624,7 +624,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -632,7 +632,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D48 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -640,7 +640,7 @@ wrote 49152/49152 bytes at offset 2048000 48 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Doff growth_mode=3Dof= f --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -648,7 +648,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Doff growth_mode=3Dme= tadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -656,7 +656,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Doff growth_mode=3Dfa= lloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -664,7 +664,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Doff growth_mode=3Dfu= ll --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D20= 48000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -672,7 +672,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -680,7 +680,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -688,7 +688,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -696,7 +696,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dmetadata growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -704,7 +704,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Doff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -712,7 +712,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dmetadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -720,7 +720,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dfalloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -728,7 +728,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfalloc growth_mode= =3Dfull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D2048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -736,7 +736,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfull growth_mode=3Do= ff --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -744,7 +744,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfull growth_mode=3Dm= etadata --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -752,7 +752,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfull growth_mode=3Df= alloc --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -760,7 +760,7 @@ wrote 81920/81920 bytes at offset 2048000 80 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 --- cluster_size=3D64k growth_size=3D80 create_mode=3Dfull growth_mode=3Df= ull --- -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2048000 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D2= 048000 Image resized. wrote 2048000/2048000 bytes at offset 0 1.953 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index 09d46f6b17..f2878f5f3a 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -1,5 +1,5 @@ QA output created by 134 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 encryption= =3Don encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 =20 =3D=3D reading whole image =3D=3D read 134217728/134217728 bytes at offset 0 diff --git a/tests/qemu-iotests/144.out b/tests/qemu-iotests/144.out index 885a8874a5..a2172a1308 100644 --- a/tests/qemu-iotests/144.out +++ b/tests/qemu-iotests/144.out @@ -9,7 +9,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D5368709= 12 { 'execute': 'qmp_capabilities' } {"return": {}} { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0',= 'snapshot-file':'TEST_DIR/tmp.IMGFMT', 'format': 'IMGFMT' } } -Formatting 'TEST_DIR/tmp.qcow2', fmt=3Dqcow2 size=3D536870912 backing_file= =3DTEST_DIR/t.qcow2 backing_fmt=3Dqcow2 cluster_size=3D65536 lazy_refcounts= =3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/tmp.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compress= ion_type=3Dzlib size=3D536870912 backing_file=3DTEST_DIR/t.qcow2 backing_fm= t=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} =20 =3D=3D=3D Performing block-commit on active layer =3D=3D=3D @@ -31,6 +31,6 @@ Formatting 'TEST_DIR/tmp.qcow2', fmt=3Dqcow2 size=3D53687= 0912 backing_file=3DTEST_DIR/ =3D=3D=3D Performing Live Snapshot 2 =3D=3D=3D =20 { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'virtio0',= 'snapshot-file':'TEST_DIR/tmp2.IMGFMT', 'format': 'IMGFMT' } } -Formatting 'TEST_DIR/tmp2.qcow2', fmt=3Dqcow2 size=3D536870912 backing_fil= e=3DTEST_DIR/t.qcow2 backing_fmt=3Dqcow2 cluster_size=3D65536 lazy_refcount= s=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/tmp2.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compres= sion_type=3Dzlib size=3D536870912 backing_file=3DTEST_DIR/t.qcow2 backing_f= mt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} *** done diff --git a/tests/qemu-iotests/158.out b/tests/qemu-iotests/158.out index 6def216e55..fa2294bb85 100644 --- a/tests/qemu-iotests/158.out +++ b/tests/qemu-iotests/158.out @@ -1,6 +1,6 @@ QA output created by 158 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D134217728 encrypt= ion=3Don encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encryption=3Don encrypt.= key-secret=3Dsec0 size=3D134217728 =20 =3D=3D writing whole image =3D=3D wrote 134217728/134217728 bytes at offset 0 @@ -10,7 +10,7 @@ wrote 134217728/134217728 bytes at offset 0 read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 backing_file= =3DTEST_DIR/t.IMGFMT.base encryption=3Don encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 backing_file=3DTEST_DIR/t.IMGFMT.base =20 =3D=3D writing part of a cluster =3D=3D wrote 1024/1024 bytes at offset 0 diff --git a/tests/qemu-iotests/182.out b/tests/qemu-iotests/182.out index ae43654d32..29e9db3497 100644 --- a/tests/qemu-iotests/182.out +++ b/tests/qemu-iotests/182.out @@ -13,7 +13,7 @@ Is another process using the image [TEST_DIR/t.qcow2]? {'execute': 'blockdev-add', 'arguments': { 'node-name': 'node0', 'driver':= 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } {"return": {}} {'execute': 'blockdev-snapshot-sync', 'arguments': { 'node-name': 'node0',= 'snapshot-file': 'TEST_DIR/t.IMGFMT.overlay', 'snapshot-node-name': 'node1= ' } } -Formatting 'TEST_DIR/t.qcow2.overlay', fmt=3Dqcow2 size=3D197120 backing_f= ile=3DTEST_DIR/t.qcow2 backing_fmt=3Dfile cluster_size=3D65536 lazy_refcoun= ts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2.overlay', fmt=3Dqcow2 cluster_size=3D65536 co= mpression_type=3Dzlib size=3D197120 backing_file=3DTEST_DIR/t.qcow2 backing= _fmt=3Dfile lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} {'execute': 'blockdev-add', 'arguments': { 'node-name': 'node1', 'driver':= 'file', 'filename': 'TEST_DIR/t.IMGFMT', 'locking': 'on' } } {"return": {}} diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out index ac5ab16bc8..62d1ab74d3 100644 --- a/tests/qemu-iotests/185.out +++ b/tests/qemu-iotests/185.out @@ -9,14 +9,14 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D= 67108864 =3D=3D=3D Creating backing chain =3D=3D=3D =20 { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 's= napshot-file': 'TEST_DIR/t.IMGFMT.mid', 'format': 'IMGFMT', 'mode': 'absolu= te-paths' } } -Formatting 'TEST_DIR/t.qcow2.mid', fmt=3Dqcow2 size=3D67108864 backing_fil= e=3DTEST_DIR/t.qcow2.base backing_fmt=3Dqcow2 cluster_size=3D65536 lazy_ref= counts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2.mid', fmt=3Dqcow2 cluster_size=3D65536 compre= ssion_type=3Dzlib size=3D67108864 backing_file=3DTEST_DIR/t.qcow2.base back= ing_fmt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} { 'execute': 'human-monitor-command', 'arguments': { 'command-line': 'qemu= -io disk "write 0 4M"' } } wrote 4194304/4194304 bytes at offset 0 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) {"return": ""} { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 's= napshot-file': 'TEST_DIR/t.IMGFMT', 'format': 'IMGFMT', 'mode': 'absolute-p= aths' } } -Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D67108864 backing_file=3D= TEST_DIR/t.qcow2.mid backing_fmt=3Dqcow2 cluster_size=3D65536 lazy_refcount= s=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D67108864 backing_file=3DTEST_DIR/t.qcow2.mid backing_f= mt=3Dqcow2 lazy_refcounts=3Doff refcount_bits=3D16 {"return": {}} =20 =3D=3D=3D Start commit job and exit qemu =3D=3D=3D @@ -48,7 +48,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=3Dqcow2 size=3D6710886= 4 backing_file=3DTEST_DIR/t.q { 'execute': 'qmp_capabilities' } {"return": {}} { 'execute': 'drive-mirror', 'arguments': { 'device': 'disk', 'target': 'T= EST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 = } } -Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 size=3D67108864 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 cluster_size=3D65536 compr= ession_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} {"return": {}} @@ -62,7 +62,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 size=3D67= 108864 cluster_size=3D65536 l { 'execute': 'qmp_capabilities' } {"return": {}} { 'execute': 'drive-backup', 'arguments': { 'device': 'disk', 'target': 'T= EST_DIR/t.IMGFMT.copy', 'format': 'IMGFMT', 'sync': 'full', 'speed': 65536 = } } -Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 size=3D67108864 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/t.qcow2.copy', fmt=3Dqcow2 cluster_size=3D65536 compr= ession_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event"= : "JOB_STATUS_CHANGE", "data": {"status": "paused", "id": "disk"}} diff --git a/tests/qemu-iotests/188.out b/tests/qemu-iotests/188.out index c568ef3701..4b9aadd51c 100644 --- a/tests/qemu-iotests/188.out +++ b/tests/qemu-iotests/188.out @@ -1,5 +1,5 @@ QA output created by 188 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 encrypt.forma= t=3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 =20 =3D=3D reading whole image =3D=3D read 16777216/16777216 bytes at offset 0 diff --git a/tests/qemu-iotests/189.out b/tests/qemu-iotests/189.out index a0b7c9c24c..e536d95d53 100644 --- a/tests/qemu-iotests/189.out +++ b/tests/qemu-iotests/189.out @@ -1,6 +1,6 @@ QA output created by 189 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D16777216 encrypt.= format=3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encrypt.format=3Dluks en= crypt.key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 =20 =3D=3D writing whole image =3D=3D wrote 16777216/16777216 bytes at offset 0 @@ -10,7 +10,7 @@ wrote 16777216/16777216 bytes at offset 0 read 16777216/16777216 bytes at offset 0 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 backing_file= =3DTEST_DIR/t.IMGFMT.base encrypt.format=3Dluks encrypt.key-secret=3Dsec1 e= ncrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec1 encrypt.iter-time=3D10 size=3D16777216 backing_file=3DTE= ST_DIR/t.IMGFMT.base =20 =3D=3D writing part of a cluster =3D=3D wrote 1024/1024 bytes at offset 0 diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out index 6280ae6eed..7714995c02 100644 --- a/tests/qemu-iotests/198.out +++ b/tests/qemu-iotests/198.out @@ -1,12 +1,12 @@ QA output created by 198 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D16777216 encrypt.= format=3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encrypt.format=3Dluks en= crypt.key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 =20 =3D=3D writing whole image base =3D=3D wrote 16777216/16777216 bytes at offset 0 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 backing_file= =3DTEST_DIR/t.IMGFMT.base encrypt.format=3Dluks encrypt.key-secret=3Dsec1 e= ncrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec1 encrypt.iter-time=3D10 size=3D16777216 backing_file=3DTE= ST_DIR/t.IMGFMT.base =20 =3D=3D writing whole image layer =3D=3D wrote 16777216/16777216 bytes at offset 0 diff --git a/tests/qemu-iotests/243.out b/tests/qemu-iotests/243.out index dcb33fac32..341ef3b7d0 100644 --- a/tests/qemu-iotests/243.out +++ b/tests/qemu-iotests/243.out @@ -2,31 +2,31 @@ QA output created by 243 =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 preallocation= =3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D67= 108864 File size: 196616 Disk usage: low =20 =3D=3D=3D preallocation=3Dmetadata =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D67108864 File size: 67436544 Disk usage: low =20 =3D=3D=3D preallocation=3Dfalloc =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 preallocation= =3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D67108864 File size: 67436544 Disk usage: high =20 =3D=3D=3D preallocation=3Dfull =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 preallocation= =3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D6= 7108864 File size: 67436544 Disk usage: high =20 =3D=3D=3D External data file: preallocation=3Doff =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 data_file=3DT= EST_DIR/t.IMGFMT.data preallocation=3Doff +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Doff size=3D67= 108864 data_file=3DTEST_DIR/t.IMGFMT.data qcow2 file size: 196616 data file size: 67108864 qcow2 disk usage: low @@ -34,7 +34,7 @@ data disk usage: low =20 =3D=3D=3D External data file: preallocation=3Dmetadata =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 data_file=3DT= EST_DIR/t.IMGFMT.data preallocation=3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D67108864 data_file=3DTEST_DIR/t.IMGFMT.data qcow2 file size: 327680 data file size: 67108864 qcow2 disk usage: low @@ -42,7 +42,7 @@ data disk usage: low =20 =3D=3D=3D External data file: preallocation=3Dfalloc =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 data_file=3DT= EST_DIR/t.IMGFMT.data preallocation=3Dfalloc +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfalloc size= =3D67108864 data_file=3DTEST_DIR/t.IMGFMT.data qcow2 file size: 327680 data file size: 67108864 qcow2 disk usage: low @@ -50,7 +50,7 @@ data disk usage: high =20 =3D=3D=3D External data file: preallocation=3Dfull =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D67108864 data_file=3DT= EST_DIR/t.IMGFMT.data preallocation=3Dfull +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dfull size=3D6= 7108864 data_file=3DTEST_DIR/t.IMGFMT.data qcow2 file size: 327680 data file size: 67108864 qcow2 disk usage: low diff --git a/tests/qemu-iotests/250.out b/tests/qemu-iotests/250.out index f480fd273b..0b737097f3 100644 --- a/tests/qemu-iotests/250.out +++ b/tests/qemu-iotests/250.out @@ -1,5 +1,5 @@ QA output created by 250 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D2202009600 preallocati= on=3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT preallocation=3Dmetadata size= =3D2202009600 discard 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) discard 10485760/10485760 bytes at offset 2191523840 diff --git a/tests/qemu-iotests/255.out b/tests/qemu-iotests/255.out index a3c99fd62e..d74903db99 100644 --- a/tests/qemu-iotests/255.out +++ b/tests/qemu-iotests/255.out @@ -3,9 +3,9 @@ Finishing a commit job with background reads =20 =3D=3D=3D Create backing chain and start VM =3D=3D=3D =20 -Formatting 'TEST_DIR/PID-t.qcow2.mid', fmt=3Dqcow2 size=3D134217728 cluste= r_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dz= lib +Formatting 'TEST_DIR/PID-t.qcow2.mid', fmt=3Dqcow2 cluster_size=3D65536 co= mpression_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits= =3D16 =20 -Formatting 'TEST_DIR/PID-t.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_si= ze=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-t.qcow2', fmt=3Dqcow2 cluster_size=3D65536 compre= ssion_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D=3D Start background read requests =3D=3D=3D =20 @@ -23,9 +23,9 @@ Closing the VM while a job is being cancelled =20 =3D=3D=3D Create images and start VM =3D=3D=3D =20 -Formatting 'TEST_DIR/PID-src.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_= size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-src.qcow2', fmt=3Dqcow2 cluster_size=3D65536 comp= ression_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-dst.qcow2', fmt=3Dqcow2 size=3D134217728 cluster_= size=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-dst.qcow2', fmt=3Dqcow2 cluster_size=3D65536 comp= ression_type=3Dzlib size=3D134217728 lazy_refcounts=3Doff refcount_bits=3D16 =20 wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/259.out b/tests/qemu-iotests/259.out index ffed19c2a0..edf4377650 100644 --- a/tests/qemu-iotests/259.out +++ b/tests/qemu-iotests/259.out @@ -10,5 +10,5 @@ disk size: unavailable =20 --- Testing creation for which the node would need to grow --- qemu-img: TEST_DIR/t.IMGFMT: Could not resize image: Image format driver d= oes not support resize -Formatting 'TEST_DIR/t.IMGFMT', fmt=3Dqcow2 size=3D67108864 preallocation= =3Dmetadata +Formatting 'TEST_DIR/t.IMGFMT', fmt=3Dqcow2 preallocation=3Dmetadata size= =3D67108864 *** done diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out index 0c982c55cb..4cf5c79ed8 100644 --- a/tests/qemu-iotests/263.out +++ b/tests/qemu-iotests/263.out @@ -2,7 +2,7 @@ QA output created by 263 =20 testing LUKS qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 =3D=3D reading the whole image =3D=3D read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -21,7 +21,7 @@ read 982528/982528 bytes at offset 66048 =20 testing legacy AES qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Daes encrypt.key-secret=3Dsec0 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Daes encrypt.= key-secret=3Dsec0 size=3D1048576 =3D=3D reading the whole image =3D=3D read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/274.out b/tests/qemu-iotests/274.out index d24ff681af..d248a1e21b 100644 --- a/tests/qemu-iotests/274.out +++ b/tests/qemu-iotests/274.out @@ -1,9 +1,9 @@ =3D=3D Commit tests =3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D2097152 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1048576 backing_file=3DTEST_DIR/PID-base lazy_refcount= s=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D2097152 backing_file=3DTEST_DIR/PID-mid lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -64,11 +64,11 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing HMP commit (top -> mid) =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D2097152 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1048576 backing_file=3DTEST_DIR/PID-base lazy_refcount= s=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D2097152 backing_file=3DTEST_DIR/PID-mid lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -94,11 +94,11 @@ read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =20 =3D=3D=3D Testing QMP active commit (top -> mid) =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D2097152 cluster_size=3D= 65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D2097152 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 size=3D1048576 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-mid', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1048576 backing_file=3DTEST_DIR/PID-base lazy_refcount= s=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D2097152 backing_file=3DT= EST_DIR/PID-mid cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D2097152 backing_file=3DTEST_DIR/PID-mid lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -131,9 +131,9 @@ read 1048576/1048576 bytes at offset 1048576 =20 =3D=3D Resize tests =3D=3D =3D=3D=3D preallocation=3Doff =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D6442450944 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D6442450944 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D1073741824 backing_file= =3DTEST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bit= s=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D1073741824 backing_file=3DTEST_DIR/PID-base lazy_refco= unts=3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 5368709120 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -150,9 +150,9 @@ read 65536/65536 bytes at offset 5368709120 { "start": 1073741824, "length": 7516192768, "depth": 0, "zero": true, "da= ta": false}] =20 =3D=3D=3D preallocation=3Dmetadata =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D34359738368 cluster_siz= e=3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D34359738368 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D32212254720 backing_file= =3DTEST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bit= s=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D32212254720 backing_file=3DTEST_DIR/PID-base lazy_refc= ounts=3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 33285996544 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -174,9 +174,9 @@ read 65536/65536 bytes at offset 33285996544 { "start": 34896609280, "length": 536870912, "depth": 0, "zero": true, "da= ta": false, "offset": 2685075456}] =20 =3D=3D=3D preallocation=3Dfalloc =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D10485760 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D10485760 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D5242880 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D5242880 backing_file=3DTEST_DIR/PID-base lazy_refcount= s=3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 9437184 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -193,9 +193,9 @@ read 65536/65536 bytes at offset 9437184 { "start": 5242880, "length": 10485760, "depth": 0, "zero": false, "data":= true, "offset": 327680}] =20 =3D=3D=3D preallocation=3Dfull =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D16777216 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D16777216 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D8388608 backing_file=3DT= EST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D= 16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D8388608 backing_file=3DTEST_DIR/PID-base lazy_refcount= s=3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 11534336 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -212,9 +212,9 @@ read 65536/65536 bytes at offset 11534336 { "start": 8388608, "length": 4194304, "depth": 0, "zero": false, "data": = true, "offset": 327680}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D393216 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D393216 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D259072 backing_file=3DTE= ST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D259072 backing_file=3DTEST_DIR/PID-base lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 259072 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -232,9 +232,9 @@ read 65536/65536 bytes at offset 259072 { "start": 262144, "length": 262144, "depth": 0, "zero": true, "data": fal= se}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D409600 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D409600 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D262144 backing_file=3DTE= ST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D262144 backing_file=3DTEST_DIR/PID-base lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 344064 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -251,9 +251,9 @@ read 65536/65536 bytes at offset 344064 { "start": 262144, "length": 262144, "depth": 0, "zero": true, "data": fal= se}] =20 =3D=3D=3D preallocation=3Doff =3D=3D=3D -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D524288 cluster_size=3D6= 5536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D524288 lazy_refcounts=3Doff refcount_bits=3D16 =20 -Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 size=3D262144 backing_file=3DTE= ST_DIR/PID-base cluster_size=3D65536 lazy_refcounts=3Doff refcount_bits=3D1= 6 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-top', fmt=3Dqcow2 cluster_size=3D65536 compressio= n_type=3Dzlib size=3D262144 backing_file=3DTEST_DIR/PID-base lazy_refcounts= =3Doff refcount_bits=3D16 =20 wrote 65536/65536 bytes at offset 446464 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/280.out b/tests/qemu-iotests/280.out index 92e4d14079..fc59b9bc5c 100644 --- a/tests/qemu-iotests/280.out +++ b/tests/qemu-iotests/280.out @@ -1,4 +1,4 @@ -Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 size=3D67108864 cluster_size= =3D65536 lazy_refcounts=3Doff refcount_bits=3D16 compression_type=3Dzlib +Formatting 'TEST_DIR/PID-base', fmt=3Dqcow2 cluster_size=3D65536 compressi= on_type=3Dzlib size=3D67108864 lazy_refcounts=3Doff refcount_bits=3D16 =20 =3D=3D=3D Launch VM =3D=3D=3D Enabling migration QMP events on VM... diff --git a/tests/qemu-iotests/284.out b/tests/qemu-iotests/284.out index 48216f5742..1855369c56 100644 --- a/tests/qemu-iotests/284.out +++ b/tests/qemu-iotests/284.out @@ -2,7 +2,7 @@ QA output created by 284 =20 testing LUKS qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 =20 =3D=3D cluster size 512 =3D=3D checking image refcounts =3D=3D @@ -21,7 +21,7 @@ wrote 1/1 bytes at offset 512 =20 =3D=3D rechecking image refcounts =3D=3D No errors were found on the image. -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 =20 =3D=3D cluster size 2048 =3D=3D checking image refcounts =3D=3D @@ -40,7 +40,7 @@ wrote 1/1 bytes at offset 2048 =20 =3D=3D rechecking image refcounts =3D=3D No errors were found on the image. -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 encrypt.format= =3Dluks encrypt.key-secret=3Dsec0 encrypt.iter-time=3D10 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 =20 =3D=3D cluster size 32768 =3D=3D checking image refcounts =3D=3D --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609473; cv=none; d=zohomail.com; s=zohoarc; b=mfBxF4SPzSCzga0tlGSkbrtuRQOOF6c5mWvO7ssfXTT2Pa1FmaQKQ/BZPAwe8HTVMuVlD8TNRNzJVg0ExV2FL1gZF41S+UyTG3FKLM8bIfGbIqe4l2rPfmRt5Kf5smRWmJNtwGbFY9RSlJXPB108gvdUTRsDR3Jyx/ShpEaaXDA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609473; h=Content-Type:Content-Transfer-Encoding:Cc: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=4J2AhVnLJiHBpeg/0RdXsEEtZOQq5VrV0KMgoLT1cuI=; b=ZdbNUcP15FBtm3S3ZUVbWdJ6StMkw9Abr5RreaMTsPo3MZVadpYHD4+rpcDmkB20pQNa0L+sWVHcDqxMHOR4ebIfmfIRslM/AU1YQ4Go++l3OfQBQg2vDm3nXBgOCTJoLbY5OJzCqUzYXaM5f+MnrzJmaisM88a9Av9T1qtiDBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609473743580.0123359644904; Mon, 8 Jun 2020 02:44:33 -0700 (PDT) Received: from localhost ([::1]:53402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEKW-0003MF-A5 for importer@patchew.org; Mon, 08 Jun 2020 05:44:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHC-0006Q9-RH for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:06 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:27342 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEH6-0002AI-VY for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:06 -0400 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-223-FqrNtsFoP5SBhdHbski17Q-1; Mon, 08 Jun 2020 05:40:58 -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 E99B28015CB; Mon, 8 Jun 2020 09:40:57 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45371891E0; Mon, 8 Jun 2020 09:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4J2AhVnLJiHBpeg/0RdXsEEtZOQq5VrV0KMgoLT1cuI=; b=gGpZ4zLfb8Npsx1O/jkT1h76wO2v5IoXm1F3DZ363leJEx+DDdMiMf2FBI7e/T3BUswxG8 WdkbuC5BYAZ8JX9qMzqWe3801BFzRP0SpSVfTSP5dmmRVoEzT2sLyWvm1U5de7UQwXZzn/ +r8yvrmX2ymlC3K/9GconHnOgsmiUW8= X-MC-Unique: FqrNtsFoP5SBhdHbski17Q-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 06/14] block/crypto: rename two functions Date: Mon, 8 Jun 2020 12:40:22 +0300 Message-Id: <20200608094030.670121-7-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) rename the write_func to create_write_func, and init_func to create_init_fu= nc. This is preparation for other write_func that will be used to update the en= cryption keys. No functional changes Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- block/crypto.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index dcf8b42bb2..1960b47ceb 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -79,12 +79,12 @@ struct BlockCryptoCreateData { }; =20 =20 -static ssize_t block_crypto_write_func(QCryptoBlock *block, - size_t offset, - const uint8_t *buf, - size_t buflen, - void *opaque, - Error **errp) +static ssize_t block_crypto_create_write_func(QCryptoBlock *block, + size_t offset, + const uint8_t *buf, + size_t buflen, + void *opaque, + Error **errp) { struct BlockCryptoCreateData *data =3D opaque; ssize_t ret; @@ -97,11 +97,10 @@ static ssize_t block_crypto_write_func(QCryptoBlock *bl= ock, return ret; } =20 - -static ssize_t block_crypto_init_func(QCryptoBlock *block, - size_t headerlen, - void *opaque, - Error **errp) +static ssize_t block_crypto_create_init_func(QCryptoBlock *block, + size_t headerlen, + void *opaque, + Error **errp) { struct BlockCryptoCreateData *data =3D opaque; Error *local_error =3D NULL; @@ -313,8 +312,8 @@ static int block_crypto_co_create_generic(BlockDriverSt= ate *bs, }; =20 crypto =3D qcrypto_block_create(opts, NULL, - block_crypto_init_func, - block_crypto_write_func, + block_crypto_create_init_func, + block_crypto_create_write_func, &data, errp); =20 --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609463; cv=none; d=zohomail.com; s=zohoarc; b=MUGvW1nDdtAUVkymti9TBAr60Told2+7r8ANx9WAjOSKGLBw5nxfI/rSZU3H1NfYAQ2e/qe+2QFYFCcdKW8j9s0eA5es5vvn19JuMH/22nFgqeyS6wOVJiGjMkPPxgE9Q2eT5GHy2m3czU1B9hKL22cLmFpATou5PQZyCBbQecA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609463; h=Content-Type:Content-Transfer-Encoding:Cc: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=mcJT2GhmVPhHWmNKXmgny9Z4C4SHzj7Uw2cb5/qfJCk=; b=aYMqN4Q9j84yXodj2A1XyKqyJyqXnirHHN93QXfDCgZLIMDq3VEzrGDk444ykQiVxN6R+TREu2NadxDo7vkFC39yHia1aDF7AClY7aYqxQkXXTJs/U9q5VNLfHYO98oTqvwjanwjlvPtSowMExw7cnFY1cvleMbo0tvJh3qumZE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609463587666.4976829075196; Mon, 8 Jun 2020 02:44:23 -0700 (PDT) Received: from localhost ([::1]:52478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEKM-0002v4-0I for importer@patchew.org; Mon, 08 Jun 2020 05:44:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50116) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHH-0006Z5-It for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:11 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:47394 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHF-0002C4-N4 for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:11 -0400 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-299-nxRwlHTZM_G9axQGd8xsUQ-1; Mon, 08 Jun 2020 05:41:04 -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 4F4921005510; Mon, 8 Jun 2020 09:41:03 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5B2A4891E0; Mon, 8 Jun 2020 09:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609269; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mcJT2GhmVPhHWmNKXmgny9Z4C4SHzj7Uw2cb5/qfJCk=; b=GtRLo+8Jynj6Xo0ojkqBXOvPslP0OqkZDypscdGdNLKCz8sXYQOysN01MzwASYLweAsGuy cOhkXCJ7kCBzd0z/MmPEO40hwpfOIPSrDUyvYCbgI+dzFEiOkHdZHB+MrjNsf/MmDHS4UG t/Pswctv8p59Lu8dz8RXiprLac63Mr0= X-MC-Unique: nxRwlHTZM_G9axQGd8xsUQ-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 07/14] block/crypto: implement the encryption key management Date: Mon, 8 Jun 2020 12:40:23 +0300 Message-Id: <20200608094030.670121-8-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This implements the encryption key management using the generic code in qcrypto layer and exposes it to the user via qemu-img This code adds another 'write_func' because the initialization write_func works directly on the underlying file, and amend works on instance of luks device. This commit also adds a 'hack/workaround' I and Kevin Wolf (thanks) made to make the driver both support write sharing (to avoid breaking the u= sers), and be safe against concurrent metadata update (the keyslots) Eventually the write sharing for luks driver will be deprecated and removed together with this hack. The hack is that we ask (as a format driver) for BLK_PERM_CONSISTENT_READ and then when we want to update the keys, we unshare that permission. So if someone else has the image open, even readonly, encryption key update will fail gracefully. Also thanks to Daniel Berrange for the idea of unsharing read, rather that write permission which allows to avoid cases when the other user had opened the image read-only. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block/crypto.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++-- block/crypto.h | 34 +++++++++++++ 2 files changed, 161 insertions(+), 3 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index 1960b47ceb..b9c40e6922 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -37,6 +37,7 @@ typedef struct BlockCrypto BlockCrypto; =20 struct BlockCrypto { QCryptoBlock *block; + bool updating_keys; }; =20 =20 @@ -71,6 +72,24 @@ static ssize_t block_crypto_read_func(QCryptoBlock *bloc= k, return ret; } =20 +static ssize_t block_crypto_write_func(QCryptoBlock *block, + size_t offset, + const uint8_t *buf, + size_t buflen, + void *opaque, + Error **errp) +{ + BlockDriverState *bs =3D opaque; + ssize_t ret; + + ret =3D bdrv_pwrite(bs->file, offset, buf, buflen); + if (ret < 0) { + error_setg_errno(errp, -ret, "Could not write encryption header"); + return ret; + } + return ret; +} + =20 struct BlockCryptoCreateData { BlockBackend *blk; @@ -166,6 +185,19 @@ static QemuOptsList block_crypto_create_opts_luks =3D { }; =20 =20 +static QemuOptsList block_crypto_amend_opts_luks =3D { + .name =3D "crypto", + .head =3D QTAILQ_HEAD_INITIALIZER(block_crypto_create_opts_luks.head), + .desc =3D { + BLOCK_CRYPTO_OPT_DEF_LUKS_STATE(""), + BLOCK_CRYPTO_OPT_DEF_LUKS_KEYSLOT(""), + BLOCK_CRYPTO_OPT_DEF_LUKS_OLD_SECRET(""), + BLOCK_CRYPTO_OPT_DEF_LUKS_NEW_SECRET(""), + BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME(""), + { /* end of list */ } + }, +}; + QCryptoBlockOpenOptions * block_crypto_open_opts_init(QDict *opts, Error **errp) { @@ -758,6 +790,98 @@ block_crypto_get_specific_info_luks(BlockDriverState *= bs, Error **errp) return spec_info; } =20 +static int +block_crypto_amend_options_luks(BlockDriverState *bs, + QemuOpts *opts, + BlockDriverAmendStatusCB *status_cb, + void *cb_opaque, + bool force, + Error **errp) +{ + BlockCrypto *crypto =3D bs->opaque; + QDict *cryptoopts =3D NULL; + QCryptoBlockAmendOptions *amend_options =3D NULL; + int ret; + + assert(crypto); + assert(crypto->block); + crypto->updating_keys =3D true; + + ret =3D bdrv_child_refresh_perms(bs, bs->file, errp); + if (ret < 0) { + goto cleanup; + } + + cryptoopts =3D qemu_opts_to_qdict(opts, NULL); + qdict_put_str(cryptoopts, "format", "luks"); + amend_options =3D block_crypto_amend_opts_init(cryptoopts, errp); + if (!amend_options) { + ret =3D -EINVAL; + goto cleanup; + } + + ret =3D qcrypto_block_amend_options(crypto->block, + block_crypto_read_func, + block_crypto_write_func, + bs, + amend_options, + force, + errp); +cleanup: + crypto->updating_keys =3D false; + bdrv_child_refresh_perms(bs, bs->file, errp); + qapi_free_QCryptoBlockAmendOptions(amend_options); + qobject_unref(cryptoopts); + return ret; +} + + +static void +block_crypto_child_perms(BlockDriverState *bs, BdrvChild *c, + const BdrvChildRole role, + BlockReopenQueue *reopen_queue, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + + BlockCrypto *crypto =3D bs->opaque; + + bdrv_default_perms(bs, c, role, reopen_queue, perm, shared, nperm, nsh= ared); + + /* + * For backward compatibility, manually share the write + * and resize permission + */ + *nshared |=3D (BLK_PERM_WRITE | BLK_PERM_RESIZE); + /* + * Since we are not fully a format driver, don't always request + * the read/resize permission but only when explicitly + * requested + */ + *nperm &=3D ~(BLK_PERM_WRITE | BLK_PERM_RESIZE); + *nperm |=3D perm & (BLK_PERM_WRITE | BLK_PERM_RESIZE); + + /* + * This driver doesn't modify LUKS metadata except + * when updating the encryption slots. + * Thus unlike a proper format driver we don't ask for + * shared write/read permission. However we need it + * when we are updating the keys, to ensure that only we + * have access to the device. + * + * Encryption update will set the crypto->updating_keys + * during that period and refresh permissions + * + */ + if (crypto->updating_keys) { + /* need exclusive write access for header update */ + *nperm |=3D BLK_PERM_WRITE; + /* unshare read and write permission */ + *nshared &=3D ~(BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE); + } +} + + static const char *const block_crypto_strong_runtime_opts[] =3D { BLOCK_CRYPTO_OPT_LUKS_KEY_SECRET, =20 @@ -770,13 +894,12 @@ static BlockDriver bdrv_crypto_luks =3D { .bdrv_probe =3D block_crypto_probe_luks, .bdrv_open =3D block_crypto_open_luks, .bdrv_close =3D block_crypto_close, - /* This driver doesn't modify LUKS metadata except when creating image. - * Allow share-rw=3Don as a special case. */ - .bdrv_child_perm =3D bdrv_default_perms, + .bdrv_child_perm =3D block_crypto_child_perms, .bdrv_co_create =3D block_crypto_co_create_luks, .bdrv_co_create_opts =3D block_crypto_co_create_opts_luks, .bdrv_co_truncate =3D block_crypto_co_truncate, .create_opts =3D &block_crypto_create_opts_luks, + .amend_opts =3D &block_crypto_amend_opts_luks, =20 .bdrv_reopen_prepare =3D block_crypto_reopen_prepare, .bdrv_refresh_limits =3D block_crypto_refresh_limits, @@ -786,6 +909,7 @@ static BlockDriver bdrv_crypto_luks =3D { .bdrv_measure =3D block_crypto_measure, .bdrv_get_info =3D block_crypto_get_info_luks, .bdrv_get_specific_info =3D block_crypto_get_specific_info_luks, + .bdrv_amend_options =3D block_crypto_amend_options_luks, =20 .is_format =3D true, =20 diff --git a/block/crypto.h b/block/crypto.h index 06e044c9be..c72c3dec61 100644 --- a/block/crypto.h +++ b/block/crypto.h @@ -41,6 +41,11 @@ #define BLOCK_CRYPTO_OPT_LUKS_IVGEN_HASH_ALG "ivgen-hash-alg" #define BLOCK_CRYPTO_OPT_LUKS_HASH_ALG "hash-alg" #define BLOCK_CRYPTO_OPT_LUKS_ITER_TIME "iter-time" +#define BLOCK_CRYPTO_OPT_LUKS_KEYSLOT "keyslot" +#define BLOCK_CRYPTO_OPT_LUKS_STATE "state" +#define BLOCK_CRYPTO_OPT_LUKS_OLD_SECRET "old-secret" +#define BLOCK_CRYPTO_OPT_LUKS_NEW_SECRET "new-secret" + =20 #define BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(prefix) \ BLOCK_CRYPTO_OPT_DEF_KEY_SECRET(prefix, \ @@ -88,6 +93,35 @@ .help =3D "Time to spend in PBKDF in milliseconds", \ } =20 +#define BLOCK_CRYPTO_OPT_DEF_LUKS_STATE(prefix) \ + { \ + .name =3D prefix BLOCK_CRYPTO_OPT_LUKS_STATE, = \ + .type =3D QEMU_OPT_STRING, = \ + .help =3D "Select new state of affected keyslots (active/inactive)= ",\ + } + +#define BLOCK_CRYPTO_OPT_DEF_LUKS_KEYSLOT(prefix) \ + { \ + .name =3D prefix BLOCK_CRYPTO_OPT_LUKS_KEYSLOT, \ + .type =3D QEMU_OPT_NUMBER, \ + .help =3D "Select a single keyslot to modify explicitly",\ + } + +#define BLOCK_CRYPTO_OPT_DEF_LUKS_OLD_SECRET(prefix) \ + { \ + .name =3D prefix BLOCK_CRYPTO_OPT_LUKS_OLD_SECRET, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "Select all keyslots that match this password", \ + } + +#define BLOCK_CRYPTO_OPT_DEF_LUKS_NEW_SECRET(prefix) \ + { \ + .name =3D prefix BLOCK_CRYPTO_OPT_LUKS_NEW_SECRET, \ + .type =3D QEMU_OPT_STRING, \ + .help =3D "New secret to set in the matching keyslots. " \ + "Empty string to erase", \ + } + QCryptoBlockCreateOptions * block_crypto_create_opts_init(QDict *opts, Error **errp); =20 --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609620; cv=none; d=zohomail.com; s=zohoarc; b=FLBHfMYwEVe35E7LJixndt+WgxB4A6O1DdvuHW2B69S+0snE3e8XiSPmgdD8R1B8Ikq3V2osczQhYu2OEfjZ3DnAAVmyiZ2529RfB/kpATRSIN1YxEgdcvqsOsJQISk8WlXRPIpEduG5IpPJ5rqBQgyYo9nOURw5dbP//QLAMUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609620; h=Content-Type:Content-Transfer-Encoding:Cc: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=Wy0foKCd/gMixeWfAGzKuX/3iThjCsmvAPjlIgjT/00=; b=ZMzJt/17k2F6FYpxBQ/DSH8L/G3QNu1iTGe6+jThuueOYgaS+ke38CO7odx/gYO31r6xWMwR7vMRBMf16yBMj1rZfLRu9DV64YSbZ4GYKpZekAsihGAhWthVvsEjbeRT7EDYuJs9zL8+P0hH0s2CtihFMWnbAhKqWnHt4rjazIw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609620426556.7849482164996; Mon, 8 Jun 2020 02:47:00 -0700 (PDT) Received: from localhost ([::1]:34266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEMt-0007Br-3M for importer@patchew.org; Mon, 08 Jun 2020 05:46:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHG-0006Wq-9z for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:10 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:23627 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHE-0002Br-Kr for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:09 -0400 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-156-jy3haHrtONeFfSue46GmfQ-1; Mon, 08 Jun 2020 05:41:06 -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 29154835B42; Mon, 8 Jun 2020 09:41:05 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id B56B0891FF; Mon, 8 Jun 2020 09:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wy0foKCd/gMixeWfAGzKuX/3iThjCsmvAPjlIgjT/00=; b=ad4NthjXkQ2+AI0lXm+C1q9/e1mZJIAEe/5foMyji9To36fX6M6V32LUQ4oR7/aLUCG99G r9w5QXYWzDLV6+PnGdXTVOoLCD06UjVJAgJ5gxKOVgERpdHOjUmJEHaGX7FoWP0Qx0YnKc f5CLeXCoGfT3hMiJk3dCQFe8R//Wh1o= X-MC-Unique: jy3haHrtONeFfSue46GmfQ-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 08/14] block/qcow2: extend qemu-img amend interface with crypto options Date: Mon, 8 Jun 2020 12:40:24 +0300 Message-Id: <20200608094030.670121-9-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mlevitsk@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:05:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Now that we have all the infrastructure in place, wire it in the qcow2 driver and expose this to the user. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block/qcow2.c | 71 +++++++++++++++++++++++++++++++++----- tests/qemu-iotests/082.out | 45 ++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 9 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index b3ed173a9b..0e72e8fc39 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -176,6 +176,19 @@ static ssize_t qcow2_crypto_hdr_write_func(QCryptoBloc= k *block, size_t offset, return ret; } =20 +static QDict* +qcow2_extract_crypto_opts(QemuOpts *opts, const char *fmt, Error **errp) +{ + QDict *cryptoopts_qdict; + QDict *opts_qdict; + + /* Extract "encrypt." options into a qdict */ + opts_qdict =3D qemu_opts_to_qdict(opts, NULL); + qdict_extract_subqdict(opts_qdict, &cryptoopts_qdict, "encrypt."); + qobject_unref(opts_qdict); + qdict_put_str(cryptoopts_qdict, "format", fmt); + return cryptoopts_qdict; +} =20 /* * read qcow2 extension and fill bs @@ -4849,16 +4862,9 @@ static BlockMeasureInfo *qcow2_measure(QemuOpts *opt= s, BlockDriverState *in_bs, =20 if (has_luks) { g_autoptr(QCryptoBlockCreateOptions) create_opts =3D NULL; - QDict *opts_qdict; - QDict *cryptoopts; + QDict *cryptoopts =3D qcow2_extract_crypto_opts(opts, "luks", errp= ); size_t headerlen; =20 - opts_qdict =3D qemu_opts_to_qdict(opts, NULL); - qdict_extract_subqdict(opts_qdict, &cryptoopts, "encrypt."); - qobject_unref(opts_qdict); - - qdict_put_str(cryptoopts, "format", "luks"); - create_opts =3D block_crypto_create_opts_init(cryptoopts, errp); qobject_unref(cryptoopts); if (!create_opts) { @@ -5262,6 +5268,7 @@ typedef enum Qcow2AmendOperation { QCOW2_NO_OPERATION =3D 0, =20 QCOW2_UPGRADING, + QCOW2_UPDATING_ENCRYPTION, QCOW2_CHANGING_REFCOUNT_ORDER, QCOW2_DOWNGRADING, } Qcow2AmendOperation; @@ -5343,6 +5350,7 @@ static int qcow2_amend_options(BlockDriverState *bs, = QemuOpts *opts, int ret; QemuOptDesc *desc =3D opts->list->desc; Qcow2AmendHelperCBInfo helper_cb_info; + bool encryption_update =3D false; =20 while (desc && desc->name) { if (!qemu_opt_find(opts, desc->name)) { @@ -5369,6 +5377,18 @@ static int qcow2_amend_options(BlockDriverState *bs,= QemuOpts *opts, backing_file =3D qemu_opt_get(opts, BLOCK_OPT_BACKING_FILE); } else if (!strcmp(desc->name, BLOCK_OPT_BACKING_FMT)) { backing_format =3D qemu_opt_get(opts, BLOCK_OPT_BACKING_FMT); + } else if (g_str_has_prefix(desc->name, "encrypt.")) { + if (!s->crypto) { + error_setg(errp, + "Can't amend encryption options - encryption no= t present"); + return -EINVAL; + } + if (s->crypt_method_header !=3D QCOW_CRYPT_LUKS) { + error_setg(errp, + "Only LUKS encryption options can be amended"); + return -ENOTSUP; + } + encryption_update =3D true; } else if (!strcmp(desc->name, BLOCK_OPT_LAZY_REFCOUNTS)) { lazy_refcounts =3D qemu_opt_get_bool(opts, BLOCK_OPT_LAZY_REFC= OUNTS, lazy_refcounts); @@ -5411,7 +5431,8 @@ static int qcow2_amend_options(BlockDriverState *bs, = QemuOpts *opts, .original_status_cb =3D status_cb, .original_cb_opaque =3D cb_opaque, .total_operations =3D (new_version !=3D old_version) - + (s->refcount_bits !=3D refcount_bits) + + (s->refcount_bits !=3D refcount_bits) + + (encryption_update =3D=3D true) }; =20 /* Upgrade first (some features may require compat=3D1.1) */ @@ -5424,6 +5445,33 @@ static int qcow2_amend_options(BlockDriverState *bs,= QemuOpts *opts, } } =20 + if (encryption_update) { + QDict *amend_opts_dict; + QCryptoBlockAmendOptions *amend_opts; + + helper_cb_info.current_operation =3D QCOW2_UPDATING_ENCRYPTION; + amend_opts_dict =3D qcow2_extract_crypto_opts(opts, "luks", errp); + if (!amend_opts_dict) { + return -EINVAL; + } + amend_opts =3D block_crypto_amend_opts_init(amend_opts_dict, errp); + qobject_unref(amend_opts_dict); + if (!amend_opts) { + return -EINVAL; + } + ret =3D qcrypto_block_amend_options(s->crypto, + qcow2_crypto_hdr_read_func, + qcow2_crypto_hdr_write_func, + bs, + amend_opts, + force, + errp); + qapi_free_QCryptoBlockAmendOptions(amend_opts); + if (ret < 0) { + return ret; + } + } + if (s->refcount_bits !=3D refcount_bits) { int refcount_order =3D ctz32(refcount_bits); =20 @@ -5683,6 +5731,11 @@ static QemuOptsList qcow2_amend_opts =3D { .name =3D "qcow2-amend-opts", .head =3D QTAILQ_HEAD_INITIALIZER(qcow2_amend_opts.head), .desc =3D { + BLOCK_CRYPTO_OPT_DEF_LUKS_STATE("encrypt."), + BLOCK_CRYPTO_OPT_DEF_LUKS_KEYSLOT("encrypt."), + BLOCK_CRYPTO_OPT_DEF_LUKS_OLD_SECRET("encrypt."), + BLOCK_CRYPTO_OPT_DEF_LUKS_NEW_SECRET("encrypt."), + BLOCK_CRYPTO_OPT_DEF_LUKS_ITER_TIME("encrypt."), QCOW_COMMON_OPTIONS, { /* end of list */ } } diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out index b1cf5dfe43..a4a2b69030 100644 --- a/tests/qemu-iotests/082.out +++ b/tests/qemu-iotests/082.out @@ -645,6 +645,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -656,6 +661,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -667,6 +677,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -678,6 +693,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -689,6 +709,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -700,6 +725,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -711,6 +741,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -722,6 +757,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size @@ -750,6 +790,11 @@ Amend options for 'qcow2': compat=3D - Compatibility level (v2 [0.10] or v3 [1.1]) data_file=3D - File name of an external data file data_file_raw=3D - The external data file must stay valid= as a raw image + encrypt.iter-time=3D - Time to spend in PBKDF in milliseconds + encrypt.keyslot=3D - Select a single keyslot to modify explicitly + encrypt.new-secret=3D - New secret to set in the matching keyslots.= Empty string to erase + encrypt.old-secret=3D - Select all keyslots that match this password + encrypt.state=3D - Select new state of affected keyslots (active= /inactive) lazy_refcounts=3D - Postpone refcount updates refcount_bits=3D - Width of a reference count entry in bits size=3D - Virtual disk size --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609600; cv=none; d=zohomail.com; s=zohoarc; b=ESCCu7/4Ge6H/zS4ZDTHs4g+Kaxa0upkC88ugPZcs5YcMQ+UgygofOMuQbzPcxCLqGvRG5fdytmQRtLDYzx5xSgJzh5jQ57Et70QqcpeQg2UhE7KNssBNW7OwwqD8GvypHhTcLC3rF9ad5kCETWbsCOAxQoExJ0JUxctxGY10s8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609600; h=Content-Type:Content-Transfer-Encoding:Cc: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=GhQtkXhlC8dUwGXVWm5YbWUi1cc6/Q2m6ZCQZhaM8Og=; b=BX1BayfJGdpouhkmq8s5RGF56kLQACHzWM8R/YCtEiRcGYWAaBNrMnMJibNGYq9z8t1XkT8H6TjlholwZvDc/HWhyhe0UTVGCx3LjSzvL2mHvjwQzj5fBnuKr0NLLbZoKmXb5YiMPsk8lDaWa1E1bwxsMneVcrSv6T1g8sXpM+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609600703789.2896505379279; Mon, 8 Jun 2020 02:46:40 -0700 (PDT) Received: from localhost ([::1]:32940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEMZ-0006f2-9l for importer@patchew.org; Mon, 08 Jun 2020 05:46:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHN-0006lB-HV for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:17 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:26443 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHM-0002GB-Fm for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:17 -0400 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-498-nXe5NNnZOj2FL4J2vdRDcA-1; Mon, 08 Jun 2020 05:41:12 -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 3221CBFC4; Mon, 8 Jun 2020 09:41:11 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D2391CA; Mon, 8 Jun 2020 09:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GhQtkXhlC8dUwGXVWm5YbWUi1cc6/Q2m6ZCQZhaM8Og=; b=HzpW6kLpbiNQbP//1AEBWH+J2yblBHaQIRoKl8W2ASjJ0CEWkS5JxwV4HbFIQzg53gDgVu AmbXf5LMyqHAsEzy/nOG42cnzaaGgGK9OmSElYB5Hwl26rtYd1t/8MumKGXPZs5asMYs7Q aCzPC14TBwGXPWw1sdzrcYnDD08pDH4= X-MC-Unique: nXe5NNnZOj2FL4J2vdRDcA-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 09/14] iotests: filter few more luks specific create options Date: Mon, 8 Jun 2020 12:40:25 +0300 Message-Id: <20200608094030.670121-10-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mlevitsk@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:05:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This allows more tests to be able to have same output on both qcow2 luks en= crypted images and raw luks images Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemu-iotests/087.out | 6 +++--- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/158.out | 4 ++-- tests/qemu-iotests/188.out | 2 +- tests/qemu-iotests/189.out | 4 ++-- tests/qemu-iotests/198.out | 4 ++-- tests/qemu-iotests/263.out | 4 ++-- tests/qemu-iotests/284.out | 6 +++--- tests/qemu-iotests/common.filter | 6 ++++-- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out index f23bffbbf1..d5ff53302e 100644 --- a/tests/qemu-iotests/087.out +++ b/tests/qemu-iotests/087.out @@ -34,7 +34,7 @@ QMP_VERSION =20 =3D=3D=3D Encrypted image QCow =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don size=3D134217= 728 Testing: QMP_VERSION {"return": {}} @@ -46,7 +46,7 @@ QMP_VERSION =20 =3D=3D=3D Encrypted image LUKS =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D134217728 Testing: QMP_VERSION {"return": {}} @@ -58,7 +58,7 @@ QMP_VERSION =20 =3D=3D=3D Missing driver =3D=3D=3D =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don size=3D134217= 728 Testing: -S QMP_VERSION {"return": {}} diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out index f2878f5f3a..e4733c0b81 100644 --- a/tests/qemu-iotests/134.out +++ b/tests/qemu-iotests/134.out @@ -1,5 +1,5 @@ QA output created by 134 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don size=3D134217= 728 =20 =3D=3D reading whole image =3D=3D read 134217728/134217728 bytes at offset 0 diff --git a/tests/qemu-iotests/158.out b/tests/qemu-iotests/158.out index fa2294bb85..52ea9a488f 100644 --- a/tests/qemu-iotests/158.out +++ b/tests/qemu-iotests/158.out @@ -1,6 +1,6 @@ QA output created by 158 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encryption=3Don encrypt.= key-secret=3Dsec0 size=3D134217728 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encryption=3Don size=3D1= 34217728 =20 =3D=3D writing whole image =3D=3D wrote 134217728/134217728 bytes at offset 0 @@ -10,7 +10,7 @@ wrote 134217728/134217728 bytes at offset 0 read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don encrypt.key-s= ecret=3Dsec0 size=3D134217728 backing_file=3DTEST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encryption=3Don size=3D134217= 728 backing_file=3DTEST_DIR/t.IMGFMT.base =20 =3D=3D writing part of a cluster =3D=3D wrote 1024/1024 bytes at offset 0 diff --git a/tests/qemu-iotests/188.out b/tests/qemu-iotests/188.out index 4b9aadd51c..5426861b18 100644 --- a/tests/qemu-iotests/188.out +++ b/tests/qemu-iotests/188.out @@ -1,5 +1,5 @@ QA output created by 188 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 =20 =3D=3D reading whole image =3D=3D read 16777216/16777216 bytes at offset 0 diff --git a/tests/qemu-iotests/189.out b/tests/qemu-iotests/189.out index e536d95d53..bc213cbe14 100644 --- a/tests/qemu-iotests/189.out +++ b/tests/qemu-iotests/189.out @@ -1,6 +1,6 @@ QA output created by 189 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encrypt.format=3Dluks en= crypt.key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D16777216 =20 =3D=3D writing whole image =3D=3D wrote 16777216/16777216 bytes at offset 0 @@ -10,7 +10,7 @@ wrote 16777216/16777216 bytes at offset 0 read 16777216/16777216 bytes at offset 0 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec1 encrypt.iter-time=3D10 size=3D16777216 backing_file=3DTE= ST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 backing_file= =3DTEST_DIR/t.IMGFMT.base =20 =3D=3D writing part of a cluster =3D=3D wrote 1024/1024 bytes at offset 0 diff --git a/tests/qemu-iotests/198.out b/tests/qemu-iotests/198.out index 7714995c02..4b800e70db 100644 --- a/tests/qemu-iotests/198.out +++ b/tests/qemu-iotests/198.out @@ -1,12 +1,12 @@ QA output created by 198 =3D=3D create base =3D=3D -Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT encrypt.format=3Dluks en= crypt.key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D16777216 +Formatting 'TEST_DIR/t.IMGFMT.base', fmt=3DIMGFMT size=3D16777216 =20 =3D=3D writing whole image base =3D=3D wrote 16777216/16777216 bytes at offset 0 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) =3D=3D create overlay =3D=3D -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec1 encrypt.iter-time=3D10 size=3D16777216 backing_file=3DTE= ST_DIR/t.IMGFMT.base +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D16777216 backing_file= =3DTEST_DIR/t.IMGFMT.base =20 =3D=3D writing whole image layer =3D=3D wrote 16777216/16777216 bytes at offset 0 diff --git a/tests/qemu-iotests/263.out b/tests/qemu-iotests/263.out index 4cf5c79ed8..54bfbeeff8 100644 --- a/tests/qemu-iotests/263.out +++ b/tests/qemu-iotests/263.out @@ -2,7 +2,7 @@ QA output created by 263 =20 testing LUKS qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 =3D=3D reading the whole image =3D=3D read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) @@ -21,7 +21,7 @@ read 982528/982528 bytes at offset 66048 =20 testing legacy AES qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Daes encrypt.= key-secret=3Dsec0 size=3D1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 =3D=3D reading the whole image =3D=3D read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) diff --git a/tests/qemu-iotests/284.out b/tests/qemu-iotests/284.out index 1855369c56..a929239302 100644 --- a/tests/qemu-iotests/284.out +++ b/tests/qemu-iotests/284.out @@ -2,7 +2,7 @@ QA output created by 284 =20 testing LUKS qcow2 encryption =20 -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 =20 =3D=3D cluster size 512 =3D=3D checking image refcounts =3D=3D @@ -21,7 +21,7 @@ wrote 1/1 bytes at offset 512 =20 =3D=3D rechecking image refcounts =3D=3D No errors were found on the image. -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 =20 =3D=3D cluster size 2048 =3D=3D checking image refcounts =3D=3D @@ -40,7 +40,7 @@ wrote 1/1 bytes at offset 2048 =20 =3D=3D rechecking image refcounts =3D=3D No errors were found on the image. -Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT encrypt.format=3Dluks encrypt= .key-secret=3Dsec0 encrypt.iter-time=3D10 size=3D1048576 +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D1048576 =20 =3D=3D cluster size 32768 =3D=3D checking image refcounts =3D=3D diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter index 03e4f71808..99472f3acf 100644 --- a/tests/qemu-iotests/common.filter +++ b/tests/qemu-iotests/common.filter @@ -150,8 +150,10 @@ _filter_img_create() -e "s# block_state_zero=3D\\(on\\|off\\)##g" \ -e "s# log_size=3D[0-9]\\+##g" \ -e "s# refcount_bits=3D[0-9]\\+##g" \ - -e "s# key-secret=3D[a-zA-Z0-9]\\+##g" \ - -e "s# iter-time=3D[0-9]\\+##g" \ + -e "s# \\(encrypt\\.\\)\\?key-secret=3D[a-zA-Z0-9]\\+##g" \ + -e "s# \\(encrypt\\.\\)\\?iter-time=3D[0-9]\\+##g" \ + -e "s# \\(encrypt\\.\\)\\?slot=3D[0-9]\\+##g" \ + -e "s# encrypt\\.format=3D[a-zA-Z0-9]\\+##g" \ -e "s# force_size=3D\\(on\\|off\\)##g" \ -e "s# compression_type=3D[a-zA-Z0-9]\\+##g" } --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609715; cv=none; d=zohomail.com; s=zohoarc; b=lE3+BnnbKS2Uci5h4TBAegElx6d/1g6NOb/gUA9dcz2PqdEUptW8DTGawsOgiV1ffHsYtAxZwgScnwbgmIO0p27WeMT+Y1NfFTz2pzbxOO25R5yz/7t/E2U0Vm4rTOzCDAHnYAnGsjbg2Zjty9cmEtVG6Xm/l/8k4JaiJ2D7Ydo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609715; h=Content-Type:Content-Transfer-Encoding:Cc: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=rAx3dgAogp8OPh09vsAeKG2NpGev5GucDfJexqzx/CQ=; b=JQC6zYxS550ZFz9ayVt9KjB1f0T1xMCoPISrsBvd4fWsQ2Tqnoq9V7BQnX//0uzASUO+Os+uCC/1825q8E5HZ/bN1lbqx5tRhE0ctkWh2uT73JAHUkj9VhHo49my5XvoOcCnoKLl1HCZjHwT3a4t/PfDwtyyt8e8FG7P+8oX4uY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609715532128.4449692920224; Mon, 8 Jun 2020 02:48:35 -0700 (PDT) Received: from localhost ([::1]:40354 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEOQ-0001Jp-1u for importer@patchew.org; Mon, 08 Jun 2020 05:48:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHU-0006vm-Cx for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:24 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:33929 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHS-0002JS-IB for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:24 -0400 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-135-Zd9cm2o-OPe0VEn2o7oXbg-1; Mon, 08 Jun 2020 05:41:19 -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 134EB100A8F0; Mon, 8 Jun 2020 09:41:18 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 98EE61CA; Mon, 8 Jun 2020 09:41:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rAx3dgAogp8OPh09vsAeKG2NpGev5GucDfJexqzx/CQ=; b=BhnJp0DINg3M2+iUa/UsbxWopp2ze+tBaBxsOZx/vnncn9mb2n1c8w/Ot1PM5n3/0VOYbR BDRGO+SelsOqBZUjJgRkEbx22OqDB3LyMjNgcwLtU9bNr3UveOzQCks4j2EH3OvpAD8xs1 VQl9vcYAScrCG+EoSBJZ/uyTT6xN6cw= X-MC-Unique: Zd9cm2o-OPe0VEn2o7oXbg-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 10/14] iotests: qemu-img tests for luks key management Date: Mon, 8 Jun 2020 12:40:26 +0300 Message-Id: <20200608094030.670121-11-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.81; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This commit adds two tests, which test the new amend interface of both luks raw images and qcow2 luks encrypted images. Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemu-iotests/293 | 207 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/293.out | 99 ++++++++++++++++++ tests/qemu-iotests/294 | 90 ++++++++++++++++ tests/qemu-iotests/294.out | 30 ++++++ tests/qemu-iotests/group | 2 + 5 files changed, 428 insertions(+) create mode 100755 tests/qemu-iotests/293 create mode 100644 tests/qemu-iotests/293.out create mode 100755 tests/qemu-iotests/294 create mode 100644 tests/qemu-iotests/294.out diff --git a/tests/qemu-iotests/293 b/tests/qemu-iotests/293 new file mode 100755 index 0000000000..aa1a77690f --- /dev/null +++ b/tests/qemu-iotests/293 @@ -0,0 +1,207 @@ +#!/usr/bin/env bash +# +# Test encryption key management with luks +# Based on 134 +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dmlevitsk@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 luks +_supported_proto file #TODO + +QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT + +if [ "$IMGFMT" =3D "qcow2" ] ; then + PR=3D"encrypt." + EXTRA_IMG_ARGS=3D"-o encrypt.format=3Dluks" +fi + + +# secrets: you are supposed to see the password as *******, see :-) +S0=3D"--object secret,id=3Dsec0,data=3Dhunter0" +S1=3D"--object secret,id=3Dsec1,data=3Dhunter1" +S2=3D"--object secret,id=3Dsec2,data=3Dhunter2" +S3=3D"--object secret,id=3Dsec3,data=3Dhunter3" +S4=3D"--object secret,id=3Dsec4,data=3Dhunter4" +SECRETS=3D"$S0 $S1 $S2 $S3 $S4" + +# image with given secret +IMGS0=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,${PR}key-= secret=3Dsec0" +IMGS1=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,${PR}key-= secret=3Dsec1" +IMGS2=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,${PR}key-= secret=3Dsec2" +IMGS3=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,${PR}key-= secret=3Dsec3" +IMGS4=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,${PR}key-= secret=3Dsec4" + + +echo "=3D=3D creating a test image =3D=3D" +_make_test_img $S0 $EXTRA_IMG_ARGS -o ${PR}key-secret=3Dsec0,${PR}iter-tim= e=3D10 32M + +echo +echo "=3D=3D test that key 0 opens the image =3D=3D" +$QEMU_IO $S0 -c "read 0 4096" $IMGS0 | _filter_qemu_io | _filter_testdir + +echo +echo "=3D=3D adding a password to slot 4 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec4,${PR}iter-time=3D10,${PR}keyslot=3D4 +echo "=3D=3D adding a password to slot 1 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec1,${PR}iter-time=3D10 +echo "=3D=3D adding a password to slot 3 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec3,${PR}iter-time=3D10,${PR}keyslot=3D3 + +echo "=3D=3D adding a password to slot 2 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec2,${PR}iter-time=3D10 + + +echo "=3D=3D erase slot 4 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}keyslot=3D4 = | _filter_img_create + + +echo +echo "=3D=3D all secrets should work =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + +echo +echo "=3D=3D erase slot 0 and try it =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec0 | _filter_img_create +$QEMU_IO $SECRETS -c "read 0 4096" $IMGS0 | _filter_qemu_io | _filter_test= dir + +echo +echo "=3D=3D erase slot 2 and try it =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}keyslot=3D2 = | _filter_img_create +$QEMU_IO $SECRETS -c "read 0 4096" $IMGS2 | _filter_qemu_io | _filter_test= dir + + +# at this point slots 1 and 3 should be active + +echo +echo "=3D=3D filling 4 slots with secret 2 =3D=3D" +for i in $(seq 0 3) ; do + $QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dactive,${PR}new-secret=3D= sec2,${PR}iter-time=3D10 +done + +echo +echo "=3D=3D adding secret 0 =3D=3D" + $QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dactive,${PR}new-secret=3D= sec0,${PR}iter-time=3D10 + +echo +echo "=3D=3D adding secret 3 (last slot) =3D=3D" + $QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dactive,${PR}new-secret=3D= sec3,${PR}iter-time=3D10 + +echo +echo "=3D=3D trying to add another slot (should fail) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS2 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec3,${PR}iter-time=3D10 + +echo +echo "=3D=3D all secrets should work again =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + + +echo + +echo "=3D=3D erase all keys of secret 2=3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec2 + +echo "=3D=3D erase all keys of secret 1=3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec1 + +echo "=3D=3D erase all keys of secret 0=3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec0 + +echo "=3D=3D erasing secret3 will fail now since it is the only secret (in= 3 slots) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec3 + +echo +echo "=3D=3D only secret3 should work now =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + +echo +echo "=3D=3D add secret0 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS3 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec0,${PR}iter-time=3D10 + +echo "=3D=3D erase secret3 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec3 + +echo +echo "=3D=3D only secret0 should work now =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + +echo +echo "=3D=3D replace secret0 with secret1 (should fail) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec1,${PR}keyslot=3D0 + +echo +echo "=3D=3D replace secret0 with secret1 with force (should work) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o ${PR}state=3Dactive,${PR}new-secret=3Ds= ec1,${PR}iter-time=3D10,${PR}keyslot=3D0 --force + +echo +echo "=3D=3D only secret1 should work now =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + + +echo +echo "=3D=3D erase last secret (should fail) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}keyslot=3D0 +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec1 + + +echo "=3D=3D erase non existing secrets (should fail) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec5 --force +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}old-secret= =3Dsec0 --force +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}keyslot=3D1 = --force + +echo +echo "=3D=3D erase last secret with force by slot (should work) =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o ${PR}state=3Dinactive,${PR}keyslot=3D0 = --force + +echo +echo "=3D=3D we have no secrets now, data is lost forever =3D=3D" +for IMG in "$IMGS0" "$IMGS1" "$IMGS2" "$IMGS3"; do + $QEMU_IO $SECRETS -c "read 0 4096" $IMG | _filter_qemu_io | _filter_testd= ir +done + +# success, all done +echo "*** done" +rm -f $seq.full +status=3D0 + diff --git a/tests/qemu-iotests/293.out b/tests/qemu-iotests/293.out new file mode 100644 index 0000000000..7260783126 --- /dev/null +++ b/tests/qemu-iotests/293.out @@ -0,0 +1,99 @@ +QA output created by 293 +=3D=3D creating a test image =3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D33554432 + +=3D=3D test that key 0 opens the image =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D adding a password to slot 4 =3D=3D +=3D=3D adding a password to slot 1 =3D=3D +=3D=3D adding a password to slot 3 =3D=3D +=3D=3D adding a password to slot 2 =3D=3D +=3D=3D erase slot 4 =3D=3D + +=3D=3D all secrets should work =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D erase slot 0 and try it =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D erase slot 2 and try it =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D filling 4 slots with secret 2 =3D=3D + +=3D=3D adding secret 0 =3D=3D + +=3D=3D adding secret 3 (last slot) =3D=3D + +=3D=3D trying to add another slot (should fail) =3D=3D +qemu-img: Can't add a keyslot - all keyslots are in use + +=3D=3D all secrets should work again =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D erase all keys of secret 2=3D=3D +=3D=3D erase all keys of secret 1=3D=3D +=3D=3D erase all keys of secret 0=3D=3D +=3D=3D erasing secret3 will fail now since it is the only secret (in 3 slo= ts) =3D=3D +qemu-img: All the active keyslots match the (old) password that was given = and erasing them will erase all the data in the image irreversibly - refusi= ng operation + +=3D=3D only secret3 should work now =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D add secret0 =3D=3D +=3D=3D erase secret3 =3D=3D + +=3D=3D only secret0 should work now =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D replace secret0 with secret1 (should fail) =3D=3D +qemu-img: Refusing to overwrite active keyslot 0 - please erase it first + +=3D=3D replace secret0 with secret1 with force (should work) =3D=3D + +=3D=3D only secret1 should work now =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D erase last secret (should fail) =3D=3D +qemu-img: Attempt to erase the only active keyslot 0 which will erase all = the data in the image irreversibly - refusing operation +qemu-img: All the active keyslots match the (old) password that was given = and erasing them will erase all the data in the image irreversibly - refusi= ng operation +=3D=3D erase non existing secrets (should fail) =3D=3D +qemu-img: No secret with id 'sec5' +qemu-img: No keyslots match given (old) password for erase operation + +=3D=3D erase last secret with force by slot (should work) =3D=3D + +=3D=3D we have no secrets now, data is lost forever =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +qemu-io: can't open: Invalid password, cannot unlock any keyslot +*** done diff --git a/tests/qemu-iotests/294 b/tests/qemu-iotests/294 new file mode 100755 index 0000000000..9c95ed8c9a --- /dev/null +++ b/tests/qemu-iotests/294 @@ -0,0 +1,90 @@ +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +# creator +owner=3Dmlevitsk@redhat.com + +seq=3D`basename $0` +echo "QA output created by $seq" + +status=3D1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt luks +_supported_proto file #TODO + +QEMU_IO_OPTIONS=3D$QEMU_IO_OPTIONS_NO_FMT + +# you are supposed to see the password as *******, see :-) +S0=3D"--object secret,id=3Dsec0,data=3Dhunter0" +S1=3D"--object secret,id=3Dsec1,data=3Dhunter1" +SECRETS=3D"$S0 $S1" + + +IMGS0=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,key-secre= t=3Dsec0" +IMGS1=3D"--image-opts driver=3D$IMGFMT,file.filename=3D$TEST_IMG,key-secre= t=3Dsec1" + +echo "=3D=3D creating a test image =3D=3D" +_make_test_img $S0 -o "key-secret=3Dsec0,iter-time=3D10" 32M + +echo +echo "=3D=3D test that key 0 opens the image =3D=3D" +$QEMU_IO $S0 -c "read 0 4096" $IMGS0 | _filter_qemu_io | _filter_testdir + +echo +echo "=3D=3D adding a password to slot 1 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS0 -o state=3Dactive,new-secret=3Dsec1,keyslo= t=3D1,iter-time=3D10 + +echo +echo "=3D=3D 'backup' the image header =3D=3D" +dd if=3D$TEST_IMG_FILE of=3D${TEST_IMG_FILE}.bk bs=3D4K skip=3D0 count=3D1 + +echo +echo "=3D=3D erase slot 0 =3D=3D" +$QEMU_IMG amend $SECRETS $IMGS1 -o state=3Dinactive,keyslot=3D0 | _filter_= img_create + +echo +echo "=3D=3D test that key 0 doesn't open the image =3D=3D" +$QEMU_IO $S0 -c "read 0 4096" $IMGS0 | _filter_qemu_io | _filter_testdir + +echo +echo "=3D=3D 'restore' the image header =3D=3D" +dd if=3D${TEST_IMG_FILE}.bk of=3D${TEST_IMG_FILE} bs=3D4K skip=3D0 count= =3D1 conv=3Dnotrunc + +echo +echo "=3D=3D test that key 0 still doesn't open the image (key material is= erased) =3D=3D" +$QEMU_IO $SECRETS -c "read 0 4096" $IMGS0 | _filter_qemu_io | _filter_test= dir + +echo +echo "=3D=3D test that key 1 still works =3D=3D" +$QEMU_IO $SECRETS -c "read 0 4096" $IMGS1 | _filter_qemu_io | _filter_test= dir + +echo "*** done" +rm -f $seq.full +status=3D0 + + +exit 0 diff --git a/tests/qemu-iotests/294.out b/tests/qemu-iotests/294.out new file mode 100644 index 0000000000..994ae87308 --- /dev/null +++ b/tests/qemu-iotests/294.out @@ -0,0 +1,30 @@ +QA output created by 294 +=3D=3D creating a test image =3D=3D +Formatting 'TEST_DIR/t.IMGFMT', fmt=3DIMGFMT size=3D33554432 + +=3D=3D test that key 0 opens the image =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=3D=3D adding a password to slot 1 =3D=3D + +=3D=3D 'backup' the image header =3D=3D +1+0 records in +1+0 records out + +=3D=3D erase slot 0 =3D=3D + +=3D=3D test that key 0 doesn't open the image =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D 'restore' the image header =3D=3D +1+0 records in +1+0 records out + +=3D=3D test that key 0 still doesn't open the image (key material is erase= d) =3D=3D +qemu-io: can't open: Invalid password, cannot unlock any keyslot + +=3D=3D test that key 1 still works =3D=3D +read 4096/4096 bytes at offset 0 +4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index d886fa0cb3..ea3208d77b 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -301,4 +301,6 @@ 290 rw auto quick 291 rw quick 292 rw auto quick +293 rw auto +294 rw auto quick 297 meta --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609733; cv=none; d=zohomail.com; s=zohoarc; b=kdF3c8Arv0q90LyAH5YzSF4Ne9EJbvQfuUsmE6pWaB+6Rbxm/1gwFNv2HhfJ4yP+ikoqCP0bBF+GlbCvuPWxhIYkKDPBvhLwvvwGCiozg+xy9nfolCfB5ywOgHHrS+Ad9smE0Tv3t7uqSrcd7Esbnp3z92sWQl2EjT0zUyvo3gU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609733; h=Content-Type:Content-Transfer-Encoding:Cc: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=yIdmUrKBIDJzAxpRRRpnnX99KwE8mTeZlVnq+qODOkU=; b=WgJfaUxrAeh6xB7ITBCIBi1ZIFzQ2aDsLRO0fqGpWmWua6yE8IFwCFHWWpmGrEUNhOQMEPa9NAmND2A8GMF4sFbqFSUM66aJB8EdCIlHG9eYTNR2maojmcy1rYCij0TFmeLSBmo6ddbwrNJHi2DKwroW1SKylf4HnNqr5/8zxdU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609733156397.05784025211585; Mon, 8 Jun 2020 02:48:53 -0700 (PDT) Received: from localhost ([::1]:41598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEOh-0001rX-Nf for importer@patchew.org; Mon, 08 Jun 2020 05:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50166) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHX-00072B-Gd for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:27 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:43946 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHV-0002LB-Ip for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:27 -0400 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-46-SI8Cha_UOPKeXuWVYbOH7g-1; Mon, 08 Jun 2020 05:41:21 -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 E04E21940922; Mon, 8 Jun 2020 09:41:20 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77BD460C1D; Mon, 8 Jun 2020 09:41:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yIdmUrKBIDJzAxpRRRpnnX99KwE8mTeZlVnq+qODOkU=; b=aY55WZhxAKIw/Yth+GiyoYaLA05OHHb2WglEZSc3DwLhVKGTEXtj/Po/wjZgBvxd9s4B7c K+KBOWvP5ibm1uD2wNlCRQCTuj0MOav+/Ei7CTcTg4Oqm/CxHMQr8GYfuqyw6ltnuuIEIS UzHd2KuEP5BakiRkyZPWWl4hjgiTyCg= X-MC-Unique: SI8Cha_UOPKeXuWVYbOH7g-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 11/14] block/core: add generic infrastructure for x-blockdev-amend qmp command Date: Mon, 8 Jun 2020 12:40:27 +0300 Message-Id: <20200608094030.670121-12-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.120; envelope-from=mlevitsk@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:05:50 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) blockdev-amend will be used similiar to blockdev-create to allow on the fly changes of the structure of the format based block devi= ces. Current plan is to first support encryption keyslot management for luks based formats (raw and embedded in qcow2) Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- block/Makefile.objs | 2 +- block/amend.c | 113 ++++++++++++++++++++++++++++++++++++++ include/block/block_int.h | 21 +++++-- qapi/block-core.json | 42 ++++++++++++++ qapi/job.json | 4 +- 5 files changed, 174 insertions(+), 8 deletions(-) create mode 100644 block/amend.c diff --git a/block/Makefile.objs b/block/Makefile.objs index 3635b6b4c1..a0988638d5 100644 --- a/block/Makefile.objs +++ b/block/Makefile.objs @@ -19,7 +19,7 @@ block-obj-$(CONFIG_WIN32) +=3D file-win32.o win32-aio.o block-obj-$(CONFIG_POSIX) +=3D file-posix.o block-obj-$(CONFIG_LINUX_AIO) +=3D linux-aio.o block-obj-$(CONFIG_LINUX_IO_URING) +=3D io_uring.o -block-obj-y +=3D null.o mirror.o commit.o io.o create.o +block-obj-y +=3D null.o mirror.o commit.o io.o create.o amend.o block-obj-y +=3D throttle-groups.o block-obj-$(CONFIG_LINUX) +=3D nvme.o =20 diff --git a/block/amend.c b/block/amend.c new file mode 100644 index 0000000000..f4612dcf08 --- /dev/null +++ b/block/amend.c @@ -0,0 +1,113 @@ +/* + * Block layer code related to image options amend + * + * Copyright (c) 2018 Kevin Wolf + * Copyright (c) 2020 Red Hat. Inc + * + * Heavily based on create.c + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "block/block_int.h" +#include "qemu/job.h" +#include "qemu/main-loop.h" +#include "qapi/qapi-commands-block-core.h" +#include "qapi/qapi-visit-block-core.h" +#include "qapi/clone-visitor.h" +#include "qapi/error.h" + +typedef struct BlockdevAmendJob { + Job common; + BlockdevAmendOptions *opts; + BlockDriverState *bs; + bool force; +} BlockdevAmendJob; + +static int coroutine_fn blockdev_amend_run(Job *job, Error **errp) +{ + BlockdevAmendJob *s =3D container_of(job, BlockdevAmendJob, common); + int ret; + + job_progress_set_remaining(&s->common, 1); + ret =3D s->bs->drv->bdrv_co_amend(s->bs, s->opts, s->force, errp); + job_progress_update(&s->common, 1); + qapi_free_BlockdevAmendOptions(s->opts); + return ret; +} + +static const JobDriver blockdev_amend_job_driver =3D { + .instance_size =3D sizeof(BlockdevAmendJob), + .job_type =3D JOB_TYPE_AMEND, + .run =3D blockdev_amend_run, +}; + +void qmp_x_blockdev_amend(const char *job_id, + const char *node_name, + BlockdevAmendOptions *options, + bool has_force, + bool force, + Error **errp) +{ + BlockdevAmendJob *s; + const char *fmt =3D BlockdevDriver_str(options->driver); + BlockDriver *drv =3D bdrv_find_format(fmt); + BlockDriverState *bs =3D bdrv_find_node(node_name); + + + if (!drv) { + error_setg(errp, "Block driver '%s' not found or not supported", f= mt); + return; + } + + /* + * If the driver is in the schema, we know that it exists. But it may = not + * be whitelisted. + */ + if (bdrv_uses_whitelist() && !bdrv_is_whitelisted(drv, false)) { + error_setg(errp, "Driver is not whitelisted"); + return; + } + + if (bs->drv !=3D drv) { + error_setg(errp, + "x-blockdev-amend doesn't support changing the block dr= iver"); + return; + } + + /* Error out if the driver doesn't support .bdrv_co_amend */ + if (!drv->bdrv_co_amend) { + error_setg(errp, "Driver does not support x-blockdev-amend"); + return; + } + + /* Create the block job */ + s =3D job_create(job_id, &blockdev_amend_job_driver, NULL, + bdrv_get_aio_context(bs), JOB_DEFAULT | JOB_MANUAL_DISM= ISS, + NULL, NULL, errp); + if (!s) { + return; + } + + s->bs =3D bs, + s->opts =3D QAPI_CLONE(BlockdevAmendOptions, options), + s->force =3D has_force ? force : false; + job_start(&s->common); +} diff --git a/include/block/block_int.h b/include/block/block_int.h index ed335519cc..1b86b59af1 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -141,12 +141,27 @@ struct BlockDriver { int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags, Error **errp); void (*bdrv_close)(BlockDriverState *bs); + + int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts, Error **errp); int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv, const char *filename, QemuOpts *opts, Error **errp); + + int coroutine_fn (*bdrv_co_amend)(BlockDriverState *bs, + BlockdevAmendOptions *opts, + bool force, + Error **errp); + + int (*bdrv_amend_options)(BlockDriverState *bs, + QemuOpts *opts, + BlockDriverAmendStatusCB *status_cb, + void *cb_opaque, + bool force, + Error **errp); + int (*bdrv_make_empty)(BlockDriverState *bs); =20 /* @@ -441,12 +456,6 @@ struct BlockDriver { BdrvCheckResult *result, BdrvCheckMode fix); =20 - int (*bdrv_amend_options)(BlockDriverState *bs, QemuOpts *opts, - BlockDriverAmendStatusCB *status_cb, - void *cb_opaque, - bool force, - Error **errp); - void (*bdrv_debug_event)(BlockDriverState *bs, BlkdebugEvent event); =20 /* TODO Better pass a option string/QDict/QemuOpts to add any rule? */ diff --git a/qapi/block-core.json b/qapi/block-core.json index 0e1c6a59f2..c22996282f 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4674,6 +4674,48 @@ 'data': { 'job-id': 'str', 'options': 'BlockdevCreateOptions' } } =20 +## +# @BlockdevAmendOptions: +# +# Options for amending an image format +# +# @driver: Block driver of the node to amend. +# +# Since: 5.1 +## +{ 'union': 'BlockdevAmendOptions', + 'base': { + 'driver': 'BlockdevDriver' }, + 'discriminator': 'driver', + 'data': { + } } + +## +# @x-blockdev-amend: +# +# Starts a job to amend format specific options of an existing open block = device +# The job is automatically finalized, but a manual job-dismiss is required. +# +# @job-id: Identifier for the newly created job. +# +# @node-name: Name of the block node to work on +# +# @options: Options (driver specific) +# +# @force: Allow unsafe operations, format specific +# For luks that allows erase of the last active keyslot +# (permanent loss of data), +# and replacement of an active keyslot +# (possible loss of data if IO error happens) +# +# Since: 5.1 +## +{ 'command': 'x-blockdev-amend', + 'data': { 'job-id': 'str', + 'node-name': 'str', + 'options': 'BlockdevAmendOptions', + '*force': 'bool' } } + ## # @BlockErrorAction: # diff --git a/qapi/job.json b/qapi/job.json index 5e658281f5..c48a0c3e34 100644 --- a/qapi/job.json +++ b/qapi/job.json @@ -19,10 +19,12 @@ # # @create: image creation job type, see "blockdev-create" (since 3.0) # +# @amend: image options amend job type, see "x-blockdev-amend" (since 5.1) +# # Since: 1.7 ## { 'enum': 'JobType', - 'data': ['commit', 'stream', 'mirror', 'backup', 'create'] } + 'data': ['commit', 'stream', 'mirror', 'backup', 'create', 'amend'] } =20 ## # @JobStatus: --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609606; cv=none; d=zohomail.com; s=zohoarc; b=HJ+3/xvUpAJuR/pMSq+wuUkoA4gLR7riVgocjTUzxLyoSc5tsDZKVI6Ps8tLMZH7ocf+6o8gnrvDU7nzhZ6Bu3yNxibaRNNNKDy7h+cszDF21EAEXfSB+Fh4byDUu6Uci05iEFeTIgiWT46btrnpVCq6vKbc9Nt1OqkqATp740E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609606; h=Content-Type:Content-Transfer-Encoding:Cc: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=Xf2TAZaHXTVuOr7ou1bIAjIBKqEu9c1V7Yawz+/qJ2I=; b=fRWN6IfT49Z8cnoHTwwJp/rx+gKIVZwSnJSkgAmkE3BZ/tjtMV7CT6UMysIEt3i8W46TD/CIiAwpJYV2VY0flYWeSrWbWQx+CR2y1ka8O41kSj0t1FBceLYsePBtTLrwrjqFlGsxwjw54GGEwgRM5vF2ZqoT0iT64no40zBlZns= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609606693911.2926343452474; Mon, 8 Jun 2020 02:46:46 -0700 (PDT) Received: from localhost ([::1]:33300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEMf-0006nu-9c for importer@patchew.org; Mon, 08 Jun 2020 05:46:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHZ-00075x-6Z for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:29 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:29064 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHX-0002Lb-2q for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:28 -0400 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-186-MRrINmR7MYSpyPUwJhFVUg-1; Mon, 08 Jun 2020 05:41:24 -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 B9F0680572E; Mon, 8 Jun 2020 09:41:23 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51B0F60C1D; Mon, 8 Jun 2020 09:41:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609286; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xf2TAZaHXTVuOr7ou1bIAjIBKqEu9c1V7Yawz+/qJ2I=; b=ScH0PryOO8XPfxAH3euuwfp4oG/KrCbFAySuJZwvJrDUgGRp4mt19ZbVpLJEbJwhy56b7G KF0M/igKHCBBXDhGR+0juRcqo6XuX/XoHL1bzfUOy3Xv/IgabiORrTByUzZVuP0PQHK7vN PKuQp7WR8xg60XYLBMlGHXnQkeWDxxk= X-MC-Unique: MRrINmR7MYSpyPUwJhFVUg-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 12/14] block/crypto: implement blockdev-amend Date: Mon, 8 Jun 2020 12:40:28 +0300 Message-Id: <20200608094030.670121-13-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:20:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block/crypto.c | 72 ++++++++++++++++++++++++++++++++------------ qapi/block-core.json | 14 ++++++++- 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/block/crypto.c b/block/crypto.c index b9c40e6922..3fbd68832b 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -791,32 +791,21 @@ block_crypto_get_specific_info_luks(BlockDriverState = *bs, Error **errp) } =20 static int -block_crypto_amend_options_luks(BlockDriverState *bs, - QemuOpts *opts, - BlockDriverAmendStatusCB *status_cb, - void *cb_opaque, - bool force, - Error **errp) +block_crypto_amend_options_generic_luks(BlockDriverState *bs, + QCryptoBlockAmendOptions *amend_op= tions, + bool force, + Error **errp) { BlockCrypto *crypto =3D bs->opaque; - QDict *cryptoopts =3D NULL; - QCryptoBlockAmendOptions *amend_options =3D NULL; int ret; =20 assert(crypto); assert(crypto->block); - crypto->updating_keys =3D true; =20 + /* apply for exclusive read/write permissions to the underlying file*/ + crypto->updating_keys =3D true; ret =3D bdrv_child_refresh_perms(bs, bs->file, errp); - if (ret < 0) { - goto cleanup; - } - - cryptoopts =3D qemu_opts_to_qdict(opts, NULL); - qdict_put_str(cryptoopts, "format", "luks"); - amend_options =3D block_crypto_amend_opts_init(cryptoopts, errp); - if (!amend_options) { - ret =3D -EINVAL; + if (ret) { goto cleanup; } =20 @@ -828,13 +817,57 @@ block_crypto_amend_options_luks(BlockDriverState *bs, force, errp); cleanup: + /* release exclusive read/write permissions to the underlying file*/ crypto->updating_keys =3D false; bdrv_child_refresh_perms(bs, bs->file, errp); - qapi_free_QCryptoBlockAmendOptions(amend_options); + return ret; +} + +static int +block_crypto_amend_options_luks(BlockDriverState *bs, + QemuOpts *opts, + BlockDriverAmendStatusCB *status_cb, + void *cb_opaque, + bool force, + Error **errp) +{ + BlockCrypto *crypto =3D bs->opaque; + QDict *cryptoopts =3D NULL; + QCryptoBlockAmendOptions *amend_options =3D NULL; + int ret =3D -EINVAL; + + assert(crypto); + assert(crypto->block); + + cryptoopts =3D qemu_opts_to_qdict(opts, NULL); + qdict_put_str(cryptoopts, "format", "luks"); + amend_options =3D block_crypto_amend_opts_init(cryptoopts, errp); qobject_unref(cryptoopts); + if (!amend_options) { + goto cleanup; + } + ret =3D block_crypto_amend_options_generic_luks(bs, amend_options, + force, errp); +cleanup: + qapi_free_QCryptoBlockAmendOptions(amend_options); return ret; } =20 +static int +coroutine_fn block_crypto_co_amend_luks(BlockDriverState *bs, + BlockdevAmendOptions *opts, + bool force, + Error **errp) +{ + QCryptoBlockAmendOptions amend_opts; + + amend_opts =3D (QCryptoBlockAmendOptions) { + .format =3D Q_CRYPTO_BLOCK_FORMAT_LUKS, + .u.luks =3D *qapi_BlockdevAmendOptionsLUKS_base(&opts->u.luks), + }; + return block_crypto_amend_options_generic_luks(bs, &amend_opts, + force, errp); +} =20 static void block_crypto_child_perms(BlockDriverState *bs, BdrvChild *c, @@ -910,6 +943,7 @@ static BlockDriver bdrv_crypto_luks =3D { .bdrv_get_info =3D block_crypto_get_info_luks, .bdrv_get_specific_info =3D block_crypto_get_specific_info_luks, .bdrv_amend_options =3D block_crypto_amend_options_luks, + .bdrv_co_amend =3D block_crypto_co_amend_luks, =20 .is_format =3D true, =20 diff --git a/qapi/block-core.json b/qapi/block-core.json index c22996282f..cd679ad435 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4674,6 +4674,18 @@ 'data': { 'job-id': 'str', 'options': 'BlockdevCreateOptions' } } =20 +## +# @BlockdevAmendOptionsLUKS: +# +# Driver specific image amend options for LUKS. +# +# Since: 5.1 +## +{ 'struct': 'BlockdevAmendOptionsLUKS', + 'base': 'QCryptoBlockAmendOptionsLUKS', + 'data': { } +} + ## # @BlockdevAmendOptions: # @@ -4688,7 +4700,7 @@ 'driver': 'BlockdevDriver' }, 'discriminator': 'driver', 'data': { - } } + 'luks': 'BlockdevAmendOptionsLUKS' } } =20 ## # @x-blockdev-amend: --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609853; cv=none; d=zohomail.com; s=zohoarc; b=EyCIwCChpJK5XXeqGw1j0q55uAh9BcXtGdLHcLNYe95RI3nKYU9LA867L3S3f90rpTEB5irj0oRc8V2hEj1o1ebdv/gvOZrLFg+EVsurXXc4NmndCRYcHYk4TD+zvBwV2YAXXMrumsnRiQQwrWdP6R1V0h2C/o6zu/dw3+8zc6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609853; h=Content-Type:Content-Transfer-Encoding:Cc: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=SJHkH/2XpUZxvyjsQYsfu5kkAxA0yp20Sec5JMMMQU8=; b=i1QxKnjSWDoQs2jCUFzeTI5xYlyWCTEn+6/C0BH6M6aYl70U0g5ubBy3JMJEZ+AmbYnlhIdWE5722A8H5HBNUf+FzXqq/hPXu4WfCoBCG7cX9CHhu5QXmZokyzIWN6iY3tsvhIu8Tkfa2qu9kctzQy1hck7XGLNWWP5HSWcPm6k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609853537604.4940238407202; Mon, 8 Jun 2020 02:50:53 -0700 (PDT) Received: from localhost ([::1]:46790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiEQe-00041G-Ao for importer@patchew.org; Mon, 08 Jun 2020 05:50:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHd-0007CS-Po for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:33 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:49876 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHa-0002MN-Hr for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:32 -0400 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-418-OLZk3OVhPBW_Ex-vgh60gA-1; Mon, 08 Jun 2020 05:41:27 -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 92DE8835B42; Mon, 8 Jun 2020 09:41:26 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B6E61CA; Mon, 8 Jun 2020 09:41:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SJHkH/2XpUZxvyjsQYsfu5kkAxA0yp20Sec5JMMMQU8=; b=K0DPLPUWm9P+LO8WRsNb9G6vi7/gSBY9ZqKCo8NHGxctHejBwvwf/hm4GNTlTnKPt9ZJfr mA7j6cnFK8nJNgOJCfh+EU8D4Xqx5ic2fHDBuToZ46Z6mrone/CT2BNSMytIY/nROlcj/Z cz6vlJ/xJ912HnFva4PN12LLSpZ2sa0= X-MC-Unique: OLZk3OVhPBW_Ex-vgh60gA-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 13/14] block/qcow2: implement blockdev-amend Date: Mon, 8 Jun 2020 12:40:29 +0300 Message-Id: <20200608094030.670121-14-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.139.110.61; envelope-from=mlevitsk@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 01:20:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Currently the implementation only supports amending the encryption options, unlike the qemu-img version Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Max Reitz --- block/qcow2.c | 39 +++++++++++++++++++++++++++++++++++++++ qapi/block-core.json | 16 +++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/block/qcow2.c b/block/qcow2.c index 0e72e8fc39..0d2d05d1f7 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -5585,6 +5585,44 @@ static int qcow2_amend_options(BlockDriverState *bs,= QemuOpts *opts, return 0; } =20 +static int coroutine_fn qcow2_co_amend(BlockDriverState *bs, + BlockdevAmendOptions *opts, + bool force, + Error **errp) +{ + BlockdevAmendOptionsQcow2 *qopts =3D &opts->u.qcow2; + BDRVQcow2State *s =3D bs->opaque; + int ret =3D 0; + + if (qopts->has_encrypt) { + if (!s->crypto) { + error_setg(errp, "image is not encrypted, can't amend"); + return -EOPNOTSUPP; + } + + if (qopts->encrypt->format !=3D Q_CRYPTO_BLOCK_FORMAT_LUKS) { + error_setg(errp, + "Amend can't be used to change the qcow2 encryption= format"); + return -EOPNOTSUPP; + } + + if (s->crypt_method_header !=3D QCOW_CRYPT_LUKS) { + error_setg(errp, + "Only LUKS encryption options can be amended for qc= ow2 with blockdev-amend"); + return -EOPNOTSUPP; + } + + ret =3D qcrypto_block_amend_options(s->crypto, + qcow2_crypto_hdr_read_func, + qcow2_crypto_hdr_write_func, + bs, + qopts->encrypt, + force, + errp); + } + return ret; +} + /* * If offset or size are negative, respectively, they will not be included= in * the BLOCK_IMAGE_CORRUPTED event emitted. @@ -5802,6 +5840,7 @@ BlockDriver bdrv_qcow2 =3D { .mutable_opts =3D mutable_opts, .bdrv_co_check =3D qcow2_co_check, .bdrv_amend_options =3D qcow2_amend_options, + .bdrv_co_amend =3D qcow2_co_amend, =20 .bdrv_detach_aio_context =3D qcow2_detach_aio_context, .bdrv_attach_aio_context =3D qcow2_attach_aio_context, diff --git a/qapi/block-core.json b/qapi/block-core.json index cd679ad435..b20332e592 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -4686,6 +4686,19 @@ 'data': { } } =20 +## +# @BlockdevAmendOptionsQcow2: +# +# Driver specific image amend options for qcow2. +# For now, only encryption options can be amended +# +# @encrypt Encryption options to be amended +# +# Since: 5.1 +## +{ 'struct': 'BlockdevAmendOptionsQcow2', + 'data': { '*encrypt': 'QCryptoBlockAmendOptions' } } + ## # @BlockdevAmendOptions: # @@ -4700,7 +4713,8 @@ 'driver': 'BlockdevDriver' }, 'discriminator': 'driver', 'data': { - 'luks': 'BlockdevAmendOptionsLUKS' } } + 'luks': 'BlockdevAmendOptionsLUKS', + 'qcow2': 'BlockdevAmendOptionsQcow2' } } =20 ## # @x-blockdev-amend: --=20 2.25.4 From nobody Thu May 16 07:57:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1591609886; cv=none; d=zohomail.com; s=zohoarc; b=ZIJ0tZ+YofhEJnT8uFRwSgG0P7xSsnJMNnxCpSy3Zj6wLyymc241KZ79EPir0kBNJ3pvMsxplXefR81jX08Mk6dcjqQZBIM7NFZdhVAAy6zgOrpqRLpcbr5bnb68YBPPJTsTudjCdg3znNgg8A+FVjY7Yx+LbeMoUBeK00KM/tU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591609886; h=Content-Type:Content-Transfer-Encoding:Cc: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=KVFkqoy7RJJQe/8vWwEX44Pxd+WI9D8PJYzhwH5JXKM=; b=cKiuOvLNmSaK8icVlC1SqTepuixn01szZKK5Yu6dHyormFW5/47BnykL0hLyrd8w4zfMbJu6xlRlEAAz/vwfTeXs5+58M12ReB0LgilKUlGVL2XP4tXfZ/GxHSxAsMC/r757atC3ElnHXx311gOaMwL0/pmwzf+ZU6KrlmUQe94= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1591609886156876.8397836065508; Mon, 8 Jun 2020 02:51:26 -0700 (PDT) Received: from localhost ([::1]:48206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jiERA-0004fh-OG for importer@patchew.org; Mon, 08 Jun 2020 05:51:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jiEHr-0007fe-3a for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:47 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:42031 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jiEHc-0002NB-S6 for qemu-devel@nongnu.org; Mon, 08 Jun 2020 05:41:46 -0400 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-263-Ba1HupecOW2NtF45KfWGQg-1; Mon, 08 Jun 2020 05:41:30 -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 6CD7F461; Mon, 8 Jun 2020 09:41:29 +0000 (UTC) Received: from starship.redhat.com (unknown [10.35.206.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0569A1CA; Mon, 8 Jun 2020 09:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591609292; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KVFkqoy7RJJQe/8vWwEX44Pxd+WI9D8PJYzhwH5JXKM=; b=YKM3DcxiHTzG0enZcNWXmVqnhMfxVqu9QlTjk4mmp8+aSGfEoGwrf+7edHl5PwjTUoSMXL KSxAItqaPp32wQqPQBjUU7X6NpXzrTgNyMliVSoThvbVeEDZMllE9rZ/tUKFcU6jkxIW8x 9SRkY2y6agSagIR88X6XpzDtIpQ9wPI= X-MC-Unique: Ba1HupecOW2NtF45KfWGQg-1 From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH v8 14/14] iotests: add tests for blockdev-amend Date: Mon, 8 Jun 2020 12:40:30 +0300 Message-Id: <20200608094030.670121-15-mlevitsk@redhat.com> In-Reply-To: <20200608094030.670121-1-mlevitsk@redhat.com> References: <20200608094030.670121-1-mlevitsk@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=207.211.31.120; envelope-from=mlevitsk@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/08 05:40:56 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , qemu-block@nongnu.org, John Snow , Markus Armbruster , Max Reitz , Maxim Levitsky Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This commit adds two tests that cover the new blockdev-amend functionality of luks and qcow2 driver Signed-off-by: Maxim Levitsky Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qemu-iotests/295 | 279 +++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/295.out | 40 ++++++ tests/qemu-iotests/296 | 234 +++++++++++++++++++++++++++++++ tests/qemu-iotests/296.out | 33 +++++ tests/qemu-iotests/group | 2 + 5 files changed, 588 insertions(+) create mode 100755 tests/qemu-iotests/295 create mode 100644 tests/qemu-iotests/295.out create mode 100755 tests/qemu-iotests/296 create mode 100644 tests/qemu-iotests/296.out diff --git a/tests/qemu-iotests/295 b/tests/qemu-iotests/295 new file mode 100755 index 0000000000..be5dfe5063 --- /dev/null +++ b/tests/qemu-iotests/295 @@ -0,0 +1,279 @@ +#!/usr/bin/env python3 +# +# Test case QMP's encrypted key management +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests +import os +import time +import json + +test_img =3D os.path.join(iotests.test_dir, 'test.img') + +class Secret: + def __init__(self, index): + self._id =3D "keysec" + str(index) + # you are not supposed to see the password... + self._secret =3D "hunter" + str(index) + + def id(self): + return self._id + + def secret(self): + return self._secret + + def to_cmdline_object(self): + return [ "secret,id=3D" + self._id + ",data=3D" + self._secret] + + def to_qmp_object(self): + return { "qom_type" : "secret", "id": self.id(), + "props": { "data": self.secret() } } + +##########################################################################= ###### +class EncryptionSetupTestCase(iotests.QMPTestCase): + + # test case startup + def setUp(self): + # start the VM + self.vm =3D iotests.VM() + self.vm.launch() + + # create the secrets and load 'em into the VM + self.secrets =3D [ Secret(i) for i in range(0, 6) ] + for secret in self.secrets: + result =3D self.vm.qmp("object-add", **secret.to_qmp_object()) + self.assert_qmp(result, 'return', {}) + + if iotests.imgfmt =3D=3D "qcow2": + self.pfx =3D "encrypt." + self.img_opts =3D [ '-o', "encrypt.format=3Dluks" ] + else: + self.pfx =3D "" + self.img_opts =3D [] + + # test case shutdown + def tearDown(self): + # stop the VM + self.vm.shutdown() + + ######################################################################= ##### + # create the encrypted block device + def createImg(self, file, secret): + + iotests.qemu_img( + 'create', + '--object', *secret.to_cmdline_object(), + '-f', iotests.imgfmt, + '-o', self.pfx + 'key-secret=3D' + secret.id(), + '-o', self.pfx + 'iter-time=3D10', + *self.img_opts, + file, + '1M') + + ######################################################################= ##### + # open an encrypted block device + def openImageQmp(self, id, file, secret, read_only =3D False): + + encrypt_options =3D { + 'key-secret' : secret.id() + } + + if iotests.imgfmt =3D=3D "qcow2": + encrypt_options =3D { + 'encrypt': { + 'format':'luks', + **encrypt_options + } + } + + result =3D self.vm.qmp('blockdev-add', ** + { + 'driver': iotests.imgfmt, + 'node-name': id, + 'read-only': read_only, + + **encrypt_options, + + 'file': { + 'driver': 'file', + 'filename': test_img, + } + } + ) + self.assert_qmp(result, 'return', {}) + + # close the encrypted block device + def closeImageQmp(self, id): + result =3D self.vm.qmp('blockdev-del', **{ 'node-name': id }) + self.assert_qmp(result, 'return', {}) + + ######################################################################= ##### + # add a key to an encrypted block device + def addKeyQmp(self, id, new_secret, secret =3D None, + slot =3D None, force =3D False): + + crypt_options =3D { + 'state' : 'active', + 'new-secret' : new_secret.id(), + 'iter-time' : 10 + } + + if slot !=3D None: + crypt_options['keyslot'] =3D slot + + + if secret !=3D None: + crypt_options['secret'] =3D secret.id() + + if iotests.imgfmt =3D=3D "qcow2": + crypt_options['format'] =3D 'luks' + crypt_options =3D { + 'encrypt': crypt_options + } + + args =3D { + 'node-name': id, + 'job-id' : 'job_add_key', + 'options' : { + 'driver' : iotests.imgfmt, + **crypt_options + }, + } + + if force =3D=3D True: + args['force'] =3D True + + #TODO: check what jobs return + result =3D self.vm.qmp('x-blockdev-amend', **args) + assert result['return'] =3D=3D {} + self.vm.run_job('job_add_key') + + # erase a key from an encrypted block device + def eraseKeyQmp(self, id, old_secret =3D None, slot =3D None, force = =3D False): + + crypt_options =3D { + 'state' : 'inactive', + } + + if slot !=3D None: + crypt_options['keyslot'] =3D slot + if old_secret !=3D None: + crypt_options['old-secret'] =3D old_secret.id() + + if iotests.imgfmt =3D=3D "qcow2": + crypt_options['format'] =3D 'luks' + crypt_options =3D { + 'encrypt': crypt_options + } + + args =3D { + 'node-name': id, + 'job-id' : 'job_erase_key', + 'options' : { + 'driver' : iotests.imgfmt, + **crypt_options + }, + } + + if force =3D=3D True: + args['force'] =3D True + + result =3D self.vm.qmp('x-blockdev-amend', **args) + assert result['return'] =3D=3D {} + self.vm.run_job('job_erase_key') + + ######################################################################= ##### + # create image, and change its key + def testChangeKey(self): + + # create the image with secret0 and open it + self.createImg(test_img, self.secrets[0]); + self.openImageQmp("testdev", test_img, self.secrets[0]) + + # add key to slot 1 + self.addKeyQmp("testdev", new_secret =3D self.secrets[1]) + + # add key to slot 5 + self.addKeyQmp("testdev", new_secret =3D self.secrets[2], slot=3D5) + + # erase key from slot 0 + self.eraseKeyQmp("testdev", old_secret =3D self.secrets[0]) + + #reopen the image with secret1 + self.closeImageQmp("testdev") + self.openImageQmp("testdev", test_img, self.secrets[1]) + + # close and erase the image for good + self.closeImageQmp("testdev") + os.remove(test_img) + + # test that if we erase the old password, + # we can still change the encryption keys using 'old-secret' + def testOldPassword(self): + + # create the image with secret0 and open it + self.createImg(test_img, self.secrets[0]); + self.openImageQmp("testdev", test_img, self.secrets[0]) + + # add key to slot 1 + self.addKeyQmp("testdev", new_secret =3D self.secrets[1]) + + # erase key from slot 0 + self.eraseKeyQmp("testdev", old_secret =3D self.secrets[0]) + + # this will fail as the old password is no longer valid + self.addKeyQmp("testdev", new_secret =3D self.secrets[2]) + + # this will work + self.addKeyQmp("testdev", new_secret =3D self.secrets[2], secret = =3D self.secrets[1]) + + # close and erase the image for good + self.closeImageQmp("testdev") + os.remove(test_img) + + def testUseForceLuke(self): + + self.createImg(test_img, self.secrets[0]); + self.openImageQmp("testdev", test_img, self.secrets[0]) + + # Add bunch of secrets + self.addKeyQmp("testdev", new_secret =3D self.secrets[1], slot=3D4) + self.addKeyQmp("testdev", new_secret =3D self.secrets[4], slot=3D2) + + # overwrite an active secret + self.addKeyQmp("testdev", new_secret =3D self.secrets[5], slot=3D2) + self.addKeyQmp("testdev", new_secret =3D self.secrets[5], slot=3D2= , force=3DTrue) + + self.addKeyQmp("testdev", new_secret =3D self.secrets[0]) + + # Now erase all the secrets + self.eraseKeyQmp("testdev", old_secret =3D self.secrets[5]) + self.eraseKeyQmp("testdev", slot=3D4) + + # erase last keyslot + self.eraseKeyQmp("testdev", old_secret =3D self.secrets[0]) + self.eraseKeyQmp("testdev", old_secret =3D self.secrets[0], force= =3DTrue) + + self.closeImageQmp("testdev") + os.remove(test_img) + + +if __name__ =3D=3D '__main__': + # Encrypted formats support + iotests.activate_logging() + iotests.main(supported_fmts =3D ['qcow2', 'luks']) diff --git a/tests/qemu-iotests/295.out b/tests/qemu-iotests/295.out new file mode 100644 index 0000000000..ad34b2ca2c --- /dev/null +++ b/tests/qemu-iotests/295.out @@ -0,0 +1,40 @@ +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +Job failed: Invalid password, cannot unlock any keyslot +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +Job failed: Refusing to overwrite active keyslot 2 - please erase it first +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_add_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +Job failed: All the active keyslots match the (old) password that was give= n and erasing them will erase all the data in the image irreversibly - refu= sing operation +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job_erase_key"}} +{"return": {}} +... +---------------------------------------------------------------------- +Ran 3 tests + +OK diff --git a/tests/qemu-iotests/296 b/tests/qemu-iotests/296 new file mode 100755 index 0000000000..ec69ec8974 --- /dev/null +++ b/tests/qemu-iotests/296 @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +# +# Test case for encryption key management versus image sharing +# +# Copyright (C) 2019 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import iotests +import os +import time +import json + +test_img =3D os.path.join(iotests.test_dir, 'test.img') + +class Secret: + def __init__(self, index): + self._id =3D "keysec" + str(index) + # you are not supposed to see the password... + self._secret =3D "hunter" + str(index) + + def id(self): + return self._id + + def secret(self): + return self._secret + + def to_cmdline_object(self): + return [ "secret,id=3D" + self._id + ",data=3D" + self._secret] + + def to_qmp_object(self): + return { "qom_type" : "secret", "id": self.id(), + "props": { "data": self.secret() } } + +##########################################################################= ###### + +class EncryptionSetupTestCase(iotests.QMPTestCase): + + # test case startup + def setUp(self): + + # start the VMs + self.vm1 =3D iotests.VM(path_suffix =3D 'VM1') + self.vm2 =3D iotests.VM(path_suffix =3D 'VM2') + self.vm1.launch() + self.vm2.launch() + + # create the secrets and load 'em into the VMs + self.secrets =3D [ Secret(i) for i in range(0, 4) ] + for secret in self.secrets: + result =3D self.vm1.qmp("object-add", **secret.to_qmp_object()) + self.assert_qmp(result, 'return', {}) + result =3D self.vm2.qmp("object-add", **secret.to_qmp_object()) + self.assert_qmp(result, 'return', {}) + + # test case shutdown + def tearDown(self): + # stop the VM + self.vm1.shutdown() + self.vm2.shutdown() + + ######################################################################= ##### + # create the encrypted block device using qemu-img + def createImg(self, file, secret): + + output =3D iotests.qemu_img_pipe( + 'create', + '--object', *secret.to_cmdline_object(), + '-f', iotests.imgfmt, + '-o', 'key-secret=3D' + secret.id(), + '-o', 'iter-time=3D10', + file, + '1M') + + iotests.log(output, filters=3D[iotests.filter_test_dir]) + + # attempts to add a key using qemu-img + def addKey(self, file, secret, new_secret): + + image_options =3D { + 'key-secret' : secret.id(), + 'driver' : iotests.imgfmt, + 'file' : { + 'driver':'file', + 'filename': file, + } + } + + output =3D iotests.qemu_img_pipe( + 'amend', + '--object', *secret.to_cmdline_object(), + '--object', *new_secret.to_cmdline_object(), + + '-o', 'state=3Dactive', + '-o', 'new-secret=3D' + new_secret.id(), + '-o', 'iter-time=3D10', + + "json:" + json.dumps(image_options) + ) + + iotests.log(output, filters=3D[iotests.filter_test_dir]) + + ######################################################################= ##### + # open an encrypted block device + def openImageQmp(self, vm, id, file, secret, + readOnly =3D False, reOpen =3D False): + + command =3D 'x-blockdev-reopen' if reOpen else 'blockdev-add' + + result =3D vm.qmp(command, ** + { + 'driver': iotests.imgfmt, + 'node-name': id, + 'read-only': readOnly, + 'key-secret' : secret.id(), + 'file': { + 'driver': 'file', + 'filename': test_img, + } + } + ) + self.assert_qmp(result, 'return', {}) + + # close the encrypted block device + def closeImageQmp(self, vm, id): + result =3D vm.qmp('blockdev-del', **{ 'node-name': id }) + self.assert_qmp(result, 'return', {}) + + ######################################################################= ##### + + # add a key to an encrypted block device + def addKeyQmp(self, vm, id, new_secret): + + args =3D { + 'node-name': id, + 'job-id' : 'job0', + 'options' : { + 'state' : 'active', + 'driver' : iotests.imgfmt, + 'new-secret': new_secret.id(), + 'iter-time' : 10 + }, + } + + result =3D vm.qmp('x-blockdev-amend', **args) + assert result['return'] =3D=3D {} + vm.run_job('job0') + + # test that when the image opened by two qemu processes, + # neither of them can update the image + def test1(self): + self.createImg(test_img, self.secrets[0]); + + # VM1 opens the image and adds a key + self.openImageQmp(self.vm1, "testdev", test_img, self.secrets[0]) + self.addKeyQmp(self.vm1, "testdev", new_secret =3D self.secrets[1]) + + + # VM2 opens the image + self.openImageQmp(self.vm2, "testdev", test_img, self.secrets[0]) + + + # neither VMs now should be able to add a key + self.addKeyQmp(self.vm1, "testdev", new_secret =3D self.secrets[2]) + self.addKeyQmp(self.vm2, "testdev", new_secret =3D self.secrets[2]) + + + # VM 1 closes the image + self.closeImageQmp(self.vm1, "testdev") + + + # now VM2 can add the key + self.addKeyQmp(self.vm2, "testdev", new_secret =3D self.secrets[2]) + + + # qemu-img should also not be able to add a key + self.addKey(test_img, self.secrets[0], self.secrets[2]) + + # cleanup + self.closeImageQmp(self.vm2, "testdev") + os.remove(test_img) + + + def test2(self): + self.createImg(test_img, self.secrets[0]); + + # VM1 opens the image readonly + self.openImageQmp(self.vm1, "testdev", test_img, self.secrets[0], + readOnly =3D True) + + # VM2 opens the image + self.openImageQmp(self.vm2, "testdev", test_img, self.secrets[0]) + + # VM1 can't add a key since image is readonly + self.addKeyQmp(self.vm1, "testdev", new_secret =3D self.secrets[2]) + + # VM2 can't add a key since VM is has the image opened + self.addKeyQmp(self.vm2, "testdev", new_secret =3D self.secrets[2]) + + + #VM1 reopens the image read-write + self.openImageQmp(self.vm1, "testdev", test_img, self.secrets[0], + reOpen =3D True, readOnly =3D False) + + # VM1 still can't add the key + self.addKeyQmp(self.vm1, "testdev", new_secret =3D self.secrets[2]) + + # VM2 gets away + self.closeImageQmp(self.vm2, "testdev") + + # VM1 now can add the key + self.addKeyQmp(self.vm1, "testdev", new_secret =3D self.secrets[2]) + + self.closeImageQmp(self.vm1, "testdev") + os.remove(test_img) + + +if __name__ =3D=3D '__main__': + # support only raw luks since luks encrypted qcow2 is a proper + # format driver which doesn't allow any sharing + iotests.activate_logging() + iotests.main(supported_fmts =3D ['luks']) diff --git a/tests/qemu-iotests/296.out b/tests/qemu-iotests/296.out new file mode 100644 index 0000000000..afb6d2d09d --- /dev/null +++ b/tests/qemu-iotests/296.out @@ -0,0 +1,33 @@ +Formatting 'TEST_DIR/test.img', fmt=3Dluks size=3D1048576 key-secret=3Dkey= sec0 iter-time=3D10 + +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +Job failed: Failed to get shared "consistent read" lock +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +Job failed: Failed to get shared "consistent read" lock +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +qemu-img: Failed to get shared "consistent read" lock +Is another process using the image [TEST_DIR/test.img]? + +Formatting 'TEST_DIR/test.img', fmt=3Dluks size=3D1048576 key-secret=3Dkey= sec0 iter-time=3D10 + +Job failed: Block node is read-only +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +Job failed: Failed to get shared "consistent read" lock +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +Job failed: Failed to get shared "consistent read" lock +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +{"execute": "job-dismiss", "arguments": {"id": "job0"}} +{"return": {}} +.. +---------------------------------------------------------------------- +Ran 2 tests + +OK diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index ea3208d77b..ffa87a4b18 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -303,4 +303,6 @@ 292 rw auto quick 293 rw auto 294 rw auto quick +295 rw auto +296 rw auto 297 meta --=20 2.25.4