From 441f916f97a5b1d01a1f963805e7891ad1a727f8 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 13 Sep 2017 06:55:25 -0400 Subject: [PATCH] rbd-mirror: abstract policy class for mapping images to instance Also, a "simple" policy implementation that maps M images to N instances (M/N per rbd mirror daemon instance). Signed-off-by: Venky Shankar --- src/common/options.cc | 9 + src/tools/rbd_mirror/CMakeLists.txt | 4 + src/tools/rbd_mirror/image_map/Action.cc | 75 ++++ src/tools/rbd_mirror/image_map/Action.h | 41 ++ src/tools/rbd_mirror/image_map/Policy.cc | 417 ++++++++++++++++++ src/tools/rbd_mirror/image_map/Policy.h | 145 ++++++ .../rbd_mirror/image_map/SimplePolicy.cc | 85 ++++ src/tools/rbd_mirror/image_map/SimplePolicy.h | 38 ++ .../rbd_mirror/image_map/StateTransition.cc | 83 ++++ .../rbd_mirror/image_map/StateTransition.h | 63 +++ 10 files changed, 960 insertions(+) create mode 100644 src/tools/rbd_mirror/image_map/Action.cc create mode 100644 src/tools/rbd_mirror/image_map/Action.h create mode 100644 src/tools/rbd_mirror/image_map/Policy.cc create mode 100644 src/tools/rbd_mirror/image_map/Policy.h create mode 100644 src/tools/rbd_mirror/image_map/SimplePolicy.cc create mode 100644 src/tools/rbd_mirror/image_map/SimplePolicy.h create mode 100644 src/tools/rbd_mirror/image_map/StateTransition.cc create mode 100644 src/tools/rbd_mirror/image_map/StateTransition.h diff --git a/src/common/options.cc b/src/common/options.cc index 6064e0c76bf69..2f32e45c3b650 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -5476,6 +5476,15 @@ static std::vector