Changeset 29957 in vbox
- Timestamp:
- Jun 1, 2010 3:21:28 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 62239
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r29927 r29957 7407 7407 { 7408 7408 /* -> ConsoleImplTeleporter.cpp */ 7409 vrc = console->teleporterTrg(pVM, pMachine, task->mStartPaused, task->mProgress); 7410 if (RT_FAILURE(vrc) && !task->mErrorMsg.length()) 7411 rc = E_FAIL; /* Avoid the "Missing error message..." assertion. */ 7409 bool fPowerOffOnFailure; 7410 rc = console->teleporterTrg(pVM, pMachine, &task->mErrorMsg, task->mStartPaused, 7411 task->mProgress, &fPowerOffOnFailure); 7412 if (FAILED(rc) && fPowerOffOnFailure) 7413 { 7414 ErrorInfoKeeper eik; 7415 int vrc2 = VMR3PowerOff(pVM); 7416 AssertRC(vrc2); 7417 } 7412 7418 } 7413 7419 else if (task->mStartPaused) -
trunk/src/VBox/Main/ConsoleImplTeleporter.cpp
r29927 r29957 664 664 return hrc; 665 665 666 RTSocketRetain(pState->mhSocket); 666 667 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(pState)); 667 668 vrc = VMR3Teleport(pState->mpVM, pState->mcMsMaxDowntime, … … 669 670 teleporterProgressCallback, pvUser, 670 671 &pState->mfSuspendedByUs); 672 RTSocketRelease(pState->mhSocket); 671 673 if (RT_FAILURE(vrc)) 672 674 return setError(E_FAIL, tr("VMR3Teleport -> %Rrc"), vrc); … … 979 981 * @param pVM The VM handle 980 982 * @param pMachine The IMachine for the virtual machine. 983 * @param pErrorMsg Pointer to the error string for VMSetError. 981 984 * @param fStartPaused Whether to start it in the Paused (true) or 982 985 * Running (false) state, 983 986 * @param pProgress Pointer to the progress object. 987 * @param pfPowerOffOnFailure Whether the caller should power off 988 * the VM on failure. 984 989 * 985 990 * @remarks The caller expects error information to be set on failure. 986 991 * @todo Check that all the possible failure paths sets error info... 987 992 */ 988 int 989 Console::teleporterTrg(PVM pVM, IMachine *pMachine, bool fStartPaused, Progress *pProgress) 993 HRESULT 994 Console::teleporterTrg(PVM pVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused, 995 Progress *pProgress, bool *pfPowerOffOnFailure) 990 996 { 991 997 LogThisFunc(("pVM=%p pMachine=%p fStartPaused=%RTbool pProgress=%p\n", pVM, pMachine, fStartPaused, pProgress)); 998 999 *pfPowerOffOnFailure = true; 992 1000 993 1001 /* … … 997 1005 HRESULT hrc = pMachine->COMGETTER(TeleporterPort)(&uPort); 998 1006 if (FAILED(hrc)) 999 return VERR_GENERAL_FAILURE;1007 return hrc; 1000 1008 ULONG const uPortOrg = uPort; 1001 1009 … … 1003 1011 hrc = pMachine->COMGETTER(TeleporterAddress)(bstrAddress.asOutParam()); 1004 1012 if (FAILED(hrc)) 1005 return VERR_GENERAL_FAILURE;1013 return hrc; 1006 1014 Utf8Str strAddress(bstrAddress); 1007 1015 const char *pszAddress = strAddress.isEmpty() ? NULL : strAddress.c_str(); … … 1010 1018 hrc = pMachine->COMGETTER(TeleporterPassword)(bstrPassword.asOutParam()); 1011 1019 if (FAILED(hrc)) 1012 return VERR_GENERAL_FAILURE;1020 return hrc; 1013 1021 Utf8Str strPassword(bstrPassword); 1014 1022 strPassword.append('\n'); /* To simplify password checking. */ … … 1036 1044 { 1037 1045 RTTcpServerDestroy(hServer); 1038 return VERR_GENERAL_FAILURE;1046 return hrc; 1039 1047 } 1040 1048 } 1041 1049 } 1042 1050 if (RT_FAILURE(vrc)) 1043 return vrc;1051 return setError(E_FAIL, tr("RTTcpServerCreateEx failed with status %Rrc"), vrc); 1044 1052 1045 1053 /* … … 1060 1068 theState.mhServer = hServer; 1061 1069 1062 bool fPowerOff = true;1063 1070 void *pvUser = static_cast<void *>(static_cast<TeleporterState *>(&theState)); 1064 1071 if (pProgress->setCancelCallback(teleporterProgressCancelCallback, pvUser)) … … 1076 1083 /* Power off the VM on failure unless the state callback 1077 1084 already did that. */ 1078 fPowerOff = false; 1079 if (RT_FAILURE(vrc)) 1085 *pfPowerOffOnFailure = false; 1086 if (RT_SUCCESS(vrc)) 1087 hrc = S_OK; 1088 else 1080 1089 { 1081 1090 VMSTATE enmVMState = VMR3GetState(pVM); 1082 1091 if ( enmVMState != VMSTATE_OFF 1083 1092 && enmVMState != VMSTATE_POWERING_OFF) 1084 fPowerOff = true; 1093 *pfPowerOffOnFailure = true; 1094 1095 /* Set error. */ 1096 if (pErrorMsg->length()) 1097 hrc = setError(E_FAIL, "%s", pErrorMsg->c_str()); 1098 else 1099 hrc = setError(E_FAIL, tr("Teleporation failed (%Rrc)"), vrc); 1085 1100 } 1086 1101 } … … 1090 1105 hrc = pProgress->COMGETTER(Canceled)(&fCancelled); 1091 1106 if (FAILED(hrc) || fCancelled) 1092 { 1093 setError(E_FAIL, tr("Teleporting canceled")); 1094 vrc = VERR_SSM_CANCELLED; 1095 } 1107 hrc = setError(E_FAIL, tr("Teleporting canceled")); 1096 1108 else 1097 { 1098 setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection")); 1099 vrc = VERR_TIMEOUT; 1100 } 1109 hrc = setError(E_FAIL, tr("Teleporter timed out waiting for incoming connection")); 1101 1110 LogRel(("Teleporter: RTTcpServerListen aborted - %Rrc\n", vrc)); 1102 1111 } 1103 1112 else 1104 1113 { 1114 hrc = setError(E_FAIL, tr("Unexpected RTTcpServerListen status code %Rrc"), vrc); 1105 1115 LogRel(("Teleporter: Unexpected RTTcpServerListen rc: %Rrc\n", vrc)); 1106 vrc = VERR_IPE_UNEXPECTED_STATUS;1107 1116 } 1108 1117 } 1109 1118 else 1110 {1111 1119 LogThisFunc(("SetNextOperation failed, %Rhrc\n", hrc)); 1112 vrc = Global::vboxStatusCodeFromCOM(hrc);1113 }1114 1120 } 1115 1121 else 1116 1122 { 1117 1123 LogThisFunc(("Canceled - check point #1\n")); 1118 vrc = VERR_SSM_CANCELLED; 1119 } 1120 1121 if (fPowerOff) 1122 { 1123 int vrc2 = VMR3PowerOff(pVM); 1124 AssertRC(vrc2); 1125 } 1126 } 1124 hrc = setError(E_FAIL, tr("Teleporting canceled")); 1125 } 1126 } 1127 else 1128 hrc = setError(E_FAIL, "RTTimerLRStart -> %Rrc", vrc); 1127 1129 1128 1130 RTTimerLRDestroy(hTimerLR); 1129 1131 } 1132 else 1133 hrc = setError(E_FAIL, "RTTimerLRCreate -> %Rrc", vrc); 1130 1134 RTTcpServerDestroy(hServer); 1131 1135 … … 1135 1139 */ 1136 1140 if (uPortOrg != uPort) 1141 { 1142 ErrorInfoKeeper Eik; 1137 1143 pMachine->COMSETTER(TeleporterPort)(uPortOrg); 1138 1139 return vrc; 1144 } 1145 1146 return hrc; 1140 1147 } 1141 1148 -
trunk/src/VBox/Main/include/ConsoleImpl.h
r29580 r29957 573 573 HRESULT teleporterSrcReadACK(TeleporterStateSrc *pState, const char *pszWhich, const char *pszNAckMsg = NULL); 574 574 HRESULT teleporterSrcSubmitCommand(TeleporterStateSrc *pState, const char *pszCommand, bool fWaitForAck = true); 575 int teleporterTrg(PVM pVM, IMachine *pMachine, bool fStartPaused, Progress *pProgress); 575 HRESULT teleporterTrg(PVM pVM, IMachine *pMachine, Utf8Str *pErrorMsg, bool fStartPaused, 576 Progress *pProgress, bool *pfPowerOffOnFailure); 576 577 static DECLCALLBACK(int) teleporterTrgServeConnection(RTSOCKET Sock, void *pvUser); 577 578 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.