if process_pg_map_command() fails to fulfill the request, we should keep
the odata intact. and let the module take care of it.
before this change, we always write to odata even if
process_pg_map_command() returns -EOPNOTSUPP, this leaves unnecessary
leftover in the output, like pg_info,pg_ready.
after this change, we won't touch odata if process_pg_map_command()
returns -EOPNOTSUPP. and odata will be filled with whatever the python
module returns.
Fixes: http://tracker.ceph.com/issues/37444
Signed-off-by: Kefu Chai <kchai@redhat.com>
if (f) {
f->close_section();
- f->flush(cmdctx->odata);
}
if (r != -EOPNOTSUPP) {
+ if (f) {
+ f->flush(cmdctx->odata);
+ }
cmdctx->reply(r, ss);
return true;
}