File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3567,12 +3567,18 @@ error_string mp::Daemon::async_wait_for_ssh_and_start_mounts_for(
35673567 vm->wait_for_cloud_init (timeout);
35683568 }
35693569 }
3570- catch (const mp::IntentionalShutdownException&)
3570+ catch (const mp::IntentionalShutdownException& e )
35713571 {
3572- mpl::log (mpl::Level::info,
3573- name,
3574- " Instance powered off intentionally during initialization" );
3575- return {}; // Success - intentional shutdown
3572+ if constexpr (std::is_same_v<Request, LaunchRequest>)
3573+ {
3574+ mpl::log (mpl::Level::info, name,
3575+ " Instance powered off intentionally during initialization" );
3576+ return {}; // Success - intentional shutdown
3577+ }
3578+ else
3579+ {
3580+ throw StartException (name, " Unexpected shutdown during start" );
3581+ }
35763582 }
35773583
35783584 if (MP_SETTINGS.get_as <bool >(mp::mounts_key))
Original file line number Diff line number Diff line change @@ -316,12 +316,12 @@ void mp::BaseVirtualMachine::wait_for_cloud_init(std::chrono::milliseconds timeo
316316 try_to_ssh ();
317317 return mpu::TimeoutAction::retry;
318318 }
319- catch (const SSHExecFailure& e) // transitioning away from catching generic runtime errors
320- { // TODO remove once we're confident this is an anomaly
319+ catch (const SSHExecFailure& e)
320+ {
321321 return mpu::TimeoutAction::retry;
322322 }
323- catch (const std::exception& e)
324- {
323+ catch (const std::exception& e) // transitioning away from catching generic runtime errors
324+ { // TODO remove once we're confident this is an anomaly
325325 mpl::log_message (mpl::Level::warning, vm_name, e.what ());
326326 return mpu::TimeoutAction::retry;
327327 }
@@ -330,7 +330,6 @@ void mp::BaseVirtualMachine::wait_for_cloud_init(std::chrono::milliseconds timeo
330330 auto on_timeout = [] {
331331 throw std::runtime_error (" timed out waiting for initialization to complete" );
332332 };
333-
334333 mpu::try_action_for (on_timeout, timeout, action);
335334}
336335
Original file line number Diff line number Diff line change @@ -448,9 +448,9 @@ void mp::VirtualBoxVirtualMachine::suspend()
448448mp::VirtualMachine::State mp::VirtualBoxVirtualMachine::current_state ()
449449{
450450 auto present_state = instance_state_for (name);
451- if (state == State::delayed_shutdown && present_state == State::running)
451+ if (( state == State::delayed_shutdown && present_state == State::running) || state == State::starting )
452452 return state;
453-
453+
454454 state = present_state;
455455 if (state == State::suspended || state == State::suspending)
456456 drop_ssh_session ();
You can’t perform that action at this time.
0 commit comments