VirtualBox

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


Ignore:
Timestamp:
Apr 2, 2013 11:55:41 AM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84679
Message:

Main: Introduce "StorageMgmt/SilentReconfigureWhilePaused" extradata flag to allow attachment reconfiguration while the VM is paused

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

Legend:

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

    r45138 r45284  
    13391339    <attribute name="gateway" type="wstring" readonly="yes">
    13401340      <desc>
    1341         This attribute is read-only. It's recalculated on changing 
     1341        This attribute is read-only. It's recalculated on changing
    13421342        network attribute (low address of network + 1).
    13431343      </desc>
     
    13571357    <attribute name="eventSource" type="IEventSource" readonly="yes"/>
    13581358    <attribute name="portForwardRules4" type="wstring" readonly="yes" safearray="yes">
    1359       <desc>Array of NAT port-forwarding rules in string representation, 
    1360       in the following format: 
     1359      <desc>Array of NAT port-forwarding rules in string representation,
     1360      in the following format:
    13611361      "name:protocolid:[host ip]:host port:[guest ip]:guest port".
    13621362      </desc>
    13631363    </attribute>
    13641364    <attribute name="portForwardRules6" type="wstring" readonly="yes" safearray="yes">
    1365       <desc>Array of NAT port-forwarding rules in string representation, in the 
     1365      <desc>Array of NAT port-forwarding rules in string representation, in the
    13661366      following format: "name:protocolid:[host ip]:host port:[guest ip]:guest port".
    13671367      </desc>
     
    13741374      </param>
    13751375      <param name="hostIP" type="wstring" dir="in">
    1376         <desc>IP of the host interface to which the rule should apply. 
    1377         An empty ip address is acceptable, in which case the NAT engine 
     1376        <desc>IP of the host interface to which the rule should apply.
     1377        An empty ip address is acceptable, in which case the NAT engine
    13781378        binds the handling socket to any interface.
    13791379        </desc>
     
    13831383      </param>
    13841384      <param name="guestIP" type="wstring" dir="in">
    1385         <desc>The IP address of the guest which the NAT engine will forward 
     1385        <desc>The IP address of the guest which the NAT engine will forward
    13861386        matching packets to. An empty IP address is not acceptable.</desc>
    13871387        </param>
     
    23662366    <!-- bunch of metods to create NAT -->
    23672367    <method name="createNATNetwork">
    2368       <!-- Here we create a record in NAT network array with name 
    2369            and gateway/network parameters this information should 
    2370            be enough for VBoxNet[Lwip]NAT and VBoxNetDHCP for 
    2371            servicing the guests. 
     2368      <!-- Here we create a record in NAT network array with name
     2369           and gateway/network parameters this information should
     2370           be enough for VBoxNet[Lwip]NAT and VBoxNetDHCP for
     2371           servicing the guests.
    23722372      -->
    23732373      <param name="networkName" type="wstring" dir="in"/>
    23742374      <param name="network" type="INATNetwork" dir="return"/>
    23752375    </method>
    2376  
     2376
    23772377     <!--
    23782378          Returns the NATNetwork by name, e.g. for adding porforward rule or delition.
     
    91359135    </const>
    91369136  </enum>
    9137  
     9137
    91389138  <enum
    91399139    name="GuestSessionWaitResult"
     
    91469146
    91479147      To wait for a guest session to terminate after it has been
    9148       created by <link to="IGuest::createSession"/> one would specify 
     9148      created by <link to="IGuest::createSession"/> one would specify
    91499149      GuestSessionWaitResult_Terminate.
    91509150    </desc>
     
    91829182    </const>
    91839183  </enum>
    9184  
     9184
    91859185  <enum
    91869186    name="FileSeekType"
     
    1041010410      </param>
    1041110411    </method>
    10412    
     10412
    1041310413    <method name="waitFor">
    1041410414      <desc>
     
    1682316823      <param name="remove" type="boolean" dir="in">
    1682416824        <desc>TRUE if the device is removed, FALSE if it was added.</desc>
     16825      </param>
     16826      <param name="silent" type="boolean" dir="in">
     16827        <desc>TRUE if the device is is silently reconfigured without
     16828          notifying the guest about it.</desc>
    1682516829      </param>
    1682616830    </method>
     
    2030620310  <interface
    2030720311    name="IStorageDeviceChangedEvent" extends="IEvent"
    20308     uuid="8a5c2dce-e341-49d4-afce-c95979f7d70c"
     20312    uuid="232e9151-ae84-4b8e-b0f3-5c20c35caac9"
    2030920313    wsmap="managed" autogen="VBoxEvent" id="OnStorageDeviceChanged"
    2031020314    >
     
    2032220326      <desc>
    2032320327        Flag whether the device was removed or added to the VM.
     20328      </desc>
     20329    </attribute>
     20330    <attribute name="silent" type="boolean" readonly="yes">
     20331      <desc>
     20332        Flag whether the guest should be notified about the change.
    2032420333      </desc>
    2032520334    </attribute>
     
    2033520344  <!-- base class for start/stop events -->
    2033620345  <interface name="INATNetworkStartStopEvent" extends="INATNetworkChangedEvent"
    20337              uuid="269d8f6b-fa1e-4cee-91c7-6d8496bea3c1" 
     20346             uuid="269d8f6b-fa1e-4cee-91c7-6d8496bea3c1"
    2033820347             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkStartStop">
    2033920348    <attribute name="startEvent" type="boolean" readonly="yes">
     
    2034320352    </attribute>
    2034420353  </interface>
    20345  
     20354
    2034620355  <!-- base class for modification events -->
    2034720356  <interface name="INATNetworkAlterEvent" extends="INATNetworkChangedEvent"
    20348              uuid="3f5a0822-163a-43b1-ad16-8d58b0ef6e75" 
     20357             uuid="3f5a0822-163a-43b1-ad16-8d58b0ef6e75"
    2034920358             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkAlter"/>
    20350  
     20359
    2035120360  <interface name="INATNetworkCreationDeletionEvent" extends="INATNetworkAlterEvent"
    20352              uuid="8d984a7e-b855-40b8-ab0c-44d3515b4528" 
     20361             uuid="8d984a7e-b855-40b8-ab0c-44d3515b4528"
    2035320362             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkCreationDeletion">
    2035420363    <attribute name="creationEvent" type="boolean" readonly="yes"/>
    2035520364  </interface>
    2035620365  <interface name="INATNetworkSettingEvent" extends="INATNetworkAlterEvent"
    20357              uuid="9db3a9e6-7f29-4aae-a627-5a282c83092c" 
     20366             uuid="9db3a9e6-7f29-4aae-a627-5a282c83092c"
    2035820367             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkSetting">
    2035920368    <attribute name="enabled" type="boolean" readonly="yes"/>
     
    2036420373  </interface>
    2036520374  <interface name="INATNetworkPortForwardEvent" extends="INATNetworkAlterEvent"
    20366              uuid="2514881b-23d0-430a-a7ff-7ed7f05534bc" 
     20375             uuid="2514881b-23d0-430a-a7ff-7ed7f05534bc"
    2036720376             wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkPortForward">
    2036820377    <attribute name="create" type="boolean" readonly="yes"/>
     
    2037520384    <attribute name="guestPort"  type="long" readonly="yes"/>
    2037620385  </interface>
    20377  
     20386
    2037820387  <module name="VBoxSVC" context="LocalServer">
    2037920388    <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F"
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r44425 r45284  
    206206    HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
    207207    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
    208     HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
     208    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
    209209    HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
    210210    HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
     
    621621                                                 StorageBus_T enmBus,
    622622                                                 bool fUseHostIOCache,
    623                                                  IMediumAttachment *aMediumAtt);
     623                                                 IMediumAttachment *aMediumAtt,
     624                                                 bool fSilent);
    624625    static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
    625626                                                 PUVM pUVM,
     
    627628                                                 unsigned uInstance,
    628629                                                 StorageBus_T enmBus,
    629                                                  IMediumAttachment *aMediumAtt);
    630     HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM);
    631     HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM);
     630                                                 IMediumAttachment *aMediumAtt,
     631                                                 bool fSilent);
     632    HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
     633    HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
    632634
    633635    static DECLCALLBACK(int)    fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r45068 r45284  
    722722    virtual HRESULT onDragAndDropModeChange(DragAndDropMode_T /* aDragAndDropMode */) { return S_OK; }
    723723    virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
    724     virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */) { return S_OK; }
     724    virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; }
    725725
    726726    HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
     
    11111111    HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
    11121112    HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
    1113     HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
     1113    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
    11141114
    11151115    bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
  • trunk/src/VBox/Main/include/SessionImpl.h

    r42382 r45284  
    101101    STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
    102102    STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup);
    103     STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove);
     103    STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
    104104    STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
    105105                                   BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r45030 r45284  
    39153915 * @param aMediumAttachment The medium attachment which is added.
    39163916 * @param pUVM              Safe VM handle.
     3917 * @param fSilent           Flag whether to notify the guest about the attached device.
    39173918 *
    39183919 * @note Locks this object for writing.
    39193920 */
    3920 HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM)
     3921HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
    39213922{
    39223923    AutoCaller autoCaller(this);
     
    39883989                           VMREQFLAGS_VBOX_STATUS,
    39893990                           (PFNRT)Console::attachStorageDevice,
    3990                            7,
     3991                           8,
    39913992                           this,
    39923993                           pUVM,
     
    39953996                           enmBus,
    39963997                           fUseHostIOCache,
    3997                            aMediumAttachment);
     3998                           aMediumAttachment,
     3999                           fSilent);
    39984000
    39994001    /* release the lock before waiting for a result (EMT will call us back!) */
     
    40354037 * @param   pcszDevice      The PDM device name.
    40364038 * @param   uInstance       The PDM device instance.
     4039 * @param   fSilent         Flag whether to inform the guest about the attached device.
    40374040 *
    40384041 * @thread  EMT
     
    40444047                                               StorageBus_T enmBus,
    40454048                                               bool fUseHostIOCache,
    4046                                                IMediumAttachment *aMediumAtt)
     4049                                               IMediumAttachment *aMediumAtt,
     4050                                               bool fSilent)
    40474051{
    40484052    LogFlowFunc(("pConsole=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, aMediumAtt=%p\n",
     
    41184122                                             true /* fAttachDetach */,
    41194123                                             false /* fForceUnmount */,
    4120                                              true  /* fHotplug */,
     4124                                             !fSilent /* fHotplug */,
    41214125                                             pUVM,
    41224126                                             NULL /* paLedDevType */);
     
    41604164 * @param aMediumAttachment The medium attachment which is added.
    41614165 * @param pUVM              Safe VM handle.
     4166 * @param fSilent           Flag whether to notify the guest about the detached device.
    41624167 *
    41634168 * @note Locks this object for writing.
    41644169 */
    4165 HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM)
     4170HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
    41664171{
    41674172    AutoCaller autoCaller(this);
     
    42304235                           VMREQFLAGS_VBOX_STATUS,
    42314236                           (PFNRT)Console::detachStorageDevice,
    4232                            6,
     4237                           7,
    42334238                           this,
    42344239                           pUVM,
     
    42364241                           uInstance,
    42374242                           enmBus,
    4238                            aMediumAttachment);
     4243                           aMediumAttachment,
     4244                           fSilent);
    42394245
    42404246    /* release the lock before waiting for a result (EMT will call us back!) */
     
    42754281 * @param   pcszDevice      The PDM device name.
    42764282 * @param   uInstance       The PDM device instance.
     4283 * @param   fSilent         Flag whether to notify the guest about the detached device.
    42774284 *
    42784285 * @thread  EMT
     
    42834290                                               unsigned uInstance,
    42844291                                               StorageBus_T enmBus,
    4285                                                IMediumAttachment *pMediumAtt)
     4292                                               IMediumAttachment *pMediumAtt,
     4293                                               bool fSilent)
    42864294{
    42874295    LogFlowFunc(("pConsole=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, pMediumAtt=%p\n",
     
    43634371    if (pLunL0)
    43644372    {
    4365         rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, 0);
     4373        uint32_t fFlags = 0;
     4374
     4375        if (fSilent)
     4376            fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG;
     4377
     4378        rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);
    43664379        if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
    43674380            rc = VINF_SUCCESS;
     
    53685381 * @note Locks this object for writing.
    53695382 */
    5370 HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove)
     5383HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
    53715384{
    53725385    LogFlowThisFunc(("\n"));
     
    53825395    {
    53835396        if (aRemove)
    5384             rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM());
     5397            rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), aSilent);
    53855398        else
    5386             rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM());
     5399            rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), aSilent);
    53875400        ptrVM.release();
    53885401    }
     
    53905403    /* notify console callbacks on success */
    53915404    if (SUCCEEDED(rc))
    5392         fireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove);
     5405        fireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove, aSilent);
    53935406
    53945407    LogFlowThisFunc(("Leaving rc=%#x\n", rc));
  • trunk/src/VBox/Main/src-client/SessionImpl.cpp

    r42382 r45284  
    775775}
    776776
    777 STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove)
    778 {
    779     LogFlowThisFunc(("\n"));
    780 
    781     AutoCaller autoCaller(this);
    782     AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    783 
    784     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    785     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
    786     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
    787     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
    788 
    789     return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove);
     777STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
     778{
     779    LogFlowThisFunc(("\n"));
     780
     781    AutoCaller autoCaller(this);
     782    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
     783
     784    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     785    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     786    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
     787    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
     788
     789    return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove, aSilent);
    790790}
    791791
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r45068 r45284  
    37753775                        aControllerName);
    37763776
     3777    bool fSilent = false;
     3778    Bstr strReconfig;
     3779
     3780    /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
     3781    rc = mParent->GetExtraData(Bstr("StorageMgmt/SilentReconfigureWhilePaused").raw(), strReconfig.asOutParam());
     3782    if (FAILED(rc))
     3783        return rc;
     3784    if (   mData->mMachineState == MachineState_Paused
     3785        && strReconfig == "1")
     3786        fSilent = true;
     3787
    37773788    /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
    37783789    bool fHotplug = false;
    3779     if (Global::IsOnlineOrTransient(mData->mMachineState))
     3790    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
    37803791        fHotplug = true;
    37813792
     
    41764187    alock.release();
    41774188
    4178     if (fHotplug)
    4179         rc = onStorageDeviceChange(attachment, FALSE /* aRemove */);
     4189    if (fHotplug || fSilent)
     4190        rc = onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);
    41804191
    41814192    mParent->saveModifiedRegistries();
     
    42144225                        aControllerName);
    42154226
     4227    bool fSilent = false;
     4228    Bstr strReconfig;
     4229
     4230    /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
     4231    rc = mParent->GetExtraData(Bstr("StorageMgmt/SilentReconfigureWhilePaused").raw(), strReconfig.asOutParam());
     4232    if (FAILED(rc))
     4233        return rc;
     4234    if (   mData->mMachineState == MachineState_Paused
     4235        && strReconfig == "1")
     4236        fSilent = true;
     4237
    42164238    /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
    42174239    bool fHotplug = false;
    4218     if (Global::IsOnlineOrTransient(mData->mMachineState))
     4240    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
    42194241        fHotplug = true;
    42204242
     
    42374259     * If this fails we can roll back without loosing data.
    42384260     */
    4239     if (fHotplug)
     4261    if (fHotplug || fSilent)
    42404262    {
    42414263        alock.release();
    4242         rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */);
     4264        rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);
    42434265        alock.acquire();
    42444266    }
     
    1350613528 *  @note Locks this object for reading.
    1350713529 */
    13508 HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove)
     13530HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent)
    1350913531{
    1351013532    LogFlowThisFunc(("\n"));
     
    1352313545        return S_OK;
    1352413546
    13525     return directControl->OnStorageDeviceChange(aAttachment, aRemove);
     13547    return directControl->OnStorageDeviceChange(aAttachment, aRemove, aSilent);
    1352613548}
    1352713549
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