VirtualBox

Changeset 37851 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Jul 8, 2011 5:04:03 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
72745
Message:

Main/Console+Machine: new method for deleting a range of snapshot, right now not implemented

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r37831 r37851  
    29332933  <interface
    29342934    name="IInternalMachineControl" extends="$unknown"
    2935     uuid="31de448d-ef5e-4f79-9206-a8e830cbf9ea"
     2935    uuid="2087906d-bb92-43a0-8014-4cab009e4888"
    29362936    internal="yes"
    29372937    wsmap="suppress"
     
    32243224    <method name="deleteSnapshot">
    32253225      <desc>
    3226         Gets called by <link to="IConsole::deleteSnapshot"/> and
    3227         <link to="IConsole::deleteSnapshotAndAllChildren"/>.
     3226        Gets called by <link to="IConsole::deleteSnapshot"/>,
     3227        <link to="IConsole::deleteSnapshotAndAllChildren"/> and
     3228        <link to="IConsole::deleteSnapshotRange"/>.
    32283229        <result name="VBOX_E_INVALID_OBJECT_STATE">
    32293230          Snapshot has more than one child snapshot. Only possible if the
    3230           delete operation does not delete all children.
     3231          delete operation does not delete all children or the range does
     3232          not meet the linearity condition.
    32313233        </result>
    32323234      </desc>
     
    32343236        <desc>The console object that initiated this call.</desc>
    32353237      </param>
    3236       <param name="id" type="uuid" mod="string" dir="in">
    3237         <desc>UUID of the snapshot to delete.</desc>
     3238      <param name="startId" type="uuid" mod="string" dir="in">
     3239        <desc>UUID of the first snapshot to delete.</desc>
     3240      </param>
     3241      <param name="endId" type="uuid" mod="string" dir="in">
     3242        <desc>UUID of the last snapshot to delete.</desc>
    32383243      </param>
    32393244      <param name="deleteAllChildren" type="boolean" dir="in">
     
    62446249  <interface
    62456250    name="IConsole" extends="$unknown"
    6246     uuid="7fcaa74a-5d69-4c83-a357-404a60664e47"
     6251    uuid="1968b7d3-e3bf-4ceb-99e0-cb7c913317bb"
    62476252    wsmap="managed"
    62486253    >
     
    69376942      <param name="id" type="uuid" mod="string" dir="in">
    69386943        <desc>UUID of the snapshot to delete, including all its children.</desc>
     6944      </param>
     6945      <param name="progress" type="IProgress" dir="return">
     6946        <desc>Progress object to track the operation completion.</desc>
     6947      </param>
     6948    </method>
     6949
     6950    <method name="deleteSnapshotRange">
     6951      <desc>
     6952        Starts deleting the specified snapshot range. This is limited to
     6953        linear snapshot lists, which means there may not be any other child
     6954        snapshots other than the direct sequence between the start and end
     6955        snapshot. If the start and end snapshot point to the same snapshot this
     6956        method is completely equivalent to <link to="#deleteSnapshot"/>. See
     6957        <link to="ISnapshot" /> for an introduction to snapshots. The
     6958        conditions and many details are the same as with
     6959        <link to="#deleteSnapshot"/>.
     6960
     6961        This operation is generally faster than deleting snapshots one by one
     6962        and often also needs less extra disk space before freeing up disk space
     6963        by deleting the removed disk images corresponding to the snapshot.
     6964
     6965        <note>This API method is right now not implemented!</note>
     6966
     6967        <result name="VBOX_E_INVALID_VM_STATE">
     6968          The running virtual machine prevents deleting this snapshot. This
     6969          happens only in very specific situations, usually snapshots can be
     6970          deleted without trouble while a VM is running. The error message
     6971          text explains the reason for the failure.
     6972        </result>
     6973        <result name="E_NOTIMPL">
     6974          The method is not implemented yet.
     6975        </result>
     6976      </desc>
     6977      <param name="startId" type="uuid" mod="string" dir="in">
     6978        <desc>UUID of the first snapshot to delete.</desc>
     6979      </param>
     6980      <param name="endId" type="uuid" mod="string" dir="in">
     6981        <desc>UUID of the last snapshot to delete.</desc>
    69396982      </param>
    69406983      <param name="progress" type="IProgress" dir="return">
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r37813 r37851  
    157157    STDMETHOD(DeleteSnapshot)(IN_BSTR aId, IProgress **aProgress);
    158158    STDMETHOD(DeleteSnapshotAndAllChildren)(IN_BSTR aId, IProgress **aProgress);
     159    STDMETHOD(DeleteSnapshotRange)(IN_BSTR aStartId, IN_BSTR aEndId, IProgress **aProgress);
    159160    STDMETHOD(RestoreSnapshot)(ISnapshot *aSnapshot, IProgress **aProgress);
    160161    STDMETHOD(Teleport)(IN_BSTR aHostname, ULONG aPort, IN_BSTR aPassword, ULONG aMaxDowntime, IProgress **aProgress);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r37824 r37851  
    991991                                   BSTR *aStateFilePath);
    992992    STDMETHOD(EndTakingSnapshot)(BOOL aSuccess);
    993     STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aId,
    994                               BOOL fDeleteAllChildren,
     993    STDMETHOD(DeleteSnapshot)(IConsole *aInitiator, IN_BSTR aStartId,
     994                              IN_BSTR aEndID, BOOL fDeleteAllChildren,
    995995                              MachineState_T *aMachineState, IProgress **aProgress);
    996996    STDMETHOD(FinishOnlineMergeMedium)(IMediumAttachment *aMediumAttachment,
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r37843 r37851  
    32473247
    32483248    MachineState_T machineState = MachineState_Null;
    3249     HRESULT rc = mControl->DeleteSnapshot(this, aId, FALSE /* fDeleteAllChildren */, &machineState, aProgress);
     3249    HRESULT rc = mControl->DeleteSnapshot(this, aId, aId, FALSE /* fDeleteAllChildren */, &machineState, aProgress);
    32503250    if (FAILED(rc)) return rc;
    32513251
     
    32703270
    32713271    MachineState_T machineState = MachineState_Null;
    3272     HRESULT rc = mControl->DeleteSnapshot(this, aId, TRUE /* fDeleteAllChildren */, &machineState, aProgress);
     3272    HRESULT rc = mControl->DeleteSnapshot(this, aId, aId, TRUE /* fDeleteAllChildren */, &machineState, aProgress);
     3273    if (FAILED(rc)) return rc;
     3274
     3275    setMachineStateLocally(machineState);
     3276    return S_OK;
     3277}
     3278
     3279STDMETHODIMP Console::DeleteSnapshotRange(IN_BSTR aStartId, IN_BSTR aEndId, IProgress **aProgress)
     3280{
     3281    CheckComArgExpr(aStartId, Guid(aStartId).isEmpty() == false);
     3282    CheckComArgExpr(aEndId, Guid(aEndId).isEmpty() == false);
     3283    CheckComArgOutPointerValid(aProgress);
     3284
     3285    AutoCaller autoCaller(this);
     3286    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     3287
     3288    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     3289
     3290    if (Global::IsTransient(mMachineState))
     3291        return setError(VBOX_E_INVALID_VM_STATE,
     3292                        tr("Cannot delete a snapshot of the machine while it is changing the state (machine state: %s)"),
     3293                        Global::stringifyMachineState(mMachineState));
     3294
     3295    MachineState_T machineState = MachineState_Null;
     3296    HRESULT rc = mControl->DeleteSnapshot(this, aStartId, aEndId, FALSE /* fDeleteAllChildren */, &machineState, aProgress);
    32733297    if (FAILED(rc)) return rc;
    32743298
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r37449 r37851  
    20142014 */
    20152015STDMETHODIMP SessionMachine::DeleteSnapshot(IConsole *aInitiator,
    2016                                             IN_BSTR aId,
     2016                                            IN_BSTR aStartId,
     2017                                            IN_BSTR aEndId,
    20172018                                            BOOL fDeleteAllChildren,
    20182019                                            MachineState_T *aMachineState,
     
    20212022    LogFlowThisFuncEnter();
    20222023
    2023     Guid id(aId);
    2024     AssertReturn(aInitiator && !id.isEmpty(), E_INVALIDARG);
     2024    Guid startId(aStartId);
     2025    Guid endId(aEndId);
     2026    AssertReturn(aInitiator && !startId.isEmpty() && !endId.isEmpty(), E_INVALIDARG);
    20252027    AssertReturn(aMachineState && aProgress, E_POINTER);
    20262028
    2027     /** @todo implement the "and all children" variant */
    2028     if (fDeleteAllChildren)
     2029    /** @todo implement the "and all children" and "range" variants */
     2030    if (fDeleteAllChildren || startId != endId)
    20292031        ReturnComNotImplemented();
    20302032
     
    20472049
    20482050    ComObjPtr<Snapshot> pSnapshot;
    2049     HRESULT rc = findSnapshotById(id, pSnapshot, true /* aSetError */);
     2051    HRESULT rc = findSnapshotById(startId, pSnapshot, true /* aSetError */);
    20502052    if (FAILED(rc)) return rc;
    20512053
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