Changeset 23904 in vbox
- Timestamp:
- Oct 20, 2009 3:01:56 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 53705
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r23841 r23904 92 92 Utf8Str mstrHostname; 93 93 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) 96 97 : TeleporterState(pConsole, pVM, pProgress, true /*fIsSource*/) 97 98 , muPort(UINT32_MAX) 99 , menmOldMachineState(enmOldMachineState) 98 100 { 99 101 } … … 110 112 PRTTCPSERVER mhServer; 111 113 PRTTIMERLR mphTimerLR; 114 bool mfStartPaused; 112 115 int mRc; 113 116 114 117 TeleporterStateTrg(Console *pConsole, PVM pVM, Progress *pProgress, 115 IMachine *pMachine, PRTTIMERLR phTimerLR )118 IMachine *pMachine, PRTTIMERLR phTimerLR, bool fStartPaused) 116 119 : TeleporterState(pConsole, pVM, pProgress, false /*fIsSource*/) 117 120 , mpMachine(pMachine) 118 121 , mhServer(NULL) 119 122 , mphTimerLR(phTimerLR) 123 , mfStartPaused(false) 120 124 , mRc(VINF_SUCCESS) 121 125 { … … 617 621 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); 618 622 vrc = VMR3Teleport(pState->mpVM, &g_teleporterTcpOps, pvUser, teleporterProgressCallback, pvUser); 619 if ( vrc)623 if (RT_FAILURE(vrc)) 620 624 return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc); 621 625 … … 623 627 if (FAILED(hrc)) 624 628 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 } 625 643 626 644 /* … … 686 704 case VMSTATE_RESETTING: 687 705 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); 689 710 break; 690 711 case VMSTATE_GURU_MEDITATION: … … 777 798 CheckComRCReturnRC(hrc); 778 799 779 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress );800 TeleporterStateSrc *pState = new TeleporterStateSrc(this, mpVM, ptrProgress, mMachineState); 780 801 pState->mstrPassword = aPassword; 781 802 pState->mstrHostname = aHostname; … … 888 909 * Do the job, when it returns we're done. 889 910 */ 890 TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR );911 TeleporterStateTrg State(this, pVM, pProgress, pMachine, &hTimerLR, fStartPaused); 891 912 State.mstrPassword = strPassword; 892 913 State.mhServer = hServer; … … 904 925 if (RT_SUCCESS(vrc)) 905 926 { 906 if ( fStartPaused)927 if (State.mfStartPaused) 907 928 setMachineState(MachineState_Paused); 908 929 else … … 1085 1106 1086 1107 vrc = teleporterTcpWriteACK(pState); 1087 if (RT_FAILURE(vrc))1088 break;1089 1108 } 1090 1109 /** @todo implement config verification and hardware compatability checks. Or … … 1096 1115 LogRel(("Teleporter: Received cancel command.\n")); 1097 1116 vrc = VERR_SSM_CANCELLED; 1117 } 1118 else if (!strcmp(szCmd, "pause")) 1119 { 1120 pState->mfStartPaused = true; 1121 vrc = teleporterTcpWriteACK(pState); 1098 1122 } 1099 1123 else if (!strcmp(szCmd, "done")) … … 1118 1142 break; 1119 1143 } 1144 1145 if (RT_FAILURE(vrc)) 1146 break; 1120 1147 } 1121 1148 -
trunk/src/VBox/VMM/VM.cpp
r23826 r23904 1533 1533 */ 1534 1534 int rc = VINF_SUCCESS; 1535 if (VMR3GetState(pVM) == VMSTATE_SUSPENDED_LS) 1535 VMSTATE enmVMState = VMR3GetState(pVM); 1536 if (enmVMState == VMSTATE_SUSPENDED_LS) 1536 1537 vmR3SetState(pVM, VMSTATE_SAVING, VMSTATE_SUSPENDED_LS); 1537 1538 else 1538 1539 { 1539 vmR3SetState(pVM, VMSTATE_SAVING, VMSTATE_SUSPENDED_EXT_LS); 1540 if (enmVMState != VMSTATE_SAVING) 1541 vmR3SetState(pVM, VMSTATE_SAVING, VMSTATE_SUSPENDED_EXT_LS); 1540 1542 rc = VINF_SSM_LIVE_SUSPENDED; 1541 1543 } … … 1602 1604 VMSTATE_SAVING, VMSTATE_SUSPENDED, 1603 1605 VMSTATE_RUNNING_LS, VMSTATE_RUNNING); 1604 if (rc == 1) 1605 { 1606 if (rc == 1 && enmAfter != SSMAFTER_TELEPORT) 1607 { 1608 Assert(!pStreamOps); 1606 1609 rc = SSMR3Save(pVM, pszFilename, enmAfter, pfnProgress, pvProgressUser); 1607 1610 vmR3SetState(pVM, VMSTATE_SUSPENDED, VMSTATE_SAVING); 1608 1611 } 1609 else if (rc == 2 )1612 else if (rc == 2 || enmAfter == SSMAFTER_TELEPORT) 1610 1613 { 1611 1614 rc = SSMR3LiveSave(pVM, pszFilename, pStreamOps, pvStreamOpsUser, … … 1656 1659 if (RT_SUCCESS(rc)) 1657 1660 { 1658 for (;;) 1659 { 1660 /* Try suspend the VM. */ 1661 rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR, 1662 vmR3LiveDoSuspend, NULL); 1663 if (rc != VERR_TRY_AGAIN) 1664 break; 1665 1666 /* Wait for the state to change. */ 1667 RTThreadSleep(250); /** @todo LS: fix this polling wait by some smart use of multiple release event semaphores.. */ 1668 } 1661 if (VMR3GetState(pVM) != VMSTATE_SAVING) 1662 for (;;) 1663 { 1664 /* Try suspend the VM. */ 1665 rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_DESCENDING | VMMEMTRENDEZVOUS_FLAGS_STOP_ON_ERROR, 1666 vmR3LiveDoSuspend, NULL); 1667 if (rc != VERR_TRY_AGAIN) 1668 break; 1669 1670 /* Wait for the state to change. */ 1671 RTThreadSleep(250); /** @todo LS: fix this polling wait by some smart use of multiple release event semaphores.. */ 1672 } 1669 1673 if (RT_SUCCESS(rc)) 1670 1674 rc = VMR3ReqCallWaitU(pVM->pUVM, 0 /*idDstCpu*/, (PFNRT)vmR3LiveDoStep2, 2, pVM, pSSM);
Note:
See TracChangeset
for help on using the changeset viewer.