VirtualBox

Ignore:
Timestamp:
Aug 22, 2014 5:27:48 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
95701
Message:

6813 - MachineImpl.cpp - IInternalMachineControl changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r52168 r52481  
    13941394 * @return
    13951395 */
    1396 STDMETHODIMP SessionMachine::BeginTakingSnapshot(IConsole *aInitiator,
    1397                                                  IN_BSTR aName,
    1398                                                  IN_BSTR aDescription,
    1399                                                  IProgress *aConsoleProgress,
    1400                                                  BOOL fTakingSnapshotOnline,
    1401                                                  BSTR *aStateFilePath)
     1396HRESULT 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)
    14021402{
    14031403    LogFlowThisFuncEnter();
    14041404
    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));
    14121406
    14131407    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    14281422    }
    14291423
    1430     if (    !fTakingSnapshotOnline
     1424    if (    !aFTakingSnapshotOnline
    14311425         && mData->mMachineState != MachineState_Saved
    14321426       )
     
    14441438    snapshotId.create();
    14451439
    1446     Utf8Str strStateFilePath;
    14471440    /* stateFilePath is null when the machine is not online nor saved */
    1448     if (fTakingSnapshotOnline)
     1441    if (aFTakingSnapshotOnline)
    14491442    {
    14501443        Bstr value;
     
    14521445                                  value.asOutParam());
    14531446        if (FAILED(rc) || value != "1")
    1454         {
    14551447            // creating a new online snapshot: we need a fresh saved state file
    1456             i_composeSavedStateFilename(strStateFilePath);
    1457         }
     1448            i_composeSavedStateFilename(aStateFilePath);
    14581449    }
    14591450    else if (mData->mMachineState == MachineState_Saved)
    14601451        // 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())
    14641455    {
    14651456        // 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 */);
    14671458        if (FAILED(rc)) return rc;
    14681459    }
     
    14711462    ComObjPtr<SnapshotMachine> snapshotMachine;
    14721463    snapshotMachine.createObject();
    1473     HRESULT rc = snapshotMachine->init(this, snapshotId.ref(), strStateFilePath);
     1464    HRESULT rc = snapshotMachine->init(this, snapshotId.ref(), aStateFilePath);
    14741465    AssertComRCReturn(rc, rc);
    14751466
     
    14901481    mConsoleTaskData.mLastState = mData->mMachineState;
    14911482    mConsoleTaskData.mSnapshot = pSnapshot;
     1483
    14921484    /// @todo in the long run the progress object should be moved to
    14931485    // VBoxSVC to avoid trouble with monitoring the progress object state
     
    14981490    {
    14991491        LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n",
    1500                          fTakingSnapshotOnline));
     1492                         aFTakingSnapshotOnline));
    15011493
    15021494        // backup the media data so we can recover if things goes wrong along the day;
     
    15151507        rc = i_createImplicitDiffs(aConsoleProgress,
    15161508                                   1,            // operation weight; must be the same as in Console::TakeSnapshot()
    1517                                    !!fTakingSnapshotOnline);
     1509                                   !!aFTakingSnapshotOnline);
    15181510        if (FAILED(rc))
    15191511            throw rc;
     
    15431535    }
    15441536
    1545     if (fTakingSnapshotOnline && SUCCEEDED(rc))
    1546         strStateFilePath.cloneTo(aStateFilePath);
    1547     else
    1548         *aStateFilePath = NULL;
     1537    if (!(aFTakingSnapshotOnline && SUCCEEDED(rc)))
     1538        aStateFilePath = "";
    15491539
    15501540    LogFlowThisFunc(("LEAVE - %Rhrc [%s]\n", rc, Global::stringifyMachineState(mData->mMachineState) ));
     
    15661556 * @return
    15671557 */
    1568 STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)
     1558HRESULT SessionMachine::endTakingSnapshot(BOOL aSuccess)
    15691559{
    15701560    LogFlowThisFunc(("\n"));
    1571 
    1572     AutoCaller autoCaller(this);
    1573     AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    15741561
    15751562    AutoWriteLock machineLock(this COMMA_LOCKVAL_SRC_POS);
     
    16931680 * @return
    16941681 */
    1695 STDMETHODIMP SessionMachine::RestoreSnapshot(IConsole *aInitiator,
    1696                                              ISnapshot *aSnapshot,
    1697                                              MachineState_T *aMachineState,
    1698                                              IProgress **aProgress)
     1682HRESULT SessionMachine::restoreSnapshot(const ComPtr<IConsole> &aInitiator,
     1683                                        const ComPtr<ISnapshot> &aSnapshot,
     1684                                        MachineState_T *aMachineState,
     1685                                        ComPtr<IProgress> &aProgress)
    16991686{
    17001687    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());
    17071688
    17081689    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    17121693                 E_FAIL);
    17131694
    1714     ComObjPtr<Snapshot> pSnapshot(static_cast<Snapshot*>(aSnapshot));
     1695    ISnapshot* iSnapshot = aSnapshot;
     1696    ComObjPtr<Snapshot>pSnapshot(static_cast<Snapshot*>(iSnapshot));
    17151697    ComObjPtr<SnapshotMachine> pSnapMachine = pSnapshot->i_getSnapshotMachine();
    17161698
     
    17691751
    17701752    /* return the progress to the caller */
    1771     pProgress.queryInterfaceTo(aProgress);
     1753    pProgress.queryInterfaceTo(aProgress.asOutParam());
    17721754
    17731755    /* return the new state to the caller */
     
    20552037
    20562038/**
    2057  * Implementation for IInternalMachineControl::DeleteSnapshot().
     2039 * Implementation for IInternalMachineControl::deleteSnapshot().
    20582040 *
    20592041 * Gets called from Console::DeleteSnapshot(), and that's basically the
     
    20702052 * @note Locks mParent + this + children objects for writing!
    20712053 */
    2072 STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
    2073                                             IN_BSTR aStartId,
    2074                                             IN_BSTR aEndId,
    2075                                             BOOL fDeleteAllChildren,
    2076                                             MachineState_T *aMachineState,
    2077                                             IProgress **aProgress)
     2054HRESULT 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)
    20782060{
    20792061    LogFlowThisFuncEnter();
    20802062
    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);
    20852064
    20862065    AssertReturn(aMachineState && aProgress, E_POINTER);
    20872066
    20882067    /** @todo implement the "and all children" and "range" variants */
    2089     if (fDeleteAllChildren || startId != endId)
     2068    if (aDeleteAllChildren || aStartId != aEndId)
    20902069        ReturnComNotImplemented();
    2091 
    2092     AutoCaller autoCaller(this);
    2093     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    20942070
    20952071    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    21082084
    21092085    ComObjPtr<Snapshot> pSnapshot;
    2110     HRESULT rc = i_findSnapshotById(startId, pSnapshot, true /* aSetError */);
     2086    HRESULT rc = i_findSnapshotById(aStartId, pSnapshot, true /* aSetError */);
    21112087    if (FAILED(rc)) return rc;
    21122088
     
    22262202
    22272203    /* return the progress to the caller */
    2228     pProgress.queryInterfaceTo(aProgress);
     2204    pProgress.queryInterfaceTo(aProgress.asOutParam());
    22292205
    22302206    /* return the new state to the caller */
     
    34283404
    34293405/**
    3430  * Implementation for IInternalMachineControl::FinishOnlineMergeMedium().
     3406 * Implementation for IInternalMachineControl::finishOnlineMergeMedium().
    34313407 *
    34323408 * Gets called after the successful completion of an online merge from
     
    34373413 * can continue with the updated state of the medium chain.
    34383414 */
    3439 STDMETHODIMP SessionMachine::FinishOnlineMergeMedium()
     3415HRESULT SessionMachine::finishOnlineMergeMedium()
    34403416{
    34413417    HRESULT rc = S_OK;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette