Changeset 52481 in vbox for trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
- Timestamp:
- Aug 22, 2014 5:27:48 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 95701
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r52168 r52481 1394 1394 * @return 1395 1395 */ 1396 STDMETHODIMP SessionMachine::BeginTakingSnapshot(IConsole *aInitiator,1397 IN_BSTRaName,1398 IN_BSTRaDescription,1399 IProgress *aConsoleProgress,1400 BOOL fTakingSnapshotOnline,1401 BSTR *aStateFilePath)1396 HRESULT SessionMachine::beginTakingSnapshot(const ComPtr<IConsole> &aInitiator, 1397 const com::Utf8Str &aName, 1398 const com::Utf8Str &aDescription, 1399 const ComPtr<IProgress> &aConsoleProgress, 1400 BOOL aFTakingSnapshotOnline, 1401 com::Utf8Str &aStateFilePath) 1402 1402 { 1403 1403 LogFlowThisFuncEnter(); 1404 1404 1405 AssertReturn(aInitiator && aName, E_INVALIDARG); 1406 AssertReturn(aStateFilePath, E_POINTER); 1407 1408 LogFlowThisFunc(("aName='%ls' fTakingSnapshotOnline=%RTbool\n", aName, fTakingSnapshotOnline)); 1409 1410 AutoCaller autoCaller(this); 1411 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 1405 LogFlowThisFunc(("aName='%s' aFTakingSnapshotOnline=%RTbool\n", aName.c_str(), aFTakingSnapshotOnline)); 1412 1406 1413 1407 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1428 1422 } 1429 1423 1430 if ( ! fTakingSnapshotOnline1424 if ( !aFTakingSnapshotOnline 1431 1425 && mData->mMachineState != MachineState_Saved 1432 1426 ) … … 1444 1438 snapshotId.create(); 1445 1439 1446 Utf8Str strStateFilePath;1447 1440 /* stateFilePath is null when the machine is not online nor saved */ 1448 if ( fTakingSnapshotOnline)1441 if (aFTakingSnapshotOnline) 1449 1442 { 1450 1443 Bstr value; … … 1452 1445 value.asOutParam()); 1453 1446 if (FAILED(rc) || value != "1") 1454 {1455 1447 // creating a new online snapshot: we need a fresh saved state file 1456 i_composeSavedStateFilename(strStateFilePath); 1457 } 1448 i_composeSavedStateFilename(aStateFilePath); 1458 1449 } 1459 1450 else if (mData->mMachineState == MachineState_Saved) 1460 1451 // taking an online snapshot from machine in "saved" state: then use existing state file 1461 strStateFilePath = mSSData->strStateFilePath;1462 1463 if ( strStateFilePath.isNotEmpty())1452 aStateFilePath = mSSData->strStateFilePath; 1453 1454 if (aStateFilePath.isNotEmpty()) 1464 1455 { 1465 1456 // ensure the directory for the saved state file exists 1466 HRESULT rc = VirtualBox::i_ensureFilePathExists( strStateFilePath, true /* fCreate */);1457 HRESULT rc = VirtualBox::i_ensureFilePathExists(aStateFilePath, true /* fCreate */); 1467 1458 if (FAILED(rc)) return rc; 1468 1459 } … … 1471 1462 ComObjPtr<SnapshotMachine> snapshotMachine; 1472 1463 snapshotMachine.createObject(); 1473 HRESULT rc = snapshotMachine->init(this, snapshotId.ref(), strStateFilePath);1464 HRESULT rc = snapshotMachine->init(this, snapshotId.ref(), aStateFilePath); 1474 1465 AssertComRCReturn(rc, rc); 1475 1466 … … 1490 1481 mConsoleTaskData.mLastState = mData->mMachineState; 1491 1482 mConsoleTaskData.mSnapshot = pSnapshot; 1483 1492 1484 /// @todo in the long run the progress object should be moved to 1493 1485 // VBoxSVC to avoid trouble with monitoring the progress object state … … 1498 1490 { 1499 1491 LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n", 1500 fTakingSnapshotOnline));1492 aFTakingSnapshotOnline)); 1501 1493 1502 1494 // backup the media data so we can recover if things goes wrong along the day; … … 1515 1507 rc = i_createImplicitDiffs(aConsoleProgress, 1516 1508 1, // operation weight; must be the same as in Console::TakeSnapshot() 1517 !! fTakingSnapshotOnline);1509 !!aFTakingSnapshotOnline); 1518 1510 if (FAILED(rc)) 1519 1511 throw rc; … … 1543 1535 } 1544 1536 1545 if (fTakingSnapshotOnline && SUCCEEDED(rc)) 1546 strStateFilePath.cloneTo(aStateFilePath); 1547 else 1548 *aStateFilePath = NULL; 1537 if (!(aFTakingSnapshotOnline && SUCCEEDED(rc))) 1538 aStateFilePath = ""; 1549 1539 1550 1540 LogFlowThisFunc(("LEAVE - %Rhrc [%s]\n", rc, Global::stringifyMachineState(mData->mMachineState) )); … … 1566 1556 * @return 1567 1557 */ 1568 STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)1558 HRESULT SessionMachine::endTakingSnapshot(BOOL aSuccess) 1569 1559 { 1570 1560 LogFlowThisFunc(("\n")); 1571 1572 AutoCaller autoCaller(this);1573 AssertComRCReturn (autoCaller.rc(), autoCaller.rc());1574 1561 1575 1562 AutoWriteLock machineLock(this COMMA_LOCKVAL_SRC_POS); … … 1693 1680 * @return 1694 1681 */ 1695 STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,1696 ISnapshot *aSnapshot,1697 1698 IProgress **aProgress)1682 HRESULT SessionMachine::restoreSnapshot(const ComPtr<IConsole> &aInitiator, 1683 const ComPtr<ISnapshot> &aSnapshot, 1684 MachineState_T *aMachineState, 1685 ComPtr<IProgress> &aProgress) 1699 1686 { 1700 1687 LogFlowThisFuncEnter(); 1701 1702 AssertReturn(aInitiator, E_INVALIDARG);1703 AssertReturn(aSnapshot && aMachineState && aProgress, E_POINTER);1704 1705 AutoCaller autoCaller(this);1706 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());1707 1688 1708 1689 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 1712 1693 E_FAIL); 1713 1694 1714 ComObjPtr<Snapshot> pSnapshot(static_cast<Snapshot*>(aSnapshot)); 1695 ISnapshot* iSnapshot = aSnapshot; 1696 ComObjPtr<Snapshot>pSnapshot(static_cast<Snapshot*>(iSnapshot)); 1715 1697 ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->i_getSnapshotMachine(); 1716 1698 … … 1769 1751 1770 1752 /* return the progress to the caller */ 1771 pProgress.queryInterfaceTo(aProgress );1753 pProgress.queryInterfaceTo(aProgress.asOutParam()); 1772 1754 1773 1755 /* return the new state to the caller */ … … 2055 2037 2056 2038 /** 2057 * Implementation for IInternalMachineControl:: DeleteSnapshot().2039 * Implementation for IInternalMachineControl::deleteSnapshot(). 2058 2040 * 2059 2041 * Gets called from Console::DeleteSnapshot(), and that's basically the … … 2070 2052 * @note Locks mParent + this + children objects for writing! 2071 2053 */ 2072 STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,2073 IN_BSTRaStartId,2074 IN_BSTRaEndId,2075 BOOL fDeleteAllChildren,2076 2077 IProgress **aProgress)2054 HRESULT SessionMachine::deleteSnapshot(const ComPtr<IConsole> &aInitiator, 2055 const com::Guid &aStartId, 2056 const com::Guid &aEndId, 2057 BOOL aDeleteAllChildren, 2058 MachineState_T *aMachineState, 2059 ComPtr<IProgress> &aProgress) 2078 2060 { 2079 2061 LogFlowThisFuncEnter(); 2080 2062 2081 Guid startId(aStartId); 2082 Guid endId(aEndId); 2083 2084 AssertReturn(aInitiator && !startId.isZero() && !endId.isZero() && startId.isValid() && endId.isValid(), E_INVALIDARG); 2063 AssertReturn(aInitiator && !aStartId.isZero() && !aEndId.isZero() && aStartId.isValid() && aEndId.isValid(), E_INVALIDARG); 2085 2064 2086 2065 AssertReturn(aMachineState && aProgress, E_POINTER); 2087 2066 2088 2067 /** @todo implement the "and all children" and "range" variants */ 2089 if ( fDeleteAllChildren || startId != endId)2068 if (aDeleteAllChildren || aStartId != aEndId) 2090 2069 ReturnComNotImplemented(); 2091 2092 AutoCaller autoCaller(this);2093 AssertComRCReturn(autoCaller.rc(), autoCaller.rc());2094 2070 2095 2071 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 2108 2084 2109 2085 ComObjPtr<Snapshot> pSnapshot; 2110 HRESULT rc = i_findSnapshotById( startId, pSnapshot, true /* aSetError */);2086 HRESULT rc = i_findSnapshotById(aStartId, pSnapshot, true /* aSetError */); 2111 2087 if (FAILED(rc)) return rc; 2112 2088 … … 2226 2202 2227 2203 /* return the progress to the caller */ 2228 pProgress.queryInterfaceTo(aProgress );2204 pProgress.queryInterfaceTo(aProgress.asOutParam()); 2229 2205 2230 2206 /* return the new state to the caller */ … … 3428 3404 3429 3405 /** 3430 * Implementation for IInternalMachineControl:: FinishOnlineMergeMedium().3406 * Implementation for IInternalMachineControl::finishOnlineMergeMedium(). 3431 3407 * 3432 3408 * Gets called after the successful completion of an online merge from … … 3437 3413 * can continue with the updated state of the medium chain. 3438 3414 */ 3439 STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()3415 HRESULT SessionMachine::finishOnlineMergeMedium() 3440 3416 { 3441 3417 HRESULT rc = S_OK;
Note:
See TracChangeset
for help on using the changeset viewer.