Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 45283)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 45284)
@@ -1339,5 +1339,5 @@
     <attribute name="gateway" type="wstring" readonly="yes">
       <desc>
-        This attribute is read-only. It's recalculated on changing 
+        This attribute is read-only. It's recalculated on changing
         network attribute (low address of network + 1).
       </desc>
@@ -1357,11 +1357,11 @@
     <attribute name="eventSource" type="IEventSource" readonly="yes"/>
     <attribute name="portForwardRules4" type="wstring" readonly="yes" safearray="yes">
-      <desc>Array of NAT port-forwarding rules in string representation, 
-      in the following format: 
+      <desc>Array of NAT port-forwarding rules in string representation,
+      in the following format:
       "name:protocolid:[host ip]:host port:[guest ip]:guest port".
       </desc>
     </attribute>
     <attribute name="portForwardRules6" type="wstring" readonly="yes" safearray="yes">
-      <desc>Array of NAT port-forwarding rules in string representation, in the 
+      <desc>Array of NAT port-forwarding rules in string representation, in the
       following format: "name:protocolid:[host ip]:host port:[guest ip]:guest port".
       </desc>
@@ -1374,6 +1374,6 @@
       </param>
       <param name="hostIP" type="wstring" dir="in">
-        <desc>IP of the host interface to which the rule should apply. 
-        An empty ip address is acceptable, in which case the NAT engine 
+        <desc>IP of the host interface to which the rule should apply.
+        An empty ip address is acceptable, in which case the NAT engine
         binds the handling socket to any interface.
         </desc>
@@ -1383,5 +1383,5 @@
       </param>
       <param name="guestIP" type="wstring" dir="in">
-        <desc>The IP address of the guest which the NAT engine will forward 
+        <desc>The IP address of the guest which the NAT engine will forward
         matching packets to. An empty IP address is not acceptable.</desc>
         </param>
@@ -2366,13 +2366,13 @@
     <!-- bunch of metods to create NAT -->
     <method name="createNATNetwork">
-      <!-- Here we create a record in NAT network array with name 
-           and gateway/network parameters this information should 
-           be enough for VBoxNet[Lwip]NAT and VBoxNetDHCP for 
-           servicing the guests. 
+      <!-- Here we create a record in NAT network array with name
+           and gateway/network parameters this information should
+           be enough for VBoxNet[Lwip]NAT and VBoxNetDHCP for
+           servicing the guests.
       -->
       <param name="networkName" type="wstring" dir="in"/>
       <param name="network" type="INATNetwork" dir="return"/>
     </method>
- 
+
      <!--
           Returns the NATNetwork by name, e.g. for adding porforward rule or delition.
@@ -9135,5 +9135,5 @@
     </const>
   </enum>
-  
+
   <enum
     name="GuestSessionWaitResult"
@@ -9146,5 +9146,5 @@
 
       To wait for a guest session to terminate after it has been
-      created by <link to="IGuest::createSession"/> one would specify 
+      created by <link to="IGuest::createSession"/> one would specify
       GuestSessionWaitResult_Terminate.
     </desc>
@@ -9182,5 +9182,5 @@
     </const>
   </enum>
-  
+
   <enum
     name="FileSeekType"
@@ -10410,5 +10410,5 @@
       </param>
     </method>
-    
+
     <method name="waitFor">
       <desc>
@@ -16823,4 +16823,8 @@
       <param name="remove" type="boolean" dir="in">
         <desc>TRUE if the device is removed, FALSE if it was added.</desc>
+      </param>
+      <param name="silent" type="boolean" dir="in">
+        <desc>TRUE if the device is is silently reconfigured without
+          notifying the guest about it.</desc>
       </param>
     </method>
@@ -20306,5 +20310,5 @@
   <interface
     name="IStorageDeviceChangedEvent" extends="IEvent"
-    uuid="8a5c2dce-e341-49d4-afce-c95979f7d70c"
+    uuid="232e9151-ae84-4b8e-b0f3-5c20c35caac9"
     wsmap="managed" autogen="VBoxEvent" id="OnStorageDeviceChanged"
     >
@@ -20322,4 +20326,9 @@
       <desc>
         Flag whether the device was removed or added to the VM.
