- Timestamp:
- Sep 4, 2009 2:25:31 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Config.kmk
r22777 r22784 505 505 endif 506 506 507 # 508 # Config items for enabling work in progress. 509 # 510 # It's good pratice to add stuff here even if it is currently disabled by 511 # default. 512 # 513 # Note! Please, do *not* add stuff to the global DEFS unless it is *really* 514 # necessary! The other guys will hate for it you when they have to 515 # recompile everything when the feature is enabled or disabled. Put 516 # the ifdefs in target or template definitions. 517 # 518 507 519 ## For experimenting with disabling preemption instead of interrupts 508 520 # when working VT-x/AMD-V in VMMR0. … … 511 523 VBOX_WITH_VMMR0_DISABLE_PREEMPTION = 1 512 524 endif 525 526 ## Enabled the live migration API changes. 527 #VBOX_WITH_LIVE_MIGRATION = 1 513 528 514 529 # -
trunk/include/VBox/vmapi.h
r21217 r22784 370 370 typedef FNVMPROGRESS *PFNVMPROGRESS; 371 371 372 VMMR3DECL(int) VMR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser);372 VMMR3DECL(int) VMR3Save(PVM pVM, const char *pszFilename, bool fContinueAfterwards, PFNVMPROGRESS pfnProgress, void *pvUser); 373 373 VMMR3DECL(int) VMR3Load(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser); 374 374 VMMR3DECL(int) VMR3PowerOff(PVM pVM); -
trunk/src/VBox/Frontends/VBoxBFE/VMControl.cpp
r19300 r22784 161 161 startProgressInfo("Saving"); 162 162 rc = VMR3ReqCall(pVM, VMCPUID_ANY, &pReq, RT_INDEFINITE_WAIT, 163 (PFNRT)VMR3Save, 4, pVM, g_pszStateFile, &callProgressInfo, (uintptr_t)NULL);163 (PFNRT)VMR3Save, 5, pVM, g_pszStateFile, false /*fContinueAftewards*/, &callProgressInfo, (uintptr_t)NULL); 164 164 endProgressInfo(); 165 165 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Main/ConsoleImpl.cpp
r22624 r22784 2386 2386 MachineState_T lastMachineState = mMachineState; 2387 2387 2388 #ifndef VBOX_WITH_LIVE_MIGRATION /** @todo update the API docs. */ 2388 2389 if (mMachineState == MachineState_Running) 2389 2390 { … … 2391 2392 CheckComRCReturnRC(rc); 2392 2393 } 2394 #endif 2393 2395 2394 2396 HRESULT rc = S_OK; 2395 2397 2396 bool fTakingSnapshotOnline = (mMachineState == MachineState_Paused); 2398 bool const fTakingSnapshotOnline = ( mMachineState == MachineState_Running 2399 || mMachineState == MachineState_Paused); 2397 2400 2398 2401 /* … … 2450 2453 2451 2454 /* 2452 * state file is non-null only when the VM is paused 2453 * (i.e. creating a snapshot online) 2455 * The state file is non-null only when creating a online or live snapshot. 2454 2456 */ 2455 2457 ComAssertBreak( (!stateFilePath.isNull() && fTakingSnapshotOnline) … … 7316 7318 int vrc = VMR3Save(that->mpVM, 7317 7319 task->mSavedStateFile.c_str(), 7320 task->mIsSnapshot /*fContinueAfterwards*/, 7318 7321 Console::stateProgressCallback, 7319 7322 static_cast<VMProgressTask*>(task.get())); -
trunk/src/VBox/Main/MachineImpl.cpp
r22779 r22784 7927 7927 AssertReturn( ( !Global::IsOnlineOrTransient (mData->mMachineState) 7928 7928 || mData->mMachineState == MachineState_Paused 7929 #ifdef VBOX_WITH_LIVE_MIGRATION 7930 || mData->mMachineState == MachineState_Running 7931 #endif 7929 7932 ) 7930 7933 && mSnapshotData.mLastState == MachineState_Null … … 7933 7936 && mSnapshotData.mCombinedProgress.isNull(), E_FAIL); 7934 7937 7935 bool fTakingSnapshotOnline = (mData->mMachineState == MachineState_Paused); 7938 bool const fTakingSnapshotOnline = ( mData->mMachineState == MachineState_Running 7939 || mData->mMachineState == MachineState_Paused); 7936 7940 7937 7941 if ( !fTakingSnapshotOnline -
trunk/src/VBox/Main/Makefile.kmk
r22705 r22784 216 216 $(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \ 217 217 $(if $(VBOX_WITH_DBUS),VBOX_WITH_DBUS,) \ 218 $(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,) 218 $(if $(VBOX_USB_WITH_SYSFS),VBOX_USB_WITH_SYSFS,) \ 219 $(if $(VBOX_WITH_LIVE_MIGRATION),VBOX_WITH_LIVE_MIGRATION,) 219 220 ifdef VBOX_WITH_USB 220 221 VBoxSVC_DEFS += \ … … 529 530 $(if $(VBOX_WITH_SMC),VBOX_WITH_SMC,) \ 530 531 $(if $(VBOX_WITH_LPC),VBOX_WITH_LPC,) \ 531 $(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) 532 $(if $(VBOX_WITH_PDM_ASYNC_COMPLETION),VBOX_WITH_PDM_ASYNC_COMPLETION,) \ 533 $(if $(VBOX_WITH_LIVE_MIGRATION),VBOX_WITH_LIVE_MIGRATION,) 532 534 ifdef VBOX_WITH_USB 533 535 VBoxC_DEFS += \ -
trunk/src/VBox/VMM/VM.cpp
r22636 r22784 135 135 static DECLCALLBACK(int) vmR3Suspend(PVM pVM); 136 136 static DECLCALLBACK(int) vmR3Resume(PVM pVM); 137 static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser);137 static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser); 138 138 static DECLCALLBACK(int) vmR3Load(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser); 139 139 static DECLCALLBACK(int) vmR3PowerOff(PVM pVM); … … 1386 1386 * Save current VM state. 1387 1387 * 1388 * To save and terminate the VM, the VM must be suspended before the call. 1388 * Can be used for both saving the state and creating snapshots. 1389 * 1390 * When called for a VM in the RUNNING state, the saved state is created live 1391 * and the VM is only suspended when the final part of the saving is preformed. 1392 * The VM state will not be restored to RUNNING in this case and it's up to the 1393 * caller to call VMR3Resume if this is desirable. (The rational is that the 1394 * caller probably wish to reconfigure the disks before resuming the VM.) 1395 * 1396 * @returns VBox status code. 1397 * 1398 * @param pVM VM which state should be saved. 1399 * @param pszFilename Name of the save state file. 1400 * @param fContinueAftewards Continue execution afterwards. When in doubt, 1401 * set this to true. 1402 * @param pfnProgress Progress callback. Optional. 1403 * @param pvUser User argument for the progress callback. 1404 * 1405 * @thread Any thread. Will forward the request to EMT(0). 1406 * @vmstate Suspended, Running 1407 * @vmstateto Suspended. 1408 */ 1409 VMMR3DECL(int) VMR3Save(PVM pVM, const char *pszFilename, bool fContinueAftewards, PFNVMPROGRESS pfnProgress, void *pvUser) 1410 { 1411 LogFlow(("VMR3Save: pVM=%p pszFilename=%p:{%s} fContinueAftewards=%RTbool pfnProgress=%p pvUser=%p\n", 1412 pVM, pszFilename, pszFilename, fContinueAftewards, pfnProgress, pvUser)); 1413 1414 /* 1415 * Validate input. 1416 */ 1417 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 1418 AssertPtrReturn(pszFilename, VERR_INVALID_POINTER); 1419 AssertReturn(*pszFilename, VERR_INVALID_PARAMETER); 1420 AssertPtrNullReturn(pfnProgress, VERR_INVALID_POINTER); 1421 1422 /* 1423 * Request the operation in EMT(0). 1424 */ 1425 SSMAFTER enmAfter = fContinueAftewards ? SSMAFTER_CONTINUE : SSMAFTER_DESTROY; 1426 PVMREQ pReq; 1427 int rc = VMR3ReqCall(pVM, 0 /* VCPU 0 */, &pReq, RT_INDEFINITE_WAIT, 1428 (PFNRT)vmR3Save, 5, pVM, pszFilename, enmAfter, pfnProgress, pvUser); 1429 if (RT_SUCCESS(rc)) 1430 { 1431 rc = pReq->iStatus; 1432 VMR3ReqFree(pReq); 1433 } 1434 1435 LogFlow(("VMR3Save: returns %Rrc\n", rc)); 1436 return rc; 1437 } 1438 1439 1440 /** 1441 * Worker for VMR3Save that validates the state and calls SSMR3Save. 1389 1442 * 1390 1443 * @returns 0 on success. … … 1392 1445 * @param pVM VM which state should be saved. 1393 1446 * @param pszFilename Name of the save state file. 1394 * @param pfnProgress Progress callback. Optional. 1395 * @param pvUser User argument for the progress callback. 1396 * @thread Any thread. 1397 * @vmstate Suspended 1398 * @vmstateto Unchanged state. 1399 */ 1400 VMMR3DECL(int) VMR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser) 1401 { 1402 LogFlow(("VMR3Save: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser)); 1403 1404 /* 1405 * Validate input. 1406 */ 1407 if (!pVM) 1408 { 1409 AssertMsgFailed(("Invalid VM pointer\n")); 1410 return VERR_INVALID_PARAMETER; 1411 } 1412 if (!pszFilename) 1413 { 1414 AssertMsgFailed(("Must specify a filename to save the state to, wise guy!\n")); 1415 return VERR_INVALID_PARAMETER; 1416 } 1417 1418 /* 1419 * Request the operation in EMT. 1420 */ 1421 PVMREQ pReq; 1422 int rc = VMR3ReqCall(pVM, 0 /* VCPU 0 */, &pReq, RT_INDEFINITE_WAIT, (PFNRT)vmR3Save, 4, pVM, pszFilename, pfnProgress, pvUser); 1423 if (RT_SUCCESS(rc)) 1424 { 1425 rc = pReq->iStatus; 1426 VMR3ReqFree(pReq); 1427 } 1428 1429 LogFlow(("VMR3Save: returns %Rrc\n", rc)); 1430 return rc; 1431 } 1432 1433 1434 /** 1435 * Save current VM state. 1436 * 1437 * To save and terminate the VM, the VM must be suspended before the call. 1438 * 1439 * @returns 0 on success. 1440 * @returns VBox error code on failure. 1441 * @param pVM VM which state should be saved. 1442 * @param pszFilename Name of the save state file. 1447 * @param enmAfter What to do afterwards. 1443 1448 * @param pfnProgress Progress callback. Optional. 1444 1449 * @param pvUser User argument for the progress callback. 1445 1450 * @thread EMT 1446 1451 */ 1447 static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, PFNVMPROGRESS pfnProgress, void *pvUser)1448 { 1449 LogFlow(("vmR3Save: pVM=%p pszFilename=%p:{%s} pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, pfnProgress, pvUser));1452 static DECLCALLBACK(int) vmR3Save(PVM pVM, const char *pszFilename, SSMAFTER enmAfter, PFNVMPROGRESS pfnProgress, void *pvUser) 1453 { 1454 LogFlow(("vmR3Save: pVM=%p pszFilename=%p:{%s} enmAfter=%d pfnProgress=%p pvUser=%p\n", pVM, pszFilename, pszFilename, enmAfter, pfnProgress, pvUser)); 1450 1455 1451 1456 /* 1452 1457 * Validate input. 1453 1458 */ 1454 if (pVM->enmVMState != VMSTATE_SUSPENDED)1455 {1456 AssertMsgFailed(("Invalid VM state %d\n", pVM->enmVMState));1457 return VERR_VM_INVALID_VM_STATE;1458 }1459 /** @todo SMP: Check that vmR3SetState always done by EMT(0). If not add a vmR3TrySetState(). */ 1460 AssertMsgReturn( pVM->enmVMState == VMSTATE_SUSPENDED 1461 || pVM->enmVMState == VMSTATE_RUNNING, 1462 ("%d\n", pVM->enmVMState), 1463 VERR_VM_INVALID_VM_STATE); 1459 1464 1460 1465 /* If we are in an inconsistent state, then we don't allow state saving. */ 1461 if (pVM->vm.s.fPreventSaveState) 1466 if (pVM->vm.s.fPreventSaveState) /** @todo Incorporate VMINT::fPreventSaveState into the VMSTATE. There is a defect for this. */ 1462 1467 { 1463 1468 LogRel(("VMM: vmR3Save: saving the VM state is not allowed at this moment\n")); … … 1468 1473 * Change the state and perform the save. 1469 1474 */ 1470 vmR3SetState(pVM, VMSTATE_SAVING); 1471 int rc = SSMR3Save(pVM, pszFilename, SSMAFTER_CONTINUE, pfnProgress, pvUser);1475 vmR3SetState(pVM, VMSTATE_SAVING); /** @todo Should probably use a different state for live snapshots and/or live migration. Will fix the state machine later. */ 1476 int rc = SSMR3Save(pVM, pszFilename, enmAfter, pfnProgress, pvUser); 1472 1477 vmR3SetState(pVM, VMSTATE_SUSPENDED); 1473 1478
Note:
See TracChangeset
for help on using the changeset viewer.