#include "include/rados/librados.h"
+#include "include/rados/librados.hpp"
#include "test/rados-api/test.h"
#include <sstream>
#include <string>
#include <time.h>
+using namespace librados;
+
std::string get_temp_pool_name()
{
char out[17];
return "";
}
+std::string create_one_pool_pp(const std::string &pool_name, Rados &cluster)
+{
+ int ret;
+ ret = cluster.init(NULL);
+ if (ret) {
+ std::ostringstream oss;
+ oss << "cluster.init failed with error " << ret;
+ return oss.str();
+ }
+ ret = cluster.conf_read_file(NULL);
+ if (ret) {
+ cluster.shutdown();
+ std::ostringstream oss;
+ oss << "cluster.conf_read_file failed with error " << ret;
+ return oss.str();
+ }
+ ret = cluster.connect();
+ if (ret) {
+ cluster.shutdown();
+ std::ostringstream oss;
+ oss << "cluster.connect failed with error " << ret;
+ return oss.str();
+ }
+ ret = cluster.pool_create(pool_name.c_str());
+ if (ret) {
+ cluster.shutdown();
+ std::ostringstream oss;
+ oss << "cluster.pool_create(" << pool_name << ") failed with error " << ret;
+ return oss.str();
+ }
+ return "";
+}
+
int destroy_one_pool(const std::string &pool_name, rados_t *cluster)
{
int ret = rados_pool_delete(*cluster, pool_name.c_str());
rados_shutdown(*cluster);
return 0;
}
+
+int destroy_one_pool_pp(const std::string &pool_name, Rados &cluster)
+{
+ int ret = cluster.pool_delete(pool_name.c_str());
+ if (ret) {
+ cluster.shutdown();
+ return ret;
+ }
+ cluster.shutdown();
+ return 0;
+}
#define CEPH_TEST_RADOS_API_TEST_H
#include "include/rados/librados.h"
+#include "include/rados/librados.hpp"
#include <string>
#include <unistd.h>
std::string get_temp_pool_name();
std::string create_one_pool(const std::string &pool_name, rados_t *cluster);
-
+std::string create_one_pool_pp(const std::string &pool_name,
+ librados::Rados &cluster);
int destroy_one_pool(const std::string &pool_name, rados_t *cluster);
+int destroy_one_pool_pp(const std::string &pool_name, librados::Rados &cluster);
class TestAlarm
{