VirtualBox

Changeset 91363 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Sep 24, 2021 1:08:32 PM (3 years ago)
Author:
vboxsync
Message:

FE/VBoxSDL+VirtualBox,Main/Console+Machine+VirtualBox.xidl: VMs which
crash while restoring from the 'Saved' state shouldn't lose their saved
state file. bugref:1484

A new machine state named 'AbortedSaved' has been added which a VM will
enter if it crashes when restoring from the 'Saved' state before the
'Running' state has been reached. A VM in the 'AbortedSaved' machine
state will have its saved state file preserved so that the VM can still be
restored once the cause of the failure to powerUp() and reach the
'Running' state has been resolved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r91326 r91363  
    15811581HRESULT Console::i_loadDataFromSavedState()
    15821582{
    1583     if (mMachineState != MachineState_Saved || mSavedStateDataLoaded)
     1583    if ((mMachineState != MachineState_Saved && mMachineState != MachineState_AbortedSaved) || mSavedStateDataLoaded)
    15841584        return S_OK;
    15851585
     
    21822182        /* extra nice error message for a common case */
    21832183        case MachineState_Saved:
     2184        case MachineState_AbortedSaved:
    21842185            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down a saved virtual machine"));
    21852186        case MachineState_Stopping:
     
    29652966
    29662967    /// @todo see @todo in AttachUSBDevice() about the Paused state
    2967     if (mMachineState == MachineState_Saved)
     2968    if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    29682969        return setError(VBOX_E_INVALID_VM_STATE,
    2969                         tr("Cannot create a transient shared folder on the machine in the saved state"));
     2970                        tr("Cannot create a transient shared folder on a machine in a saved state (machine state: %s)"),
     2971                        Global::stringifyMachineState(mMachineState));
    29702972    if (   mMachineState != MachineState_PoweredOff
    29712973        && mMachineState != MachineState_Teleported
     
    30363038
    30373039    /// @todo see @todo in AttachUSBDevice() about the Paused state
    3038     if (mMachineState == MachineState_Saved)
     3040    if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    30393041        return setError(VBOX_E_INVALID_VM_STATE,
    3040                         tr("Cannot remove a transient shared folder from the machine in the saved state"));
     3042                        tr("Cannot remove a transient shared folder from a machine in a saved state (machine state: %s)"),
     3043                        Global::stringifyMachineState(mMachineState));;
    30413044    if (   mMachineState != MachineState_PoweredOff
    30423045        && mMachineState != MachineState_Teleported
     
    77057708        pPowerupProgress.createObject();
    77067709        Bstr progressDesc;
    7707         if (mMachineState == MachineState_Saved)
     7710        if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    77087711            progressDesc = tr("Restoring virtual machine");
    77097712        else if (fTeleporterEnabled)
     
    77177720         * Saved VMs will have to prove that their saved states seem kosher.
    77187721         */
    7719         if (mMachineState == MachineState_Saved)
     7722        if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    77207723        {
    77217724            rc = mMachine->COMGETTER(StateFilePath)(savedStateFile.asOutParam());
     
    77847787        task->mSharedFolders = sharedFolders;
    77857788        task->mStartPaused = aPaused;
    7786         if (mMachineState == MachineState_Saved)
     7789        if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    77877790            try { task->mSavedStateFile = savedStateFile; }
    77887791            catch (std::bad_alloc &) { throw rc = E_OUTOFMEMORY; }
     
    79287931        }
    79297932        else if (   mMachineState == MachineState_Saved
     7933                 || mMachineState == MachineState_AbortedSaved
    79307934                 || !fTeleporterEnabled)
    79317935        {
     
    80428046         * since we've already started the thread and it is now responsible for
    80438047         * any error reporting and appropriate state change! */
    8044         if (mMachineState == MachineState_Saved)
     8048        if (mMachineState == MachineState_Saved || mMachineState == MachineState_AbortedSaved)
    80458049            i_setMachineState(MachineState_Restoring);
    80468050        else if (fTeleporterEnabled)
     
    89648968                case MachineState_Restoring:
    89658969                    /* failed to load the saved state file, but be patient: set
    8966                      * back to Saved (to preserve the saved state file) */
    8967                     that->i_setMachineState(MachineState_Saved);
     8970                     * to AbortedSaved (to preserve the saved state file) */
     8971                    that->i_setMachineState(MachineState_AbortedSaved);
    89688972                    break;
    89698973                case MachineState_TeleportingIn:
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette