VirtualBox

Ignore:
Timestamp:
Nov 3, 2009 10:07:55 PM (15 years ago)
Author:
vboxsync
Message:

Main,Frontends: Added two new running states: Teleporting and LiveSnapshotting. Also added TeleportingPausedVM. Renamed TeleportingFrom to TeleportingIn.

File:
1 edited

Legend:

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

    r24255 r24301  
    15041504    AutoWriteLock alock(this);
    15051505
    1506     if (!Global::IsActive(mMachineState))
    1507     {
     1506    /** @todo Live Migration: Support powering down while teleporting. Maybe also
     1507     *        while taking a live snapshot.  (In case they never finish and you
     1508     *        or some other operator wish to shut down the VM.) */
     1509    switch (mMachineState)
     1510    {
     1511        case MachineState_Running:
     1512        case MachineState_Paused:
     1513        case MachineState_Stuck:
     1514            break;
     1515
    15081516        /* extra nice error message for a common case */
    1509         if (mMachineState == MachineState_Saved)
     1517        case MachineState_Saved:
     1518            return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down a saved virtual machine"));
     1519        case MachineState_Stopping:
     1520            return setError(VBOX_E_INVALID_VM_STATE, tr("Virtual machine is being powered down."));
     1521        default:
    15101522            return setError(VBOX_E_INVALID_VM_STATE,
    1511                 tr("Cannot power down a saved virtual machine"));
    1512         else if (mMachineState == MachineState_Stopping)
    1513             return setError(VBOX_E_INVALID_VM_STATE,
    1514                 tr("Virtual machine is being powered down."));
    1515         else
    1516             return setError(VBOX_E_INVALID_VM_STATE,
    1517                 tr("Invalid machine state: %s (must be Running, Paused or Stuck)"),
    1518                 Global::stringifyMachineState(mMachineState));
     1523                            tr("Invalid machine state: %s (must be Running, Paused or Stuck)"),
     1524                            Global::stringifyMachineState(mMachineState));
    15191525    }
    15201526
     
    15641570    AutoWriteLock alock(this);
    15651571
    1566     if (mMachineState != MachineState_Running)
     1572    if (   mMachineState != MachineState_Running
     1573        && mMachineState != MachineState_Teleporting
     1574        && mMachineState != MachineState_LiveSnapshotting
     1575        /** @todo r=bird: This should be allowed on paused VMs as well. Later.  */
     1576       )
    15671577        return setError(VBOX_E_INVALID_VM_STATE,
    15681578            tr("Invalid machine state: %s"),
     
    15971607    AutoWriteLock alock(this);
    15981608
    1599     if (mMachineState != MachineState_Running)
     1609    if (   mMachineState != MachineState_Running
     1610        && mMachineState != MachineState_Teleporting
     1611        && mMachineState != MachineState_LiveSnapshotting
     1612       )
    16001613        return setError(VBOX_E_INVALID_VM_STATE,
    16011614            tr("Invalid machine state: %s"),
     
    16711684    AutoWriteLock alock(this);
    16721685
    1673     if (mMachineState != MachineState_Running)
     1686    if (   mMachineState != MachineState_Running
     1687        && mMachineState != MachineState_Teleporting
     1688        && mMachineState != MachineState_LiveSnapshotting
     1689       )
    16741690        return setError(VBOX_E_INVALID_VM_STATE,
    16751691            tr("Invalid machine state: %s"),
     
    17121728    AutoWriteLock alock(this);
    17131729
    1714     if (mMachineState != MachineState_Running)
     1730    if (   mMachineState != MachineState_Running
     1731        && mMachineState != MachineState_Teleporting
     1732        && mMachineState != MachineState_LiveSnapshotting
     1733       )
    17151734        return setError(VBOX_E_INVALID_VM_STATE,
    17161735            tr("Invalid machine state: %s"),
     
    17561775    AutoWriteLock alock(this);
    17571776
    1758     if (mMachineState != MachineState_Running)
     1777    if (   mMachineState != MachineState_Running
     1778        && mMachineState != MachineState_Teleporting
     1779        && mMachineState != MachineState_LiveSnapshotting
     1780       )
    17591781        return setError(VBOX_E_INVALID_VM_STATE,
    17601782            tr("Invalid machine state %s when checking if the guest entered the ACPI mode)"),
     
    17911813    AutoWriteLock alock(this);
    17921814
    1793     if (mMachineState != MachineState_Running)
     1815    if (mMachineState != MachineState_Running) /** @todo Live Migration: ??? */
    17941816        return setError(VBOX_E_INVALID_VM_STATE,
    17951817            tr("Invalid machine state: %s)"),
     
    18321854    AutoWriteLock alock(this);
    18331855
    1834     if (mMachineState != MachineState_Running &&
    1835         mMachineState != MachineState_Paused)
     1856    if (   mMachineState != MachineState_Running
     1857        && mMachineState != MachineState_Paused)
    18361858    {
    18371859        return setError(VBOX_E_INVALID_VM_STATE,
     
    19701992    AutoWriteLock alock(this);
    19711993
    1972     if (mMachineState != MachineState_PoweredOff &&
    1973         mMachineState != MachineState_Aborted)
     1994    if (   mMachineState != MachineState_PoweredOff
     1995        && mMachineState != MachineState_Teleported
     1996        && mMachineState != MachineState_Aborted
     1997       )
    19741998        return setError(VBOX_E_INVALID_VM_STATE,
    1975             tr("Cannot adopt the saved machine state as the machine is not in Powered Off or Aborted state (machine state: %s)"),
     1999            tr("Cannot adopt the saved machine state as the machine is not in Powered Off, Teleported or Aborted state (machine state: %s)"),
    19762000            Global::stringifyMachineState(mMachineState));
    19772001
     
    21092133    AutoWriteLock alock(this);
    21102134
    2111     if (mMachineState != MachineState_Running &&
    2112         mMachineState != MachineState_Paused)
     2135    if (   mMachineState != MachineState_Running
     2136        && mMachineState != MachineState_Paused)
    21132137        return setError(VBOX_E_INVALID_VM_STATE,
    21142138            tr("Cannot attach a USB device to the machine which is not running or paused (machine state: %s)"),
     
    22882312        return setError(VBOX_E_INVALID_VM_STATE,
    22892313            tr("Cannot create a transient shared folder on the machine in the saved state"));
    2290     if (mMachineState > MachineState_Paused)
     2314    if (   mMachineState != MachineState_PoweredOff
     2315        && mMachineState != MachineState_Teleported
     2316        && mMachineState != MachineState_Aborted
     2317        && mMachineState != MachineState_Running
     2318        && mMachineState != MachineState_Paused
     2319       )
    22912320        return setError(VBOX_E_INVALID_VM_STATE,
    22922321            tr("Cannot create a transient shared folder on the machine while it is changing the state (machine state: %s)"),
     
    23502379        return setError(VBOX_E_INVALID_VM_STATE,
    23512380            tr("Cannot remove a transient shared folder from the machine in the saved state"));
    2352     if (mMachineState > MachineState_Paused)
     2381    if (   mMachineState != MachineState_PoweredOff
     2382        && mMachineState != MachineState_Teleported
     2383        && mMachineState != MachineState_Aborted
     2384        && mMachineState != MachineState_Running
     2385        && mMachineState != MachineState_Paused
     2386       )
    23532387        return setError(VBOX_E_INVALID_VM_STATE,
    23542388            tr("Cannot remove a transient shared folder from the machine while it is changing the state (machine state: %s)"),
     
    35143548    HRESULT rc = S_OK;
    35153549
    3516     if (mVRDPServer && mMachineState == MachineState_Running)
     3550    if (    mVRDPServer
     3551        &&  (   mMachineState == MachineState_Running
     3552             || mMachineState == MachineState_Teleporting
     3553             || mMachineState == MachineState_LiveSnapshotting
     3554            )
     3555       )
    35173556    {
    35183557        BOOL vrdpEnabled = FALSE;
     
    40084047    AutoWriteLock alock(this);
    40094048
    4010     AssertReturn(    mMachineState == MachineState_Saving
    4011                   || mMachineState == MachineState_RestoringSnapshot
    4012                   || mMachineState == MachineState_DeletingSnapshot,
    4013                  E_FAIL);
     4049    AssertReturn(   mMachineState == MachineState_Saving
     4050                 || mMachineState == MachineState_LiveSnapshotting
     4051                 || mMachineState == MachineState_RestoringSnapshot
     4052                 || mMachineState == MachineState_DeletingSnapshot
     4053                 , E_FAIL);
    40144054
    40154055    return setMachineStateLocally(aMachineState);
     
    47124752        setMachineState(MachineState_Restoring);
    47134753    else if (fTeleporterEnabled)
    4714         setMachineState(MachineState_TeleportingFrom);
     4754        setMachineState(MachineState_TeleportingIn);
    47154755    else
    47164756        setMachineState(MachineState_Starting);
     
    47724812    Assert(mpVM != NULL);
    47734813
    4774     AssertMsg(mMachineState == MachineState_Running ||
    4775               mMachineState == MachineState_Paused ||
    4776               mMachineState == MachineState_Stuck ||
    4777               mMachineState == MachineState_Saving ||
    4778               mMachineState == MachineState_Starting ||
    4779               mMachineState == MachineState_Restoring ||
    4780               mMachineState == MachineState_TeleportingFrom || /** @todo Teleportation ???*/
    4781               mMachineState == MachineState_Stopping,
    4782               ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
     4814    AssertMsg(   mMachineState == MachineState_Running
     4815              || mMachineState == MachineState_Paused
     4816              || mMachineState == MachineState_Teleporting           /** @todo Live Migration: ???*/
     4817              || mMachineState == MachineState_LiveSnapshotting      /** @todo Live Migration: ???*/
     4818              || mMachineState == MachineState_Stuck
     4819              || mMachineState == MachineState_Starting
     4820              || mMachineState == MachineState_Stopping
     4821              || mMachineState == MachineState_Saving
     4822              || mMachineState == MachineState_Restoring
     4823              || mMachineState == MachineState_TeleportingPausedVM   /** @todo Teleportation ???*/
     4824              || mMachineState == MachineState_TeleportingIn         /** @todo Teleportation ???*/
     4825              , ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState)));
    47834826
    47844827    LogRel(("Console::powerDown(): A request to power off the VM has been issued (mMachineState=%d, InUninit=%d)\n",
     
    47934836        && (   mMachineState == MachineState_Starting
    47944837            || mMachineState == MachineState_Restoring
    4795             || mMachineState == MachineState_TeleportingFrom)
     4838            || mMachineState == MachineState_TeleportingIn)
    47964839       )
    47974840        mVMPoweredOff = true;
     
    48014844     * set the state to Saved on VMSTATE_TERMINATED. In terms of protecting from
    48024845     * inappropriate operations while leaving the lock below, Saving or
    4803      * Restoring should be fine too */
     4846     * Restoring should be fine too.  Ditto for Teleporting* -> Teleported. */
    48044847    if (   mMachineState != MachineState_Saving
    48054848        && mMachineState != MachineState_Restoring
    4806         && mMachineState != MachineState_TeleportingFrom
    48074849        && mMachineState != MachineState_Stopping
     4850        && mMachineState != MachineState_TeleportingIn
     4851        && mMachineState != MachineState_Teleporting /** @todo Live Migration: what should really happen here? */
     4852        && mMachineState != MachineState_TeleportingPausedVM
     4853        && mMachineState != MachineState_LiveSnapshotting /** @todo Live Migration: what should really happen here? */
    48084854       )
    48094855        setMachineState(MachineState_Stopping);
     
    48624908                uint32_t fFlags;
    48634909                guestProp::validateFlags(Utf8Str(flagsOut[i]).raw(), &fFlags);
    4864                 if (   !( fFlags & guestProp::TRANSIENT)
    4865                     || (mMachineState == MachineState_Saving)
     4910                if (   !(fFlags & guestProp::TRANSIENT)
     4911                    || mMachineState == MachineState_Saving
     4912                    || mMachineState == MachineState_LiveSnapshotting
    48664913                  )
    48674914                {
     
    54905537                && that->mMachineState != MachineState_Saving
    54915538                && that->mMachineState != MachineState_Restoring
    5492                 && that->mMachineState != MachineState_TeleportingFrom
     5539                && that->mMachineState != MachineState_TeleportingIn
     5540                && that->mMachineState != MachineState_LiveSnapshotting
     5541                && that->mMachineState != MachineState_Teleporting
     5542                && that->mMachineState != MachineState_TeleportingPausedVM
    54935543               )
    54945544            {
     
    55855635                    that->setMachineState(MachineState_Saved);
    55865636                    break;
    5587                 case MachineState_TeleportingFrom:
     5637                case MachineState_TeleportingIn:
    55885638                    /* Teleportation failed or was cancelled.  Back to powered off. */
    55895639                    that->setMachineState(MachineState_PoweredOff);
    55905640                    break;
     5641                case MachineState_Teleporting:
     5642                case MachineState_TeleportingPausedVM:
     5643                    /* Successfully teleported the VM. */
     5644                    that->setMachineState(MachineState_Teleported);
     5645                    break;
    55915646            }
    55925647            break;
     
    55955650        case VMSTATE_SUSPENDED:
    55965651        {
    5597             /** @todo state/live VMSTATE_SUSPENDING_LS. */
     5652            /** @todo Live Migration: state/live VMSTATE_SUSPENDING_LS. */
    55985653            if (aOldState == VMSTATE_SUSPENDING)
    55995654            {
     
    56265681                           && aOldState == VMSTATE_POWERING_ON)
    56275682                       || (   (   that->mMachineState == MachineState_Restoring
    5628                                || that->mMachineState == MachineState_TeleportingFrom
     5683                               || that->mMachineState == MachineState_TeleportingIn
    56295684                               || that->mMachineState == MachineState_Paused)
    56305685                           && aOldState == VMSTATE_RESUMING));
     
    68216876    if (   console->mMachineState == MachineState_Starting
    68226877        || console->mMachineState == MachineState_Restoring
    6823         || console->mMachineState == MachineState_TeleportingFrom
     6878        || console->mMachineState == MachineState_TeleportingIn
    68246879       )
    68256880    {
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