VirtualBox

Ignore:
Timestamp:
Jun 30, 2011 1:51:51 PM (14 years ago)
Author:
vboxsync
Message:

Main/MediumAttachment+Machine: add a setting which controls the guest-triggered medium eject behavior, fix handling "implicit" media, and corresponding VBoxManage and documentation updates

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r37543 r37709  
    466466                     "                            [--setparentuuid <uuid>]\n"
    467467                     "                            [--passthrough on|off]\n"
     468                     "                            [--tempeject on|off]\n"
    468469                     "                            [--bandwidthgroup <name>]\n"
    469470                     "                            [--forceunmount]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp

    r37674 r37709  
    5252    { "--mtype",            'M', RTGETOPT_REQ_STRING },
    5353    { "--passthrough",      'h', RTGETOPT_REQ_STRING },
     54    { "--tempeject",        'e', RTGETOPT_REQ_STRING },
    5455    { "--bandwidthgroup",   'b', RTGETOPT_REQ_STRING },
    5556    { "--forceunmount",     'f', RTGETOPT_REQ_NOTHING },
     
    8485    const char *pszMedium = NULL;
    8586    const char *pszPassThrough = NULL;
     87    const char *pszTempEject = NULL;
    8688    const char *pszBandwidthGroup = NULL;
    8789    Bstr bstrNewUuid;
     
    162164                if (ValueUnion.psz)
    163165                    pszPassThrough = ValueUnion.psz;
     166                else
     167                    rc = E_FAIL;
     168                break;
     169            }
     170
     171            case 'e':   // tempeject <on|off>
     172            {
     173                if (ValueUnion.psz)
     174                    pszTempEject = ValueUnion.psz;
    164175                else
    165176                    rc = E_FAIL;
     
    682693        }
    683694
     695        if (   pszTempEject
     696            && (SUCCEEDED(rc)))
     697        {
     698            ComPtr<IMediumAttachment> mattach;
     699            CHECK_ERROR(machine, GetMediumAttachment(Bstr(pszCtl).raw(), port,
     700                                                     device, mattach.asOutParam()));
     701
     702            if (SUCCEEDED(rc))
     703            {
     704                if (!RTStrICmp(pszTempEject, "on"))
     705                {
     706                    CHECK_ERROR(machine, TemporaryEjectDevice(Bstr(pszCtl).raw(),
     707                                                              port, device, TRUE));
     708                }
     709                else if (!RTStrICmp(pszTempEject, "off"))
     710                {
     711                    CHECK_ERROR(machine, TemporaryEjectDevice(Bstr(pszCtl).raw(),
     712                                                              port, device, FALSE));
     713                }
     714                else
     715                    throw Utf8StrFmt("Invalid --tempeject argument '%s'", pszTempEject);
     716            }
     717            else
     718                throw Utf8StrFmt("Couldn't find the controller attachment for the controller '%s'\n", pszCtl);
     719        }
     720
    684721        if (   pszBandwidthGroup
    685722            && !fRunTime
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