]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-disk: integration tests for multipath 5699/head
authorLoic Dachary <ldachary@redhat.com>
Thu, 27 Aug 2015 20:22:43 +0000 (22:22 +0200)
committerLoic Dachary <ldachary@redhat.com>
Sat, 29 Aug 2015 00:37:52 +0000 (02:37 +0200)
Add integration tests for multipath to the ceph-disk workunit, with the
following caveats:

A workaround is added (explicit call to ceph-disk activate) until the
CentOS activation bug http://tracker.ceph.com/issues/12786 is fixed.

The tests do not run on Ubuntu because of the multipath / device mapper
bug
https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/1488688
and it has not been tested on Debian.

http://tracker.ceph.com/issues/11881 Refs: #11881

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

index c9914e93b7ea9241f94bbf43c91db2fbd6a89f04..bc6d2544cc64cfed68fde8e44382f92fc3a6a0ca 100644 (file)
@@ -144,6 +144,7 @@ class TestCephDisk(object):
         logging.basicConfig(level=logging.DEBUG)
         c = CephDisk()
         c.helper("install augeas-tools augeas")
+        c.helper("install multipath-tools device-mapper-multipath")
         c.augtool("set /files/etc/ceph/ceph.conf/global/osd_journal_size 100")
 
     def test_destroy_osd(self):
@@ -345,6 +346,50 @@ class TestCephDisk(object):
         c.destroy_osd(osd_uuid)
         c.sh("ceph-disk zap " + data_disk + " " + journal_disk)
 
+    def test_activate_multipath(self):
+        c = CephDisk()
+        if c.sh("lsb_release -si") != 'CentOS':
+            pytest.skip("see issue https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/1488688")
+        c.ensure_sd()
+        #
+        # Figure out the name of the multipath device
+        #
+        disk = c.unused_disks('sd.')[0]
+        c.sh("mpathconf --enable || true")
+        c.sh("multipath " + disk)
+        holders = os.listdir("/sys/block/" + os.path.basename(disk) + "/holders")
+        assert 1 == len(holders)
+        name = open("/sys/block/" + holders[0] + "/dm/name").read()
+        multipath = "/dev/mapper/" + name
+        #
+        # Prepare the multipath device
+        #
+        osd_uuid = str(uuid.uuid1())
+        c.sh("ceph-disk zap " + multipath)
+        c.sh("ceph-disk prepare --osd-uuid " + osd_uuid +
+             " " + multipath)
+        device = json.loads(c.helper("ceph-disk list --format json " + multipath))[0]
+        assert len(device['partitions']) == 2
+        data_partition = c.get_osd_partition(osd_uuid)
+        assert data_partition['type'] == 'data'
+        #
+        # Activate it although it should auto activate
+        #
+        if True: # remove this block when http://tracker.ceph.com/issues/12786 is fixed
+            c.sh("ceph-disk activate " + data_partition['path'])
+            device = json.loads(c.helper("ceph-disk list --format json " + multipath))[0]
+            assert len(device['partitions']) == 2
+            data_partition = c.get_osd_partition(osd_uuid)
+        assert data_partition['state'] == 'active'
+        journal_partition = c.get_journal_partition(osd_uuid)
+        assert journal_partition
+        c.helper("pool_read_write")
+        c.destroy_osd(osd_uuid)
+        c.sh("ceph-disk zap " + multipath)
+        c.sh("udevadm settle")
+        c.sh("multipath -F")
+        c.unload_scsi_debug()
+
 class CephDiskTest(CephDisk):
 
     def main(self, argv):