Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +1 −0 Original line number Diff line number Diff line Loading @@ -644,6 +644,7 @@ class SnapshotManager final : public ISnapshotManager { MergeFailureCode CheckMergeConsistency(LockedFile* lock, const std::string& name, const SnapshotStatus& update_status); auto UpdateStateToStr(enum UpdateState state); // Get status or table information about a device-mapper node with a single target. enum class TableQuery { Table, Loading fs_mgr/libsnapshot/snapshot.cpp +27 −3 Original line number Diff line number Diff line Loading @@ -988,6 +988,29 @@ bool SnapshotManager::IsSnapshotDevice(const std::string& dm_name, TargetInfo* t return true; } auto SnapshotManager::UpdateStateToStr(const enum UpdateState state) { switch (state) { case None: return "None"; case Initiated: return "Initiated"; case Unverified: return "Unverified"; case Merging: return "Merging"; case MergeNeedsReboot: return "MergeNeedsReboot"; case MergeCompleted: return "MergeCompleted"; case MergeFailed: return "MergeFailed"; case Cancelled: return "Cancelled"; default: return "Unknown"; } } bool SnapshotManager::QuerySnapshotStatus(const std::string& dm_name, std::string* target_type, DmTargetSnapshot::Status* status) { DeviceMapper::TargetInfo target; Loading Loading @@ -1016,7 +1039,7 @@ UpdateState SnapshotManager::ProcessUpdateState(const std::function<bool()>& cal const std::function<bool()>& before_cancel) { while (true) { auto result = CheckMergeState(before_cancel); LOG(INFO) << "ProcessUpdateState handling state: " << result.state; LOG(INFO) << "ProcessUpdateState handling state: " << UpdateStateToStr(result.state); if (result.state == UpdateState::MergeFailed) { AcknowledgeMergeFailure(result.failure_code); Loading Loading @@ -1044,7 +1067,7 @@ auto SnapshotManager::CheckMergeState(const std::function<bool()>& before_cancel } auto result = CheckMergeState(lock.get(), before_cancel); LOG(INFO) << "CheckMergeState for snapshots returned: " << result.state; LOG(INFO) << "CheckMergeState for snapshots returned: " << UpdateStateToStr(result.state); if (result.state == UpdateState::MergeCompleted) { // Do this inside the same lock. Failures get acknowledged without the Loading Loading @@ -1109,7 +1132,8 @@ auto SnapshotManager::CheckMergeState(LockedFile* lock, const std::function<bool } auto result = CheckTargetMergeState(lock, snapshot, update_status); LOG(INFO) << "CheckTargetMergeState for " << snapshot << " returned: " << result.state; LOG(INFO) << "CheckTargetMergeState for " << snapshot << " returned: " << UpdateStateToStr(result.state); switch (result.state) { case UpdateState::MergeFailed: Loading Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +1 −0 Original line number Diff line number Diff line Loading @@ -644,6 +644,7 @@ class SnapshotManager final : public ISnapshotManager { MergeFailureCode CheckMergeConsistency(LockedFile* lock, const std::string& name, const SnapshotStatus& update_status); auto UpdateStateToStr(enum UpdateState state); // Get status or table information about a device-mapper node with a single target. enum class TableQuery { Table, Loading
fs_mgr/libsnapshot/snapshot.cpp +27 −3 Original line number Diff line number Diff line Loading @@ -988,6 +988,29 @@ bool SnapshotManager::IsSnapshotDevice(const std::string& dm_name, TargetInfo* t return true; } auto SnapshotManager::UpdateStateToStr(const enum UpdateState state) { switch (state) { case None: return "None"; case Initiated: return "Initiated"; case Unverified: return "Unverified"; case Merging: return "Merging"; case MergeNeedsReboot: return "MergeNeedsReboot"; case MergeCompleted: return "MergeCompleted"; case MergeFailed: return "MergeFailed"; case Cancelled: return "Cancelled"; default: return "Unknown"; } } bool SnapshotManager::QuerySnapshotStatus(const std::string& dm_name, std::string* target_type, DmTargetSnapshot::Status* status) { DeviceMapper::TargetInfo target; Loading Loading @@ -1016,7 +1039,7 @@ UpdateState SnapshotManager::ProcessUpdateState(const std::function<bool()>& cal const std::function<bool()>& before_cancel) { while (true) { auto result = CheckMergeState(before_cancel); LOG(INFO) << "ProcessUpdateState handling state: " << result.state; LOG(INFO) << "ProcessUpdateState handling state: " << UpdateStateToStr(result.state); if (result.state == UpdateState::MergeFailed) { AcknowledgeMergeFailure(result.failure_code); Loading Loading @@ -1044,7 +1067,7 @@ auto SnapshotManager::CheckMergeState(const std::function<bool()>& before_cancel } auto result = CheckMergeState(lock.get(), before_cancel); LOG(INFO) << "CheckMergeState for snapshots returned: " << result.state; LOG(INFO) << "CheckMergeState for snapshots returned: " << UpdateStateToStr(result.state); if (result.state == UpdateState::MergeCompleted) { // Do this inside the same lock. Failures get acknowledged without the Loading Loading @@ -1109,7 +1132,8 @@ auto SnapshotManager::CheckMergeState(LockedFile* lock, const std::function<bool } auto result = CheckTargetMergeState(lock, snapshot, update_status); LOG(INFO) << "CheckTargetMergeState for " << snapshot << " returned: " << result.state; LOG(INFO) << "CheckTargetMergeState for " << snapshot << " returned: " << UpdateStateToStr(result.state); switch (result.state) { case UpdateState::MergeFailed: Loading