From 75b7fd344de28f9c79940722f9d9f9e5342ddcd8 Mon Sep 17 00:00:00 2001 From: Jiffin Tony Thottan Date: Thu, 14 Jan 2016 15:07:47 +0530 Subject: tests : Modifying crypt xlators unit tests Backport of http://review.gluster.org/#/c/13240/ The "encryption.master-key" should be set before enabling crypt xlators. Otherwise glusterfs client process(like gluster-NFS) will crash due to the failure in intialising crypt xlator. You can see the following messages in client log file [2016-01-14 08:13:15.740835] E [crypt.c:4298:master_set_master_vol_key] 0-test1-crypt: FATAL: missing master key [2016-01-14 08:13:15.740859] E [MSGID: 101019] [xlator.c:429lator_init] 0-test1-crypt: Initialization of volume 'test1-crypt' failed, review your volfile again [2016-01-14 08:13:15.740890] E [MSGID: 101066] [graph.c:324:glusterfs_graph_init] 0-test1-crypt: initializing translator failed [2016-01-14 08:13:15.740904] E [MSGID: 101176] [graph.c:670:glusterfs_graph_activate] 0-graph: init failed [2016-01-14 08:13:15.741676] W [glusterfsd.c:1231:cleanup_and_exit] (-->/usr/sbin/glusterfs(mgmt_getspec_cbk+0x307) [0x40d287] -->/usr/sbin/glusterfs(glusterfs_process_volfp+0x117) [0x4086c7] -->/usr/sbin/glusterfs(cleanup_and_exit+0x4d) [0x407e1d] ) 0-: received signum (0), shutting down Upstream reference ------------------- >Change-Id: I124deda505d128eacb15ca20fbdcd1593cb8eba3 >BUG: 1298520 >Signed-off-by: Jiffin Tony Thottan >Reviewed-on: http://review.gluster.org/13240 >Smoke: Gluster Build System >Reviewed-by: Niels de Vos >CentOS-regression: Gluster Build System >NetBSD-regression: NetBSD Build System >(cherry picked from commit ca4d4a26a553bac9c627bc6e6d6c9fa1f9435297) Change-Id: I8073765b02cd4bebc202fbae5ef7558df25ea664 BUG: 1303033 Reviewed-on: http://review.gluster.org/13320 Smoke: Gluster Build System Reviewed-by: Jeff Darcy CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- ...140162-file-snapshot-features-encrypt-opts-validation.t | 8 ++++++++ tests/encryption/crypt.t | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/bugs/snapshot/bug-1140162-file-snapshot-features-encrypt-opts-validation.t b/tests/bugs/snapshot/bug-1140162-file-snapshot-features-encrypt-opts-validation.t index f91093db4e7..b9f6dc715e6 100644 --- a/tests/bugs/snapshot/bug-1140162-file-snapshot-features-encrypt-opts-validation.t +++ b/tests/bugs/snapshot/bug-1140162-file-snapshot-features-encrypt-opts-validation.t @@ -28,6 +28,14 @@ TEST $CLI volume set $V0 ping-timeout 60 ## Set features.file-snapshot and features.encryption option with valid boolean ## value. These options should succeed. TEST $CLI volume set $V0 features.file-snapshot on + +## Before setting the crypt xlator on, it is required to create master key +## Otherwise glusterfs client process will fail to start +echo "0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff" > $GLUSTERD_WORKDIR/$V0-master-key + +## Specify location of master key +TEST $CLI volume set $V0 encryption.master-key $GLUSTERD_WORKDIR/$V0-master-key + TEST $CLI volume set $V0 features.encryption on cleanup; diff --git a/tests/encryption/crypt.t b/tests/encryption/crypt.t index efd8852e2ec..8781db3478b 100755 --- a/tests/encryption/crypt.t +++ b/tests/encryption/crypt.t @@ -23,16 +23,16 @@ EXPECT 'off' volinfo_field $V0 'performance.write-behind' TEST $CLI volume set $V0 performance.open-behind off EXPECT 'off' volinfo_field $V0 'performance.open-behind' -## Turn on crypt xlator by setting features.encryption to on -TEST $CLI volume set $V0 encryption on -EXPECT 'on' volinfo_field $V0 'features.encryption' +## Create a file with master key -## Specify location of master key -TEST $CLI volume set $V0 encryption.master-key /tmp/$V0-master-key +echo "0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff" > $GLUSTERD_WORKDIR/$V0-master-key -## Create a file with master key +## Specify location of master key +TEST $CLI volume set $V0 encryption.master-key $GLUSTERD_WORKDIR/$V0-master-key -echo "0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff" > /tmp/$V0-master-key +## Turn on crypt xlator by setting features.encryption to on +TEST $CLI volume set $V0 encryption on +EXPECT 'on' volinfo_field $V0 'features.encryption' ## Start the volume TEST $CLI volume start $V0; -- cgit