Index: trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 48817)
+++ trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 48879)
@@ -4501,4 +4501,5 @@
                           false /* fNonRotational */,
                           false /* fDiscard */,
+                          false /* fHotPluggable */,
                           Utf8Str::Empty);
     if (FAILED(rc)) return rc;
@@ -4828,4 +4829,56 @@
                         aDevice, aControllerPort, aControllerName);
     pAttach->updateDiscard(!!aDiscard);
+
+    return S_OK;
+}
+
+STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aControllerPort,
+                                               LONG aDevice, BOOL aHotPluggable)
+{
+    CheckComArgStrNotEmptyOrNull(aControllerName);
+
+    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n",
+                     aControllerName, aControllerPort, aDevice, aHotPluggable));
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
+
+    HRESULT rc = checkStateDependency(MutableStateDep);
+    if (FAILED(rc)) return rc;
+
+    AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
+
+    if (Global::IsOnlineOrTransient(mData->mMachineState))
+        return setError(VBOX_E_INVALID_VM_STATE,
+                        tr("Invalid machine state: %s"),
+                        Global::stringifyMachineState(mData->mMachineState));
+
+    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
+                                               aControllerName,
+                                               aControllerPort,
+                                               aDevice);
+    if (!pAttach)
+        return setError(VBOX_E_OBJECT_NOT_FOUND,
+                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
+                        aDevice, aControllerPort, aControllerName);
+
+    /** @todo remove this blocker and add the missing code to support this
+     * flag properly in all code areas, with proper support checks below. */
+    return setError(VBOX_E_NOT_SUPPORTED,
+                    tr("Controller '%ls' does not support changing the hot-pluggable device flag"),
+                    aControllerName);
+
+    setModified(IsModified_Storage);
+    mMediaData.backup();
+
+    AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
+
+    if (pAttach->getType() == DeviceType_Floppy)
+        return setError(E_INVALIDARG,
+                        tr("Setting the hot-pluggable device flag rejected as the device attached to device slot %d on port %d of controller '%ls' is a floppy drive"),
+                        aDevice, aControllerPort, aControllerName);
+    pAttach->updateHotPluggable(!!aHotPluggable);
 
     return S_OK;
@@ -9716,4 +9769,6 @@
                                dev.fNonRotational,
                                dev.fDiscard,
+        /// @todo load setting once the hot-pluggable flag works
+                               false /*dev.fHotPluggable*/,
                                pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName());
         if (FAILED(rc)) break;
@@ -10819,4 +10874,6 @@
         dev.lDevice = pAttach->getDevice();
         dev.fPassThrough = pAttach->getPassthrough();
+        /// @todo save setting once the hot-pluggable flag works
+        dev.fHotPluggable = false /* pAttach->getHotPluggable()*/;
         if (pMedium)
         {
@@ -11161,4 +11218,5 @@
                                   pAtt->getNonRotational(),
                                   pAtt->getDiscard(),
+                                  pAtt->getHotPluggable(),
                                   pAtt->getBandwidthGroup());
             if (FAILED(rc)) throw rc;
@@ -12777,5 +12835,5 @@
         {
             Bstr name;
-            
+
             hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam());
             if (SUCCEEDED(hrc))
Index: trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp
===================================================================
--- trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp	(revision 48817)
+++ trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp	(revision 48879)
@@ -5,5 +5,5 @@
 
 /*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
  *
  * This file is part of VirtualBox Open Source Edition (OSE), as
@@ -43,5 +43,6 @@
           fNonRotational(false),
           fDiscard(false),
-          fImplicit(false)
+          fImplicit(false),
+          fHotPluggable(false)
     { }
 
@@ -63,4 +64,5 @@
     bool                fDiscard;
     bool                fImplicit;
+    bool                fHotPluggable;
 };
 
@@ -123,8 +125,9 @@
                                bool aNonRotational,
                                bool aDiscard,
+                               bool aHotPluggable,
                                const Utf8Str &strBandwidthGroup)
 {
     LogFlowThisFuncEnter();
-    LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, strBandwidthGroup.c_str()));
+    LogFlowThisFunc(("aParent=%p aMedium=%p aControllerName=%ls aPort=%d aDevice=%d aType=%d aImplicit=%d aPassthrough=%d aTempEject=%d aNonRotational=%d aDiscard=%d aHotPluggable=%d strBandwithGroup=%s\n", aParent, aMedium, aControllerName.raw(), aPort, aDevice, aType, aImplicit, aPassthrough, aTempEject, aNonRotational, aDiscard, aHotPluggable, strBandwidthGroup.c_str()));
 
     if (aType == DeviceType_HardDisk)
@@ -152,4 +155,5 @@
     m->bd->fDiscard = aDiscard;
     m->bd->fImplicit = aImplicit;
+    m->bd->fHotPluggable = aHotPluggable;
 
     /* Confirm a successful initialization when it's the case */
@@ -417,4 +421,21 @@
 }
 
+STDMETHODIMP MediumAttachment::COMGETTER(HotPluggable)(BOOL *aHotPluggable)
+{
+    LogFlowThisFuncEnter();
+
+    CheckComArgOutPointerValid(aHotPluggable);
+
+    AutoCaller autoCaller(this);
+    if (FAILED(autoCaller.rc())) return autoCaller.rc();
+
+    AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
+
+    *aHotPluggable = m->bd->fHotPluggable;
+
+    LogFlowThisFuncLeave();
+    return S_OK;
+}
+
 /**
  *  @note Locks this object for writing.
@@ -511,4 +532,10 @@
     AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     return m->bd->fDiscard;
+}
+
+bool MediumAttachment::getHotPluggable() const
+{
+    AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
+    return m->bd->fHotPluggable;
 }
 
