TracepointProvider::initialize<tracepoint_traits>(get_cct(io_ctx));
tracepoint(librbd, trash_undelete_enter, io_ctx.get_pool_name().c_str(),
io_ctx.get_id(), id, name);
- int r = librbd::api::Trash<>::restore(io_ctx, RBD_TRASH_IMAGE_SOURCE_USER,
- id, name);
+ int r = librbd::api::Trash<>::restore(
+ io_ctx, librbd::api::Trash<>::RESTORE_SOURCE_WHITELIST, id, name);
tracepoint(librbd, trash_undelete_exit, r);
return r;
}
return librbd::api::Mirror<>::mode_get(io_ctx, mirror_mode);
}
+ int RBD::mirror_site_name_get(librados::Rados& rados,
+ std::string* site_name) {
+ return librbd::api::Mirror<>::site_name_get(rados, site_name);
+ }
+
+ int RBD::mirror_site_name_set(librados::Rados& rados,
+ const std::string& site_name) {
+ return librbd::api::Mirror<>::site_name_set(rados, site_name);
+ }
+
int RBD::mirror_mode_set(IoCtx& io_ctx, rbd_mirror_mode_t mirror_mode) {
return librbd::api::Mirror<>::mode_set(io_ctx, mirror_mode);
}
+ int RBD::mirror_peer_bootstrap_create(IoCtx& io_ctx, std::string* token) {
+ return librbd::api::Mirror<>::peer_bootstrap_create(io_ctx, token);
+ }
+
+ int RBD::mirror_peer_bootstrap_import(IoCtx& io_ctx,
+ rbd_mirror_peer_direction_t direction,
+ const std::string& token) {
+ return librbd::api::Mirror<>::peer_bootstrap_import(io_ctx, direction,
+ token);
+ }
+
int RBD::mirror_peer_add(IoCtx& io_ctx, std::string *uuid,
const std::string &cluster_name,
const std::string &client_name) {
int64_t Image::get_data_pool_id()
{
ImageCtx *ictx = reinterpret_cast<ImageCtx *>(ctx);
- return ictx->data_ctx.get_id();
+ return librbd::api::Image<>::get_data_pool_id(ictx);
}
int Image::parent_info(string *parent_pool_name, string *parent_name,
}
/* pool mirroring */
+extern "C" int rbd_mirror_site_name_get(rados_t cluster, char *name,
+ size_t *max_len) {
+ librados::Rados rados;
+ librados::Rados::from_rados_t(cluster, rados);
+
+ std::string site_name;
+ int r = librbd::api::Mirror<>::site_name_get(rados, &site_name);
+ if (r < 0) {
+ return r;
+ }
+
+ auto total_len = site_name.size() + 1;
+ if (*max_len < total_len) {
+ *max_len = total_len;
+ return -ERANGE;
+ }
+ *max_len = total_len;
+
+ strcpy(name, site_name.c_str());
+ return 0;
+}
+
+extern "C" int rbd_mirror_site_name_set(rados_t cluster, const char *name) {
+ librados::Rados rados;
+ librados::Rados::from_rados_t(cluster, rados);
+ return librbd::api::Mirror<>::site_name_set(rados, name);
+}
+
extern "C" int rbd_mirror_mode_get(rados_ioctx_t p,
rbd_mirror_mode_t *mirror_mode) {
librados::IoCtx io_ctx;
return librbd::api::Mirror<>::mode_set(io_ctx, mirror_mode);
}
+extern "C" int rbd_mirror_peer_bootstrap_create(rados_ioctx_t p, char *token,
+ size_t *max_len) {
+ librados::IoCtx io_ctx;
+ librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
+
+ std::string token_str;
+ int r = librbd::api::Mirror<>::peer_bootstrap_create(io_ctx, &token_str);
+ if (r < 0) {
+ return r;
+ }
+
+ auto total_len = token_str.size() + 1;
+ if (*max_len < total_len) {
+ *max_len = total_len;
+ return -ERANGE;
+ }
+ *max_len = total_len;
+
+ strcpy(token, token_str.c_str());
+ return 0;
+}
+
+extern "C" int rbd_mirror_peer_bootstrap_import(
+ rados_ioctx_t p, rbd_mirror_peer_direction_t direction,
+ const char *token) {
+ librados::IoCtx io_ctx;
+ librados::IoCtx::from_rados_ioctx_t(p, io_ctx);
+
+ return librbd::api::Mirror<>::peer_bootstrap_import(io_ctx, direction, token);
+}
+
extern "C" int rbd_mirror_peer_add(rados_ioctx_t p, char *uuid,
size_t uuid_max_length,
const char *cluster_name,
TracepointProvider::initialize<tracepoint_traits>(get_cct(io_ctx));
tracepoint(librbd, trash_undelete_enter, io_ctx.get_pool_name().c_str(),
io_ctx.get_id(), id, name);
- int r = librbd::api::Trash<>::restore(io_ctx, RBD_TRASH_IMAGE_SOURCE_USER,
- id, name);
+ int r = librbd::api::Trash<>::restore(
+ io_ctx, librbd::api::Trash<>::RESTORE_SOURCE_WHITELIST, id, name);
tracepoint(librbd, trash_undelete_exit, r);
return r;
}
extern "C" int64_t rbd_get_data_pool_id(rbd_image_t image)
{
librbd::ImageCtx *ictx = reinterpret_cast<librbd::ImageCtx *>(image);
- return ictx->data_ctx.get_id();
+ return librbd::api::Image<>::get_data_pool_id(ictx);
}
extern "C" int rbd_get_parent_info(rbd_image_t image,