VirtualBox

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


Ignore:
Timestamp:
Mar 29, 2022 3:50:26 PM (3 years ago)
Author:
vboxsync
Message:

Main/Machine+FE/Qt+VBoxManage/showvminfo: Attaching USB devices to a VM
when it isn't running should default to being marked as 'hot-pluggable'.
Further, attempts to remove the 'hot-pluggable' status of a USB device
via either the API or GUI should be impossible. Also update 'VBoxManage
showvminfo' to include the 'hot-pluggable' status of medium attachments
along with a few other IMediumAttachment attributes which were omitted
previously. bugref:8211

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r94184 r94394  
    35443544        fSilent = true;
    35453545
    3546     /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
     3546    /* Check that the controller can do hot-plugging if we attach the device while the VM is running. */
    35473547    bool fHotplug = false;
    35483548    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
     
    35513551    if (fHotplug && !i_isControllerHotplugCapable(ctrlType))
    35523552        return setError(VBOX_E_INVALID_VM_STATE,
    3553                         tr("Controller '%s' does not support hotplugging"),
     3553                        tr("Controller '%s' does not support hot-plugging"),
    35543554                        aName.c_str());
     3555
     3556    /* Attaching a USB device when a VM is powered off should default to being marked as hot-pluggable */
     3557    if (!fHotplug && !Global::IsOnlineOrTransient(mData->mMachineState) && ctrlType == StorageControllerType_USB)
     3558        fHotplug = true;
    35553559
    35563560    // check that the port and device are not out of range
     
    41224126        fSilent = true;
    41234127
    4124     /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
     4128    /* Check that the controller can do hot-plugging if we detach the device while the VM is running. */
    41254129    bool fHotplug = false;
    41264130    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
     
    41294133    if (fHotplug && !i_isControllerHotplugCapable(ctrlType))
    41304134        return setError(VBOX_E_INVALID_VM_STATE,
    4131                         tr("Controller '%s' does not support hotplugging"),
     4135                        tr("Controller '%s' does not support hot-plugging"),
    41324136                        aName.c_str());
    41334137
     
    41434147    if (fHotplug && !pAttach->i_getHotPluggable())
    41444148        return setError(VBOX_E_NOT_SUPPORTED,
    4145                         tr("The device slot %d on port %d of controller '%s' does not support hotplugging"),
     4149                        tr("The device slot %d on port %d of controller '%s' does not support hot-plugging"),
    41464150                        aDevice, aControllerPort, aName.c_str());
    41474151
     
    42084212        fSilent = true;
    42094213
    4210     /* Check that the controller can do hotplugging if we detach the device while the VM is running. */
     4214    /* Check that the controller can do hot-plugging if we detach the device while the VM is running. */
    42114215    bool fHotplug = false;
    42124216    if (!fSilent && Global::IsOnlineOrTransient(mData->mMachineState))
     
    42154219    if (fHotplug && !i_isControllerHotplugCapable(ctrlType))
    42164220        return setError(VBOX_E_INVALID_VM_STATE,
    4217                         tr("Controller '%s' does not support hotplugging which is required to change the passthrough setting while the VM is running"),
     4221                        tr("Controller '%s' does not support hot-plugging which is required to change the passthrough setting while the VM is running"),
    42184222                        aName.c_str());
    42194223
     
    44134417
    44144418    if (!i_isControllerHotplugCapable(ctrlType))
    4415     return setError(VBOX_E_NOT_SUPPORTED,
    4416                     tr("Controller '%s' does not support changing the hot-pluggable device flag"),
    4417                     aName.c_str());
     4419        return setError(VBOX_E_NOT_SUPPORTED,
     4420                        tr("Controller '%s' does not support changing the hot-pluggable device flag"),
     4421                        aName.c_str());
     4422
     4423    /* silently ignore attempts to modify the hot-plug status of USB devices */
     4424    if (ctrlType == StorageControllerType_USB)
     4425        return S_OK;
    44184426
    44194427    i_setModified(IsModified_Storage);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette