Skip to content

Commit

Permalink
Merge pull request #3706 from canonical/unify_unknown_state_err_msg
Browse files Browse the repository at this point in the history
Unify unknown state err msg
  • Loading branch information
ricab authored Oct 2, 2024
2 parents 602c754 + 8c90619 commit 76172f4
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/daemon/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2072,13 +2072,15 @@ try // clang-format on
{
case VirtualMachine::State::unknown:
{
auto error_string = fmt::format("Instance \'{}\' is already running, but in an unknown state", name);
auto error_string = fmt::format("Instance '{0}' is already running, but in an unknown state.\n"
"Try to stop it first.",
name);
mpl::log(mpl::Level::warning, category, error_string);
fmt::format_to(std::back_inserter(start_errors), error_string);
continue;
}
case VirtualMachine::State::suspending:
fmt::format_to(std::back_inserter(start_errors), "Cannot start the instance \'{}\' while suspending", name);
fmt::format_to(std::back_inserter(start_errors), "Cannot start the instance '{}' while suspending.", name);
continue;
case VirtualMachine::State::delayed_shutdown:
delayed_shutdown_instances.erase(name);
Expand Down Expand Up @@ -3129,7 +3131,10 @@ grpc::Status mp::Daemon::reboot_vm(VirtualMachine& vm)

if (!MP_UTILS.is_running(vm.current_state()))
return grpc::Status{grpc::StatusCode::INVALID_ARGUMENT,
fmt::format("instance \"{}\" is not running", vm.vm_name), ""};
fmt::format("Instance '{0}' is already running, but in an unknown state.\n"
"Try to stop and start it instead.",
vm.vm_name),
""};

mpl::log(mpl::Level::debug, category, fmt::format("Rebooting {}", vm.vm_name));
return ssh_reboot(vm);
Expand Down

0 comments on commit 76172f4

Please sign in to comment.