" listomapvals <obj-name> list the keys and vals in the object map \n"
" getomapval <obj-name> <key> [file] show the value for the specified key\n"
" in the object's object map\n"
-" setomapval <obj-name> <key> <val>\n"
+" setomapval <obj-name> <key> <val | --input-file file>\n"
" rmomapkey <obj-name> <key>\n"
" clearomap <obj-name> [obj-name2 obj-name3...] clear all the omap keys for the specified objects\n"
" getomapheader <obj-name> [file]\n"
" -s name\n"
" --snap name\n"
" select given snap name for (read) IO\n"
+" --input-file file\n"
+" use the content of the specified file in place of <val>\n"
" --create\n"
" create the pool or directory that was specified\n"
" -N namespace\n"
bool omap_key_valid = false;
std::string omap_key;
std::string omap_key_pretty;
+ std::string input_file;
bool with_reference = false;
Rados rados;
if (i != opts.end()) {
with_reference = true;
}
+ i = opts.find("input_file");
+ if (i != opts.end()) {
+ input_file = i->second;
+ }
// open rados
ret = rados.init_with_context(g_ceph_context);
}
bufferlist bl;
- if (nargs.size() > min_args) {
+ if (!input_file.empty()) {
+ string err;
+ ret = bl.read_file(input_file.c_str(), &err);
+ if (ret < 0) {
+ cerr << "error reading file " << input_file.c_str() << ": " << err << std::endl;
+ return 1;
+ }
+ } else if (nargs.size() > min_args) {
string val(nargs[min_args]);
bl.append(val);
} else {
opts["with-reference"] = "true";
} else if (ceph_argparse_witharg(args, i, &val, "--pgid", (char*)NULL)) {
opts["pgid"] = val;
+ } else if (ceph_argparse_witharg(args, i, &val, "--input-file", (char*)NULL)) {
+ opts["input_file"] = val;
} else {
if (val[0] == '-')
usage_exit();