From: David Zafman Date: Wed, 15 Jul 2015 00:45:58 +0000 (-0700) Subject: rados: Fix bug in export of xattr which dropped first char of key on import X-Git-Tag: v9.1.0~523^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1b3f899c142be814177426df7aacad06e1644edc;p=ceph.git rados: Fix bug in export of xattr which dropped first char of key on import This was caused because the user xattrs exported in a pg includes a underscore prepended to the xattr key. Signed-off-by: David Zafman --- diff --git a/src/tools/rados/PoolDump.cc b/src/tools/rados/PoolDump.cc index 998bd54f4b2..69963ee264d 100644 --- a/src/tools/rados/PoolDump.cc +++ b/src/tools/rados/PoolDump.cc @@ -94,13 +94,20 @@ int PoolDump::dump(IoCtx *io_ctx) // Compose TYPE_ATTRS chunk // ======================== + std::map raw_xattrs; std::map xattrs; - r = io_ctx->getxattrs(oid, xattrs); + r = io_ctx->getxattrs(oid, raw_xattrs); if (r < 0) { cerr << "error getting xattr set " << oid << ": " << cpp_strerror(r) << std::endl; return r; } + // Prepend "_" to mimic how user keys are represented in a pg export + for (std::map::iterator i = raw_xattrs.begin(); + i != raw_xattrs.end(); ++i) { + std::pair< std::string, bufferlist> item(std::string("_") + std::string(i->first.c_str()), i->second); + xattrs.insert(item); + } r = write_section(TYPE_ATTRS, attr_section(xattrs), file_fd); if (r != 0) { return r;