Changeset 80074 in vbox for trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
- Timestamp:
- Jul 31, 2019 2:18:34 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r79120 r80074 118 118 #endif /* VBOX_WITH_NETSHAPER */ 119 119 #include <VBox/vmm/mm.h> 120 #include <VBox/vmm/ftm.h>121 120 #include <VBox/vmm/ssm.h> 122 121 #include <VBox/err.h> … … 231 230 VMPowerUpTask(Console *aConsole, 232 231 Progress *aProgress) 233 : VMTask(aConsole, aProgress, NULL /* aServerProgress */, 234 false /* aUsesVMPtr */), 235 mConfigConstructor(NULL), 236 mStartPaused(false), 237 mTeleporterEnabled(FALSE), 238 mEnmFaultToleranceState(FaultToleranceState_Inactive) 232 : VMTask(aConsole, aProgress, NULL /* aServerProgress */, false /* aUsesVMPtr */) 233 , mConfigConstructor(NULL) 234 , mStartPaused(false) 235 , mTeleporterEnabled(FALSE) 239 236 { 240 237 m_strTaskName = "VMPwrUp"; … … 246 243 bool mStartPaused; 247 244 BOOL mTeleporterEnabled; 248 FaultToleranceState_T mEnmFaultToleranceState;249 245 250 246 /* array of progress objects for hard disk reset operations */ … … 2167 2163 return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a live snapshot")); 2168 2164 2169 /* Try cancel the FT sync. */2170 case MachineState_FaultTolerantSyncing:2171 if (!mptrCancelableProgress.isNull())2172 {2173 HRESULT hrc = mptrCancelableProgress->Cancel();2174 if (SUCCEEDED(hrc))2175 break;2176 }2177 return setError(VBOX_E_INVALID_VM_STATE, tr("Cannot power down at this point in a fault tolerant sync"));2178 2179 2165 /* extra nice error message for a common case */ 2180 2166 case MachineState_Saved: … … 7181 7167 case VMSTATE_RUNNING: 7182 7168 case VMSTATE_RUNNING_LS: 7183 case VMSTATE_RUNNING_FT:7184 7169 case VMSTATE_RESETTING: 7185 7170 case VMSTATE_RESETTING_LS: … … 7654 7639 #endif 7655 7640 7656 /* test the FaultToleranceState property */7657 FaultToleranceState_T enmFaultToleranceState;7658 rc = mMachine->COMGETTER(FaultToleranceState)(&enmFaultToleranceState);7659 if (FAILED(rc))7660 throw rc;7661 BOOL fFaultToleranceSyncEnabled = (enmFaultToleranceState == FaultToleranceState_Standby);7662 7663 7641 /* Create a progress object to track progress of this operation. Must 7664 7642 * be done as early as possible (together with BeginPowerUp()) as this … … 7671 7649 else if (fTeleporterEnabled) 7672 7650 progressDesc = tr("Teleporting virtual machine"); 7673 else if (fFaultToleranceSyncEnabled)7674 progressDesc = tr("Fault Tolerance syncing of remote virtual machine");7675 7651 else 7676 7652 progressDesc = tr("Starting virtual machine"); … … 7752 7728 catch (std::bad_alloc &) { throw rc = E_OUTOFMEMORY; } 7753 7729 task->mTeleporterEnabled = fTeleporterEnabled; 7754 task->mEnmFaultToleranceState = enmFaultToleranceState;7755 7730 7756 7731 /* Reset differencing hard disks for which autoReset is true, … … 7893 7868 } 7894 7869 else if ( mMachineState == MachineState_Saved 7895 || (!fTeleporterEnabled && !fFaultToleranceSyncEnabled))7870 || !fTeleporterEnabled) 7896 7871 { 7897 7872 rc = pPowerupProgress->init(static_cast<IConsole *>(this), … … 7907 7882 10 /* ulTotalOperationsWeight */, 7908 7883 Bstr(tr("Teleporting virtual machine")).raw(), 7909 1 /* ulFirstOperationWeight */);7910 }7911 else if (fFaultToleranceSyncEnabled)7912 {7913 rc = pPowerupProgress->init(static_cast<IConsole *>(this),7914 progressDesc.raw(),7915 TRUE /* aCancelable */,7916 3 /* cOperations */,7917 10 /* ulTotalOperationsWeight */,7918 Bstr(tr("Fault Tolerance syncing of remote virtual machine")).raw(),7919 7884 1 /* ulFirstOperationWeight */); 7920 7885 } … … 8021 7986 else if (fTeleporterEnabled) 8022 7987 i_setMachineState(MachineState_TeleportingIn); 8023 else if (enmFaultToleranceState == FaultToleranceState_Standby)8024 i_setMachineState(MachineState_FaultTolerantSyncing);8025 7988 else 8026 7989 i_setMachineState(MachineState_Starting); … … 8121 8084 || mMachineState == MachineState_Restoring 8122 8085 || mMachineState == MachineState_TeleportingPausedVM 8123 || mMachineState == MachineState_FaultTolerantSyncing8124 8086 || mMachineState == MachineState_TeleportingIn 8125 8087 , ("Invalid machine state: %s\n", Global::stringifyMachineState(mMachineState))); … … 8136 8098 && ( mMachineState == MachineState_Starting 8137 8099 || mMachineState == MachineState_Restoring 8138 || mMachineState == MachineState_FaultTolerantSyncing8139 8100 || mMachineState == MachineState_TeleportingIn) 8140 8101 ) … … 8155 8116 && mMachineState != MachineState_TeleportingIn 8156 8117 && mMachineState != MachineState_TeleportingPausedVM 8157 && mMachineState != MachineState_FaultTolerantSyncing8158 8118 ) 8159 8119 i_setMachineState(MachineState_Stopping); … … 8982 8942 && that->mMachineState != MachineState_Restoring 8983 8943 && that->mMachineState != MachineState_TeleportingIn 8984 && that->mMachineState != MachineState_FaultTolerantSyncing8985 8944 && that->mMachineState != MachineState_TeleportingPausedVM 8986 8945 && !that->mVMIsAlreadyPoweringOff … … 9108 9067 that->i_setMachineState(MachineState_Teleported); 9109 9068 break; 9110 case MachineState_FaultTolerantSyncing:9111 /* Fault tolerant sync failed or was canceled. Back to powered off. */9112 that->i_setMachineState(MachineState_PoweredOff);9113 break;9114 9069 } 9115 9070 break; … … 9153 9108 case MachineState_Stopping: 9154 9109 case MachineState_TeleportingIn: 9155 case MachineState_FaultTolerantSyncing:9156 9110 case MachineState_OnlineSnapshotting: 9157 9111 /* The worker thread handles the transition. */ … … 9205 9159 { 9206 9160 if ( enmOldState == VMSTATE_POWERING_ON 9207 || enmOldState == VMSTATE_RESUMING 9208 || enmOldState == VMSTATE_RUNNING_FT) 9161 || enmOldState == VMSTATE_RESUMING) 9209 9162 { 9210 9163 AutoWriteLock alock(that COMMA_LOCKVAL_SRC_POS); … … 9221 9174 || that->mMachineState == MachineState_Saving 9222 9175 ) 9223 && enmOldState == VMSTATE_RESUMING) 9224 || ( that->mMachineState == MachineState_FaultTolerantSyncing 9225 && enmOldState == VMSTATE_RUNNING_FT)); 9176 && enmOldState == VMSTATE_RESUMING)); 9226 9177 9227 9178 that->i_setMachineState(MachineState_Running); … … 9234 9185 AssertMsg( that->mMachineState == MachineState_LiveSnapshotting 9235 9186 || that->mMachineState == MachineState_Teleporting, 9236 ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState),9237 VMR3GetStateName(enmOldState), VMR3GetStateName(enmState) ));9238 break;9239 9240 case VMSTATE_RUNNING_FT:9241 AssertMsg(that->mMachineState == MachineState_FaultTolerantSyncing,9242 9187 ("%s/%s -> %s\n", Global::stringifyMachineState(that->mMachineState), 9243 9188 VMR3GetStateName(enmOldState), VMR3GetStateName(enmState) )); … … 10210 10155 } 10211 10156 10212 /**10213 * Progress cancelation callback for fault tolerance VM poweron10214 */10215 static void faultToleranceProgressCancelCallback(void *pvUser)10216 {10217 PUVM pUVM = (PUVM)pvUser;10218 10219 if (pUVM)10220 FTMR3CancelStandby(pUVM);10221 }10222 10157 10223 10158 /** … … 10292 10227 * SessionMachine::i_setMachineState() when the VM is powered down. 10293 10228 */ 10294 if ( !pTask->mTeleporterEnabled 10295 && pTask->mEnmFaultToleranceState != FaultToleranceState_Standby) 10229 if (!pTask->mTeleporterEnabled) 10296 10230 { 10297 10231 rc = pConsole->mControl->LockMedia(); … … 10516 10450 pConsole->mptrExtPackManager->i_callAllVmPowerOffHooks(pConsole, pVM); 10517 10451 #endif 10518 }10519 }10520 else if (pTask->mEnmFaultToleranceState != FaultToleranceState_Inactive)10521 {10522 /*10523 * Get the config.10524 */10525 ULONG uPort;10526 rc = pMachine->COMGETTER(FaultTolerancePort)(&uPort);10527 if (SUCCEEDED(rc))10528 {10529 ULONG uInterval;10530 rc = pMachine->COMGETTER(FaultToleranceSyncInterval)(&uInterval);10531 if (SUCCEEDED(rc))10532 {10533 Bstr bstrAddress;10534 rc = pMachine->COMGETTER(FaultToleranceAddress)(bstrAddress.asOutParam());10535 if (SUCCEEDED(rc))10536 {10537 Bstr bstrPassword;10538 rc = pMachine->COMGETTER(FaultTolerancePassword)(bstrPassword.asOutParam());10539 if (SUCCEEDED(rc))10540 {10541 if (pTask->mProgress->i_setCancelCallback(faultToleranceProgressCancelCallback,10542 pConsole->mpUVM))10543 {10544 if (SUCCEEDED(rc))10545 {10546 Utf8Str strAddress(bstrAddress);10547 const char *pszAddress = strAddress.isEmpty() ? NULL : strAddress.c_str();10548 Utf8Str strPassword(bstrPassword);10549 const char *pszPassword = strPassword.isEmpty() ? NULL : strPassword.c_str();10550 10551 /* Power on the FT enabled VM. */10552 #ifdef VBOX_WITH_EXTPACK10553 vrc = pConsole->mptrExtPackManager->i_callAllVmPowerOnHooks(pConsole, pVM);10554 #endif10555 if (RT_SUCCESS(vrc))10556 vrc = FTMR3PowerOn(pConsole->mpUVM,10557 pTask->mEnmFaultToleranceState == FaultToleranceState_Master /* fMaster */,10558 uInterval,10559 pszAddress,10560 uPort,10561 pszPassword);10562 AssertLogRelRC(vrc);10563 }10564 pTask->mProgress->i_setCancelCallback(NULL, NULL);10565 }10566 else10567 rc = E_FAIL;10568 10569 }10570 }10571 }10572 10452 } 10573 10453 }
Note:
See TracChangeset
for help on using the changeset viewer.