]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/DaemonState: clean up device life_expectancy values
authorSage Weil <sage@redhat.com>
Fri, 12 Oct 2018 13:40:30 +0000 (08:40 -0500)
committerSage Weil <sage@redhat.com>
Fri, 12 Oct 2018 13:40:30 +0000 (08:40 -0500)
Instead of "0.000000" for empty time values, use "".

Signed-off-by: Sage Weil <sage@redhat.com>
src/mgr/DaemonState.cc

index 8bae839c71939e23300cf0e38a97c93c07bea100..2ef768e352ee389fc446ad91545cb26fc07011b4 100644 (file)
@@ -43,9 +43,21 @@ void DeviceState::set_life_expectancy(utime_t from, utime_t to, utime_t now)
 {
   life_expectancy = make_pair(from, to);
   life_expectancy_stamp = now;
-  metadata["life_expectancy_min"] = stringify(life_expectancy.first);
-  metadata["life_expectancy_max"] = stringify(life_expectancy.second);
-  metadata["life_expectancy_stamp"] = stringify(life_expectancy_stamp);
+  if (from != utime_t()) {
+    metadata["life_expectancy_min"] = from;
+  } else {
+    metadata["life_expectancy_min"] = "";
+  }
+  if (to != utime_t()) {
+    metadata["life_expectancy_max"] = to;
+  } else {
+    metadata["life_expectancy_max"] = "";
+  }
+  if (now != utime_t()) {
+    metadata["life_expectancy_stamp"] = stringify(now);
+  } else {
+    metadata["life_expectancy_stamp"] = "";
+  }
 }
 
 void DeviceState::rm_life_expectancy()