[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 15/15] Add simple test for crypto volumes.



Signed-off-by: Milan Broz <mbroz redhat com>
---
 test/t-crypto-usage.sh |   54 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100755 test/t-crypto-usage.sh

diff --git a/test/t-crypto-usage.sh b/test/t-crypto-usage.sh
new file mode 100755
index 0000000..2462931
--- /dev/null
+++ b/test/t-crypto-usage.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# 'Exercise some encrypted volumes operations'
+
+. ./test-utils.sh
+
+aux prepare_pvs 2
+aux pvcreate $devs
+vgcreate -cn $vg $devs -s 4M
+
+cipher="aes-cbc-essiv:sha256"
+key_plain="0123456789012345678901234567890101234567890123456789012345678901"
+keysize=256
+password="xxx"
+
+modprobe dm_crypt
+
+# 'lvcreate creates simple encrypted volume'
+echo $key_plain | lvcreate -n $lv1 -l 4 --crypt plain --cipher $cipher --keysize $keysize --keyfile - $vg
+echo $key_plain | lvcreate -n $lv2 -l 4 --crypt $vg/$lv1 --keyfile - $vg
+
+# 'deactivate volumes'
+lvchange -a n $vg/$lv1
+lvchange -a n $vg/$lv2
+echo $key_plain | vgchange -a y --keyfile -
+
+# 'cannot remove used cryptostore directly
+not lvremove $vg/cryptostore0
+
+# 'resize active volume'
+lvresize -l 8 $vg/$lv1
+lvresize -f -l 4 $vg/$lv1
+
+# 'lvremove removes simple encrypted volume'
+lvremove -ff $vg/$lv1
+lvremove -ff $vg/$lv2
+
+# 'import luks volume, using first extent as keystore (extent is 8192 sectors)'
+lvcreate -n $lv3 -L 36M $vg
+echo -n $password | cryptsetup luksFormat -q $G_dev_/$vg/$lv3 --key-size $keysize --align-payload=8192 --key-file -
+lvconvert --crypt luks1 $vg/$lv3
+echo $password | lvchange -a y $vg/$lv3 --keyfile -
+lvchange -a n $vg/$lv3
+lvremove -ff $vg/$lv3
+
-- 
1.5.6.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]