Index: trunk/src/VBox/Main/include/ConsoleImpl.h
===================================================================
--- trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 50734)
+++ trunk/src/VBox/Main/include/ConsoleImpl.h	(revision 50736)
@@ -570,6 +570,6 @@
     HRESULT removeSharedFolder(const Utf8Str &strName);
 
-    int  suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
-    void resumeAfterConfigChange(PUVM pUVM);
+    HRESULT suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume);
+    void    resumeAfterConfigChange(PUVM pUVM);
 
     static DECLCALLBACK(int) configConstructor(PUVM pUVM, PVM pVM, void *pvConsole);
Index: trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 50734)
+++ trunk/src/VBox/Main/src-client/ConsoleImpl.cpp	(revision 50736)
@@ -3544,5 +3544,5 @@
  *                          afterwards.
  */
-int Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
+HRESULT Console::suspendBeforeConfigChange(PUVM pUVM, AutoWriteLock *pAlock, bool *pfResume)
 {
     *pfResume = false;
@@ -3569,8 +3569,14 @@
             break;
         default:
-            return VERR_INVALID_STATE;
-    }
-
-    return VINF_SUCCESS;
+            return setErrorInternal(VBOX_E_INVALID_VM_STATE,
+                                    COM_IIDOF(IConsole),
+                                    getStaticComponentName(),
+                                    Utf8StrFmt("Invalid state '%s' for changing medium",
+                                        VMR3GetStateName(enmVMState)),
+                                    false /*aWarning*/,
+                                    true /*aLogIt*/);
+    }
+
+    return S_OK;
 }
 
@@ -3672,7 +3678,7 @@
      */
     bool fResume = false;
-    int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
-    if (RT_FAILURE(vrc))
-        return vrc;
+    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    if (FAILED(rc))
+        return rc;
 
     /*
@@ -3682,7 +3688,7 @@
      */
     PVMREQ pReq;
-    vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                       (PFNRT)changeRemovableMedium, 8,
-                       this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);
+    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
+                           (PFNRT)changeRemovableMedium, 8,
+                           this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fForce);
 
     /* release the lock before waiting for a result (EMT will call us back!) */
@@ -3865,7 +3871,7 @@
      */
     bool fResume = false;
-    int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
-    if (RT_FAILURE(vrc))
-        return vrc;
+    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    if (FAILED(rc))
+        return rc;
 
     /*
@@ -3875,7 +3881,7 @@
      */
     PVMREQ pReq;
-    vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                       (PFNRT)attachStorageDevice, 8,
-                       this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);
+    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
+                           (PFNRT)attachStorageDevice, 8,
+                           this, pUVM, pszDevice, uInstance, enmBus, fUseHostIOCache, aMediumAttachment, fSilent);
 
     /* release the lock before waiting for a result (EMT will call us back!) */
@@ -4057,7 +4063,7 @@
      */
     bool fResume = false;
-    int vrc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
-    if (RT_FAILURE(vrc))
-        return vrc;
+    rc = suspendBeforeConfigChange(pUVM, &alock, &fResume);
+    if (FAILED(rc))
+        return rc;
 
     /*
@@ -4067,7 +4073,7 @@
      */
     PVMREQ pReq;
-    vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                       (PFNRT)detachStorageDevice, 7,
-                       this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);
+    int vrc = VMR3ReqCallU(pUVM, VMCPUID_ANY, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
+                           (PFNRT)detachStorageDevice, 7,
+                           this, pUVM, pszDevice, uInstance, enmBus, aMediumAttachment, fSilent);
 
     /* release the lock before waiting for a result (EMT will call us back!) */
@@ -4446,7 +4452,7 @@
      */
     bool fResume = false;
-    int vrc = suspendBeforeConfigChange(pUVM, NULL, &fResume);
-    if (RT_FAILURE(vrc))
-        return vrc;
+    int rc = suspendBeforeConfigChange(pUVM, NULL, &fResume);
+    if (FAILED(rc))
+        return rc;
 
     /*
@@ -4456,7 +4462,7 @@
      */
     PVMREQ pReq;
-    vrc = VMR3ReqCallU(pUVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
-                       (PFNRT)changeNetworkAttachment, 6,
-                       this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
+    int vrc = VMR3ReqCallU(pUVM, 0 /*idDstCpu*/, &pReq, 0 /* no wait! */, VMREQFLAGS_VBOX_STATUS,
+                           (PFNRT)changeNetworkAttachment, 6,
+                           this, pUVM, pszDevice, uInstance, uLun, aNetworkAdapter);
 
     if (vrc == VERR_TIMEOUT || RT_SUCCESS(vrc))
