VirtualBox

Changeset 29927 in vbox


Ignore:
Timestamp:
May 31, 2010 6:40:56 PM (14 years ago)
Author:
vboxsync
Message:

Main: Three state powerOn progress object when teleporting.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

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

    r29864 r29927  
    52305230    else
    52315231        progressDesc = tr("Starting virtual machine");
    5232     rc = powerupProgress->init(static_cast<IConsole *>(this),
    5233                                progressDesc,
    5234                                fTeleporterEnabled /* aCancelable */);
     5232    if (mMachineState == MachineState_Saved || !fTeleporterEnabled)
     5233        rc = powerupProgress->init(static_cast<IConsole *>(this),
     5234                                   progressDesc,
     5235                                   FALSE /* aCancelable */);
     5236    else
     5237        rc = powerupProgress->init(static_cast<IConsole *>(this),
     5238                                   progressDesc,
     5239                                   TRUE /* aCancelable */,
     5240                                   3    /* cOperations */,
     5241                                   10   /* ulTotalOperationsWeight */,
     5242                                   Bstr(tr("Teleporting virtual machine")),
     5243                                   1    /* ulFirstOperationWeight */,
     5244                                   NULL);
    52355245    if (FAILED(rc))
    52365246        return rc;
  • trunk/src/VBox/Main/ConsoleImplTeleporter.cpp

    r29882 r29927  
    10601060            theState.mhServer          = hServer;
    10611061
    1062             bool fPowerOff;
     1062            bool fPowerOff = true;
    10631063            void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(&theState));
    10641064            if (pProgress->setCancelCallback(teleporterProgressCancelCallback, pvUser))
    10651065            {
    10661066                LogRel(("Teleporter: Waiting for incoming VM...\n"));
    1067                 vrc = RTTcpServerListen(hServer, Console::teleporterTrgServeConnection, &theState);
    1068                 pProgress->setCancelCallback(NULL, NULL);
    1069 
    1070                 fPowerOff = false;
    1071                 if (vrc == VERR_TCP_SERVER_STOP)
     1067                hrc = pProgress->SetNextOperation(Bstr(tr("Waiting for incoming VM")), 1);
     1068                if (SUCCEEDED(hrc))
    10721069                {
    1073                     vrc = theState.mRc;
    1074                     /* Power off the VM on failure unless the state callback
    1075                        already did that. */
    1076                     if (RT_FAILURE(vrc))
     1070                    vrc = RTTcpServerListen(hServer, Console::teleporterTrgServeConnection, &theState);
     1071                    pProgress->setCancelCallback(NULL, NULL);
     1072
     1073                    if (vrc == VERR_TCP_SERVER_STOP)
    10771074                    {
    1078                         VMSTATE enmVMState = VMR3GetState(pVM);
    1079                         if (    enmVMState != VMSTATE_OFF
    1080                             &&  enmVMState != VMSTATE_POWERING_OFF)
    1081                             fPowerOff = true;
     1075                        vrc = theState.mRc;
     1076                        /* Power off the VM on failure unless the state callback
     1077                           already did that. */
     1078                        fPowerOff = false;
     1079                        if (RT_FAILURE(vrc))
     1080                        {
     1081                            VMSTATE enmVMState = VMR3GetState(pVM);
     1082                            if (    enmVMState != VMSTATE_OFF
     1083                                &&  enmVMState != VMSTATE_POWERING_OFF)
     1084                                fPowerOff = true;
     1085                        }
    10821086                    }
    1083                 }
    1084                 else if (vrc == VERR_TCP_SERVER_SHUTDOWN)
    1085                 {
    1086                     BOOL fCancelled = TRUE;
    1087                     hrc = pProgress->COMGETTER(Canceled)(&fCancelled);
    1088                     if (FAILED(hrc) || fCancelled)
     1087                    else if (vrc == VERR_TCP_SERVER_SHUTDOWN)
    10891088                    {
    1090                         setError(E_FAIL, tr("Teleporting canceled"));
    1091                         vrc = VERR_SSM_CANCELLED;
     1089                        BOOL fCancelled = TRUE;
     1090                        hrc = pProgress->COMGETTER(Canceled)(&fCancelled);
     1091                        if (FAILED(hrc) || fCancelled)
     1092                        {
     1093                            setError(E_FAIL, tr("Teleporting canceled"));
     1094                            vrc = VERR_SSM_CANCELLED;
     1095                        }
     1096                        else
     1097                        {
     1098                            setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection"));
     1099                            vrc = VERR_TIMEOUT;
     1100                        }
     1101                        LogRel(("Teleporter: RTTcpServerListen aborted - %Rrc\n", vrc));
    10921102                    }
    10931103                    else
    10941104                    {
    1095                         setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection"));
    1096                         vrc = VERR_TIMEOUT;
     1105                        LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc));
     1106                        vrc = VERR_IPE_UNEXPECTED_STATUS;
    10971107                    }
    1098                     LogRel(("Teleporter: RTTcpServerListen aborted - %Rrc\n", vrc));
    1099                     fPowerOff = true;
    11001108                }
    11011109                else
    11021110                {
    1103                     LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc));
    1104                     vrc = VERR_IPE_UNEXPECTED_STATUS;
    1105                     fPowerOff = true;
     1111                    LogThisFunc(("SetNextOperation failed, %Rhrc\n", hrc));
     1112                    vrc = Global::vboxStatusCodeFromCOM(hrc);
    11061113                }
    11071114            }
     
    11101117                LogThisFunc(("Canceled - check point #1\n"));
    11111118                vrc = VERR_SSM_CANCELLED;
    1112                 fPowerOff = true;
    11131119            }
    11141120
     
    12291235    if (RT_FAILURE(vrc))
    12301236        return VINF_SUCCESS;
    1231     LogRel(("Teleporter: Incoming VM!\n"));
     1237
     1238    /*
     1239     * Update the progress bar, with peer name if available.
     1240     */
     1241    HRESULT     hrc;
     1242    RTNETADDR   Addr;
     1243    vrc = RTTcpGetPeerAddress(Sock, &Addr);
     1244    if (RT_SUCCESS(vrc))
     1245    {
     1246        LogRel(("Teleporter: Incoming VM from %RTnaddr!\n", &Addr));
     1247        hrc = pState->mptrProgress->SetNextOperation(Bstr(Utf8StrFmt(tr("Teleporting VM from %RTnaddr"), &Addr)), 8);
     1248    }
     1249    else
     1250    {
     1251        LogRel(("Teleporter: Incoming VM!\n"));
     1252        hrc = pState->mptrProgress->SetNextOperation(Bstr(tr("Teleporting VM")), 8);
     1253    }
     1254    AssertMsg(SUCCEEDED(hrc) || hrc == E_FAIL, ("%Rhrc\n", hrc));
    12321255
    12331256    /*
     
    12921315        else if (!strcmp(szCmd, "lock-media"))
    12931316        {
    1294             HRESULT hrc = pState->mpControl->LockMedia();
     1317            hrc = pState->mpControl->LockMedia();
    12951318            if (SUCCEEDED(hrc))
    12961319            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r29909 r29927  
    68516851        been saved.
    68526852
     6853        If the machine <link to="IMachine::teleporterEnabled"/> property is
     6854        enabled on the machine being powered up, the machine will wait for an
     6855        incoming teleportation in the <link to="MachineState_TeleportingIn"/>
     6856        state. The returned progress object will have at least three
     6857        operations where the last three are defined as: (1) powering up and
     6858        starting TCP server, (2) waiting for incoming teleportations, and
     6859        (3) perform teleportation. These operations will be reflected as the
     6860        last three operations of the progress objected returned by
     6861        <link to="IVirtualBox::openRemoteSession"/> as well.
     6862
    68536863        <note>
    68546864          Unless you are trying to write a new VirtualBox front-end that
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