Changeset 35175 in vbox
- Timestamp:
- Dec 16, 2010 12:36:00 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r35124 r35175 10242 10242 } 10243 10243 10244 Assert(m SnapshotData.mStateFilePath.isEmpty() || !mSnapshotData.mSnapshot);10245 if (!m SnapshotData.mStateFilePath.isEmpty())10244 Assert(mConsoleTaskData.mStateFilePath.isEmpty() || !mConsoleTaskData.mSnapshot); 10245 if (!mConsoleTaskData.mStateFilePath.isEmpty()) 10246 10246 { 10247 10247 LogWarningThisFunc(("canceling failed save state request!\n")); 10248 10248 endSavingState(E_FAIL, tr("Machine terminated with pending save state!")); 10249 10249 } 10250 else if (!m SnapshotData.mSnapshot.isNull())10250 else if (!mConsoleTaskData.mSnapshot.isNull()) 10251 10251 { 10252 10252 LogWarningThisFunc(("canceling untaken snapshot!\n")); … … 10256 10256 rollbackMedia(); 10257 10257 /* delete the saved state file (it might have been already created) */ 10258 if (m SnapshotData.mSnapshot->stateFilePath().length())10259 RTFileDelete(m SnapshotData.mSnapshot->stateFilePath().c_str());10260 10261 m SnapshotData.mSnapshot->uninit();10258 if (mConsoleTaskData.mSnapshot->stateFilePath().length()) 10259 RTFileDelete(mConsoleTaskData.mSnapshot->stateFilePath().c_str()); 10260 10261 mConsoleTaskData.mSnapshot->uninit(); 10262 10262 } 10263 10263 … … 10752 10752 10753 10753 AssertReturn( mData->mMachineState == MachineState_Paused 10754 && m SnapshotData.mLastState == MachineState_Null10755 && m SnapshotData.mStateFilePath.isEmpty(),10754 && mConsoleTaskData.mLastState == MachineState_Null 10755 && mConsoleTaskData.mStateFilePath.isEmpty(), 10756 10756 E_FAIL); 10757 10757 … … 10777 10777 10778 10778 /* fill in the snapshot data */ 10779 m SnapshotData.mLastState = mData->mMachineState;10780 m SnapshotData.mStateFilePath = stateFilePath;10781 m SnapshotData.mProgress = pProgress;10779 mConsoleTaskData.mLastState = mData->mMachineState; 10780 mConsoleTaskData.mStateFilePath = stateFilePath; 10781 mConsoleTaskData.mProgress = pProgress; 10782 10782 10783 10783 /* set the state to Saving (this is expected by Console::SaveState()) */ … … 10805 10805 AssertReturn( ( (SUCCEEDED(iResult) && mData->mMachineState == MachineState_Saved) 10806 10806 || (FAILED(iResult) && mData->mMachineState == MachineState_Saving)) 10807 && m SnapshotData.mLastState != MachineState_Null10808 && !m SnapshotData.mStateFilePath.isEmpty(),10807 && mConsoleTaskData.mLastState != MachineState_Null 10808 && !mConsoleTaskData.mStateFilePath.isEmpty(), 10809 10809 E_FAIL); 10810 10810 … … 10816 10816 */ 10817 10817 if (FAILED(iResult)) 10818 setMachineState(m SnapshotData.mLastState);10818 setMachineState(mConsoleTaskData.mLastState); 10819 10819 10820 10820 return endSavingState(iResult, aErrMsg); … … 11517 11517 if (SUCCEEDED(aRc)) 11518 11518 { 11519 mSSData->mStateFilePath = m SnapshotData.mStateFilePath;11519 mSSData->mStateFilePath = mConsoleTaskData.mStateFilePath; 11520 11520 11521 11521 /* save all VM settings */ … … 11527 11527 { 11528 11528 /* delete the saved state file (it might have been already created) */ 11529 RTFileDelete(m SnapshotData.mStateFilePath.c_str());11529 RTFileDelete(mConsoleTaskData.mStateFilePath.c_str()); 11530 11530 } 11531 11531 11532 11532 /* notify the progress object about operation completion */ 11533 Assert(m SnapshotData.mProgress);11533 Assert(mConsoleTaskData.mProgress); 11534 11534 if (SUCCEEDED(aRc)) 11535 m SnapshotData.mProgress->notifyComplete(S_OK);11535 mConsoleTaskData.mProgress->notifyComplete(S_OK); 11536 11536 else 11537 11537 { 11538 11538 if (aErrMsg.length()) 11539 m SnapshotData.mProgress->notifyComplete(aRc,11539 mConsoleTaskData.mProgress->notifyComplete(aRc, 11540 11540 COM_IIDOF(ISession), 11541 11541 getComponentName(), 11542 11542 aErrMsg.c_str()); 11543 11543 else 11544 m SnapshotData.mProgress->notifyComplete(aRc);11544 mConsoleTaskData.mProgress->notifyComplete(aRc); 11545 11545 } 11546 11546 11547 11547 /* clear out the temporary saved state data */ 11548 m SnapshotData.mLastState = MachineState_Null;11549 m SnapshotData.mStateFilePath.setNull();11550 m SnapshotData.mProgress.setNull();11548 mConsoleTaskData.mLastState = MachineState_Null; 11549 mConsoleTaskData.mStateFilePath.setNull(); 11550 mConsoleTaskData.mProgress.setNull(); 11551 11551 11552 11552 LogFlowThisFuncLeave(); … … 11731 11731 /* ignore PoweredOff->Saving->PoweredOff transition when taking a 11732 11732 * snapshot */ 11733 && ( m SnapshotData.mSnapshot.isNull()11734 || m SnapshotData.mLastState >= MachineState_Running /** @todo Live Migration: clean up (lazy bird) */11733 && ( mConsoleTaskData.mSnapshot.isNull() 11734 || mConsoleTaskData.mLastState >= MachineState_Running /** @todo Live Migration: clean up (lazy bird) */ 11735 11735 ) 11736 11736 ) -
trunk/src/VBox/Main/SnapshotImpl.cpp
r35011 r35175 1367 1367 || mData->mMachineState == MachineState_Running 1368 1368 || mData->mMachineState == MachineState_Paused, E_FAIL); 1369 AssertReturn(m SnapshotData.mLastState == MachineState_Null, E_FAIL);1370 AssertReturn(m SnapshotData.mSnapshot.isNull(), E_FAIL);1369 AssertReturn(mConsoleTaskData.mLastState == MachineState_Null, E_FAIL); 1370 AssertReturn(mConsoleTaskData.mSnapshot.isNull(), E_FAIL); 1371 1371 1372 1372 if ( !fTakingSnapshotOnline … … 1422 1422 1423 1423 /* fill in the snapshot data */ 1424 mSnapshotData.mLastState = mData->mMachineState; 1425 mSnapshotData.mSnapshot = pSnapshot; 1424 mConsoleTaskData.mLastState = mData->mMachineState; 1425 mConsoleTaskData.mSnapshot = pSnapshot; 1426 /// @todo in the long run the progress object should be moved to 1427 // VBoxSVC to avoid trouble with monitoring the progress object state 1428 // when the process where it lives is terminating shortly after the 1429 // operation completed. 1426 1430 1427 1431 try … … 1436 1440 1437 1441 /* Console::fntTakeSnapshotWorker and friends expects this. */ 1438 if (m SnapshotData.mLastState == MachineState_Running)1442 if (mConsoleTaskData.mLastState == MachineState_Running) 1439 1443 setMachineState(MachineState_LiveSnapshotting); 1440 1444 else … … 1449 1453 throw rc; 1450 1454 1451 if (m SnapshotData.mLastState == MachineState_Saved)1455 if (mConsoleTaskData.mLastState == MachineState_Saved) 1452 1456 { 1453 1457 Utf8Str stateFrom = mSSData->mStateFilePath; 1454 Utf8Str stateTo = m SnapshotData.mSnapshot->stateFilePath();1458 Utf8Str stateTo = mConsoleTaskData.mSnapshot->stateFilePath(); 1455 1459 1456 1460 LogFlowThisFunc(("Copying the execution state from '%s' to '%s'...\n", … … 1484 1488 { 1485 1489 LogThisFunc(("Caught %Rhrc [%s]\n", hrc, Global::stringifyMachineState(mData->mMachineState) )); 1486 if ( m SnapshotData.mLastState != mData->mMachineState1487 && ( m SnapshotData.mLastState == MachineState_Running1490 if ( mConsoleTaskData.mLastState != mData->mMachineState 1491 && ( mConsoleTaskData.mLastState == MachineState_Running 1488 1492 ? mData->mMachineState == MachineState_LiveSnapshotting 1489 1493 : mData->mMachineState == MachineState_Saving) 1490 1494 ) 1491 setMachineState(m SnapshotData.mLastState);1495 setMachineState(mConsoleTaskData.mLastState); 1492 1496 1493 1497 pSnapshot->uninit(); 1494 1498 pSnapshot.setNull(); 1495 m SnapshotData.mLastState = MachineState_Null;1496 m SnapshotData.mSnapshot.setNull();1499 mConsoleTaskData.mLastState = MachineState_Null; 1500 mConsoleTaskData.mSnapshot.setNull(); 1497 1501 1498 1502 rc = hrc; … … 1540 1544 || ( ( mData->mMachineState == MachineState_Saving 1541 1545 || mData->mMachineState == MachineState_LiveSnapshotting) 1542 && m SnapshotData.mLastState != MachineState_Null1543 && !m SnapshotData.mSnapshot.isNull()1546 && mConsoleTaskData.mLastState != MachineState_Null 1547 && !mConsoleTaskData.mSnapshot.isNull() 1544 1548 ) 1545 1549 , E_FAIL); … … 1551 1555 * all to avoid races. 1552 1556 */ 1553 if ( mData->mMachineState != m SnapshotData.mLastState1554 && m SnapshotData.mLastState != MachineState_Running1557 if ( mData->mMachineState != mConsoleTaskData.mLastState 1558 && mConsoleTaskData.mLastState != MachineState_Running 1555 1559 ) 1556 setMachineState(m SnapshotData.mLastState);1560 setMachineState(mConsoleTaskData.mLastState); 1557 1561 1558 1562 ComObjPtr<Snapshot> pOldFirstSnap = mData->mFirstSnapshot; 1559 1563 ComObjPtr<Snapshot> pOldCurrentSnap = mData->mCurrentSnapshot; 1560 1564 1561 bool fOnline = Global::IsOnline(m SnapshotData.mLastState);1565 bool fOnline = Global::IsOnline(mConsoleTaskData.mLastState); 1562 1566 1563 1567 HRESULT rc = S_OK; … … 1566 1570 { 1567 1571 // new snapshot becomes the current one 1568 mData->mCurrentSnapshot = m SnapshotData.mSnapshot;1572 mData->mCurrentSnapshot = mConsoleTaskData.mSnapshot; 1569 1573 1570 1574 /* memorize the first snapshot if necessary */ … … 1591 1595 /* inform callbacks */ 1592 1596 mParent->onSnapshotTaken(mData->mUuid, 1593 m SnapshotData.mSnapshot->getId());1597 mConsoleTaskData.mSnapshot->getId()); 1594 1598 } 1595 1599 else … … 1603 1607 1604 1608 /* delete the saved state file (it might have been already created) */ 1605 if (m SnapshotData.mSnapshot->stateFilePath().length())1606 RTFileDelete(m SnapshotData.mSnapshot->stateFilePath().c_str());1607 1608 m SnapshotData.mSnapshot->uninit();1609 if (mConsoleTaskData.mSnapshot->stateFilePath().length()) 1610 RTFileDelete(mConsoleTaskData.mSnapshot->stateFilePath().c_str()); 1611 1612 mConsoleTaskData.mSnapshot->uninit(); 1609 1613 } 1610 1614 1611 1615 /* clear out the snapshot data */ 1612 m SnapshotData.mLastState = MachineState_Null;1613 m SnapshotData.mSnapshot.setNull();1616 mConsoleTaskData.mLastState = MachineState_Null; 1617 mConsoleTaskData.mSnapshot.setNull(); 1614 1618 1615 1619 // save VirtualBox.xml (media registry most probably changed with diff image); -
trunk/src/VBox/Main/include/MachineImpl.h
r34770 r35175 993 993 private: 994 994 995 struct SnapshotData996 { 997 SnapshotData() : mLastState(MachineState_Null) {}995 struct ConsoleTaskData 996 { 997 ConsoleTaskData() : mLastState(MachineState_Null) {} 998 998 999 999 MachineState_T mLastState; 1000 ComObjPtr<Progress> mProgress; 1000 1001 1001 1002 // used when taking snapshot 1002 1003 ComObjPtr<Snapshot> mSnapshot; 1003 1004 1004 // used when saving state 1005 // used when saving state (either as part of a snapshot or separate) 1005 1006 Utf8Str mStateFilePath; 1006 ComObjPtr<Progress> mProgress;1007 1007 }; 1008 1008 … … 1063 1063 HRESULT mRemoveSavedState; 1064 1064 1065 SnapshotData mSnapshotData;1065 ConsoleTaskData mConsoleTaskData; 1066 1066 1067 1067 /** interprocess semaphore handle for this machine */
Note:
See TracChangeset
for help on using the changeset viewer.