third_party/virtualbox/src/VBox/Main/src-server/MachineImpl.cpp
/**
 *  Saves the hard disk configuration.
 */
Saves the hard disk configuration.
Saves the hard disk configuration .
HRESULT Machine::i_saveStorageDevices(ComObjPtr<StorageController> aStorageController,
                                      settings::StorageController &data)
{
    MediumAttachmentList atts;
    HRESULT rc = i_getMediumAttachmentsOfController(aStorageController->i_getName(), atts);
    if (FAILED(rc)) return rc;
    data.llAttachedDevices.clear();
    for (MediumAttachmentList::const_iterator
         it = atts.begin();
         it != atts.end();
         ++it)
    {
        settings::AttachedDevice dev;
        IMediumAttachment *iA = *it;
        MediumAttachment *pAttach = static_cast<MediumAttachment *>(iA);
        Medium *pMedium = pAttach->i_getMedium();
        dev.deviceType = pAttach->i_getType();
        dev.lPort = pAttach->i_getPort();
        dev.lDevice = pAttach->i_getDevice();
        dev.fPassThrough = pAttach->i_getPassthrough();
        dev.fHotPluggable = pAttach->i_getHotPluggable();
        if (pMedium)
        {
            if (pMedium->i_isHostDrive())
                dev.strHostDriveSrc = pMedium->i_getLocationFull();
            else
                dev.uuid = pMedium->i_getId();
            dev.fTempEject = pAttach->i_getTempEject();
            dev.fNonRotational = pAttach->i_getNonRotational();
            dev.fDiscard = pAttach->i_getDiscard();
        }
        dev.strBwGroup = pAttach->i_getBandwidthGroup();
        data.llAttachedDevices.push_back(dev);
    }
    return S_OK;
}
HRESULT Machine :: i_saveStorageDevices ( ComObjPtr < StorageController > aStorageController , settings :: StorageController & data ) { MediumAttachmentList atts ; HRESULT rc = i_getMediumAttachmentsOfController ( aStorageController -> i_getName ( ) , atts ) ; if ( FAILED ( rc ) ) return rc ; data . llAttachedDevices . clear ( ) ; for ( MediumAttachmentList :: const_iterator it = atts . begin ( ) ; it != atts . end ( ) ; ++ it ) { settings :: AttachedDevice dev ; IMediumAttachment * iA = * it ; MediumAttachment * pAttach = static_cast < MediumAttachment * > ( iA ) ; Medium * pMedium = pAttach -> i_getMedium ( ) ; dev . deviceType = pAttach -> i_getType ( ) ; dev . lPort = pAttach -> i_getPort ( ) ; dev . lDevice = pAttach -> i_getDevice ( ) ; dev . fPassThrough = pAttach -> i_getPassthrough ( ) ; dev . fHotPluggable = pAttach -> i_getHotPluggable ( ) ; if ( pMedium ) { if ( pMedium -> i_isHostDrive ( ) ) dev . strHostDriveSrc = pMedium -> i_getLocationFull ( ) ; else dev . uuid = pMedium -> i_getId ( ) ; dev . fTempEject = pAttach -> i_getTempEject ( ) ; dev . fNonRotational = pAttach -> i_getNonRotational ( ) ; dev . fDiscard = pAttach -> i_getDiscard ( ) ; } dev . strBwGroup = pAttach -> i_getBandwidthGroup ( ) ; data . llAttachedDevices . push_back ( dev ) ; } return S_OK ; }
Saves the hard disk configuration.
Saves the hard disk configuration .