From: Loic Dachary Date: Thu, 27 Aug 2015 20:22:43 +0000 (+0200) Subject: ceph-disk: integration tests for multipath X-Git-Tag: v9.1.0~252^2~1^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5ce7ed1bdd5c4cb3a48fb4f8b83e740703e520e0;p=ceph.git ceph-disk: integration tests for multipath 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 --- diff --git a/qa/workunits/ceph-disk/ceph-disk-test.py b/qa/workunits/ceph-disk/ceph-disk-test.py index c9914e93b7e..bc6d2544cc6 100644 --- a/qa/workunits/ceph-disk/ceph-disk-test.py +++ b/qa/workunits/ceph-disk/ceph-disk-test.py @@ -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):