]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: Apply sanity check for daemon metadata 26235/head
authorXinying Song <songxinying@sensetime.com>
Tue, 15 Jan 2019 11:18:20 +0000 (19:18 +0800)
committerPrashant D <pdhange@redhat.com>
Thu, 31 Jan 2019 23:21:03 +0000 (18:21 -0500)
Signed-off-by: Xinying Song <songxinying@sensetime.com>
(cherry picked from commit 3c333f3599642f29dc7a080570ed6b1954e49dce)

src/mgr/Mgr.cc

index 17389d3de5e1ea98e03cde1093ae68420aa60907..05d1b004c9f6f2c68ba19242c321746ef5899ff7 100644 (file)
@@ -87,6 +87,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()) {