VirtualBox

Changeset 48879 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Oct 4, 2013 8:37:50 AM (11 years ago)
Author:
vboxsync
Message:

Main/MediumAttachment+Machine: stub attribute/method for an explicit hot-pluggable medium attachment flag, to be used by AHCI soon

Location:
trunk/src/VBox/Main/src-server
Files:
2 edited

Legend:

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

    r48735 r48879  
    45014501                          false /* fNonRotational */,
    45024502                          false /* fDiscard */,
     4503                          false /* fHotPluggable */,
    45034504                          Utf8Str::Empty);
    45044505    if (FAILED(rc)) return rc;
     
    48284829                        aDevice, aControllerPort, aControllerName);
    48294830    pAttach->updateDiscard(!!aDiscard);
     4831
     4832    return S_OK;
     4833}
     4834
     4835STDMETHODIMP Machine::SetHotPluggableForDevice(IN_BSTR aControllerName, LONG aControllerPort,
     4836                                               LONG aDevice, BOOL aHotPluggable)
     4837{
     4838    CheckComArgStrNotEmptyOrNull(aControllerName);
     4839
     4840    LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%d aDevice=%d aHotPluggable=%d\n",
     4841                     aControllerName, aControllerPort, aDevice, aHotPluggable));
     4842
     4843    AutoCaller autoCaller(this);
     4844    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     4845
     4846    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     4847
     4848    HRESULT rc = checkStateDependency(MutableStateDep);
     4849    if (FAILED(rc)) return rc;
     4850
     4851    AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL);
     4852
     4853    if (Global::IsOnlineOrTransient(mData->mMachineState))
     4854        return setError(VBOX_E_INVALID_VM_STATE,
     4855                        tr("Invalid machine state: %s"),
     4856                        Global::stringifyMachineState(mData->mMachineState));
     4857
     4858    MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments,
     4859                                               aControllerName,
     4860                                               aControllerPort,
     4861                                               aDevice);
     4862    if (!pAttach)
     4863        return setError(VBOX_E_OBJECT_NOT_FOUND,
     4864                        tr("No storage device attached to device slot %d on port %d of controller '%ls'"),
     4865                        aDevice, aControllerPort, aControllerName);
     4866
     4867    /** @todo remove this blocker and add the missing code to support this
     4868     * flag properly in all code areas, with proper support checks below. */
     4869    return setError(VBOX_E_NOT_SUPPORTED,
     4870                    tr("Controller '%ls' does not support changing the hot-pluggable device flag"),
     4871                    aControllerName);
     4872
     4873    setModified(IsModified_Storage);
     4874    mMediaData.backup();
     4875
     4876    AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS);
     4877
     4878    if (pAttach->getType() == DeviceType_Floppy)
     4879        return setError(E_INVALIDARG,
     4880                        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"),
     4881                        aDevice, aControllerPort, aControllerName);
     4882    pAttach->updateHotPluggable(!!aHotPluggable);
    48304883
    48314884    return S_OK;
     
    97169769                               dev.fNonRotational,
    97179770                               dev.fDiscard,
     9771        /// @todo load setting once the hot-pluggable flag works
     9772                               false /*dev.fHotPluggable*/,
    97189773                               pBwGroup.isNull() ? Utf8Str::Empty : pBwGroup->getName());
    97199774        if (FAILED(rc)) break;
     
    1081910874        dev.lDevice = pAttach->getDevice();
    1082010875        dev.fPassThrough = pAttach->getPassthrough();
     10876        /// @todo save setting once the hot-pluggable flag works
     10877        dev.fHotPluggable = false /* pAttach->getHotPluggable()*/;
    1082110878        if (pMedium)
    1082210879        {
     
    1116111218                                  pAtt->getNonRotational(),
    1116211219                                  pAtt->getDiscard(),
     11220                                  pAtt->getHotPluggable(),
    1116311221                                  pAtt->getBandwidthGroup());
    1116411222            if (FAILED(rc)) throw rc;
     
    1277712835        {
    1277812836            Bstr name;
    12779            
     12837
    1278012838            hrc = mNetworkAdapters[slot]->COMGETTER(NATNetwork)(name.asOutParam());
    1278112839            if (SUCCEEDED(hrc))
  • trunk/src/VBox/Main/src-server/MediumAttachmentImpl.cpp

    r38873 r48879  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4343          fNonRotational(false),
    4444          fDiscard(false),
    45           fImplicit(false)
     45          fImplicit(false),
     46          fHotPluggable(false)
    4647    { }
    4748
     
    6364    bool                fDiscard;
    6465    bool                fImplicit;
     66    bool                fHotPluggable;
    6567};
    6668
     
    123125                               bool aNonRotational,
    124126                               bool aDiscard,
     127                               bool aHotPluggable,
    125128                               const Utf8Str &strBandwidthGroup)
    126129{
    127130    LogFlowThisFuncEnter();
    128     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()));
     131    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()));
    129132
    130133    if (aType == DeviceType_HardDisk)
     
    152155    m->bd->fDiscard = aDiscard;
    153156    m->bd->fImplicit = aImplicit;
     157    m->bd->fHotPluggable = aHotPluggable;
    154158
    155159    /* Confirm a successful initialization when it's the case */
     
    417421}
    418422
     423STDMETHODIMP MediumAttachment::COMGETTER(HotPluggable)(BOOL *aHotPluggable)
     424{
     425    LogFlowThisFuncEnter();
     426
     427    CheckComArgOutPointerValid(aHotPluggable);
     428
     429    AutoCaller autoCaller(this);
     430    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     431
     432    AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     433
     434    *aHotPluggable = m->bd->fHotPluggable;
     435
     436    LogFlowThisFuncLeave();
     437    return S_OK;
     438}
     439
    419440/**
    420441 *  @note Locks this object for writing.
     
    511532    AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
    512533    return m->bd->fDiscard;
     534}
     535
     536bool MediumAttachment::getHotPluggable() const
     537{
     538    AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS);
     539    return m->bd->fHotPluggable;
    513540}
    514541
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