Miscellaneous improvements to activation/item updater
This commit slightly enhances and improves the item updater and the
activation process, addressing a few issues that were raised in code
review of openbmc/openbmc#1756
1.) Service file booleans used in activation are reset to false, to
avoid a BMC-flavored issue in the vein of openbmc/openbmc#1984
2.) systemd constants used in multiple places are moved to configure.ac
3.) Activation objects are unsubscribed from systemd signals at the end
of that process.
Resolves openbmc/openbmc#2031
Change-Id: I573645b16bca28ac6bf3b173d5b4845205224e07
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index 1e04230..2a8c122 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -1,5 +1,6 @@
#include "activation.hpp"
#include "item_updater.hpp"
+#include "config.h"
namespace phosphor
{
@@ -10,22 +11,28 @@
namespace softwareServer = sdbusplus::xyz::openbmc_project::Software::server;
-constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
-constexpr auto SYSTEMD_PATH = "/org/freedesktop/systemd1";
-constexpr auto SIGNAL_INTERFACE = "/org/freedesktop/systemd1";
-constexpr auto MANAGER_INTERFACE = "org.freedesktop.systemd1.Manager";
-
void Activation::subscribeToSystemdSignals()
{
- auto method = this->bus.new_method_call(SYSTEMD_SERVICE,
+ auto method = this->bus.new_method_call(SYSTEMD_BUSNAME,
SYSTEMD_PATH,
- SIGNAL_INTERFACE,
+ SYSTEMD_INTERFACE,
"Subscribe");
this->bus.call_noreply(method);
return;
}
+void Activation::unsubscribeFromSystemdSignals()
+{
+ auto method = this->bus.new_method_call(SYSTEMD_BUSNAME,
+ SYSTEMD_PATH,
+ SYSTEMD_INTERFACE,
+ "Unsubscribe");
+ this->bus.call_noreply(method);
+
+ return;
+}
+
auto Activation::activation(Activations value) ->
Activations
{
@@ -48,9 +55,9 @@
}
auto method = bus.new_method_call(
- SYSTEMD_SERVICE,
+ SYSTEMD_BUSNAME,
SYSTEMD_PATH,
- MANAGER_INTERFACE,
+ SYSTEMD_INTERFACE,
"StartUnit");
method.append("obmc-flash-bmc-ubirw.service", "replace");
bus.call_noreply(method);
@@ -58,9 +65,9 @@
auto roServiceFile = "obmc-flash-bmc-ubiro@" + versionId +
".service";
method = bus.new_method_call(
- SYSTEMD_SERVICE,
+ SYSTEMD_BUSNAME,
SYSTEMD_PATH,
- MANAGER_INTERFACE,
+ SYSTEMD_INTERFACE,
"StartUnit");
method.append(roServiceFile, "replace");
bus.call_noreply(method);
@@ -78,6 +85,11 @@
}
activationBlocksTransition.reset(nullptr);
+
+ rwVolumeCreated = false;
+ roVolumeCreated = false;
+ Activation::unsubscribeFromSystemdSignals();
+
return softwareServer::Activation::activation(
softwareServer::Activation::Activations::Active);
}