summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Tritz <mtritz@us.ibm.com>2017-09-22 15:16:11 -0500
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-10-03 13:41:29 +0000
commitfa7aa12cdbf1ef7e70655fd62ed4ec28a885ce83 (patch)
treeaf65707c09ef95a653d51a20cbae68ea6caacae2
parent6a52226d5e43d8a5c0f300af0322ae65283463dd (diff)
downloadopenpower-pnor-code-mgmt-fa7aa12cdbf1ef7e70655fd62ed4ec28a885ce83.tar.gz
openpower-pnor-code-mgmt-fa7aa12cdbf1ef7e70655fd62ed4ec28a885ce83.zip
Host reset: Change deletes to clears
This commit changes the behavior of the host factory reset to clear affected read-write and preserved volumes, rather than deleting them. Resolves openbmc/openbmc#2322 Change-Id: Ib08f6ef039e32034ce18d80ce82e8a75021f81c2 Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
-rw-r--r--item_updater.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/item_updater.cpp b/item_updater.cpp
index 7692293af..5ef6bd03e 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -318,28 +318,43 @@ void ItemUpdater::removeReadWritePartition(std::string versionId)
bus.call_noreply(method);
}
-void ItemUpdater::removePreservedPartition()
+void ItemUpdater::reset()
{
- // Remove the preserved partition.
+ for (const auto& it : activations)
+ {
+ auto serviceFile = "obmc-flash-bios-ubiclear@pnor-rw-" + it.first +
+ ".service";
+
+ // Clear the read-write partitions.
+ auto method = bus.new_method_call(
+ SYSTEMD_BUSNAME,
+ SYSTEMD_PATH,
+ SYSTEMD_INTERFACE,
+ "StartUnit");
+ method.append(serviceFile, "replace");
+ auto reply = bus.call(method);
+
+ if (reply.is_method_error())
+ {
+ elog<InternalFailure>();
+ }
+
+ removeFile(it.first);
+ }
+ // Clear the preserved partition.
auto method = bus.new_method_call(
SYSTEMD_BUSNAME,
SYSTEMD_PATH,
SYSTEMD_INTERFACE,
"StartUnit");
- method.append("obmc-flash-bios-ubiumount-prsv.service", "replace");
- bus.call_noreply(method);
-
- return;
-}
+ method.append("obmc-flash-bios-ubiclear@pnor-prsv.service", "replace");
+ auto reply = bus.call(method);
-void ItemUpdater::reset()
-{
- for (const auto& it : activations)
+ if (reply.is_method_error())
{
- removeReadWritePartition(it.first);
- removeFile(it.first);
+ elog<InternalFailure>();
}
- removePreservedPartition();
+
return;
}
OpenPOWER on IntegriCloud