VirtualBox

Changeset 78261 in vbox for trunk/src


Ignore:
Timestamp:
Apr 23, 2019 4:49:28 PM (6 years ago)
Author:
vboxsync
Message:

Main: bugref:6913: Added OnStorageControllerChanged to IVirtualBox events and fixed generation the medium events

Location:
trunk/src/VBox/Main
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r78255 r78261  
    2109521095
    2109621096      </desc>
     21097      <param name="machineId" type="uuid" mod="string" dir="in">
     21098        <desc>The id of the machine containing the storage controller.</desc>
     21099      </param>
     21100      <param name="controllerName" type="wstring" dir="in">
     21101        <desc>The name of the storage controller.</desc>
     21102      </param>
    2109721103    </method>
    2109821104
     
    2423324239  <interface
    2423424240    name="IStorageControllerChangedEvent" extends="IEvent"
    24235     uuid="715212BF-DA59-426E-8230-3831FAA52C56"
     24241    uuid="6BB335CC-1C58-440C-BB7B-3A1397284C7B"
    2423624242    wsmap="managed" autogen="VBoxEvent" id="OnStorageControllerChanged"
    2423724243    >
    2423824244    <desc>
    2423924245      Notification when a
    24240       <link to="IMachine::mediumAttachments">medium attachment</link>
     24246      <link to="IMachine::storageControllers">storage controllers</link>
    2424124247      changes.
    2424224248    </desc>
    24243     <attribute name="midlDoesNotLikeEmptyInterfaces" readonly="yes" type="boolean"/>
     24249    <attribute name="machinId" type="uuid" mod="string" readonly="yes">
     24250      <desc>
     24251        The id of the machine containing the storage controller.
     24252      </desc>
     24253    </attribute>
     24254    <attribute name="controllerName" type="wstring" readonly="yes">
     24255      <desc>
     24256        The name of the storage controller.
     24257      </desc>
     24258    </attribute>
    2424424259  </interface>
    2424524260
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r77910 r78261  
    179179    HRESULT i_onSerialPortChange(ISerialPort *aSerialPort);
    180180    HRESULT i_onParallelPortChange(IParallelPort *aParallelPort);
    181     HRESULT i_onStorageControllerChange();
     181    HRESULT i_onStorageControllerChange(const com::Guid& aMachineId, const com::Utf8Str& aControllerName);
    182182    HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
    183183    HRESULT i_onCPUChange(ULONG aCPU, BOOL aRemove);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r77910 r78261  
    519519    virtual HRESULT i_onVRDEServerChange(BOOL /* aRestart */) { return S_OK; }
    520520    virtual HRESULT i_onUSBControllerChange() { return S_OK; }
    521     virtual HRESULT i_onStorageControllerChange() { return S_OK; }
     521    virtual HRESULT i_onStorageControllerChange(const com::Guid & /* aMachineId */, const com::Utf8Str & /* aControllerName */) { return S_OK; }
    522522    virtual HRESULT i_onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; }
    523523    virtual HRESULT i_onCPUExecutionCapChange(ULONG /* aExecutionCap */) { return S_OK; }
     
    13261326                                      NATProtocol_T aProto, IN_BSTR aHostIp, LONG aHostPort,
    13271327                                      IN_BSTR aGuestIp, LONG aGuestPort);
    1328     HRESULT i_onStorageControllerChange();
     1328    HRESULT i_onStorageControllerChange(const com::Guid &aMachineId, const com::Utf8Str &aControllerName);
    13291329    HRESULT i_onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce);
    13301330    HRESULT i_onVMProcessPriorityChange(VMProcPriority_T aPriority);
  • trunk/src/VBox/Main/include/SessionImpl.h

    r77910 r78261  
    9393    HRESULT onSerialPortChange(const ComPtr<ISerialPort> &aSerialPort);
    9494    HRESULT onParallelPortChange(const ComPtr<IParallelPort> &aParallelPort);
    95     HRESULT onStorageControllerChange();
     95    HRESULT onStorageControllerChange(const Guid &aMachineId, const com::Utf8Str& aControllerName);
    9696    HRESULT onMediumChange(const ComPtr<IMediumAttachment> &aMediumAttachment,
    9797                           BOOL aForce);
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r76562 r78261  
    156156    void i_onMediumConfigChanged(IMedium *aMedium);
    157157    void i_onMediumChanged(IMediumAttachment* aMediumAttachment);
     158    void i_onStorageControllerChanged(const Guid &aMachineId, const com::Utf8Str &aControllerName);
    158159    void i_onStorageDeviceChanged(IMediumAttachment* aStorageDevice, const BOOL fRemoved, const BOOL fSilent);
    159160    void i_onMachineStateChange(const Guid &aId, MachineState_T aState);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r78090 r78261  
    52465246 * Called by IInternalSessionControl::OnStorageControllerChange().
    52475247 */
    5248 HRESULT Console::i_onStorageControllerChange()
     5248HRESULT Console::i_onStorageControllerChange(const Guid &aMachineId, const Utf8Str &aControllerName)
    52495249{
    52505250    LogFlowThisFunc(("\n"));
     
    52535253    AssertComRCReturnRC(autoCaller.rc());
    52545254
    5255     fireStorageControllerChangedEvent(mEventSource);
     5255    fireStorageControllerChangedEvent(mEventSource, Bstr(aMachineId.toString()).raw(), Bstr(aControllerName).raw());
    52565256
    52575257    LogFlowThisFunc(("Leaving rc=%#x\n", S_OK));
  • trunk/src/VBox/Main/src-client/SessionImpl.cpp

    r77910 r78261  
    640640}
    641641
    642 HRESULT Session::onStorageControllerChange()
    643 {
    644     LogFlowThisFunc(("\n"));
    645 
    646     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    647     AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
    648     AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
    649 #ifndef VBOX_COM_INPROC_API_CLIENT
    650     AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
    651 
    652     return mConsole->i_onStorageControllerChange();
    653 #else
     642HRESULT Session::onStorageControllerChange(const Guid &aMachineId, const Utf8Str &aControllerName)
     643{
     644    LogFlowThisFunc(("\n"));
     645
     646    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     647    AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE);
     648    AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE);
     649#ifndef VBOX_COM_INPROC_API_CLIENT
     650    AssertReturn(mConsole, VBOX_E_INVALID_OBJECT_STATE);
     651
     652    return mConsole->i_onStorageControllerChange(aMachineId, aControllerName);
     653#else
     654    NOREF(aMachineId);
     655    NOREF(aControllerName);
    654656    return S_OK;
    655657#endif
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r78202 r78261  
    41784178    mParent->i_saveModifiedRegistries();
    41794179
    4180     if (aM)
    4181         mParent->i_onMediumConfigChanged(aM);
     4180    if (SUCCEEDED(rc))
     4181    {
     4182        if (fIndirect && medium != aM)
     4183            mParent->i_onMediumConfigChanged(medium);
     4184        mParent->i_onStorageDeviceChanged(attachment, FALSE, fSilent);
     4185    }
     4186
    41824187    return rc;
    41834188}
     
    42634268    mParent->i_saveModifiedRegistries();
    42644269
     4270    if (SUCCEEDED(rc))
     4271        mParent->i_onStorageDeviceChanged(pAttach, TRUE, fSilent);
     4272
    42654273    return rc;
    42664274}
     
    43344342    alock.release();
    43354343    rc = i_onStorageDeviceChange(pAttach, FALSE /* aRemove */, FALSE /* aSilent */);
     4344    if (SUCCEEDED(rc))
     4345        mParent->i_onStorageDeviceChanged(pAttach, FALSE, FALSE);
    43364346
    43374347    return rc;
     
    60436053    /* inform the direct session if any */
    60446054    alock.release();
    6045     i_onStorageControllerChange();
     6055    i_onStorageControllerChange(i_getId(), aName);
    60466056
    60476057    return S_OK;
     
    61306140        /* inform the direct session if any */
    61316141        alock.release();
    6132         i_onStorageControllerChange();
     6142        i_onStorageControllerChange(i_getId(), aName);
    61336143    }
    61346144
     
    61836193    /* inform the direct session if any */
    61846194    alock.release();
    6185     i_onStorageControllerChange();
     6195    i_onStorageControllerChange(i_getId(), aName);
    61866196
    61876197    return S_OK;
     
    1184111851
    1184211852        if (flModifications & IsModified_Storage)
    11843             that->i_onStorageControllerChange();
     11853        {
     11854            for (StorageControllerList::const_iterator
     11855                 it = mStorageControllers->begin();
     11856                 it != mStorageControllers->end();
     11857                 ++it)
     11858            {
     11859                that->i_onStorageControllerChange(that->i_getId(), (*it)->i_getName());
     11860            }
     11861        }
     11862
    1184411863
    1184511864#if 0
     
    1402414043 *  @note Locks this object for reading.
    1402514044 */
    14026 HRESULT SessionMachine::i_onStorageControllerChange()
     14045HRESULT SessionMachine::i_onStorageControllerChange(const Guid &aMachineId, const Utf8Str &aControllerName)
    1402714046{
    1402814047    LogFlowThisFunc(("\n"));
     
    1403814057    }
    1403914058
     14059    mParent->i_onStorageControllerChanged(aMachineId, aControllerName);
     14060
    1404014061    /* ignore notifications sent after #OnSessionEnd() is called */
    1404114062    if (!directControl)
    1404214063        return S_OK;
    1404314064
    14044     return directControl->OnStorageControllerChange();
     14065    return directControl->OnStorageControllerChange(Bstr(aMachineId.toString()).raw(), Bstr(aControllerName).raw());
    1404514066}
    1404614067
     
    1432114342            directControl = mData->mSession.mDirectControl;
    1432214343    }
    14323 
    14324     mParent->i_onStorageDeviceChanged(aAttachment, aRemove, aSilent);
    1432514344
    1432614345    /* ignore notifications sent after #OnSessionEnd() is called */
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r77857 r78261  
    23822382    Guid uId = i_getId();
    23832383    DeviceType_T devType = i_getDeviceType();
    2384     bool wasCreated = m->state != MediumState_NotCreated;
    23852384    MultiResult mrc = i_close(aAutoCaller);
    23862385
    23872386    pVirtualBox->i_saveModifiedRegistries();
    23882387
    2389     if (SUCCEEDED(mrc) && wasCreated)
     2388    if (SUCCEEDED(mrc))
    23902389        pVirtualBox->i_onMediumRegistered(uId, devType, FALSE);
    23912390
     
    84538452            m->pVirtualBox->i_saveModifiedRegistries();
    84548453        }
    8455         if (task.NotifyAboutChanges())
    8456             m->pVirtualBox->i_onMediumRegistered(m->id, m->devType, TRUE);
    84578454    }
    84588455    else
     
    84658462            unconst(m->id).clear();
    84668463    }
     8464
     8465    if (task.NotifyAboutChanges() && SUCCEEDED(rc))
     8466        m->pVirtualBox->i_onMediumConfigChanged(this);
    84678467
    84688468    return rc;
     
    86918691
    86928692    if (task.NotifyAboutChanges() && SUCCEEDED(mrc))
    8693     {
    8694         m->pVirtualBox->i_onMediumRegistered(pTarget->i_getId(), pTarget->i_getDeviceType(), TRUE);
    86958693        m->pVirtualBox->i_onMediumConfigChanged(this);
    8696     }
    86978694
    86988695    return mrc;
  • trunk/src/VBox/Main/src-server/StorageControllerImpl.cpp

    r76592 r78261  
    334334        alock.release();
    335335
    336         m->pParent->i_onStorageControllerChange();
     336        m->pParent->i_onStorageControllerChange(m->pParent->i_getId(), aName);
    337337    }
    338338
     
    435435        mlock.release();
    436436
    437         m->pParent->i_onStorageControllerChange();
     437        m->pParent->i_onStorageControllerChange(m->pParent->i_getId(), m->bd->strName);
    438438    }
    439439
     
    576576        mlock.release();
    577577
    578         m->pParent->i_onStorageControllerChange();
     578        m->pParent->i_onStorageControllerChange(m->pParent->i_getId(), m->bd->strName);
    579579    }
    580580
     
    609609        mlock.release();
    610610
    611         m->pParent->i_onStorageControllerChange();
     611        m->pParent->i_onStorageControllerChange(m->pParent->i_getId(), m->bd->strName);
    612612    }
    613613
     
    642642        mlock.release();
    643643
    644         m->pParent->i_onStorageControllerChange();
     644        m->pParent->i_onStorageControllerChange(m->pParent->i_getId(), m->bd->strName);
    645645    }
    646646
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r78202 r78261  
    30203020}
    30213021
     3022/** Event for onStorageControllerChanged() */
     3023struct StorageControllerChangedEventStruct : public VirtualBox::CallbackEvent
     3024{
     3025    StorageControllerChangedEventStruct(VirtualBox *aVB, const Guid &aMachineId,
     3026                                        const com::Utf8Str &aControllerName)
     3027        : CallbackEvent(aVB, VBoxEventType_OnStorageControllerChanged)
     3028        , mMachineId(aMachineId.toUtf16()), mControllerName(aControllerName)
     3029    {}
     3030
     3031    virtual HRESULT prepareEventDesc(IEventSource *aSource, VBoxEventDesc &aEvDesc)
     3032    {
     3033        return aEvDesc.init(aSource, VBoxEventType_OnStorageControllerChanged, mMachineId.raw(), mControllerName.raw());
     3034    }
     3035
     3036    Bstr mMachineId;
     3037    Bstr mControllerName;
     3038};
     3039
     3040/**
     3041 *  @note Doesn't lock any object.
     3042 */
     3043void VirtualBox::i_onStorageControllerChanged(const Guid &aMachineId, const com::Utf8Str &aControllerName)
     3044{
     3045    i_postEvent(new StorageControllerChangedEventStruct(this, aMachineId, aControllerName));
     3046}
     3047
    30223048/** Event for onStorageDeviceChanged() */
    30233049struct StorageDeviceChangedEventStruct : public VirtualBox::CallbackEvent
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