third_party/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
/**
 *  Called from i_loadMachineDataFromSettings() for the storage controller data, including media.
 *
 * @param data          storage settings.
 * @param puuidRegistry media registry ID to set media to or NULL;
 *                      see Machine::i_loadMachineDataFromSettings()
 * @param puuidSnapshot snapshot ID
 * @return
 */
Called from i_loadMachineDataFromSettings() for the storage controller data, including media.
@param data          storage settings.
@param puuidRegistry media registry ID to set media to or NULL;
see Machine::i_loadMachineDataFromSettings()
@param puuidSnapshot snapshot ID
@return
Called from i_loadMachineDataFromSettings () for the storage controller data including media . @param data storage settings . @param puuidRegistry media registry ID to set media to or NULL ; see Machine :: i_loadMachineDataFromSettings () @param puuidSnapshot snapshot ID @return
HRESULT Machine::i_loadStorageControllers(const settings::Storage &data,
                                          const Guid *puuidRegistry,
                                          const Guid *puuidSnapshot)
{
    AssertReturn(!i_isSessionMachine(), E_FAIL);
    HRESULT rc = S_OK;
    for (settings::StorageControllersList::const_iterator
         it = data.llStorageControllers.begin();
         it != data.llStorageControllers.end();
         ++it)
    {
        const settings::StorageController &ctlData = *it;
        ComObjPtr<StorageController> pCtl;
        rc = i_getStorageControllerByName(ctlData.strName, pCtl, false );
        if (SUCCEEDED(rc))
            return setError(VBOX_E_OBJECT_IN_USE,
                            tr("Storage controller named '%s' already exists"),
                            ctlData.strName.c_str());
        pCtl.createObject();
        rc = pCtl->init(this,
                        ctlData.strName,
                        ctlData.storageBus,
                        ctlData.ulInstance,
                        ctlData.fBootable);
        if (FAILED(rc)) return rc;
        mStorageControllers->push_back(pCtl);
        rc = pCtl->COMSETTER(ControllerType)(ctlData.controllerType);
        if (FAILED(rc)) return rc;
        rc = pCtl->COMSETTER(PortCount)(ctlData.ulPortCount);
        if (FAILED(rc)) return rc;
        rc = pCtl->COMSETTER(UseHostIOCache)(ctlData.fUseHostIOCache);
        if (FAILED(rc)) return rc;
        rc = i_loadStorageDevices(pCtl,
                                  ctlData,
                                  puuidRegistry,
                                  puuidSnapshot);
        if (FAILED(rc)) return rc;
    }
    return S_OK;
}
HRESULT Machine :: i_loadStorageControllers ( const settings :: Storage & data , const Guid * puuidRegistry , const Guid * puuidSnapshot ) { AssertReturn ( ! i_isSessionMachine ( ) , E_FAIL ) ; HRESULT rc = S_OK ; for ( settings :: StorageControllersList :: const_iterator it = data . llStorageControllers . begin ( ) ; it != data . llStorageControllers . end ( ) ; ++ it ) { const settings :: StorageController & ctlData = * it ; ComObjPtr < StorageController > pCtl ; rc = i_getStorageControllerByName ( ctlData . strName , pCtl , false ) ; if ( SUCCEEDED ( rc ) ) return setError ( VBOX_E_OBJECT_IN_USE , tr ( " " ) , ctlData . strName . c_str ( ) ) ; pCtl . createObject ( ) ; rc = pCtl -> init ( this , ctlData . strName , ctlData . storageBus , ctlData . ulInstance , ctlData . fBootable ) ; if ( FAILED ( rc ) ) return rc ; mStorageControllers -> push_back ( pCtl ) ; rc = pCtl -> COMSETTER ( ControllerType ) ( ctlData . controllerType ) ; if ( FAILED ( rc ) ) return rc ; rc = pCtl -> COMSETTER ( PortCount ) ( ctlData . ulPortCount ) ; if ( FAILED ( rc ) ) return rc ; rc = pCtl -> COMSETTER ( UseHostIOCache ) ( ctlData . fUseHostIOCache ) ; if ( FAILED ( rc ) ) return rc ; rc = i_loadStorageDevices ( pCtl , ctlData , puuidRegistry , puuidSnapshot ) ; if ( FAILED ( rc ) ) return rc ; } return S_OK ; }
Called from i_loadMachineDataFromSettings() for the storage controller data, including media.
Called from i_loadMachineDataFromSettings () for the storage controller data including media .
/* Try to find one with the name first. */ /* aSetError */ /* Load the attached devices now. */