VirtualBox

Ignore:
Timestamp:
Oct 20, 2009 3:01:56 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53705
Message:

VMM,Main: Fixed bugs related to teleporting a paused VM.

File:
1 edited

Legend:

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

    r23841 r23904  
    9292    Utf8Str             mstrHostname;
    9393    uint32_t            muPort;
    94 
    95     TeleporterStateSrc(Console *pConsole, PVM pVM, Progress *pProgress)
     94    MachineState_T      menmOldMachineState;
     95
     96    TeleporterStateSrc(Console *pConsole, PVM pVM, Progress *pProgress, MachineState_T enmOldMachineState)
    9697        : TeleporterState(pConsole, pVM, pProgress, true /*fIsSource*/)
    9798        , muPort(UINT32_MAX)
     99        , menmOldMachineState(enmOldMachineState)
    98100    {
    99101    }
     
    110112    PRTTCPSERVER        mhServer;
    111113    PRTTIMERLR          mphTimerLR;
     114    bool                mfStartPaused;
    112115    int                 mRc;
    113116
    114117    TeleporterStateTrg(Console *pConsole, PVM pVM, Progress *pProgress,
    115                        IMachine *pMachine, PRTTIMERLR phTimerLR)
     118                       IMachine *pMachine, PRTTIMERLR phTimerLR, bool fStartPaused)
    116119        : TeleporterState(pConsole, pVM, pProgress, false /*fIsSource*/)
    117120        , mpMachine(pMachine)
    118121        , mhServer(NULL)
    119122        , mphTimerLR(phTimerLR)
     123        , mfStartPaused(false)
    120124        , mRc(VINF_SUCCESS)
    121125    {
     
    617621    void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState));
    618622    vrc = VMR3Teleport(pState->mpVM, &g_teleporterTcpOps, pvUser, teleporterProgressCallback, pvUser);
    619     if (vrc)
     623    if (RT_FAILURE(vrc))
    620624        return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc);
    621625
     
    623627    if (FAILED(hrc))
    624628        return hrc;
     629
     630    /*
     631     * If we're paused, mention this to the target side.
     632     *
     633     * Note: This means you have to resume the target manually if you pause it
     634     *       during the teleportation.
     635     */
     636    if (    vrc == VINF_SSM_LIVE_SUSPENDED
     637        ||  pState->menmOldMachineState == MachineState_Paused)
     638    {
     639        hrc = teleporterSrcSubmitCommand(pState, "pause");
     640        if (FAILED(hrc))
     641            return hrc;
     642    }
    625643
    626644    /*
     
    686704                case VMSTATE_RESETTING:
    687705                case VMSTATE_RESETTING_LS:
    688                     pState->mptrConsole->setMachineState(MachineState_Running);
     706                    if (pState->menmOldMachineState == MachineState_Running)
     707                        pState->mptrConsole->setMachineState(MachineState_Running);
     708                    else
     709                        pState->mptrConsole->setMachineState(MachineState_Paused);
    689710                    break;
    690711                case VMSTATE_GURU_MEDITATION:
     
    777798    CheckComRCReturnRC(hrc);
    778799
    779     TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress);
     800    TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress, mMachineState);
    780801    pState->mstrPassword = aPassword;
    781802    pState->mstrHostname = aHostname;
     
    888909             * Do the job, when it returns we're done.
    889910             */
    890             TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR);
     911            TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR, fStartPaused);
    891912            State.mstrPassword      = strPassword;
    892913            State.mhServer          = hServer;
     
    904925                    if (RT_SUCCESS(vrc))
    905926                    {
    906                         if (fStartPaused)
     927                        if (State.mfStartPaused)
    907928                            setMachineState(MachineState_Paused);
    908929                        else
     
    10851106
    10861107            vrc = teleporterTcpWriteACK(pState);
    1087             if (RT_FAILURE(vrc))
    1088                 break;
    10891108        }
    10901109        /** @todo implement config verification and hardware compatability checks. Or
     
    10961115            LogRel(("Teleporter: Received cancel command.\n"));
    10971116            vrc = VERR_SSM_CANCELLED;
     1117        }
     1118        else if (!strcmp(szCmd, "pause"))
     1119        {
     1120            pState->mfStartPaused = true;
     1121            vrc = teleporterTcpWriteACK(pState);
    10981122        }
    10991123        else if (!strcmp(szCmd, "done"))
     
    11181142            break;
    11191143        }
     1144
     1145        if (RT_FAILURE(vrc))
     1146            break;
    11201147    }
    11211148
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