+      </desc>
+    </attribute>
+    <attribute name="silent" type="boolean" readonly="yes">
+      <desc>
+        Flag whether the guest should be notified about the change.
       </desc>
     </attribute>
@@ -20335,5 +20344,5 @@
   <!-- base class for start/stop events -->
   <interface name="INATNetworkStartStopEvent" extends="INATNetworkChangedEvent"
-             uuid="269d8f6b-fa1e-4cee-91c7-6d8496bea3c1" 
+             uuid="269d8f6b-fa1e-4cee-91c7-6d8496bea3c1"
              wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkStartStop">
     <attribute name="startEvent" type="boolean" readonly="yes">
@@ -20343,17 +20352,17 @@
     </attribute>
   </interface>
-  
+
   <!-- base class for modification events -->
   <interface name="INATNetworkAlterEvent" extends="INATNetworkChangedEvent"
-             uuid="3f5a0822-163a-43b1-ad16-8d58b0ef6e75" 
+             uuid="3f5a0822-163a-43b1-ad16-8d58b0ef6e75"
              wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkAlter"/>
-  
+
   <interface name="INATNetworkCreationDeletionEvent" extends="INATNetworkAlterEvent"
-             uuid="8d984a7e-b855-40b8-ab0c-44d3515b4528" 
+             uuid="8d984a7e-b855-40b8-ab0c-44d3515b4528"
              wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkCreationDeletion">
     <attribute name="creationEvent" type="boolean" readonly="yes"/>
   </interface>
   <interface name="INATNetworkSettingEvent" extends="INATNetworkAlterEvent"
-             uuid="9db3a9e6-7f29-4aae-a627-5a282c83092c" 
+             uuid="9db3a9e6-7f29-4aae-a627-5a282c83092c"
              wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkSetting">
     <attribute name="enabled" type="boolean" readonly="yes"/>
@@ -20364,5 +20373,5 @@
   </interface>
   <interface name="INATNetworkPortForwardEvent" extends="INATNetworkAlterEvent"
-             uuid="2514881b-23d0-430a-a7ff-7ed7f05534bc" 
+             uuid="2514881b-23d0-430a-a7ff-7ed7f05534bc"
              wsmap="managed" autogen="VBoxEvent" id="OnNATNetworkPortForward">
     <attribute name="create" type="boolean" readonly="yes"/>
@@ -20375,5 +20384,5 @@
     <attribute name="guestPort"  type="long" readonly="yes"/>
   </interface>
-  
+
   <module name="VBoxSVC" context="LocalServer">
     <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F"
Index: /trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 45283)
+++ /trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 45284)
@@ -206,5 +206,5 @@
     HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError);
     HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
-    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
     HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags);
     HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags);
@@ -621,5 +621,6 @@
                                                  StorageBus_T enmBus,
                                                  bool fUseHostIOCache,
-                                                 IMediumAttachment *aMediumAtt);
+                                                 IMediumAttachment *aMediumAtt,
+                                                 bool fSilent);
     static DECLCALLBACK(int) detachStorageDevice(Console *pThis,
                                                  PUVM pUVM,
@@ -627,7 +628,8 @@
                                                  unsigned uInstance,
                                                  StorageBus_T enmBus,
-                                                 IMediumAttachment *aMediumAtt);
-    HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM);
-    HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM);
+                                                 IMediumAttachment *aMediumAtt,
+                                                 bool fSilent);
+    HRESULT doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
+    HRESULT doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent);
 
     static DECLCALLBACK(int)    fntTakeSnapshotWorker(RTTHREAD Thread, void *pvUser);
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 45283)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 45284)
@@ -722,5 +722,5 @@
     virtual HRESULT onDragAndDropModeChange(DragAndDropMode_T /* aDragAndDropMode */) { return S_OK; }
     virtual HRESULT onBandwidthGroupChange(IBandwidthGroup * /* aBandwidthGroup */) { return S_OK; }
-    virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */) { return S_OK; }
+    virtual HRESULT onStorageDeviceChange(IMediumAttachment * /* mediumAttachment */, BOOL /* remove */, BOOL /* silent */) { return S_OK; }
 
     HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data);
@@ -1111,5 +1111,5 @@
     HRESULT onDragAndDropModeChange(DragAndDropMode_T aDragAndDropMode);
     HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup);
-    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+    HRESULT onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
 
     bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs);
