From nobody Mon Feb 9 16:18:38 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; spf=pass (zoho.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=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554219751425834.294169113381; Tue, 2 Apr 2019 08:42:31 -0700 (PDT) Received: from localhost ([127.0.0.1]:38116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBLYP-0005E0-Co for importer@patchew.org; Tue, 02 Apr 2019 11:42:25 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBLTm-0001eX-6y for qemu-devel@nongnu.org; Tue, 02 Apr 2019 11:37:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBLTk-0000Vb-Mu for qemu-devel@nongnu.org; Tue, 02 Apr 2019 11:37:38 -0400 Received: from relay.sw.ru ([185.231.240.75]:43480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBLTk-0000Ti-AJ; Tue, 02 Apr 2019 11:37:36 -0400 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1hBLTf-0001s1-F7; Tue, 02 Apr 2019 18:37:31 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Tue, 2 Apr 2019 18:37:21 +0300 Message-Id: <20190402153730.54145-2-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190402153730.54145-1-vsementsov@virtuozzo.com> References: <20190402153730.54145-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v5 01/10] tests/perf: Test qemu-img convert from raw to encrypted qcow2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, berto@igalia.com, mreitz@redhat.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/perf/block/qcow2/convert-to-encrypted | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 tests/perf/block/qcow2/convert-to-encrypted diff --git a/tests/perf/block/qcow2/convert-to-encrypted b/tests/perf/block= /qcow2/convert-to-encrypted new file mode 100755 index 0000000000..7a6b7b1cab --- /dev/null +++ b/tests/perf/block/qcow2/convert-to-encrypted @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Test qemu-img convert from raw to encrypted qcow2 +# +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. +# +# 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 . +# + +if [ "$#" -lt 2 ]; then + echo "Usage: $0 SOURCE_FILE DESTINATION_FILE [additional qemu-img conv= ert parameters]" + exit 1 +fi + +ROOT_DIR=3D"$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../../.." >/dev/nul= l 2>&1 && pwd )" +QEMU_IMG=3D"$ROOT_DIR/qemu-img" +QEMU_IO=3D"$ROOT_DIR/qemu-io" + +size=3D1G + +src=3D"$1" +shift + +dst=3D"$1" +shift + +( +# create source +$QEMU_IMG create -f raw "$src" $size +$QEMU_IO -f raw -c "write -P 0xa 0 $size" "$src" + +# create target +$QEMU_IMG create -f qcow2 --object secret,id=3Dsec0,data=3Dtest -o encrypt= .format=3Dluks,encrypt.key-secret=3Dsec0 "$dst" $size +) > /dev/null + +# test with additional parameters left in $@ +/usr/bin/time -f %e $QEMU_IMG convert "$@" -f raw --object secret,id=3Dsec= 0,data=3Dtest --target-image-opts -n "$src" "driver=3Dqcow2,file.filename= =3D$dst,encrypt.key-secret=3Dsec0" --=20 2.18.0