This will allow a user to store binary values within omap. Since
RBD uses binary omap values, this will assist with certain recovery
operations.
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
ret = 0;
}
} else if (strcmp(nargs[0], "setomapval") == 0) {
- if (!pool_name || nargs.size() < 4)
+ if (!pool_name || nargs.size() < 3 || nargs.size() > 4)
usage_exit();
string oid(nargs[1]);
string key(nargs[2]);
- string val(nargs[3]);
- map<string, bufferlist> values;
bufferlist bl;
- bl.append(val);
+ if (nargs.size() == 4) {
+ string val(nargs[3]);
+ bl.append(val);
+ } else {
+ do {
+ ret = bl.read_fd(STDIN_FILENO, 1024); // from stdin
+ if (ret < 0) {
+ goto out;
+ }
+ } while (ret > 0);
+ }
+
+ map<string, bufferlist> values;
values[key] = bl;
ret = io_ctx.omap_set(oid, values);