Index: /trunk/src/VBox/Main/include/SessionImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/SessionImpl.h	(revision 45283)
+++ /trunk/src/VBox/Main/include/SessionImpl.h	(revision 45284)
@@ -101,5 +101,5 @@
     STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId);
     STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup);
-    STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove);
+    STDMETHOD(OnStorageDeviceChange)(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent);
     STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags,
                                    BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags);
Index: /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 45283)
+++ /trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 45284)
@@ -3915,8 +3915,9 @@
  * @param aMediumAttachment The medium attachment which is added.
  * @param pUVM              Safe VM handle.
+ * @param fSilent           Flag whether to notify the guest about the attached device.
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM)
+HRESULT Console::doStorageDeviceAttach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
 {
     AutoCaller autoCaller(this);
@@ -3988,5 +3989,5 @@
                            VMREQFLAGS_VBOX_STATUS,
                            (PFNRT)Console::attachStorageDevice,
-                           7,
+                           8,
                            this,
                            pUVM,
@@ -3995,5 +3996,6 @@
                            enmBus,
                            fUseHostIOCache,
-                           aMediumAttachment);
+                           aMediumAttachment,
+                           fSilent);
 
     /* release the lock before waiting for a result (EMT will call us back!) */
@@ -4035,4 +4037,5 @@
  * @param   pcszDevice      The PDM device name.
  * @param   uInstance       The PDM device instance.
+ * @param   fSilent         Flag whether to inform the guest about the attached device.
  *
  * @thread  EMT
@@ -4044,5 +4047,6 @@
                                                StorageBus_T enmBus,
                                                bool fUseHostIOCache,
-                                               IMediumAttachment *aMediumAtt)
+                                               IMediumAttachment *aMediumAtt,
+                                               bool fSilent)
 {
     LogFlowFunc(("pConsole=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, aMediumAtt=%p\n",
@@ -4118,5 +4122,5 @@
                                              true /* fAttachDetach */,
                                              false /* fForceUnmount */,
-                                             true   /* fHotplug */,
+                                             !fSilent /* fHotplug */,
                                              pUVM,
                                              NULL /* paLedDevType */);
@@ -4160,8 +4164,9 @@
  * @param aMediumAttachment The medium attachment which is added.
  * @param pUVM              Safe VM handle.
+ * @param fSilent           Flag whether to notify the guest about the detached device.
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM)
+HRESULT Console::doStorageDeviceDetach(IMediumAttachment *aMediumAttachment, PUVM pUVM, bool fSilent)
 {
     AutoCaller autoCaller(this);
@@ -4230,5 +4235,5 @@
                            VMREQFLAGS_VBOX_STATUS,
                            (PFNRT)Console::detachStorageDevice,
-                           6,
+                           7,
                            this,
                            pUVM,
@@ -4236,5 +4241,6 @@
                            uInstance,
                            enmBus,
-                           aMediumAttachment);
+                           aMediumAttachment,
+                           fSilent);
 
     /* release the lock before waiting for a result (EMT will call us back!) */
@@ -4275,4 +4281,5 @@
  * @param   pcszDevice      The PDM device name.
  * @param   uInstance       The PDM device instance.
+ * @param   fSilent         Flag whether to notify the guest about the detached device.
  *
  * @thread  EMT
@@ -4283,5 +4290,6 @@
                                                unsigned uInstance,
                                                StorageBus_T enmBus,
-                                               IMediumAttachment *pMediumAtt)
+                                               IMediumAttachment *pMediumAtt,
+                                               bool fSilent)
 {
     LogFlowFunc(("pConsole=%p uInstance=%u pszDevice=%p:{%s} enmBus=%u, pMediumAtt=%p\n",
@@ -4363,5 +4371,10 @@
     if (pLunL0)
     {
-        rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, 0);
+        uint32_t fFlags = 0;
+
+        if (fSilent)
+            fFlags |= PDM_TACH_FLAGS_NOT_HOT_PLUG;
+
+        rc = PDMR3DeviceDetach(pUVM, pcszDevice, uInstance, uLUN, fFlags);
         if (rc == VERR_PDM_NO_DRIVER_ATTACHED_TO_LUN)
             rc = VINF_SUCCESS;
@@ -5368,5 +5381,5 @@
  * @note Locks this object for writing.
  */
-HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove)
+HRESULT Console::onStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
 {
     LogFlowThisFunc(("\n"));
@@ -5382,7 +5395,7 @@
     {
         if (aRemove)
-            rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM());
+            rc = doStorageDeviceDetach(aMediumAttachment, ptrVM.rawUVM(), aSilent);
         else
-            rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM());
+            rc = doStorageDeviceAttach(aMediumAttachment, ptrVM.rawUVM(), aSilent);
         ptrVM.release();
     }
@@ -5390,5 +5403,5 @@
     /* notify console callbacks on success */
     if (SUCCEEDED(rc))
-        fireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove);
+        fireStorageDeviceChangedEvent(mEventSource, aMediumAttachment, aRemove, aSilent);
 
     LogFlowThisFunc(("Leaving rc=%#x\n", rc));
