OpenPOWER: Fix for host dump delete

If the dump is not created by host or the request is not
complete the dump id provided by the host will not be
valid. When deleting such dump entries a request for
delete should not be send to the host.

Tests:

Deleting a dump which is not finished when host is running

Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: If7e8b7fad67c215f057152bb64b5232f198fee9e
diff --git a/dump-extensions/openpower-dumps/resource_dump_entry.cpp b/dump-extensions/openpower-dumps/resource_dump_entry.cpp
index 0954e9a..a1d90a2 100644
--- a/dump-extensions/openpower-dumps/resource_dump_entry.cpp
+++ b/dump-extensions/openpower-dumps/resource_dump_entry.cpp
@@ -2,6 +2,7 @@
 
 #include "dump_utils.hpp"
 #include "host_transport_exts.hpp"
+#include "op_dump_consts.hpp"
 
 #include <phosphor-logging/elog-errors.hpp>
 #include <xyz/openbmc_project/Common/error.hpp>
@@ -43,7 +44,7 @@
 
     // Remove resource dump when host is up by using source dump id
     // which is present in resource dump entry dbus object as a property.
-    if (phosphor::dump::isHostRunning())
+    if ((phosphor::dump::isHostRunning()) && (srcDumpID != INVALID_SOURCE_ID))
     {
         phosphor::dump::host::requestDelete(srcDumpID,
                                             TRANSPORT_DUMP_TYPE_IDENTIFIER);