VirtualBox

Ignore:
Timestamp:
May 20, 2015 4:52:25 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
100486
Message:

Main/Snapshot: add a parameter to IMachine.takeSnapshot, returning the snapshot UUID, which is useful for finding the snapshot reliably (using the non-unique name is error prone), plus the necessary code adaptions everywhere.
Frontends/VBoxManage: add a feature for creating unique snapshot names (by appending a number or timestamp).

File:
1 edited

Legend:

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

    r55749 r55977  
    13321332                     const Utf8Str &strName,
    13331333                     const Utf8Str &strDescription,
     1334                     const Guid &uuidSnapshot,
    13341335                     bool fPause,
    13351336                     uint32_t uMemSize,
     
    13381339          m_strName(strName),
    13391340          m_strDescription(strDescription),
     1341          m_uuidSnapshot(uuidSnapshot),
    13401342          m_fPause(fPause),
    13411343          m_uMemSize(uMemSize),
     
    13571359    Utf8Str m_strName;
    13581360    Utf8Str m_strDescription;
     1361    Guid m_uuidSnapshot;
    13591362    Utf8Str m_strStateFilePath;
    13601363    ComPtr<IInternalSessionControl> m_pDirectControl;
     
    14121415                              const com::Utf8Str &aDescription,
    14131416                              BOOL fPause,
     1417                              com::Guid &aId,
    14141418                              ComPtr<IProgress> &aProgress)
    14151419{
     
    14171421    NOREF(aDescription);
    14181422    NOREF(fPause);
     1423    NOREF(aId);
    14191424    NOREF(aProgress);
    14201425    ReturnComNotImplemented();
     
    14241429                                     const com::Utf8Str &aDescription,
    14251430                                     BOOL fPause,
     1431                                     com::Guid &aId,
    14261432                                     ComPtr<IProgress> &aProgress)
    14271433{
     
    14821488        return rc;
    14831489
     1490    /* create an ID for the snapshot */
     1491    Guid snapshotId;
     1492    snapshotId.create();
     1493
    14841494    /* create and start the task on a separate thread (note that it will not
    14851495     * start working until we release alock) */
     
    14901500                                                   aName,
    14911501                                                   aDescription,
     1502                                                   snapshotId,
    14921503                                                   !!fPause,
    14931504                                                   mHWData->mMemorySize,
     
    15091520        i_setMachineState(MachineState_Snapshotting);
    15101521
     1522    aId = snapshotId;
    15111523    pTask->m_pProgress.queryInterfaceTo(aProgress.asOutParam());
    15121524
     
    15551567    bool fBeganTakingSnapshot = false;
    15561568    BOOL fSuspendedBySave     = FALSE;
    1557     Guid snapshotId;
    15581569
    15591570    try
     
    16061617        /* STEP 1: create the snapshot object */
    16071618
    1608         /* create an ID for the snapshot */
    1609         snapshotId.create();
    1610 
    16111619        /* create a snapshot machine object */
    16121620        ComObjPtr<SnapshotMachine> pSnapshotMachine;
    16131621        pSnapshotMachine.createObject();
    1614         rc = pSnapshotMachine->init(this, snapshotId.ref(), task.m_strStateFilePath);
     1622        rc = pSnapshotMachine->init(this, task.m_uuidSnapshot.ref(), task.m_strStateFilePath);
    16151623        AssertComRCThrowRC(rc);
    16161624
     
    16201628        task.m_pSnapshot.createObject();
    16211629        rc = task.m_pSnapshot->init(mParent,
    1622                                     snapshotId,
     1630                                    task.m_uuidSnapshot,
    16231631                                    task.m_strName,
    16241632                                    task.m_strDescription,
     
    17971805
    17981806    if (SUCCEEDED(rc))
    1799         mParent->i_onSnapshotTaken(mData->mUuid, snapshotId);
     1807        mParent->i_onSnapshotTaken(mData->mUuid, task.m_uuidSnapshot);
    18001808    LogFlowThisFuncLeave();
    18011809}
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