VirtualBox

Changeset 55255 in vbox


Ignore:
Timestamp:
Apr 14, 2015 3:45:46 PM (10 years ago)
Author:
vboxsync
Message:

Main/Snapshot: only update the machine state on the VM process if there is one,
and introduce a new event when a snapshot has been restored instead of abusing t
he one for deleting a snapshot.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/manual/en_US/SDKRef.xml

    r55235 r55255  
    39203920          <xref linkend="MachineState__OnlineSnapshotting" xreflabel="MachineState::OnlineSnapshotting" />
    39213921          is used when an online snapshot is taken.</para>
     3922        </listitem>
     3923
     3924        <listitem>
     3925          <para>A new event has been introduced, which signals when a snapshot has been
     3926          restored:
     3927          <xref linkend="ISnapshotRestoredEvent" xreflabel="ISnapshotRestoredEvent"/>.
     3928          Previously the event
     3929          <xref linkend="ISnapshotDeletedEvent" xreflabel="ISnapshotDeletedEvent"/> was
     3930          signalled, which isn't logical (but could be distinguished from actual deletion
     3931          by the fact that the snapshot was still there).</para>
    39223932        </listitem>
    39233933
  • trunk/include/VBox/log.h

    r52921 r55255  
    44
    55/*
    6  * Copyright (C) 2006-2014 Oracle Corporation
     6 * Copyright (C) 2006-2015 Oracle Corporation
    77 *
    88 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    563563    LOG_GROUP_MAIN_SNAPSHOTEVENT,
    564564    /** Main group, ISnapshotTakenEvent. */
     565    LOG_GROUP_MAIN_SNAPSHOTRESTOREDEVENT,
     566    /** Main group, ISnapshotRestoredEvent. */
    565567    LOG_GROUP_MAIN_SNAPSHOTTAKENEVENT,
    566568    /** Main group, IStateChangedEvent. */
     
    10261028    "MAIN_SNAPSHOTDELETEDEVENT", \
    10271029    "MAIN_SNAPSHOTEVENT", \
     1030    "MAIN_SNAPSHOTRESTOREDEVENT", \
    10281031    "MAIN_SNAPSHOTTAKENEVENT", \
    10291032    "MAIN_STATECHANGEDEVENT", \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55218 r55255  
    2011120111  <enum
    2011220112    name="VBoxEventType"
    20113     uuid="1622f8d2-6c76-4410-9e78-86e083046efc"
     20113    uuid="b2ddb312-2f9e-4e69-98df-7235e43b2149"
    2011420114    >
    2011520115
     
    2049020490      </desc>
    2049120491    </const>
    20492     <!-- OnHostNameResolutionConfigurationChange -->
     20492    <const name="OnSnapshotRestored" value="95">
     20493      <desc>
     20494        See <link to="ISnapshotRestoredEvent">ISnapshotRestoredEvent</link>.
     20495      </desc>
     20496    </const>
    2049320497    <!-- Last event marker -->
    20494     <const name="Last" value="95">
     20498    <const name="Last" value="96">
    2049520499      <desc>
    2049620500        Must be last event, used for iterations and structures relying on numerical event values.
     
    2098720991      </note>
    2098820992
     20993      <see><link to="ISnapshot"/></see>
     20994    </desc>
     20995    <attribute name="midlDoesNotLikEmptyInterfaces" readonly="yes" type="boolean"/>
     20996  </interface>
     20997
     20998  <interface
     20999    name="ISnapshotRestoredEvent" extends="ISnapshotEvent"
     21000    uuid="f4d803b4-9b2d-4377-bfe6-9702e881516b"
     21001    wsmap="managed" autogen="VBoxEvent" id="OnSnapshotRestored"
     21002    >
     21003    <desc>
     21004      Snapshot of the given machine has been restored.
    2098921005      <see><link to="ISnapshot"/></see>
    2099021006    </desc>
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r54948 r55255  
    141141    void i_onSnapshotTaken(const Guid &aMachineId, const Guid &aSnapshotId);
    142142    void i_onSnapshotDeleted(const Guid &aMachineId, const Guid &aSnapshotId);
     143    void i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId);
    143144    void i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId);
    144145    void i_onGuestPropertyChange(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue,
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r55233 r55255  
    21732173            i_setMachineState(MachineState_PoweredOff);
    21742174
    2175         i_updateMachineStateOnClient();
    21762175        stateRestored = true;
    21772176
     
    22652264            /* restore the machine state */
    22662265            i_setMachineState(task.m_machineStateBackup);
    2267             i_updateMachineStateOnClient();
    22682266        }
    22692267    }
     
    22752273
    22762274    if (SUCCEEDED(rc))
    2277         mParent->i_onSnapshotDeleted(mData->mUuid, Guid());
     2275        mParent->i_onSnapshotRestored(mData->mUuid, Guid());
    22782276
    22792277    LogFlowThisFunc(("Done restoring snapshot (rc=%08X)\n", rc));
     
    24882486    // set the proper machine state here now (note: after creating a Task instance)
    24892487    if (mData->mMachineState == MachineState_Running)
     2488    {
    24902489        i_setMachineState(MachineState_DeletingSnapshotOnline);
     2490        i_updateMachineStateOnClient();
     2491    }
    24912492    else if (mData->mMachineState == MachineState_Paused)
     2493    {
    24922494        i_setMachineState(MachineState_DeletingSnapshotPaused);
     2495        i_updateMachineStateOnClient();
     2496    }
    24932497    else
    24942498        i_setMachineState(MachineState_DeletingSnapshot);
    2495     i_updateMachineStateOnClient();
    24962499
    24972500    /* return the progress to the caller */
     
    31663169        // task was started
    31673170        i_setMachineState(task.m_machineStateBackup);
    3168         i_updateMachineStateOnClient();
     3171        if (Global::IsOnline(mData->mMachineState))
     3172            i_updateMachineStateOnClient();
    31693173
    31703174        mParent->i_saveModifiedRegistries();
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r55209 r55255  
    28142814}
    28152815
    2816 /** Event for onSnapshotTaken(), onSnapshotDeleted() and onSnapshotChange() */
     2816/** Event for i_onSnapshotTaken(), i_onSnapshotDeleted(), i_onSnapshotRestored() and i_onSnapshotChange() */
    28172817struct SnapshotEvent : public VirtualBox::CallbackEvent
    28182818{
     
    28392839{
    28402840    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
    2841                                 VBoxEventType_OnSnapshotTaken));
     2841                                  VBoxEventType_OnSnapshotTaken));
    28422842}
    28432843
     
    28482848{
    28492849    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
    2850                                 VBoxEventType_OnSnapshotDeleted));
     2850                                  VBoxEventType_OnSnapshotDeleted));
    28512851}
    28522852
     
    28542854 *  @note Doesn't lock any object.
    28552855 */
     2856void VirtualBox::i_onSnapshotRestored(const Guid &aMachineId, const Guid &aSnapshotId)
     2857{
     2858    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
     2859                                  VBoxEventType_OnSnapshotRestored));
     2860}
     2861
     2862/**
     2863 *  @note Doesn't lock any object.
     2864 */
    28562865void VirtualBox::i_onSnapshotChange(const Guid &aMachineId, const Guid &aSnapshotId)
    28572866{
    28582867    i_postEvent(new SnapshotEvent(this, aMachineId, aSnapshotId,
    2859                                 VBoxEventType_OnSnapshotChanged));
     2868                                  VBoxEventType_OnSnapshotChanged));
    28602869}
    28612870
Note: See TracChangeset for help on using the changeset viewer.

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