nvme_manager: Reduce setFaultLEDs D-Bus calls

setFaultLEDs was found to take 1/3 of a read cycle on average. Reduce
the number of time-consuming D-Bus calls by doing a "get" first before
the "set".

Tested: Reduced the average setFaultLEDs operation time by 86%

Bug-Id: openbmc/phosphor-nvme#4
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I0fe85a3cb286d103ed5d915b32271cc0c3d43bba
diff --git a/nvme_manager.cpp b/nvme_manager.cpp
index e73d849..02bc819 100644
--- a/nvme_manager.cpp
+++ b/nvme_manager.cpp
@@ -116,8 +116,12 @@
     // Before toggle LED, check whether is Identify or not.
     if (!getLEDGroupState(locateLedGroupPath))
     {
-        util::SDBusPlus::setProperty(bus, LED_GROUP_BUSNAME, faultLedGroupPath,
-                                     LED_GROUP_IFACE, "Asserted", request);
+        if (getLEDGroupState(faultLedGroupPath) != request)
+        {
+            util::SDBusPlus::setProperty(bus, LED_GROUP_BUSNAME,
+                                         faultLedGroupPath, LED_GROUP_IFACE,
+                                         "Asserted", request);
+        }
     }
 }