]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: Apply sanity check for daemon metadata 25725/head
authorXinying Song <songxinying@sensetime.com>
Tue, 15 Jan 2019 11:18:20 +0000 (19:18 +0800)
committerXinying Song <songxinying@sensetime.com>
Tue, 15 Jan 2019 11:21:32 +0000 (19:21 +0800)
Signed-off-by: Xinying Song <songxinying@sensetime.com>
src/mgr/Mgr.cc

index e4c83c4e1526e9d3b50b54bd0790f93bbacc11fa..24188518bfa34e1807a4aa92f01ac23cb37ae866 100644 (file)
@@ -85,6 +85,13 @@ void MetadataUpdate::finish(int r)
 
       json_spirit::mObject daemon_meta = json_result.get_obj();
 
+      // Skip daemon who doesn't have hostname yet
+      if (daemon_meta.count("hostname") == 0) {
+        dout(1) << "Skipping incomplete metadata entry for "
+                << key.first << "." << key.second << dendl;
+        return;
+      }
+
       // Apply any defaults
       for (const auto &i : defaults) {
         if (daemon_meta.find(i.first) == daemon_meta.end()) {