]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | #include "include/int_types.h" | |
4 | #include "include/rados/librados.h" | |
5 | #include "include/rbd/librbd.hpp" | |
6 | #include "librbd/ImageCtx.h" | |
7 | #include "gtest/gtest.h" | |
8 | #include <set> | |
9 | #include <string> | |
10 | ||
11 | using namespace ceph; | |
12 | ||
13 | class TestFixture : public ::testing::Test { | |
14 | public: | |
15 | ||
16 | TestFixture(); | |
17 | ||
18 | static void SetUpTestCase(); | |
19 | static void TearDownTestCase(); | |
20 | ||
21 | static std::string get_temp_image_name(); | |
22 | ||
23 | void SetUp() override; | |
24 | void TearDown() override; | |
25 | ||
26 | int open_image(const std::string &image_name, librbd::ImageCtx **ictx); | |
27 | void close_image(librbd::ImageCtx *ictx); | |
28 | ||
29 | int snap_create(librbd::ImageCtx &ictx, const std::string &snap_name); | |
30 | int snap_protect(librbd::ImageCtx &ictx, const std::string &snap_name); | |
31 | ||
32 | int flatten(librbd::ImageCtx &ictx, librbd::ProgressContext &prog_ctx); | |
b32b8144 | 33 | int resize(librbd::ImageCtx *ictx, uint64_t size); |
7c673cae FG |
34 | |
35 | int lock_image(librbd::ImageCtx &ictx, ClsLockType lock_type, | |
36 | const std::string &cookie); | |
37 | int unlock_image(); | |
38 | ||
39 | int acquire_exclusive_lock(librbd::ImageCtx &ictx); | |
40 | ||
41 | static std::string _pool_name; | |
42 | static librados::Rados _rados; | |
43 | static rados_t _cluster; | |
44 | static uint64_t _image_number; | |
45 | static std::string _data_pool; | |
46 | ||
47 | librados::IoCtx m_ioctx; | |
48 | librbd::RBD m_rbd; | |
49 | ||
50 | std::string m_image_name; | |
51 | uint64_t m_image_size; | |
52 | ||
53 | std::set<librbd::ImageCtx *> m_ictxs; | |
54 | ||
55 | std::string m_lock_object; | |
56 | std::string m_lock_cookie; | |
57 | }; |