]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rbd_support: check pool is rbd when validating level spec name
authorMykola Golub <mgolub@suse.com>
Mon, 24 Feb 2020 15:06:23 +0000 (15:06 +0000)
committerMykola Golub <mgolub@suse.com>
Tue, 25 Feb 2020 09:52:22 +0000 (09:52 +0000)
Otherwise we could successfully add a schedule for a non-rbd
pool, which would become invisible on the next refresh, because
on refresh we loads only rbd pools.

Signed-off-by: Mykola Golub <mgolub@suse.com>
src/pybind/mgr/rbd_support/schedule.py

index 4c13914e022d31ef8d68957ac44d8c1cb923833f..3d72f4fae66896e46b9e2cdfed7fbf343f3b9e7e 100644 (file)
@@ -79,6 +79,8 @@ class LevelSpec:
                 pool_id = handler.module.rados.pool_lookup(pool_name)
                 if pool_id is None:
                     raise ValueError("pool {} does not exist".format(pool_name))
+                if pool_id not in get_rbd_pools(handler.module):
+                    raise ValueError("{} is not an RBD pool".format(pool_name))
                 pool_id = str(pool_id)
                 id += pool_id
                 if match.group(2) is not None or match.group(3):