From 269f4d233a17cffc774897660cf60f1b0acf077e Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Fri, 27 Mar 2020 06:53:31 +0000 Subject: [PATCH] librbd: API for quiesce callbacks The callbacks are fired by librbd before/after creating a snapshot. The callback users like QEMU could attempt to freeze the FS before allowing librbd to actually perform the snapshot. Signed-off-by: Mykola Golub --- src/common/options.cc | 5 + src/include/rbd/librbd.h | 32 +++ src/include/rbd/librbd.hpp | 18 ++ src/librbd/ImageState.cc | 237 ++++++++++++++++- src/librbd/ImageState.h | 9 + src/librbd/ImageWatcher.cc | 183 ++++++++++++- src/librbd/ImageWatcher.h | 18 +- src/librbd/Operations.cc | 3 +- src/librbd/WatchNotifyTypes.cc | 14 + src/librbd/WatchNotifyTypes.h | 26 ++ src/librbd/librbd.cc | 66 +++++ src/librbd/operation/SnapshotCreateRequest.cc | 98 +++++-- src/librbd/operation/SnapshotCreateRequest.h | 71 ++--- src/test/librbd/mock/MockImageState.h | 2 +- src/test/librbd/mock/MockImageWatcher.h | 3 + .../test_mock_SnapshotCreateRequest.cc | 62 ++++- src/test/librbd/test_librbd.cc | 251 ++++++++++++++++++ 17 files changed, 1032 insertions(+), 66 deletions(-) diff --git a/src/common/options.cc b/src/common/options.cc index c78d9b69d7591..85871c2ba0870 100644 --- a/src/common/options.cc +++ b/src/common/options.cc @@ -7478,6 +7478,11 @@ static std::vector