VirtualBox

Changeset 22807 in vbox


Ignore:
Timestamp:
Sep 7, 2009 11:40:04 AM (15 years ago)
Author:
vboxsync
Message:

SSM: sketched out cancellation and handling of VMs powering off and stuff.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r22793 r22807  
    578578/** Giving up a live snapshot attempt because we're low on disk space.  */
    579579#define VERR_SSM_LOW_ON_DISK_SPACE              (-1855)
     580/** The machine was powered off while saving. */
     581#define VERR_SSM_LIVE_POWERED_OFF               (-1856)
     582/** The live snapshot/migration operation was cancelled. */
     583#define VERR_SSM_LIVE_CANCELLED                 (-1857)
     584/** The live snapshot/migration operation was aborted because of a guru
     585 *  meditation. */
     586#define VERR_SSM_LIVE_GURU_MEDITATION           (-1858)
     587/** The VM was paused while saving, don't resume execution. */
     588#define VINF_SSM_LIVE_PAUSED                    1859
    580589/** @} */
    581590
  • trunk/include/VBox/err.mac

    r22430 r22807  
    192192%define VERR_SSM_GCPHYS_OVERFLOW    (-1849)
    193193%define VERR_SSM_GCPTR_OVERFLOW    (-1850)
     194%define VINF_SSM_VOTE_FOR_ANOTHER_PASS    1851
     195%define VERR_SSM_VOTE_FOR_GIVING_UP    (-1852)
     196%define VERR_SSM_TOO_MANY_PASSES    (-1853)
     197%define VERR_SSM_STATE_GREW_TOO_BIG    (-1854)
     198%define VERR_SSM_LOW_ON_DISK_SPACE    (-1855)
     199%define VERR_SSM_LIVE_POWERED_OFF    (-1856)
     200%define VERR_SSM_LIVE_CANCELLED    (-1857)
     201%define VERR_SSM_LIVE_GURU_MEDITATION    (-1858)
     202%define VINF_SSM_LIVE_PAUSED    1859
    194203%define VERR_VM_ATRESET_NOT_FOUND    (-1900)
    195204%define VERR_VM_REQUEST_INVALID_TYPE    (-1901)
     
    419428%define VERR_SUPDRV_INTERFACE_NOT_SUPPORTED    (-3701)
    420429%define VERR_SUPDRV_SERVICE_NOT_FOUND    (-3702)
     430%define VERR_SUPDRV_KERNEL_TOO_OLD_FOR_VTX    (-3703)
    421431%define VERR_GMM_SEED_ME    (-3800)
    422432%define VERR_GMM_OUT_OF_MEMORY    (-3801)
  • trunk/src/VBox/VMM/SSM.cpp

    r22803 r22807  
    4949 * Compared to normal saved stated and snapshots, the difference is in that the
    5050 * VM is running while we do most of the saving.  Prior to LS, there was only
    51  * round of callback during saving, after LS there are 1 or more while the VM is
    52  * still running and a final one after it has been paused.  The runtime stages
    53  * is executed on a dedicated thread running at at the same priority as the EMTs
    54  * so that the saving doesn't starve or lose in scheduling questions.  The final
     51 * one round of callbacks during saving and the VM was paused during it.  With
     52 * LS there are 1 or more passes while the VM is still running and a final one
     53 * after it has been paused.  The runtime passes are executed on a dedicated
     54 * thread running at at the same priority as the EMTs so that the saving doesn't
     55 * starve or lose in scheduling questions (note: not implemented yet). The final
    5556 * pass is done on EMT(0).
    5657 *
     
    5960 *   - Takes too long (LM) / Too much output (LS).
    6061 *
    61  * FIGURE THIS: It is currently unclear who will resume the VM after it has been
    62  * paused.  The most efficient way to do this is by doing it before returning
    63  * from the VMR3Save call and use a callback for reconfiguring the disk images.
    64  * (It is more efficient because of fewer thread switches.) The more convenient
    65  * way is to have main do it after calling VMR3Save.
     62 *
     63 * The live saving sequence is something like this:
     64 *
     65 *      -# SSMR3LiveToFile is called on EMT0.  It returns a saved state
     66 *         handle.
     67 *      -# SSMR3LiveDoStep1 is called on a non-EMT.  This will save the major
     68 *         parts of the state while the VM may still be running.
     69 *      -# The VM is suspended.
     70 *      -# SSMR3LiveDoStep2 is called on EMT0 to save the remainder of the state
     71 *         in the normal way.
     72 *      -# The client does any necessary reconfiguration of harddisks and
     73 *         similar.
     74 *      -# SSMR3LiveDone is called on EMT0 to close the handle.
     75 *      -# The VM is resumed or powered off and destroyed.
    6676 *
    6777 *
     
    40394049    pSSM->rc = VINF_SUCCESS;
    40404050    pSSM->enmOp = SSMSTATE_LIVE_EXEC;
    4041     for (PSSMUNIT pUnit = pVM->ssm.s.pHead; pUnit; pUnit = pUnit->pNext)
     4051    for (PSSMUNIT pUnit = pVM->ssm.s.pHead;
     4052         /** @todo VMR3GetState(pVM) == VMSTATE_LIVE_SAVING &&*/ pUnit;
     4053         pUnit = pUnit->pNext)
    40424054    {
    40434055        /*
     
    42324244            }
    42334245        }
     4246#if 0
     4247        /*
     4248         * Check the VM state to see if it has changed.
     4249         */
     4250        VMSTATE enmState = VMR3GetState(pVM);
     4251        if (enmState != VMSTATE_LIVE_SAVING)
     4252        {
     4253            switch (enmState)
     4254            {
     4255                case VMSTATE_LIVE_CANCELLED:
     4256                    LogRel(("SSM: Cancelled\n"));
     4257                    return pSSM->rc = VERR_SSM_LIVE_CANCELLED;
     4258                case VMSTATE_LIVE_POWERED_OFF:
     4259                    LogRel(("SSM: Powered off, no state to save, aborting.\n"));
     4260                    return pSSM->rc = VERR_SSM_LIVE_POWERED_OFF;
     4261                case VMSTATE_GURU_MEDITATION:
     4262                    LogRel(("SSM: Guru meditation, aborting.\n"));
     4263                    return pSSM->rc = VERR_SSM_LIVE_GURU_MEDITATION;
     4264                default:
     4265                    LogRel(("SSM: Invalid VM state transition: %d->%d\n", VMSTATE_LIVE_SAVING, enmState));
     4266                    return pSSM->rc = VERR_INTERNAL_ERROR_3;
     4267            }
     4268        }
     4269#endif
    42344270    }
    42354271
     
    43054341 * Start saving the live state to a file.
    43064342 *
    4307  * The live saving sequence is something like this:
    4308  *
    4309  *      -# SSMR3LiveToFile is called on EMT0.  It returns a saved state
    4310  *         handle.
    4311  *      -# SSMR3LiveDoStep1 is called on a non-EMT.  This will save the major
    4312  *         parts of the state while the VM may still be running.
    4313  *      -# The VM is suspended.
    4314  *      -# SSMR3LiveDoStep2 is called on EMT0 to save the remainder of the state
    4315  *         in the normal way.
    4316  *      -# The client does any necessary reconfiguration of harddisks and
    4317  *         similar.
    4318  *      -# SSMR3LiveDone is called on EMT0 to close the handle.
    4319  *      -# The VM is resumed or powered off and destroyed.
    4320  *
     4343 * Call SSMR3LiveDoStep1, SSMR3LiveDoStep2 and finally SSMR3LiveDone on success.
    43214344 * SSMR3LiveDone should be called even if SSMR3LiveDoStep1 or SSMR3LiveDoStep2
    43224345 * fails.
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