]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: parse alg names that include a digit
authorSage Weil <sage@redhat.com>
Sat, 7 Mar 2015 01:43:11 +0000 (17:43 -0800)
committerSage Weil <sage@redhat.com>
Sat, 7 Mar 2015 01:43:11 +0000 (17:43 -0800)
The str_p("straw2") won't parse straw2, it seems because the digit is throwing
it off.  Use the existing name rule instead which is more robust.  Note that
not constraining the alg value here is better anyway because instead of a
'cannot parse' error that is hard to debug we instead get a 'unknown alg foo'
error when doing the semantic pass.

Fixes: #11015
Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/grammar.h

index 61709185ef58f6c72a5afa320adb019b4371a1cc..de77696aca9cdc09da39f3fbafa5cb08e7a9b2b1 100644 (file)
@@ -113,11 +113,7 @@ struct crush_grammar : public grammar<crush_grammar>
 
       // buckets
       bucket_id = str_p("id") >> negint;
-      bucket_alg = str_p("alg") >> ( str_p("uniform") |
-                                    str_p("list") |
-                                    str_p("tree") |
-                                    str_p("straw") |
-                                    str_p("straw2"));
+      bucket_alg = str_p("alg") >> name;
       bucket_hash = str_p("hash") >> ( integer |
                                       str_p("rjenkins1") );
       bucket_item = str_p("item") >> name