]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
misc: wait_until_osds_up must verify 'up' in state 648/head
authorLoic Dachary <ldachary@redhat.com>
Tue, 6 Oct 2015 16:18:44 +0000 (18:18 +0200)
committerLoic Dachary <ldachary@redhat.com>
Tue, 6 Oct 2015 16:21:35 +0000 (18:21 +0200)
It is not enough to count the number of entries in the osds
array, wait_until_osds_up must count which one are actually up by
checking if the string "up" is in the "state" array.

http://tracker.ceph.com/issues/13363 Fixes: #13363

Signed-off-by: Loic Dachary <loic@dachary.org>
teuthology/misc.py
teuthology/test/test_misc.py

index 7dbb0e3d10a490ad8dd1f777e390b7626eac88dd..06ac08ca417abbf8a4e841c0c987460f959cc9be 100644 (file)
@@ -910,7 +910,7 @@ def wait_until_osds_up(ctx, cluster, remote):
         )
         out = r.stdout.getvalue()
         j = json.loads('\n'.join(out.split('\n')[1:]))
-        up = len(j['osds'])
+        up = len(filter(lambda o: 'up' in o['state'], j['osds']))
         log.debug('%d of %d OSDs are up' % (up, num_osds))
         if up == num_osds:
             break
index c3da5dbc10163334b7f06f784c89427eed8908e1..71a534acbfb376a570965d0720e40750e515d292 100644 (file)
@@ -12,6 +12,27 @@ class FakeRemote(object):
     pass
 
 
+def test_wait_until_osds_up():
+    ctx = argparse.Namespace()
+    remote = FakeRemote()
+    class r():
+        class o:
+            def getvalue(self):
+                return 'IGNORED\n{"osds":[{"state":["up"]}]}'
+        stdout = o()
+
+    remote.run = lambda **kwargs: r()
+    ctx.cluster = cluster.Cluster(
+        remotes=[
+            (remote, ['osd.0', 'client.1'])
+        ],
+    )
+    with patch.multiple(
+            misc,
+            get_testdir=lambda ctx: "TESTDIR",
+    ):
+        misc.wait_until_osds_up(ctx, ctx.cluster, remote)
+
 def test_get_clients_simple():
     ctx = argparse.Namespace()
     remote = FakeRemote()