1 #include "test_rgw_common.h"
3 void test_rgw_add_placement(RGWZoneGroup
*zonegroup
, RGWZoneParams
*zone_params
, const std::string
& name
, bool is_default
)
5 zonegroup
->placement_targets
[name
] = { name
};
7 RGWZonePlacementInfo
& pinfo
= zone_params
->placement_pools
[name
];
8 pinfo
.index_pool
= rgw_pool(name
+ ".index").to_str();
10 rgw_pool
data_pool(name
+ ".data");
11 pinfo
.storage_classes
.set_storage_class(RGW_STORAGE_CLASS_STANDARD
, &data_pool
, nullptr);
12 pinfo
.data_extra_pool
= rgw_pool(name
+ ".extra").to_str();
15 zonegroup
->default_placement
= rgw_placement_rule(name
, RGW_STORAGE_CLASS_STANDARD
);
19 void test_rgw_init_env(RGWZoneGroup
*zonegroup
, RGWZoneParams
*zone_params
)
21 test_rgw_add_placement(zonegroup
, zone_params
, "default-placement", true);
25 void test_rgw_populate_explicit_placement_bucket(rgw_bucket
*b
, const char *t
, const char *n
, const char *dp
, const char *ip
, const char *m
, const char *id
)
31 b
->explicit_placement
.data_pool
= rgw_pool(dp
);
32 b
->explicit_placement
.index_pool
= rgw_pool(ip
);
35 void test_rgw_populate_old_bucket(old_rgw_bucket
*b
, const char *t
, const char *n
, const char *dp
, const char *ip
, const char *m
, const char *id
)
45 std::string
test_rgw_get_obj_oid(const rgw_obj
& obj
)
50 get_obj_bucket_and_oid_loc(obj
, oid
, loc
);
54 void test_rgw_init_explicit_placement_bucket(rgw_bucket
*bucket
, const char *name
)
56 test_rgw_populate_explicit_placement_bucket(bucket
, "", name
, ".data-pool", ".index-pool", "marker", "bucket-id");
59 void test_rgw_init_old_bucket(old_rgw_bucket
*bucket
, const char *name
)
61 test_rgw_populate_old_bucket(bucket
, "", name
, ".data-pool", ".index-pool", "marker", "bucket-id");
64 void test_rgw_populate_bucket(rgw_bucket
*b
, const char *t
, const char *n
, const char *m
, const char *id
)
72 void test_rgw_init_bucket(rgw_bucket
*bucket
, const char *name
)
74 test_rgw_populate_bucket(bucket
, "", name
, "marker", "bucket-id");
77 rgw_obj
test_rgw_create_obj(const rgw_bucket
& bucket
, const std::string
& name
, const std::string
& instance
, const std::string
& ns
)
79 rgw_obj
obj(bucket
, name
);
80 if (!instance
.empty()) {
81 obj
.key
.set_instance(instance
);