From 5f1703902ef5db4c5bdc3860e2b9d76dac8d4ad7 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Mon, 24 Feb 2020 15:06:23 +0000 Subject: [PATCH] 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 --- src/pybind/mgr/rbd_support/schedule.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pybind/mgr/rbd_support/schedule.py b/src/pybind/mgr/rbd_support/schedule.py index 4c13914e022d3..3d72f4fae6689 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): -- 2.39.5