]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: ceph-disk: dmcrypt simplification 5742/head
authorLoic Dachary <ldachary@redhat.com>
Tue, 1 Sep 2015 16:44:59 +0000 (16:44 +0000)
committerLoic Dachary <ldachary@redhat.com>
Tue, 1 Sep 2015 17:04:19 +0000 (19:04 +0200)
* Get rid of the cryptsetup calls that are redundant with what ceph
  prepare already does
* Do not use the --dmcrypt-key-dir option. This is less coverage but it
  interferes with the udev logic and is expected to be refactored soon.

Signed-off-by: Loic Dachary <ldachary@redhat.com>
qa/workunits/ceph-disk/ceph-disk-test.py

index bc6d2544cc64cfed68fde8e44382f92fc3a6a0ca..5f42d143bbf3d3d6ba65c045be07080f507e98a1 100644 (file)
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU Library Public License for more details.
 #
+# When debugging these tests, here are a few useful commands:
+#
+#  export PATH=..:$PATH
+#  python ceph-disk-test.py --verbose --destroy-osd 0
+#  py.test -s -v -k test_activate_dmcrypt_luks ceph-disk-test.py
+#
 import argparse
 import json
 import logging
@@ -178,33 +184,14 @@ class TestCephDisk(object):
         disk = c.unused_disks()[0]
         osd_uuid = str(uuid.uuid1())
         journal_uuid = str(uuid.uuid1())
-        d = tempfile.mkdtemp()
         c.sh("ceph-disk zap " + disk)
         c.sh("ceph-disk prepare " +
-             " --dmcrypt-key-dir " + d +
              " --osd-uuid " + osd_uuid +
              " --journal-uuid " + journal_uuid +
              " --dmcrypt " +
              " " + disk)
-        if type == 'plain':
-            c.sh("cryptsetup --key-file " + d + "/" + osd_uuid +
-                 " --key-size 256 create " + osd_uuid +
-                 " " + disk + "1")
-        else:
-            c.sh("cryptsetup --key-file " + d + "/" + osd_uuid + ".luks.key" +
-                 " luksOpen " +
-                 " " + disk + "1" +
-                 " " + osd_uuid)
-        if type == 'plain':
-            c.sh("cryptsetup --key-file " + d + "/" + journal_uuid +
-                 " --key-size 256 create " + journal_uuid +
-                 " " + disk + "2")
-        else:
-            c.sh("cryptsetup --key-file " + d + "/" + journal_uuid + ".luks.key" +
-                 " luksOpen " +
-                 " " + disk + "2" +
-                 " " + journal_uuid)
-        c.sh("ceph-disk activate /dev/mapper/" + osd_uuid)
+        data_partition = c.get_osd_partition(osd_uuid)
+        c.sh("ceph-disk activate --dmcrypt " + data_partition['path'])
         data_partition = c.get_osd_partition(osd_uuid)
         assert data_partition['type'] == 'data'
         assert data_partition['state'] == 'active'