summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorJason Dillaman <dillaman@redhat.com>2020-06-18 18:56:31 +0200
committerGitHub <noreply@github.com>2020-06-18 18:56:31 +0200
commit187367ff17de1e63f4331f41be89a7a642ce4fc4 (patch)
tree49c558ef8670165083f4f7863b2576ce011fee1d /src/test
parentMerge PR #35649 into master (diff)
parenttest/librbd: make TestLibRBD.QuiesceWatchError pass (diff)
downloadceph-187367ff17de1e63f4331f41be89a7a642ce4fc4.tar.xz
ceph-187367ff17de1e63f4331f41be89a7a642ce4fc4.zip
Merge pull request #35329 from trociny/wip-quiesce_complete
librbd: quiesce/unquiesce API improvements Reviewed-by: Jason Dillaman <dillaman@redhat.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/cli-integration/rbd/formatted-output.t10
-rw-r--r--src/test/cli-integration/rbd/snap-diff.t4
-rw-r--r--src/test/cli-integration/rbd/unmap.t6
-rw-r--r--src/test/cli/rbd/help.t59
-rw-r--r--src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc3
-rw-r--r--src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc3
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc4
-rw-r--r--src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc5
-rw-r--r--src/test/librbd/image/test_mock_AttachChildRequest.cc4
-rw-r--r--src/test/librbd/image/test_mock_CloneRequest.cc3
-rw-r--r--src/test/librbd/journal/test_Replay.cc30
-rw-r--r--src/test/librbd/journal/test_mock_Replay.cc5
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc4
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc16
-rw-r--r--src/test/librbd/mirror/snapshot/test_mock_PromoteRequest.cc1
-rw-r--r--src/test/librbd/mock/MockImageWatcher.h2
-rw-r--r--src/test/librbd/mock/MockOperations.h4
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc12
-rw-r--r--src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc3
-rw-r--r--src/test/librbd/test_ImageWatcher.cc4
-rw-r--r--src/test/librbd/test_fixture.cc3
-rw-r--r--src/test/librbd/test_internal.cc2
-rw-r--r--src/test/librbd/test_librbd.cc86
-rw-r--r--src/test/pybind/test_rbd.py15
-rw-r--r--src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc5
-rw-r--r--src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc5
-rw-r--r--src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc4
-rw-r--r--src/test/rbd_mirror/test_ImageDeleter.cc8
-rw-r--r--src/test/rbd_mirror/test_ImageReplayer.cc20
-rw-r--r--src/test/rbd_mirror/test_PoolWatcher.cc5
-rw-r--r--src/test/rbd_mirror/test_fixture.cc4
31 files changed, 234 insertions, 105 deletions
diff --git a/src/test/cli-integration/rbd/formatted-output.t b/src/test/cli-integration/rbd/formatted-output.t
index e063c0d7bbc..778cc2198fc 100644
--- a/src/test/cli-integration/rbd/formatted-output.t
+++ b/src/test/cli-integration/rbd/formatted-output.t
@@ -22,21 +22,21 @@ create
snapshot
========
- $ rbd snap create bar@snap
+ $ rbd snap create bar@snap --no-progress
$ rbd resize -s 1024 --no-progress bar
$ rbd resize -s 2G --no-progress quuy
- $ rbd snap create bar@snap2
- $ rbd snap create foo@snap
+ $ rbd snap create bar@snap2 --no-progress
+ $ rbd snap create foo@snap --no-progress
clone
=====
$ rbd snap protect bar@snap
$ rbd clone --image-feature layering,exclusive-lock,object-map,fast-diff bar@snap rbd_other/child
- $ rbd snap create rbd_other/child@snap
+ $ rbd snap create rbd_other/child@snap --no-progress
$ rbd flatten rbd_other/child 2> /dev/null
$ rbd bench rbd_other/child --io-type write --io-pattern seq --io-total 1B > /dev/null 2>&1
$ rbd clone bar@snap rbd_other/deep-flatten-child
- $ rbd snap create rbd_other/deep-flatten-child@snap
+ $ rbd snap create rbd_other/deep-flatten-child@snap --no-progress
$ rbd flatten rbd_other/deep-flatten-child 2> /dev/null
lock
diff --git a/src/test/cli-integration/rbd/snap-diff.t b/src/test/cli-integration/rbd/snap-diff.t
index ba9c0d6fed6..1ca2fb04ddd 100644
--- a/src/test/cli-integration/rbd/snap-diff.t
+++ b/src/test/cli-integration/rbd/snap-diff.t
@@ -8,7 +8,7 @@
$ rbd create --size 1M xrbddiff1/xtestdiff1
$ rbd diff xrbddiff1/xtestdiff1 --format json
[]
- $ rbd snap create xrbddiff1/xtestdiff1 --snap=allzeroes
+ $ rbd snap create xrbddiff1/xtestdiff1 --snap=allzeroes --no-progress
$ rbd diff xrbddiff1/xtestdiff1 --format json
[]
$ rbd diff --from-snap=allzeroes xrbddiff1/xtestdiff1 --format json
@@ -18,7 +18,7 @@
[{"offset":0,"length":1048576,"exists":"true"}]
$ rbd diff --from-snap=allzeroes xrbddiff1/xtestdiff1 --format json
[{"offset":0,"length":1048576,"exists":"true"}]
- $ rbd snap create xrbddiff1/xtestdiff1 --snap=snap1
+ $ rbd snap create xrbddiff1/xtestdiff1 --snap=snap1 --no-progress
$ rbd snap list xrbddiff1/xtestdiff1 --format json | python3 -mjson.tool --sort-keys | sed 's/,$/, /'
[
{
diff --git a/src/test/cli-integration/rbd/unmap.t b/src/test/cli-integration/rbd/unmap.t
index aa381b1bc20..06b8ee666c1 100644
--- a/src/test/cli-integration/rbd/unmap.t
+++ b/src/test/cli-integration/rbd/unmap.t
@@ -3,13 +3,13 @@ Setup
=====
$ rbd create --size 1 img
- $ rbd snap create img@snap
+ $ rbd snap create img@snap --no-progress
$ rbd create --size 1 anotherimg
$ ceph osd pool create custom >/dev/null 2>&1
$ rbd pool init custom
$ rbd create --size 1 custom/img
- $ rbd snap create custom/img@snap
- $ rbd snap create custom/img@anothersnap
+ $ rbd snap create custom/img@snap --no-progress
+ $ rbd snap create custom/img@anothersnap --no-progress
Spell out device instead of using $DEV - sfdisk is not a joke.
diff --git a/src/test/cli/rbd/help.t b/src/test/cli/rbd/help.t
index 18d40de6724..6fa03762ce2 100644
--- a/src/test/cli/rbd/help.t
+++ b/src/test/cli/rbd/help.t
@@ -229,8 +229,8 @@
Positional arguments
<source-snap-spec> source snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-n
- ame>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>
+ )
<dest-image-spec> destination image specification
(example: [<pool-name>/[<namespace>/]]<image-name>)
@@ -602,7 +602,7 @@
--snap arg snapshot name
--read-only map read-only
--exclusive disable automatic exclusive lock transitions
- --quiesce use quiesce callbacks
+ --quiesce use quiesce hooks
--quiesce-hook arg quiesce hook path
-o [ --options ] arg device specific options
@@ -615,8 +615,8 @@
Positional arguments
<image-or-snap-or-device-spec> image, snapshot, or device specification
- [<pool-name>/]<image-name>[@<snapshot-name>]
- or <device-path>
+ [<pool-name>/]<image-name>[@<snap-name>] or
+ <device-path>
Optional arguments
-t [ --device-type ] arg device type [ggate, krbd (default), nbd]
@@ -993,7 +993,7 @@
(example:
[<pool-name>/[<namespace>/]]<group-name>@<snap-name>)
<dest-snap> destination snapshot name
- (example: <snapshot-name>)
+ (example: <snap-name>)
Optional arguments
-p [ --pool ] arg pool name
@@ -1603,19 +1603,22 @@
rbd help mirror image snapshot
usage: rbd mirror image snapshot [--pool <pool>] [--namespace <namespace>]
- [--image <image>]
+ [--image <image>] [--skip-quiesce]
+ [--ignore-quiesce-error]
<image-spec>
Create RBD mirroring image snapshot.
Positional arguments
- <image-spec> image specification
- (example: [<pool-name>/[<namespace>/]]<image-name>)
+ <image-spec> image specification
+ (example: [<pool-name>/[<namespace>/]]<image-name>)
Optional arguments
- -p [ --pool ] arg pool name
- --namespace arg namespace name
- --image arg image name
+ -p [ --pool ] arg pool name
+ --namespace arg namespace name
+ --image arg image name
+ --skip-quiesce do not run quiesce hooks
+ --ignore-quiesce-error ignore quiesce hook error
rbd help mirror image status
usage: rbd mirror image status [--pool <pool>] [--namespace <namespace>]
@@ -2102,21 +2105,25 @@
rbd help snap create
usage: rbd snap create [--pool <pool>] [--namespace <namespace>]
- [--image <image>] [--snap <snap>]
+ [--image <image>] [--snap <snap>] [--skip-quiesce]
+ [--ignore-quiesce-error] [--no-progress]
<snap-spec>
Create a snapshot.
Positional arguments
- <snap-spec> snapshot specification
- (example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ <snap-spec> snapshot specification
+ (example:
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
- -p [ --pool ] arg pool name
- --namespace arg namespace name
- --image arg image name
- --snap arg snapshot name
+ -p [ --pool ] arg pool name
+ --namespace arg namespace name
+ --image arg image name
+ --snap arg snapshot name
+ --skip-quiesce do not run quiesce hooks
+ --ignore-quiesce-error ignore quiesce hook error
+ --no-progress disable progress output
rbd help snap limit clear
usage: rbd snap limit clear [--pool <pool>] [--namespace <namespace>]
@@ -2182,7 +2189,7 @@
Positional arguments
<snap-spec> snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
-p [ --pool ] arg pool name
@@ -2220,7 +2227,7 @@
Positional arguments
<snap-spec> snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
-p [ --pool ] arg pool name
@@ -2245,10 +2252,10 @@
Positional arguments
<source-snap-spec> source snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
<dest-snap-spec> destination snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
-p [ --pool ] arg source pool name
@@ -2270,7 +2277,7 @@
Positional arguments
<snap-spec> snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
-p [ --pool ] arg pool name
@@ -2290,7 +2297,7 @@
Positional arguments
<snap-spec> snapshot specification
(example:
- [<pool-name>/[<namespace>/]]<image-name>@<snapshot-name>)
+ [<pool-name>/[<namespace>/]]<image-name>@<snap-name>)
Optional arguments
-p [ --pool ] arg pool name
diff --git a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
index 64a4173abd8..1b2172a51cc 100644
--- a/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ImageCopyRequest.cc
@@ -244,8 +244,9 @@ public:
int create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
librados::snap_t *snap_id) {
+ NoOpProgressContext prog_ctx;
int r = image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace(), snap_name);
+ cls::rbd::UserSnapshotNamespace(), snap_name, 0, prog_ctx);
if (r < 0) {
return r;
}
diff --git a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
index acd1a12693b..03de245f151 100644
--- a/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc
@@ -303,8 +303,9 @@ public:
int create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
librados::snap_t *snap_id) {
+ NoOpProgressContext prog_ctx;
int r = image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace(), snap_name);
+ cls::rbd::UserSnapshotNamespace(), snap_name, 0, prog_ctx);
if (r < 0) {
return r;
}
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
index 308b552ec0f..f2e10cfde40 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCopyRequest.cc
@@ -239,7 +239,9 @@ public:
int create_snap(librbd::ImageCtx *image_ctx,
const cls::rbd::SnapshotNamespace& snap_ns,
const std::string &snap_name, bool protect) {
- int r = image_ctx->operations->snap_create(snap_ns, snap_name.c_str());
+ NoOpProgressContext prog_ctx;
+ int r = image_ctx->operations->snap_create(snap_ns, snap_name.c_str(), 0,
+ prog_ctx);
if (r < 0) {
return r;
}
diff --git a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
index 204328177cf..b192e3f1a6f 100644
--- a/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/deep_copy/test_mock_SnapshotCreateRequest.cc
@@ -105,9 +105,10 @@ public:
void expect_snap_create(librbd::MockTestImageCtx &mock_image_ctx,
const std::string &snap_name, uint64_t snap_id, int r) {
+ uint64_t flags = SNAP_CREATE_FLAG_SKIP_OBJECT_MAP |
+ SNAP_CREATE_FLAG_SKIP_NOTIFY_QUIESCE;
EXPECT_CALL(*mock_image_ctx.operations,
- execute_snap_create(_, StrEq(snap_name), _, 0,
- SNAP_CREATE_FLAG_SKIP_OBJECT_MAP, _))
+ execute_snap_create(_, StrEq(snap_name), _, 0, flags, _))
.WillOnce(DoAll(InvokeWithoutArgs([&mock_image_ctx, snap_id, snap_name]() {
inject_snap(mock_image_ctx, snap_id, snap_name);
}),
diff --git a/src/test/librbd/image/test_mock_AttachChildRequest.cc b/src/test/librbd/image/test_mock_AttachChildRequest.cc
index 14f9a734073..100d2da2457 100644
--- a/src/test/librbd/image/test_mock_AttachChildRequest.cc
+++ b/src/test/librbd/image/test_mock_AttachChildRequest.cc
@@ -10,6 +10,7 @@
#include "librbd/Operations.h"
#include "librbd/image/AttachChildRequest.h"
#include "librbd/image/RefreshRequest.h"
+#include "librbd/internal.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@@ -72,8 +73,9 @@ public:
TestMockFixture::SetUp();
ASSERT_EQ(0, open_image(m_image_name, &image_ctx));
+ NoOpProgressContext prog_ctx;
ASSERT_EQ(0, image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap"));
+ cls::rbd::UserSnapshotNamespace{}, "snap", 0, prog_ctx));
if (is_feature_enabled(RBD_FEATURE_LAYERING)) {
ASSERT_EQ(0, image_ctx->operations->snap_protect(
cls::rbd::UserSnapshotNamespace{}, "snap"));
diff --git a/src/test/librbd/image/test_mock_CloneRequest.cc b/src/test/librbd/image/test_mock_CloneRequest.cc
index 1ba69bed6e8..1745a96335c 100644
--- a/src/test/librbd/image/test_mock_CloneRequest.cc
+++ b/src/test/librbd/image/test_mock_CloneRequest.cc
@@ -237,8 +237,9 @@ public:
ASSERT_EQ(0, _rados.conf_set("rbd_default_clone_format", "2"));
ASSERT_EQ(0, open_image(m_image_name, &image_ctx));
+ NoOpProgressContext prog_ctx;
ASSERT_EQ(0, image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap"));
+ cls::rbd::UserSnapshotNamespace{}, "snap", 0, prog_ctx));
if (is_feature_enabled(RBD_FEATURE_LAYERING)) {
ASSERT_EQ(0, image_ctx->operations->snap_protect(
cls::rbd::UserSnapshotNamespace{}, "snap"));
diff --git a/src/test/librbd/journal/test_Replay.cc b/src/test/librbd/journal/test_Replay.cc
index 68f41a7ab25..90cb6005b1e 100644
--- a/src/test/librbd/journal/test_Replay.cc
+++ b/src/test/librbd/journal/test_Replay.cc
@@ -338,9 +338,10 @@ TEST_F(TestJournalReplay, SnapCreate) {
"snap"));
}
- // verify lock ordering constraints
+ // verify lock ordering constraints
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap2"));
+ "snap2", 0, no_op_progress));
}
TEST_F(TestJournalReplay, SnapProtect) {
@@ -351,8 +352,9 @@ TEST_F(TestJournalReplay, SnapProtect) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, when_acquired_lock(ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
// get current commit position
int64_t initial_tag;
@@ -383,7 +385,7 @@ TEST_F(TestJournalReplay, SnapProtect) {
// verify lock ordering constraints
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap2"));
+ "snap2", 0, no_op_progress));
ASSERT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
"snap2"));
}
@@ -396,8 +398,9 @@ TEST_F(TestJournalReplay, SnapUnprotect) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, when_acquired_lock(ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
uint64_t snap_id;
{
std::shared_lock image_locker{ictx->image_lock};
@@ -436,7 +439,7 @@ TEST_F(TestJournalReplay, SnapUnprotect) {
// verify lock ordering constraints
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap2"));
+ "snap2", 0, no_op_progress));
ASSERT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
"snap2"));
ASSERT_EQ(0, ictx->operations->snap_unprotect(cls::rbd::UserSnapshotNamespace(),
@@ -451,8 +454,9 @@ TEST_F(TestJournalReplay, SnapRename) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, when_acquired_lock(ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
uint64_t snap_id;
{
std::shared_lock image_locker{ictx->image_lock};
@@ -500,8 +504,9 @@ TEST_F(TestJournalReplay, SnapRollback) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, when_acquired_lock(ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
// get current commit position
int64_t initial_tag;
@@ -527,7 +532,6 @@ TEST_F(TestJournalReplay, SnapRollback) {
ASSERT_EQ(initial_entry + 2, current_entry);
// verify lock ordering constraints
- librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_rollback(cls::rbd::UserSnapshotNamespace(),
"snap",
no_op_progress));
@@ -541,8 +545,9 @@ TEST_F(TestJournalReplay, SnapRemove) {
ASSERT_EQ(0, open_image(m_image_name, &ictx));
ASSERT_EQ(0, when_acquired_lock(ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
// get current commit position
int64_t initial_tag;
@@ -576,7 +581,7 @@ TEST_F(TestJournalReplay, SnapRemove) {
// verify lock ordering constraints
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
ASSERT_EQ(0, ictx->operations->snap_remove(cls::rbd::UserSnapshotNamespace(),
"snap"));
}
@@ -653,8 +658,9 @@ TEST_F(TestJournalReplay, Flatten) {
librbd::ImageCtx *ictx;
ASSERT_EQ(0, open_image(m_image_name, &ictx));
+ librbd::NoOpProgressContext no_op_progress;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap"));
+ "snap", 0, no_op_progress));
ASSERT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
"snap"));
diff --git a/src/test/librbd/journal/test_mock_Replay.cc b/src/test/librbd/journal/test_mock_Replay.cc
index c0c77517c53..85ff9884cc8 100644
--- a/src/test/librbd/journal/test_mock_Replay.cc
+++ b/src/test/librbd/journal/test_mock_Replay.cc
@@ -218,8 +218,9 @@ public:
void expect_snap_create(MockReplayImageCtx &mock_image_ctx,
Context **on_finish, const char *snap_name,
uint64_t op_tid) {
- EXPECT_CALL(*mock_image_ctx.operations, execute_snap_create(_, StrEq(snap_name), _,
- op_tid, 0, _))
+ EXPECT_CALL(*mock_image_ctx.operations,
+ execute_snap_create(_, StrEq(snap_name), _, op_tid,
+ SNAP_CREATE_FLAG_SKIP_NOTIFY_QUIESCE, _))
.WillOnce(DoAll(SaveArg<2>(on_finish),
NotifyInvoke(&m_invoke_lock, &m_invoke_cond)));
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
index a92be03304f..6649d24479a 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_CreateNonPrimaryRequest.cc
@@ -155,8 +155,8 @@ public:
}
void expect_create_snapshot(MockTestImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(*mock_image_ctx.operations, snap_create(_, _, _))
- .WillOnce(WithArg<2>(CompleteContext(
+ EXPECT_CALL(*mock_image_ctx.operations, snap_create(_, _, _, _, _))
+ .WillOnce(WithArg<4>(CompleteContext(
r, mock_image_ctx.image_ctx->op_work_queue)));
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
index a79bd0cc45f..3babd19d232 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_CreatePrimaryRequest.cc
@@ -146,18 +146,20 @@ public:
}
void expect_create_snapshot(MockTestImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(*mock_image_ctx.operations, snap_create(_, _, _))
+ EXPECT_CALL(*mock_image_ctx.operations, snap_create(_, _, _, _, _))
.WillOnce(DoAll(
Invoke([this, &mock_image_ctx, r](
const cls::rbd::SnapshotNamespace &ns,
const std::string& snap_name,
+ uint64_t flags,
+ ProgressContext &prog_ctx,
Context *on_finish) {
if (r != 0) {
return;
}
snap_create(mock_image_ctx, ns, snap_name);
}),
- WithArg<2>(CompleteContext(
+ WithArg<4>(CompleteContext(
r, mock_image_ctx.image_ctx->op_work_queue))
));
}
@@ -211,7 +213,7 @@ TEST_F(TestMockMirrorSnapshotCreatePrimaryRequest, Success) {
C_SaferCond ctx;
auto req = new MockCreatePrimaryRequest(&mock_image_ctx, "gid", CEPH_NOSNAP,
- 0U, nullptr, &ctx);
+ 0U, 0U, nullptr, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
}
@@ -232,7 +234,7 @@ TEST_F(TestMockMirrorSnapshotCreatePrimaryRequest, CanNotError) {
C_SaferCond ctx;
auto req = new MockCreatePrimaryRequest(&mock_image_ctx, "gid", CEPH_NOSNAP,
- 0U, nullptr, &ctx);
+ 0U, 0U, nullptr, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
@@ -256,7 +258,7 @@ TEST_F(TestMockMirrorSnapshotCreatePrimaryRequest, GetMirrorPeersError) {
C_SaferCond ctx;
auto req = new MockCreatePrimaryRequest(&mock_image_ctx, "gid", CEPH_NOSNAP,
- 0U, nullptr, &ctx);
+ 0U, 0U, nullptr, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
@@ -281,7 +283,7 @@ TEST_F(TestMockMirrorSnapshotCreatePrimaryRequest, CreateSnapshotError) {
C_SaferCond ctx;
auto req = new MockCreatePrimaryRequest(&mock_image_ctx, "gid", CEPH_NOSNAP,
- 0U, nullptr, &ctx);
+ 0U, 0U, nullptr, &ctx);
req->send();
ASSERT_EQ(-EINVAL, ctx.wait());
}
@@ -316,7 +318,7 @@ TEST_F(TestMockMirrorSnapshotCreatePrimaryRequest, SuccessUnlinkPeer) {
0);
C_SaferCond ctx;
auto req = new MockCreatePrimaryRequest(&mock_image_ctx, "gid", CEPH_NOSNAP,
- 0U, nullptr, &ctx);
+ 0U, 0U, nullptr, &ctx);
req->send();
ASSERT_EQ(0, ctx.wait());
}
diff --git a/src/test/librbd/mirror/snapshot/test_mock_PromoteRequest.cc b/src/test/librbd/mirror/snapshot/test_mock_PromoteRequest.cc
index 0965ab4644b..af9c349339b 100644
--- a/src/test/librbd/mirror/snapshot/test_mock_PromoteRequest.cc
+++ b/src/test/librbd/mirror/snapshot/test_mock_PromoteRequest.cc
@@ -123,6 +123,7 @@ struct CreatePrimaryRequest<MockTestImageCtx> {
static CreatePrimaryRequest *create(MockTestImageCtx *image_ctx,
const std::string& global_image_id,
uint64_t clean_since_snap_id,
+ uint64_t snap_create_flags,
uint32_t flags, uint64_t *snap_id,
Context *on_finish) {
ceph_assert(s_instance != nullptr);
diff --git a/src/test/librbd/mock/MockImageWatcher.h b/src/test/librbd/mock/MockImageWatcher.h
index f58bb2ba962..0f010564115 100644
--- a/src/test/librbd/mock/MockImageWatcher.h
+++ b/src/test/librbd/mock/MockImageWatcher.h
@@ -25,7 +25,7 @@ struct MockImageWatcher {
MOCK_METHOD0(notify_released_lock, void());
MOCK_METHOD0(notify_request_lock, void());
- MOCK_METHOD2(notify_quiesce, uint64_t(ProgressContext &, Context *));
+ MOCK_METHOD3(notify_quiesce, void(uint64_t *, ProgressContext &, Context *));
MOCK_METHOD2(notify_unquiesce, void(uint64_t, Context *));
};
diff --git a/src/test/librbd/mock/MockOperations.h b/src/test/librbd/mock/MockOperations.h
index 93fd2fa4502..99dc253d115 100644
--- a/src/test/librbd/mock/MockOperations.h
+++ b/src/test/librbd/mock/MockOperations.h
@@ -25,8 +25,10 @@ struct MockOperations {
ProgressContext &prog_ctx,
Context *on_finish,
uint64_t journal_op_tid));
- MOCK_METHOD3(snap_create, void(const cls::rbd::SnapshotNamespace &snapshot_namespace,
+ MOCK_METHOD5(snap_create, void(const cls::rbd::SnapshotNamespace &snapshot_namespace,
const std::string &snap_name,
+ uint64_t flags,
+ ProgressContext &prog_ctx,
Context *on_finish));
MOCK_METHOD6(execute_snap_create, void(const cls::rbd::SnapshotNamespace &snapshot_namespace,
const std::string &snap_name,
diff --git a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
index f43b39f3601..cf56f9e2980 100644
--- a/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotCreateRequest.cc
@@ -63,10 +63,9 @@ public:
typedef mirror::snapshot::SetImageStateRequest<MockImageCtx> MockSetImageStateRequest;
void expect_notify_quiesce(MockImageCtx &mock_image_ctx, int r) {
- EXPECT_CALL(*mock_image_ctx.image_watcher, notify_quiesce(_, _))
- .WillOnce(DoAll(WithArg<1>(CompleteContext(
- r, mock_image_ctx.image_ctx->op_work_queue)),
- Return(0)));
+ EXPECT_CALL(*mock_image_ctx.image_watcher, notify_quiesce(_, _, _))
+ .WillOnce(WithArg<2>(CompleteContext(
+ r, mock_image_ctx.image_ctx->op_work_queue)));
}
void expect_block_writes(MockImageCtx &mock_image_ctx) {
@@ -173,7 +172,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, Success) {
expect_op_work_queue(mock_image_ctx);
::testing::InSequence seq;
- expect_notify_quiesce(mock_image_ctx, 0);
+ expect_notify_quiesce(mock_image_ctx, -EINVAL);
expect_block_writes(mock_image_ctx);
expect_allocate_snap_id(mock_image_ctx, 0);
expect_snap_create(mock_image_ctx, 0);
@@ -188,7 +187,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, Success) {
librbd::NoOpProgressContext prog_ctx;
MockSnapshotCreateRequest *req = new MockSnapshotCreateRequest(
mock_image_ctx, &cond_ctx, cls::rbd::UserSnapshotNamespace(),
- "snap1", 0, 0, prog_ctx);
+ "snap1", 0, SNAP_CREATE_FLAG_IGNORE_NOTIFY_QUIESCE_ERROR, prog_ctx);
{
std::shared_lock owner_locker{mock_image_ctx.owner_lock};
req->send();
@@ -206,6 +205,7 @@ TEST_F(TestMockOperationSnapshotCreateRequest, NotifyQuiesceError) {
::testing::InSequence seq;
expect_notify_quiesce(mock_image_ctx, -EINVAL);
+ expect_notify_unquiesce(mock_image_ctx, 0);
C_SaferCond cond_ctx;
librbd::NoOpProgressContext prog_ctx;
diff --git a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
index 208998b5eac..74c0108300d 100644
--- a/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
+++ b/src/test/librbd/operation/test_mock_SnapshotRemoveRequest.cc
@@ -446,8 +446,9 @@ TEST_F(TestMockOperationSnapshotRemoveRequest, TrashCloneParent) {
librbd::ImageCtx *ictx;
ASSERT_EQ(0, open_image(m_image_name, &ictx));
+ NoOpProgressContext prog_ctx;
ASSERT_EQ(0, ictx->operations->snap_create(
- {cls::rbd::TrashSnapshotNamespace{}}, "snap1"));
+ {cls::rbd::TrashSnapshotNamespace{}}, "snap1", 0, prog_ctx));
ASSERT_EQ(0, ictx->state->refresh_if_required());
MockImageCtx mock_image_ctx(*ictx);
diff --git a/src/test/librbd/test_ImageWatcher.cc b/src/test/librbd/test_ImageWatcher.cc
index 58a831ab788..22bf95e1e24 100644
--- a/src/test/librbd/test_ImageWatcher.cc
+++ b/src/test/librbd/test_ImageWatcher.cc
@@ -293,7 +293,7 @@ struct SnapCreateTask {
std::shared_lock l{ictx->owner_lock};
C_SaferCond ctx;
ictx->image_watcher->notify_snap_create(0, cls::rbd::UserSnapshotNamespace(),
- "snap", *progress_context, &ctx);
+ "snap", 0, *progress_context, &ctx);
ASSERT_EQ(0, ctx.wait());
}
};
@@ -486,7 +486,7 @@ TEST_F(TestImageWatcher, NotifySnapCreateError) {
C_SaferCond notify_ctx;
librbd::NoOpProgressContext prog_ctx;
ictx->image_watcher->notify_snap_create(0, cls::rbd::UserSnapshotNamespace(),
- "snap", prog_ctx, &notify_ctx);
+ "snap", 0, prog_ctx, &notify_ctx);
ASSERT_EQ(-EEXIST, notify_ctx.wait());
NotifyOps expected_notify_ops;
diff --git a/src/test/librbd/test_fixture.cc b/src/test/librbd/test_fixture.cc
index 82c6e6d2781..15409d5676f 100644
--- a/src/test/librbd/test_fixture.cc
+++ b/src/test/librbd/test_fixture.cc
@@ -85,8 +85,9 @@ int TestFixture::open_image(const std::string &image_name,
int TestFixture::snap_create(librbd::ImageCtx &ictx,
const std::string &snap_name) {
+ librbd::NoOpProgressContext prog_ctx;
return ictx.operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str());
+ snap_name.c_str(), 0, prog_ctx);
}
int TestFixture::snap_protect(librbd::ImageCtx &ictx,
diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc
index 4d455de0773..ce6e939f8a8 100644
--- a/src/test/librbd/test_internal.cc
+++ b/src/test/librbd/test_internal.cc
@@ -1157,7 +1157,7 @@ TEST_F(TestInternal, WriteFullCopyup) {
ASSERT_EQ(0, open_image(clone_name, &ictx2));
ASSERT_EQ(0, ictx2->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "snap1"));
+ "snap1", 0, no_op));
bufferlist write_full_bl;
write_full_bl.append(std::string(1 << ictx2->order, '2'));
diff --git a/src/test/librbd/test_librbd.cc b/src/test/librbd/test_librbd.cc
index a3e539fd54b..f046efe91bd 100644
--- a/src/test/librbd/test_librbd.cc
+++ b/src/test/librbd/test_librbd.cc
@@ -8210,7 +8210,7 @@ TEST_F(TestLibRBD, QuiesceWatch)
void handle_quiesce() {
ASSERT_EQ(quiesce_count, unquiesce_count);
quiesce_count++;
- rbd_quiesce_complete(image);
+ rbd_quiesce_complete(image, 0);
}
void handle_unquiesce() {
unquiesce_count++;
@@ -8280,7 +8280,7 @@ TEST_F(TestLibRBD, QuiesceWatchPP)
void handle_quiesce() override {
ASSERT_EQ(quiesce_count, unquiesce_count);
quiesce_count++;
- image.quiesce_complete();
+ image.quiesce_complete(0);
}
void handle_unquiesce() override {
unquiesce_count++;
@@ -8323,6 +8323,82 @@ TEST_F(TestLibRBD, QuiesceWatchPP)
ioctx.close();
}
+TEST_F(TestLibRBD, QuiesceWatchError)
+{
+ librbd::RBD rbd;
+ librados::IoCtx ioctx;
+ ASSERT_EQ(0, _rados.ioctx_create(m_pool_name.c_str(), ioctx));
+ std::string name = get_temp_image_name();
+ int order = 0;
+ uint64_t size = 2 << 20;
+ ASSERT_EQ(0, create_image_pp(rbd, ioctx, name.c_str(), size, &order));
+
+ {
+ librbd::Image image1, image2;
+ ASSERT_EQ(0, rbd.open(ioctx, image1, name.c_str(), NULL));
+ ASSERT_EQ(0, rbd.open(ioctx, image2, name.c_str(), NULL));
+
+ struct Watcher : public librbd::QuiesceWatchCtx {
+ librbd::Image &image;
+ int r;
+ size_t quiesce_count = 0;
+ size_t unquiesce_count = 0;
+
+ Watcher(librbd::Image &image, int r) : image(image), r(r) {
+ }
+
+ void handle_quiesce() override {
+ quiesce_count++;
+ image.quiesce_complete(r);
+ }
+
+ void handle_unquiesce() override {
+ unquiesce_count++;
+ }
+ } watcher1(image1, -EINVAL), watcher2(image2, 0);
+ uint64_t handle1, handle2;
+
+ ASSERT_EQ(0, image1.quiesce_watch(&watcher1, &handle1));
+ ASSERT_EQ(0, image2.quiesce_watch(&watcher2, &handle2));
+
+ ASSERT_EQ(-EINVAL, image1.snap_create("snap1"));
+ ASSERT_LT(0U, watcher1.quiesce_count);
+ ASSERT_EQ(0U, watcher1.unquiesce_count);
+ ASSERT_EQ(1U, watcher2.quiesce_count);
+ ASSERT_EQ(1U, watcher2.unquiesce_count);
+
+ PrintProgress prog_ctx;
+ watcher1.quiesce_count = 0;
+ ASSERT_EQ(0, image2.snap_create2("snap2",
+ RBD_SNAP_CREATE_IGNORE_QUIESCE_ERROR,
+ prog_ctx));
+ ASSERT_LT(0U, watcher1.quiesce_count);
+ ASSERT_EQ(0U, watcher1.unquiesce_count);
+ ASSERT_EQ(2U, watcher2.quiesce_count);
+ ASSERT_EQ(2U, watcher2.unquiesce_count);
+
+ ASSERT_EQ(0, image1.quiesce_unwatch(handle1));
+
+ ASSERT_EQ(0, image1.snap_create("snap3"));
+ ASSERT_EQ(3U, watcher2.quiesce_count);
+ ASSERT_EQ(3U, watcher2.unquiesce_count);
+
+ ASSERT_EQ(0, image2.snap_create2("snap4", RBD_SNAP_CREATE_SKIP_QUIESCE,
+ prog_ctx));
+ ASSERT_EQ(3U, watcher2.quiesce_count);
+ ASSERT_EQ(3U, watcher2.unquiesce_count);
+
+ ASSERT_EQ(0, image2.quiesce_unwatch(handle2));
+
+ ASSERT_EQ(0, image1.snap_remove("snap2"));
+ ASSERT_EQ(0, image1.snap_remove("snap3"));
+ ASSERT_EQ(0, image1.snap_remove("snap4"));
+ }
+
+ ASSERT_EQ(0, rbd.remove(ioctx, name.c_str()));
+ ioctx.close();
+}
+
TEST_F(TestLibRBD, QuiesceWatchTimeout)
{
REQUIRE(!is_librados_test_stub(_rados));
@@ -8388,7 +8464,7 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
thread quiesce1([&image, &watcher]() {
watcher.wait_for_quiesce_count(1);
sleep(8);
- image.quiesce_complete();
+ image.quiesce_complete(0);
});
ASSERT_EQ(0, image.snap_create("snap1"));
@@ -8406,7 +8482,7 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
std::cerr << "waiting for timed out ... " << i << std::endl;
sleep(1);
}
- image.quiesce_complete();
+ image.quiesce_complete(0);
});
ASSERT_EQ(-ETIMEDOUT, image.snap_create("snap2"));
@@ -8418,7 +8494,7 @@ TEST_F(TestLibRBD, QuiesceWatchTimeout)
thread quiesce3([&image, &watcher]() {
watcher.wait_for_quiesce_count(3);
- image.quiesce_complete();
+ image.quiesce_complete(0);
});
std::cerr << "test retry succeeds" << std::endl;
diff --git a/src/test/pybind/test_rbd.py b/src/test/pybind/test_rbd.py
index e97bc2805c1..dc323d3022c 100644
--- a/src/test/pybind/test_rbd.py
+++ b/src/test/pybind/test_rbd.py
@@ -38,7 +38,9 @@ from rbd import (RBD, Group, Image, ImageNotFound, InvalidArgument, ImageExists,
RBD_MIRROR_PEER_ATTRIBUTE_NAME_KEY,
RBD_MIRROR_PEER_DIRECTION_RX, RBD_MIRROR_PEER_DIRECTION_RX_TX,
RBD_SNAP_REMOVE_UNPROTECT, RBD_SNAP_MIRROR_STATE_PRIMARY,
- RBD_SNAP_MIRROR_STATE_PRIMARY_DEMOTED)
+ RBD_SNAP_MIRROR_STATE_PRIMARY_DEMOTED,
+ RBD_SNAP_CREATE_SKIP_QUIESCE,
+ RBD_SNAP_CREATE_IGNORE_QUIESCE_ERROR)
rados = None
ioctx = None
@@ -785,6 +787,14 @@ class TestImage(object):
assert_raises(ImageExists, self.image.create_snap, 'snap1')
self.image.remove_snap('snap1')
+ def test_create_snap_flags(self):
+ self.image.create_snap('snap1', 0)
+ self.image.remove_snap('snap1')
+ self.image.create_snap('snap1', RBD_SNAP_CREATE_SKIP_QUIESCE)
+ self.image.remove_snap('snap1')
+ self.image.create_snap('snap1', RBD_SNAP_CREATE_IGNORE_QUIESCE_ERROR)
+ self.image.remove_snap('snap1')
+
def test_list_snaps(self):
eq([], list(self.image.list_snaps()))
self.image.create_snap('snap1')
@@ -2126,7 +2136,8 @@ class TestMirroring(object):
info['mode'] = RBD_MIRROR_IMAGE_MODE_SNAPSHOT;
eq(info, entries[self.image.id()])
- snap_id = self.image.mirror_image_create_snapshot()
+ snap_id = self.image.mirror_image_create_snapshot(
+ RBD_SNAP_CREATE_SKIP_QUIESCE)
snaps = list(self.image.list_snaps())
eq(2, len(snaps))
diff --git a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
index 3277f77f87a..74e385a8084 100644
--- a/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/snapshot/test_mock_CreateLocalImageRequest.cc
@@ -142,10 +142,11 @@ public:
}
void snap_create(librbd::ImageCtx *image_ctx, const std::string &snap_name) {
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, image_ctx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name, 0, prog_ctx));
ASSERT_EQ(0, image_ctx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name));
ASSERT_EQ(0, image_ctx->state->refresh());
}
diff --git a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
index 2e10f28d6d8..c87173d271b 100644
--- a/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
+++ b/src/test/rbd_mirror/image_replayer/test_mock_CreateImageRequest.cc
@@ -230,10 +230,11 @@ public:
}
void snap_create(librbd::ImageCtx *image_ctx, const std::string &snap_name) {
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, image_ctx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name, 0, prog_ctx));
ASSERT_EQ(0, image_ctx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name));
ASSERT_EQ(0, image_ctx->state->refresh());
}
diff --git a/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc b/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
index 69c2f388384..9a4d920f8c2 100644
--- a/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
+++ b/src/test/rbd_mirror/image_sync/test_mock_SyncPointCreateRequest.cc
@@ -77,8 +77,8 @@ public:
}
void expect_snap_create(librbd::MockTestImageCtx &mock_remote_image_ctx, int r) {
- EXPECT_CALL(*mock_remote_image_ctx.operations, snap_create(_, _, _))
- .WillOnce(WithArg<2>(CompleteContext(r)));
+ EXPECT_CALL(*mock_remote_image_ctx.operations, snap_create(_, _, _, _, _))
+ .WillOnce(WithArg<4>(CompleteContext(r)));
}
MockSyncPointCreateRequest *create_request(librbd::MockTestImageCtx &mock_remote_image_ctx,
diff --git a/src/test/rbd_mirror/test_ImageDeleter.cc b/src/test/rbd_mirror/test_ImageDeleter.cc
index 9bd2658daed..2febc6f3296 100644
--- a/src/test/rbd_mirror/test_ImageDeleter.cc
+++ b/src/test/rbd_mirror/test_ImageDeleter.cc
@@ -170,12 +170,13 @@ public:
ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
}
+ librbd::NoOpProgressContext prog_ctx;
EXPECT_EQ(0, ictx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace(), snap_name.c_str()));
+ cls::rbd::UserSnapshotNamespace(), snap_name, 0, prog_ctx));
if (protect) {
EXPECT_EQ(0, ictx->operations->snap_protect(
- cls::rbd::UserSnapshotNamespace(), snap_name.c_str()));
+ cls::rbd::UserSnapshotNamespace(), snap_name));
}
EXPECT_EQ(0, ictx->state->close());
@@ -190,8 +191,9 @@ public:
ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
}
+ librbd::NoOpProgressContext prog_ctx;
EXPECT_EQ(0, ictx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace(), "snap1"));
+ cls::rbd::UserSnapshotNamespace(), "snap1", 0, prog_ctx));
EXPECT_EQ(0, ictx->operations->snap_protect(
cls::rbd::UserSnapshotNamespace(), "snap1"));
EXPECT_EQ(0, librbd::api::Image<>::snap_set(
diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc
index 4498c7bef3a..ce94e5a6d14 100644
--- a/src/test/rbd_mirror/test_ImageReplayer.cc
+++ b/src/test/rbd_mirror/test_ImageReplayer.cc
@@ -536,7 +536,7 @@ public:
} else {
uint64_t snap_id = CEPH_NOSNAP;
ASSERT_EQ(0, librbd::api::Mirror<>::image_snapshot_create(
- ictx, &snap_id));
+ ictx, 0, &snap_id));
}
printf("flushed\n");
@@ -1008,8 +1008,9 @@ TEST_F(TestImageReplayerJournal, MultipleReplayFailures_SingleEpoch) {
librbd::ImageCtx *ictx;
this->open_image(this->m_local_ioctx, this->m_image_name, false, &ictx);
ictx->features &= ~RBD_FEATURE_JOURNALING;
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "foo"));
+ "foo", 0, prog_ctx));
ASSERT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
"foo"));
ASSERT_EQ(0, librbd::cls_client::add_child(&ictx->md_ctx, RBD_CHILDREN,
@@ -1061,8 +1062,9 @@ TEST_F(TestImageReplayerJournal, MultipleReplayFailures_MultiEpoch) {
librbd::ImageCtx *ictx;
this->open_image(this->m_local_ioctx, this->m_image_name, false, &ictx);
ictx->features &= ~RBD_FEATURE_JOURNALING;
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- "foo"));
+ "foo", 0, prog_ctx));
ASSERT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
"foo"));
ASSERT_EQ(0, librbd::cls_client::add_child(&ictx->md_ctx, RBD_CHILDREN,
@@ -1465,8 +1467,9 @@ TYPED_TEST(TestImageReplayer, SnapshotUnprotect) {
this->open_remote_image(&remote_image_ctx);
// create a protected snapshot
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, remote_image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap1"));
+ cls::rbd::UserSnapshotNamespace{}, "snap1", 0, prog_ctx));
ASSERT_EQ(0, remote_image_ctx->operations->snap_protect(
cls::rbd::UserSnapshotNamespace{}, "snap1"));
this->flush(remote_image_ctx);
@@ -1508,8 +1511,9 @@ TYPED_TEST(TestImageReplayer, SnapshotProtect) {
this->open_remote_image(&remote_image_ctx);
// create an unprotected snapshot
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, remote_image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap1"));
+ cls::rbd::UserSnapshotNamespace{}, "snap1", 0, prog_ctx));
this->flush(remote_image_ctx);
this->create_replayer();
@@ -1549,8 +1553,9 @@ TYPED_TEST(TestImageReplayer, SnapshotRemove) {
this->open_remote_image(&remote_image_ctx);
// create a user snapshot
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, remote_image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap1"));
+ cls::rbd::UserSnapshotNamespace{}, "snap1", 0, prog_ctx));
this->flush(remote_image_ctx);
this->create_replayer();
@@ -1584,8 +1589,9 @@ TYPED_TEST(TestImageReplayer, SnapshotRename) {
this->open_remote_image(&remote_image_ctx);
// create a user snapshot
+ librbd::NoOpProgressContext prog_ctx;
ASSERT_EQ(0, remote_image_ctx->operations->snap_create(
- cls::rbd::UserSnapshotNamespace{}, "snap1"));
+ cls::rbd::UserSnapshotNamespace{}, "snap1", 0, prog_ctx));
this->flush(remote_image_ctx);
this->create_replayer();
diff --git a/src/test/rbd_mirror/test_PoolWatcher.cc b/src/test/rbd_mirror/test_PoolWatcher.cc
index 493c675d0c4..c29ed65afb2 100644
--- a/src/test/rbd_mirror/test_PoolWatcher.cc
+++ b/src/test/rbd_mirror/test_PoolWatcher.cc
@@ -170,10 +170,11 @@ public:
librbd::ImageCtx *ictx = new librbd::ImageCtx(parent_image_name.c_str(),
"", "", pioctx, false);
ictx->state->open(0);
+ librbd::NoOpProgressContext prog_ctx;
EXPECT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name, 0, prog_ctx));
EXPECT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
- snap_name.c_str()));
+ snap_name));
ictx->state->close();
}
diff --git a/src/test/rbd_mirror/test_fixture.cc b/src/test/rbd_mirror/test_fixture.cc
index 092d41f5f65..e271364033d 100644
--- a/src/test/rbd_mirror/test_fixture.cc
+++ b/src/test/rbd_mirror/test_fixture.cc
@@ -8,6 +8,7 @@
#include "librbd/ImageCtx.h"
#include "librbd/ImageState.h"
#include "librbd/Operations.h"
+#include "librbd/internal.h"
#include "test/librados/test_cxx.h"
#include "tools/rbd_mirror/Threads.h"
@@ -105,8 +106,9 @@ int TestFixture::open_image(librados::IoCtx &io_ctx,
int TestFixture::create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
librados::snap_t *snap_id) {
+ librbd::NoOpProgressContext prog_ctx;
int r = image_ctx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
- snap_name);
+ snap_name, 0, prog_ctx);
if (r < 0) {
return r;
}