Index: trunk/src/VBox/Main/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 24490)
+++ trunk/src/VBox/Main/ConsoleImpl.cpp	(revision 24493)
@@ -2745,8 +2745,9 @@
  *
  * @param aMediumAttachment The medium attachment with the new medium state.
+ * @param fForce            Force medium chance, if it is locked or not.
  *
  * @note Locks this object for writing.
  */
-HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment)
+HRESULT Console::doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce)
 {
     AutoCaller autoCaller(this);
@@ -2820,6 +2821,6 @@
     PVMREQ pReq;
     int vrc = VMR3ReqCall(mpVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                          (PFNRT)Console::changeDrive, 8,
-                          this, pszDevice, uInstance, uLun, !!fHostDrive, location.raw(), format.raw(), !!fPassthrough);
+                          (PFNRT)Console::changeDrive, 9,
+                          this, pszDevice, uInstance, uLun, !!fHostDrive, location.raw(), format.raw(), !!fPassthrough, fForce);
 
     /* leave the lock before waiting for a result (EMT will call us back!) */
@@ -2873,9 +2874,9 @@
  */
 DECLCALLBACK(int) Console::changeDrive(Console *pThis, const char *pszDevice, unsigned uInstance, unsigned uLun,
-                                       bool fHostDrive, const char *pszPath, const char *pszFormat, bool fPassthrough)
+                                       bool fHostDrive, const char *pszPath, const char *pszFormat, bool fPassthrough, bool fForce)
 {
 /// @todo change this to use the same code as in ConsoleImpl2.cpp
-    LogFlowFunc(("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u fHostDrive=%d pszPath=%p:{%s} pszFormat=%p:{%s} fPassthrough=%d\n",
-                 pThis, pszDevice, pszDevice, uInstance, uLun, fHostDrive, pszPath, pszPath, pszFormat, pszFormat, fPassthrough));
+    LogFlowFunc(("pThis=%p pszDevice=%p:{%s} uInstance=%u uLun=%u fHostDrive=%d pszPath=%p:{%s} pszFormat=%p:{%s} fPassthrough=%d fForce=%d\n",
+                 pThis, pszDevice, pszDevice, uInstance, uLun, fHostDrive, pszPath, pszPath, pszFormat, pszFormat, fPassthrough, fForce));
 
     AssertReturn(pThis, VERR_INVALID_PARAMETER);
@@ -2962,5 +2963,5 @@
              * Unmount the media.
              */
-            rc = pIMount->pfnUnmount(pIMount, false);
+            rc = pIMount->pfnUnmount(pIMount, fForce);
             if (rc == VERR_PDM_MEDIA_NOT_MOUNTED)
                 rc = VINF_SUCCESS;
@@ -3526,5 +3527,5 @@
  * @note Locks this object for writing.
  */
-HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment)
+HRESULT Console::onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
@@ -3545,5 +3546,5 @@
     CheckComRCReturnRC(autoVMCaller.rc());
 
-    rc = doMediumChange(aMediumAttachment);
+    rc = doMediumChange(aMediumAttachment, !!aForce);
 
     /* notify console callbacks on success */
Index: trunk/src/VBox/Main/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/MachineImpl.cpp	(revision 24490)
+++ trunk/src/VBox/Main/MachineImpl.cpp	(revision 24493)
@@ -2797,9 +2797,10 @@
                                   LONG aControllerPort,
                                   LONG aDevice,
-                                  IN_BSTR aId)
+                                  IN_BSTR aId,
+                                  BOOL aForce)
 {
     int rc = S_OK;
-    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n",
-                     aControllerName, aControllerPort, aDevice));
+    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld aForce=%d\n",
+                     aControllerName, aControllerPort, aDevice, aForce));
 
     CheckComArgNotNull(aControllerName);
@@ -2897,5 +2898,5 @@
 
     alock.unlock();
-    onMediumChange(pAttach);
+    onMediumChange(pAttach, aForce);
 
     return rc;
@@ -9214,5 +9215,5 @@
  *  @note Locks this object for reading.
  */
-HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment)
+HRESULT SessionMachine::onMediumChange(IMediumAttachment *aAttachment, BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
@@ -9231,5 +9232,5 @@
         return S_OK;
 
-    return directControl->OnMediumChange(aAttachment);
+    return directControl->OnMediumChange(aAttachment, aForce);
 }
 
Index: trunk/src/VBox/Main/SessionImpl.cpp
===================================================================
--- trunk/src/VBox/Main/SessionImpl.cpp	(revision 24490)
+++ trunk/src/VBox/Main/SessionImpl.cpp	(revision 24493)
@@ -558,5 +558,5 @@
 }
 
-STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment)
+STDMETHODIMP Session::OnMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce)
 {
     LogFlowThisFunc(("\n"));
@@ -569,5 +569,5 @@
     AssertReturn(mType == SessionType_Direct, VBOX_E_INVALID_OBJECT_STATE);
 
-    return mConsole->onMediumChange(aMediumAttachment);
+    return mConsole->onMediumChange(aMediumAttachment, aForce);
 }
 
Index: trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 24490)
+++ trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 24493)
@@ -4097,5 +4097,5 @@
   <interface
      name="IMachine" extends="$unknown"
-     uuid="25472915-3da2-42f6-82f2-70a3bc74d73c"
+     uuid="c5669e1a-491a-4367-99c6-28110dd474c6"
      wsmap="managed"
      >
@@ -4884,4 +4884,8 @@
           currently mounted medium.</desc>
       </param>
+      <param name="force" type="boolean" dir="in">
+        <desc>Allows to force unmount/mount of a medium which is locked by
+          theDevice slot in the given port to attach the medium to.</desc>
+      </param>
     </method>
 
@@ -12510,5 +12514,5 @@
   <interface
      name="IInternalSessionControl" extends="$unknown"
-     uuid="989e2c33-8dfa-437a-9a15-5ad441d50dbf"
+     uuid="f9aac6d0-41b3-46b7-bea4-6370b4036de6"
      internal="yes"
      wsmap="suppress"
@@ -12675,4 +12679,5 @@
 
       <param name="mediumAttachment" type="IMediumAttachment" dir="in"/>
+      <param name="force" type="boolean" dir="in"/>
     </method>
 
Index: trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 24490)
+++ trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 24493)
@@ -178,5 +178,5 @@
     HRESULT onParallelPortChange (IParallelPort *aParallelPort);
     HRESULT onStorageControllerChange ();
-    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment);
+    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
     HRESULT onVRDPServerChange();
     HRESULT onUSBControllerChange();
@@ -441,8 +441,9 @@
                                           unsigned uInstance, unsigned uLun,
                                           bool fHostDrive, const char *pszPath,
-                                          const char *pszFormat, bool fPassthrough);
+                                          const char *pszFormat, bool fPassthrough,
+                                          bool fForce);
     const char *controllerTypeToDev(StorageControllerType_T enmCtrlType);
     HRESULT convertBusPortDeviceToLun(StorageBus_T enmBus, LONG port, LONG device, unsigned &uLun);
-    HRESULT doMediumChange(IMediumAttachment *aMediumAttachment);
+    HRESULT doMediumChange(IMediumAttachment *aMediumAttachment, bool fForce);
 
 #ifdef VBOX_DYNAMIC_NET_ATTACH
Index: trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- trunk/src/VBox/Main/include/MachineImpl.h	(revision 24490)
+++ trunk/src/VBox/Main/include/MachineImpl.h	(revision 24493)
@@ -586,5 +586,5 @@
     STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough);
     STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort,
-                           LONG aDevice, IN_BSTR aId);
+                           LONG aDevice, IN_BSTR aId, BOOL aForce);
     STDMETHOD(GetMedium)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice,
                          IMedium **aMedium);
@@ -701,5 +701,5 @@
     virtual HRESULT onUSBControllerChange() { return S_OK; }
     virtual HRESULT onStorageControllerChange() { return S_OK; }
-    virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */) { return S_OK; }
+    virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; }
     virtual HRESULT onSharedFolderChange() { return S_OK; }
 
@@ -1008,5 +1008,5 @@
     HRESULT onNetworkAdapterChange(INetworkAdapter *networkAdapter, BOOL changeAdapter);
     HRESULT onStorageControllerChange();
-    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment);
+    HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
     HRESULT onSerialPortChange(ISerialPort *serialPort);
     HRESULT onParallelPortChange(IParallelPort *parallelPort);
Index: trunk/src/VBox/Main/include/SessionImpl.h
===================================================================
--- trunk/src/VBox/Main/include/SessionImpl.h	(revision 24490)
+++ trunk/src/VBox/Main/include/SessionImpl.h	(revision 24493)
@@ -95,5 +95,5 @@
     STDMETHOD(OnParallelPortChange)(IParallelPort *parallelPort);
     STDMETHOD(OnStorageControllerChange)();
-    STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment);
+    STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce);
     STDMETHOD(OnVRDPServerChange)();
     STDMETHOD(OnUSBControllerChange)();
