]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/OSDCap: add unit test for parsing pools/objects with _ and -
authorSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 19:37:57 +0000 (11:37 -0800)
committerSage Weil <sage@inktank.com>
Thu, 14 Feb 2013 23:39:46 +0000 (15:39 -0800)
Hunting #4122, where a user saw

2013-02-13 19:39:25.467916 7f766fdb4700 10 osd.0 10  session 0x2c8cc60 client.libvirt has caps osdcap[grant(object_prefix rbd^@children  class-read),grant(pool libvirt^@pool^@test rwx)] 'allow class-read object_prefix rbd_children, allow pool libvirt-pool-test rwx'

Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 2ce28ef1d7f95e71e1043912dfa269ea3b0d1599)

src/test/osd/osdcap.cc

index cec26e2b8d5c1f4396e5597b2b7c9c37f3356d00..a26a843057ef04098332762e2873108346cfa2d8 100644 (file)
@@ -60,6 +60,8 @@ const char *parse_good[] = {
   "  allow     pool foo rwx; allow pool bar r  ",
   " allow wx pool taco",
   "allow r   pool    foo    object_prefix   blah   ;   allow   w   auid  5",
+  "allow class-read object_prefix rbd_children, allow pool libvirt-pool-test rwx",
+  "allow class-read object_prefix rbd-children, allow pool libvirt_pool_test rwx",
   0
 };
 
@@ -420,7 +422,9 @@ TEST(OSDCap, OutputParsed)
     {"allow pool images r; allow pool rbd rwx",
      "osdcap[grant(pool images r),grant(pool rbd rwx)]"},
     {"allow pool images r, allow pool rbd rwx",
-     "osdcap[grant(pool images r),grant(pool rbd rwx)]"}
+     "osdcap[grant(pool images r),grant(pool rbd rwx)]"},
+    {"allow class-read object_prefix rbd_children, allow pool libvirt-pool-test rwx",
+     "osdcap[grant(object_prefix rbd_children  class-read),grant(pool libvirt-pool-test rwx)]"}
   };
 
   size_t num_tests = sizeof(test_values) / sizeof(*test_values);