Index: /trunk/src/VBox/Main/src-client/SessionImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/SessionImpl.cpp	(revision 45283)
+++ /trunk/src/VBox/Main/src-client/SessionImpl.cpp	(revision 45284)
@@ -775,17 +775,17 @@
 }
 
-STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove)
-{
-    LogFlowThisFunc(("\n"));
-
-    AutoCaller autoCaller(this);
-    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
-    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
-    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
-
-    return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove);
+STDMETHODIMP Session::OnStorageDeviceChange(IMediumAttachment *aMediumAttachment, BOOL aRemove, BOOL aSilent)
+{
+    LogFlowThisFunc(("\n"));
+
+    AutoCaller autoCaller(this);
+    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
+
+    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
+    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
+    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
+    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
+
+    return mConsole->onStorageDeviceChange(aMediumAttachment, aRemove, aSilent);
 }
 
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 45283)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 45284)
@@ -3775,7 +3775,18 @@
                         aControllerName);
 
+    bool fSilent = false;
+    Bstr strReconfig;
+
+    /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
+    rc = mParent->GetExtraData(Bstr("StorageMgmt/SilentReconfigureWhilePaused").raw(), strReconfig.asOutParam());
+    if (FAILED(rc))
+        return rc;
+    if (   mData->mMachineState == MachineState_Paused
+        && strReconfig == "1")
+        fSilent = true;
+
     /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
     bool fHotplug = false;
-    if (Global::IsOnlineOrTransient(mData->mMachineState))
+    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
         fHotplug = true;
 
@@ -4176,6 +4187,6 @@
     alock.release();
 
-    if (fHotplug)
-        rc = onStorageDeviceChange(attachment, FALSE /* aRemove */);
+    if (fHotplug || fSilent)
+        rc = onStorageDeviceChange(attachment, FALSE /* aRemove */, fSilent);
 
     mParent->saveModifiedRegistries();
@@ -4214,7 +4225,18 @@
                         aControllerName);
 
+    bool fSilent = false;
+    Bstr strReconfig;
+
+    /* Check whether the flag to allow silent storage attachment reconfiguration is set. */
+    rc = mParent->GetExtraData(Bstr("StorageMgmt/SilentReconfigureWhilePaused").raw(), strReconfig.asOutParam());
+    if (FAILED(rc))
+        return rc;
+    if (   mData->mMachineState == MachineState_Paused
+        && strReconfig == "1")
+        fSilent = true;
+
     /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
     bool fHotplug = false;
-    if (Global::IsOnlineOrTransient(mData->mMachineState))
+    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
         fHotplug = true;
 
@@ -4237,8 +4259,8 @@
      * If this fails we can roll back without loosing data.
      */
-    if (fHotplug)
+    if (fHotplug || fSilent)
     {
         alock.release();
-        rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */);
+        rc = onStorageDeviceChange(pAttach, TRUE /* aRemove */, fSilent);
         alock.acquire();
     }
@@ -13506,5 +13528,5 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove)
+HRESULT SessionMachine::onStorageDeviceChange(IMediumAttachment *aAttachment, BOOL aRemove, BOOL aSilent)
 {
     LogFlowThisFunc(("\n"));
@@ -13523,5 +13545,5 @@
         return S_OK;
 
-    return directControl->OnStorageDeviceChange(aAttachment, aRemove);
+    return directControl->OnStorageDeviceChange(aAttachment, aRemove, aSilent);
 }
 
