oem: Fix to remove extra system dump

An unwanted system dump is being generated if the resource dump is
initiated from hypervisor with an empty vsp string. So the fix here
is to additionally check the resource dump progress status and block
sending the command to hypervisor if the status is not in progress.

Tested by initiating a resource dump from hypervisor with an empty
string and observed that extra system dump was not getting generated
after the fix.

Signed-off-by: Jayashankar Padath <jayashankar.padath@in.ibm.com>
Change-Id: I25c1db3510d6f44b354881e4065aa148fe618464
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index a0a8e38..67ea9fb 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -111,6 +111,28 @@
 void DbusToFileHandler::processNewResourceDump(
     const std::string& vspString, const std::string& resDumpReqPass)
 {
+    try
+    {
+        std::string objPath = resDumpCurrentObjPath;
+        auto propVal = pldm::utils::DBusHandler().getDbusPropertyVariant(
+            objPath.c_str(), "Status", resDumpProgressIntf);
+        const auto& curResDumpStatus = std::get<ResDumpStatus>(propVal);
+
+        if (curResDumpStatus !=
+            "xyz.openbmc_project.Common.Progress.OperationStatus.InProgress")
+        {
+            return;
+        }
+    }
+    catch (const sdbusplus::exception_t& e)
+    {
+        std::cerr << "Error " << e.what()
+                  << " found in getting current resource dump status while "
+                     "initiating a new resource dump with objPath="
+                  << resDumpCurrentObjPath.str.c_str()
+                  << " and intf=" << resDumpProgressIntf << "\n";
+    }
+
     namespace fs = std::filesystem;
     const fs::path resDumpDirPath = "/var/lib/pldm/resourcedump";
 
diff --git a/oem/ibm/requester/dbus_to_file_handler.hpp b/oem/ibm/requester/dbus_to_file_handler.hpp
index f527f2c..0fbec1c 100644
--- a/oem/ibm/requester/dbus_to_file_handler.hpp
+++ b/oem/ibm/requester/dbus_to_file_handler.hpp
@@ -15,6 +15,8 @@
 {
 namespace oem_ibm
 {
+using ResDumpStatus = std::string;
+
 /** @class DbusToFileHandler
  *  @brief This class can process resource dump parameters and send PLDM
  *         new file available cmd to the hypervisor. This class can be used