aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/storageserverinstance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/hub/storageserverinstance.cpp')
-rw-r--r--src/zenserver/hub/storageserverinstance.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/zenserver/hub/storageserverinstance.cpp b/src/zenserver/hub/storageserverinstance.cpp
index bab501429..7933cfa70 100644
--- a/src/zenserver/hub/storageserverinstance.cpp
+++ b/src/zenserver/hub/storageserverinstance.cpp
@@ -123,7 +123,7 @@ StorageServerInstance::DeprovisionLocked()
m_State = HubInstanceState::Unprovisioned;
}
-void
+bool
StorageServerInstance::HibernateLocked()
{
// Signal server to shut down, but keep data around for later wake
@@ -133,16 +133,13 @@ StorageServerInstance::HibernateLocked()
ZEN_WARN("Attempted to hibernate storage server instance for module '{}' which is not provisioned (state: '{}')",
m_ModuleId,
ToString(m_State.load()));
- return;
+ return false;
}
if (!m_ServerInstance.IsRunning())
{
ZEN_WARN("Attempted to hibernate storage server instance for module '{}' which is not running", m_ModuleId);
-
- // This is an unexpected state. Should consider the instance invalid?
-
- return;
+ return false;
}
m_State = HubInstanceState::Hibernating;
@@ -150,12 +147,13 @@ StorageServerInstance::HibernateLocked()
{
m_ServerInstance.Shutdown();
m_State = HubInstanceState::Hibernated;
- return;
+ return true;
}
catch (const std::exception& Ex)
{
ZEN_ERROR("Failed to hibernate storage server instance for module '{}': {}", m_ModuleId, Ex.what());
m_State = HubInstanceState::Provisioned; // Shutdown failed; instance is still running
+ return false;
}
}
@@ -166,9 +164,10 @@ StorageServerInstance::WakeLocked()
if (m_State.load() != HubInstanceState::Hibernated)
{
- ZEN_WARN("Attempted to wake storage server instance for module '{}' which is not hibernated", m_ModuleId);
-
- return true; // Instance is already usable (noop success)
+ ZEN_WARN("Attempted to wake storage server instance for module '{}' which is not hibernated (state: '{}')",
+ m_ModuleId,
+ ToString(m_State.load()));
+ return false;
}
ZEN_ASSERT_FORMAT(!m_ServerInstance.IsRunning(), "Storage server instance for module '{}' is already running", m_ModuleId);
@@ -389,11 +388,11 @@ StorageServerInstance::ExclusiveLockedPtr::Deprovision()
m_Instance->DeprovisionLocked();
}
-void
+bool
StorageServerInstance::ExclusiveLockedPtr::Hibernate()
{
ZEN_ASSERT(m_Instance != nullptr);
- m_Instance->HibernateLocked();
+ return m_Instance->HibernateLocked();
}
bool