storage metric: add generic implementation

Add the generic implementation for the storage metric, so there is no
need to add a new enum value and new code, every time a new storage
type needs to be added.

Change-Id: Idcd99455ca559eb6274a71613684a99b4b63a6f0
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_metric_collection.cpp b/health_metric_collection.cpp
index ea587ac..d83f8d0 100644
--- a/health_metric_collection.cpp
+++ b/health_metric_collection.cpp
@@ -102,7 +102,7 @@
         debug("CPU Metric {SUBTYPE}: {VALUE}", "SUBTYPE", config.subType,
               "VALUE", (double)activePercValue);
         /* For CPU, both user and monitor uses percentage values */
-        metrics[config.subType]->update(MValue(activePercValue, 100));
+        metrics[config.name]->update(MValue(activePercValue, 100));
     }
     return true;
 }
@@ -159,7 +159,7 @@
         auto total = memoryValues.at(MetricIntf::SubType::memoryTotal) * 1024;
         debug("Memory Metric {SUBTYPE}: {VALUE}, {TOTAL}", "SUBTYPE",
               config.subType, "VALUE", value, "TOTAL", total);
-        metrics[config.subType]->update(MValue(value, total));
+        metrics[config.name]->update(MValue(value, total));
     }
     return true;
 }
@@ -180,7 +180,7 @@
         double total = buffer.f_blocks * buffer.f_frsize;
         debug("Storage Metric {SUBTYPE}: {VALUE}, {TOTAL}", "SUBTYPE",
               config.subType, "VALUE", value, "TOTAL", total);
-        metrics[config.subType]->update(MValue(value, total));
+        metrics[config.name]->update(MValue(value, total));
     }
     return true;
 }
@@ -227,12 +227,7 @@
 
     for (auto& config : configs)
     {
-        /* TODO: Remove this after adding iNode support */
-        if (config.subType == MetricIntf::SubType::NA)
-        {
-            continue;
-        }
-        metrics[config.subType] = std::make_unique<MetricIntf::HealthMetric>(
+        metrics[config.name] = std::make_unique<MetricIntf::HealthMetric>(
             bus, type, config, bmcPaths);
     }
 }