From: Mykola Golub Date: Mon, 24 Feb 2020 15:06:23 +0000 (+0000) Subject: mgr/rbd_support: check pool is rbd when validating level spec name X-Git-Tag: v15.1.1~214^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f1703902ef5db4c5bdc3860e2b9d76dac8d4ad7;p=ceph.git mgr/rbd_support: check pool is rbd when validating level spec name 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 --- diff --git a/src/pybind/mgr/rbd_support/schedule.py b/src/pybind/mgr/rbd_support/schedule.py index 4c13914e022d..3d72f4fae668 100644 --- a/src/pybind/mgr/rbd_support/schedule.py +++ b/src/pybind/mgr/rbd_support/schedule.py @@ -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):