@@ -27,7 +27,6 @@ TEST_F(TestGroup, group_create)
2727 rados_ioctx_destroy (ioctx);
2828 } BOOST_SCOPE_EXIT_END;
2929
30- librbd::RBD rbd;
3130 ASSERT_EQ (0 , rbd_group_create (ioctx, " mygroup" ));
3231
3332 size_t size = 0 ;
@@ -50,20 +49,20 @@ TEST_F(TestGroup, group_createPP)
5049 ASSERT_EQ (0 , _rados.ioctx_create (_pool_name.c_str (), ioctx));
5150
5251 librbd::RBD rbd;
53- ASSERT_EQ (0 , rbd.group_create (ioctx, " mygroup " ));
52+ ASSERT_EQ (0 , rbd.group_create (ioctx, " mygroupPP " ));
5453
5554 std::vector<std::string> groups;
5655 ASSERT_EQ (0 , rbd.group_list (ioctx, &groups));
5756 ASSERT_EQ (1U , groups.size ());
58- ASSERT_EQ (" mygroup " , groups[0 ]);
57+ ASSERT_EQ (" mygroupPP " , groups[0 ]);
5958
6059 groups.clear ();
61- ASSERT_EQ (0 , rbd.group_rename (ioctx, " mygroup " , " newgroup " ));
60+ ASSERT_EQ (0 , rbd.group_rename (ioctx, " mygroupPP " , " newgroupPP " ));
6261 ASSERT_EQ (0 , rbd.group_list (ioctx, &groups));
6362 ASSERT_EQ (1U , groups.size ());
64- ASSERT_EQ (" newgroup " , groups[0 ]);
63+ ASSERT_EQ (" newgroupPP " , groups[0 ]);
6564
66- ASSERT_EQ (0 , rbd.group_remove (ioctx, " newgroup " ));
65+ ASSERT_EQ (0 , rbd.group_remove (ioctx, " newgroupPP " ));
6766
6867 groups.clear ();
6968 ASSERT_EQ (0 , rbd.group_list (ioctx, &groups));
@@ -195,7 +194,7 @@ TEST_F(TestGroup, add_imagePP)
195194 librados::IoCtx ioctx;
196195 ASSERT_EQ (0 , _rados.ioctx_create (_pool_name.c_str (), ioctx));
197196
198- const char *group_name = " mycg " ;
197+ const char *group_name = " mycgPP " ;
199198 librbd::RBD rbd;
200199 ASSERT_EQ (0 , rbd.group_create (ioctx, group_name));
201200
@@ -276,7 +275,8 @@ TEST_F(TestGroup, add_snapshot)
276275 EXPECT_EQ (0 , rbd_close (image));
277276 } BOOST_SCOPE_EXIT_END;
278277
279- ASSERT_EQ (10 , rbd_write (image, 0 , 10 , orig_data));
278+ ASSERT_EQ (10 , rbd_write2 (image, 0 , 10 , orig_data,
279+ LIBRADOS_OP_FLAG_FADVISE_FUA));
280280 ASSERT_EQ (10 , rbd_read (image, 0 , 10 , read_data));
281281 ASSERT_EQ (0 , memcmp (orig_data, read_data, 10 ));
282282
@@ -345,13 +345,17 @@ TEST_F(TestGroup, add_snapshot)
345345
346346 ASSERT_STREQ (snap_name, snaps[0 ].name);
347347
348- ASSERT_EQ (10 , rbd_write(image, 9 , 10 , test_data));
348+ ASSERT_EQ (10 , rbd_write2(image, 9 , 10 , test_data,
349+ LIBRADOS_OP_FLAG_FADVISE_FUA));
349350 ASSERT_EQ (10 , rbd_read(image, 9 , 10 , read_data));
350351 ASSERT_EQ (0 , memcmp(test_data, read_data, 10 ));
351352
352353 ASSERT_EQ (10 , rbd_read(image, 0 , 10 , read_data));
353354 ASSERT_NE (0 , memcmp(orig_data, read_data, 10 ));
354355 ASSERT_EQ (0 , rbd_group_snap_rollback(ioctx, group_name, snap_name));
356+ if (!is_feature_enabled(RBD_FEATURE_EXCLUSIVE_LOCK)) {
357+ ASSERT_EQ (0 , rbd_invalidate_cache (image));
358+ }
355359 ASSERT_EQ (10 , rbd_read(image, 0 , 10 , read_data));
356360 ASSERT_EQ (0 , memcmp(orig_data, read_data, 10 ));
357361
@@ -408,7 +412,7 @@ TEST_F(TestGroup, add_snapshotPP)
408412 librados::IoCtx ioctx;
409413 ASSERT_EQ (0 , _rados.ioctx_create (_pool_name.c_str (), ioctx));
410414
411- const char *group_name = " snap_group " ;
415+ const char *group_name = " snap_groupPP " ;
412416 const char *snap_name = " snap_snapshot" ;
413417
414418 librbd::RBD rbd;
@@ -422,7 +426,8 @@ TEST_F(TestGroup, add_snapshotPP)
422426 bufferlist expect_bl;
423427 bufferlist read_bl;
424428 expect_bl.append (std::string (512 , ' 1' ));
425- ASSERT_EQ ((ssize_t )expect_bl.length (), image.write (0 , expect_bl.length (), expect_bl));
429+ ASSERT_EQ (512 , image.write2 (0 , expect_bl.length (), expect_bl,
430+ LIBRADOS_OP_FLAG_FADVISE_FUA));
426431 ASSERT_EQ (512 , image.read (0 , 512 , read_bl));
427432 ASSERT_TRUE (expect_bl.contents_equal (read_bl));
428433
@@ -437,13 +442,17 @@ TEST_F(TestGroup, add_snapshotPP)
437442
438443 bufferlist write_bl;
439444 write_bl.append (std::string (1024 , ' 2' ));
440- ASSERT_EQ (1024 , image.write (256 , write_bl.length (), write_bl));
445+ ASSERT_EQ (1024 , image.write2 (256 , write_bl.length (), write_bl,
446+ LIBRADOS_OP_FLAG_FADVISE_FUA));
441447 ASSERT_EQ (1024 , image.read (256 , 1024 , read_bl));
442448 ASSERT_TRUE (write_bl.contents_equal (read_bl));
443449
444450 ASSERT_EQ (512 , image.read (0 , 512 , read_bl));
445451 ASSERT_FALSE (expect_bl.contents_equal (read_bl));
446452 ASSERT_EQ (0 , rbd.group_snap_rollback (ioctx, group_name, snap_name));
453+ if (!is_feature_enabled (RBD_FEATURE_EXCLUSIVE_LOCK)) {
454+ ASSERT_EQ (0 , image.invalidate_cache ());
455+ }
447456 ASSERT_EQ (512 , image.read (0 , 512 , read_bl));
448457 ASSERT_TRUE (expect_bl.contents_equal (read_bl));
449458
0 commit comments