<< cpp_strerror(-ret) << dendl;
}
- populate_metadata();
-
client_lock.Lock();
initialized = true;
client_lock.Unlock();
* Populate a map of strings with client-identifying metadata,
* such as the hostname. Call this once at initialization.
*/
-void Client::populate_metadata()
+void Client::populate_metadata(const std::string &mount_root)
{
// Hostname
struct utsname u;
metadata["entity_id"] = cct->_conf->name.get_id();
// Our mount position
- metadata["root"] = cct->_conf->client_mountpoint;
+ if (!mount_root.empty()) {
+ metadata["root"] = mount_root;
+ }
// Ceph version
metadata["ceph_version"] = pretty_version_to_str();
return -ENOENT;
}
+ if (metadata.empty()) {
+ // We are called on an unmounted client, so metadata
+ // won't be initialized yet.
+ populate_metadata("");
+ }
+
// Send commands to targets
C_GatherBuilder gather(cct, onfinish);
for (const auto target_gid : non_laggy) {
}
}
+ populate_metadata(mount_root.empty() ? "/" : mount_root);
+
filepath fp(CEPH_INO_ROOT);
if (!mount_root.empty()) {
- metadata["root"] = mount_root.c_str();
fp = filepath(mount_root.c_str());
}
while (true) {
// Optional extra metadata about me to send to the MDS
std::map<std::string, std::string> metadata;
- void populate_metadata();
+ void populate_metadata(const std::string &mount_root);
/* async block write barrier support */