make bmc dump creation a utility function

Other parts of the code have a need for this function so put it in utils

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I223d9142e7d6ffe12ec3d59d42e848c2c859e3ce
diff --git a/utils.cpp b/utils.cpp
index 1e5e9e2..d925d4c 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -164,6 +164,26 @@
     }
 }
 
+void createBmcDump(sdbusplus::bus::bus& bus)
+{
+    auto method = bus.new_method_call(
+        "xyz.openbmc_project.Dump.Manager", "/xyz/openbmc_project/dump/bmc",
+        "xyz.openbmc_project.Dump.Create", "CreateDump");
+    method.append(
+        std::vector<
+            std::pair<std::string, std::variant<std::string, uint64_t>>>());
+    try
+    {
+        bus.call_noreply(method);
+    }
+    catch (const sdbusplus::exception::exception& e)
+    {
+        error("Failed to create BMC dump, exception:{ERROR}", "ERROR", e);
+        // just continue, this is error path anyway so we're just collecting
+        // what we can
+    }
+}
+
 } // namespace utils
 } // namespace manager
 } // namespace state