VirtualBox

Changeset 28825 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 27, 2010 1:50:46 PM (15 years ago)
Author:
vboxsync
Message:

Make SATA the default harddisk controller for Windows guests (Vista and up) and 2.6 Linux guests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp

    r28805 r28825  
    667667
    668668    /* Create default storage controllers */
    669     QString ctrName = VBoxVMSettingsHD::tr("Storage Controller");
    670     KStorageBus ideBus = KStorageBus_IDE;
    671 
    672     // Add storage controller
    673     m_Machine.AddStorageController(ctrName, ideBus);
    674 
    675     // Set storage controller type
    676     CStorageController ctr = m_Machine.GetStorageControllerByName(ctrName);
    677     KStorageControllerType storageControllerType = type.GetRecommendedStorageController();
    678     ctr.SetControllerType(storageControllerType);
     669    QString ctrDvdName = VBoxVMSettingsHD::tr("Storage Controller");
     670    KStorageBus ctrDvdBus = type.GetRecommendedDvdStorageBus();
     671
     672    // Add IDE storage controller
     673    m_Machine.AddStorageController(ctrDvdName, ctrDvdBus);
     674
     675    // Set DVD storage controller type
     676    CStorageController dvdCtr = m_Machine.GetStorageControllerByName(ctrDvdName);
     677    KStorageControllerType dvdStorageControllerType = type.GetRecommendedDvdStorageController();
     678    dvdCtr.SetControllerType(dvdStorageControllerType);
     679
     680    // Create a storage controller for harddisks if this is not the same as the DVD controller
     681    KStorageBus ctrHdBus = type.GetRecommendedHdStorageBus();
     682    KStorageControllerType hdStorageControllerType = type.GetRecommendedHdStorageController();
     683    CStorageController hdCtr;
     684    QString ctrHdName;
     685
     686    if (   ctrHdBus != ctrDvdBus
     687        && hdStorageControllerType != dvdStorageControllerType)
     688    {
     689        ctrHdName = VBoxVMSettingsHD::tr("Storage Controller 1");
     690        m_Machine.AddStorageController(ctrHdName, ctrHdBus);
     691        hdCtr = m_Machine.GetStorageControllerByName(ctrHdName);
     692        hdCtr.SetControllerType(hdStorageControllerType);
     693
     694        // Disable the I/O cache if this is not a IDE controller.
     695        if (ctrHdBus != KStorageBus_IDE)
     696            hdCtr.SetIoBackend(KIoBackendType_Unbuffered);
     697    }
     698    else
     699    {
     700        // The Hard disk controller is the same
     701        hdCtr = dvdCtr;
     702        ctrHdName = ctrDvdName;
     703    }
    679704
    680705    // Turn on PAE, if recommended
     
    727752            if (!field("hardDiskId").toString().isNull())
    728753            {
    729                 m.AttachDevice(ctrName, 0, 0, KDeviceType_HardDisk, field("hardDiskId").toString());
     754                m.AttachDevice(ctrHdName, 0, 0, KDeviceType_HardDisk, field("hardDiskId").toString());
    730755                if (!m.isOk())
    731756                    vboxProblem().cannotAttachDevice(this, m, VBoxDefs::MediumType_HardDisk,
    732                                                      field("hardDiskLocation").toString(), ideBus, 0, 0);
     757                                                     field("hardDiskLocation").toString(), ctrHdBus, 0, 0);
    733758            }
    734759
    735760            /* Attach empty CD/DVD ROM Device */
    736             m.AttachDevice(ctrName, 1, 0, KDeviceType_DVD, QString(""));
     761            m.AttachDevice(ctrDvdName, 1, 0, KDeviceType_DVD, QString(""));
    737762            if (!m.isOk())
    738                 vboxProblem().cannotAttachDevice(this, m, VBoxDefs::MediumType_DVD, QString(), ideBus, 1, 0);
     763                vboxProblem().cannotAttachDevice(this, m, VBoxDefs::MediumType_DVD, QString(), ctrDvdBus, 1, 0);
    739764
    740765            if (m.isOk())
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