#include <iostream>
#include <errno.h>
+#include <string>
#include "include/rados/librados.hpp"
#include "include/encoding.h"
#include "test/librados/test_cxx.h"
#include "gtest/gtest.h"
+#include "json_spirit/json_spirit.h"
using namespace librados;
ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster));
}
+static std::string _get_required_osd_release(Rados& cluster)
+{
+ bufferlist inbl;
+ std::string cmd = std::string("{\"prefix\": \"osd dump\",\"format\":\"json\"}");
+ bufferlist outbl;
+ int r = cluster.mon_command(cmd, inbl, &outbl, NULL);
+ ceph_assert(r >= 0);
+ std::string outstr(outbl.c_str(), outbl.length());
+ json_spirit::Value v;
+ if (!json_spirit::read(outstr, v)) {
+ std::cerr <<" unable to parse json " << outstr << std::endl;
+ return "";
+ }
+
+ json_spirit::Object& o = v.get_obj();
+ for (json_spirit::Object::size_type i=0; i<o.size(); i++) {
+ json_spirit::Pair& p = o[i];
+ if (p.name_ == "require_osd_release") {
+ std::cout << "require_osd_release = " << p.value_.get_str() << std::endl;
+ return p.value_.get_str();
+ }
+ }
+ std::cerr << "didn't find require_osd_release in " << outstr << std::endl;
+ return "";
+}
+
TEST(ClsHello, WriteReturnData) {
Rados cluster;
std::string pool_name = get_temp_pool_name();
IoCtx ioctx;
cluster.ioctx_create(pool_name.c_str(), ioctx);
+ // skip test if not yet mimic
+ if (_get_required_osd_release(cluster) < "octopus") {
+ std::cout << "cluster is not yet octopus, skipping test" << std::endl;
+ return;
+ }
+
// this will return nothing -- not flag set
bufferlist in, out;
ASSERT_EQ(0, ioctx.exec("myobject", "hello", "write_return_data", in, out));