]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
test_osd: dynamically get the osd container
authorSébastien Han <seb@redhat.com>
Mon, 29 Oct 2018 11:00:40 +0000 (12:00 +0100)
committerGuillaume Abrioux <gabrioux@redhat.com>
Mon, 29 Oct 2018 14:33:12 +0000 (15:33 +0100)
Do not enforce the container name since this will fail when we have
multiple VMs running OSDs.

Signed-off-by: Sébastien Han <seb@redhat.com>
tests/functional/tests/osd/test_osds.py

index 851c7d7f520117661bdb2750c5a1b726fe3778b1..8bad5c7054f5f12fef44963d88dbfa859d6df941 100644 (file)
@@ -71,14 +71,9 @@ class TestOSDs(object):
 
     @pytest.mark.docker
     def test_all_docker_osds_are_up_and_in(self, node, host):
-        osd_scenario = node["vars"].get('osd_scenario', False)
-        if osd_scenario in ['lvm', 'lvm-batch']:
-            osd_id = "0"
-        else:
-            hostname = node["vars"]["inventory_hostname"]
-            osd_id = os.path.join(hostname+"-sda")
-
-        cmd = "sudo docker exec ceph-osd-{osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
+        osd_id = host.check_output(
+            "docker ps -q --filter='name=ceph-osd' | head -1")
+        cmd = "sudo docker exec {osd_id} ceph --cluster={cluster} --connect-timeout 5 --keyring /var/lib/ceph/bootstrap-osd/{cluster}.keyring -n client.bootstrap-osd osd tree -f json".format(
             osd_id=osd_id,
             cluster=node["cluster_name"]
         )