VirtualBox

Changeset 25901 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Jan 18, 2010 4:52:21 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56716
Message:

CPU hotplug: Merge 4th patch. Implements the Main API and a VBoxManage interface to turn CPU hotplug on/off and to add/remove CPUs while the VM is running

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r25892 r25901  
    3030 *   3) In the settings writer method, write the setting _only_ if the current settings
    3131 *      version (stored in m->sv) is high enough. That is, for VirtualBox 3.2, write it
    32  *      only if (m->sv >= SettingsVersion_v1_10).
     32 *      only if (m->sv >= SettingsVersion_v1_11).
    3333 *
    3434 *   4) In MachineConfigFile::bumpSettingsVersionIfNeeded(), check if the new setting has
     
    8282
    8383/** VirtualBox XML settings version number substring ("x.y")  */
    84 #define VBOX_XML_VERSION        "1.9"
     84#define VBOX_XML_VERSION        "1.11"
    8585
    8686/** VirtualBox XML settings version platform substring */
     
    282282                else if (ulMinor == 10)
    283283                    m->sv = SettingsVersion_v1_10;
    284                 else if (ulMinor > 10)
     284                else if (ulMinor == 11)
     285                    m->sv = SettingsVersion_v1_11;
     286                else if (ulMinor > 11)
    285287                    m->sv = SettingsVersion_Future;
    286288            }
     
    302304        // creating new settings file:
    303305        m->strSettingsVersionFull = VBOX_XML_VERSION_FULL;
    304         m->sv = SettingsVersion_v1_10;
     306        m->sv = SettingsVersion_v1_11;
    305307    }
    306308}
     
    556558
    557559        case SettingsVersion_v1_10:
     560            pcszVersion = "1.10";
     561            m->sv = SettingsVersion_v1_10;
     562            break;
     563
     564        case SettingsVersion_v1_11:
    558565        case SettingsVersion_Future:                // can be set if this code runs on XML files that were created by a future version of VBox;
    559566                                                    // in that case, downgrade to current version when writing since we can't write future versions...
    560             pcszVersion = "1.10";
    561             m->sv = SettingsVersion_v1_10;
     567            pcszVersion = "1.11";
     568            m->sv = SettingsVersion_v1_11;
    562569            break;
    563570
     
    12631270          fPAE(false),
    12641271          cCPUs(1),
     1272          fCpuHotPlug(false),
    12651273          ulMemorySizeMB((uint32_t)-1),
    12661274          ulVRAMSizeMB(8),
     
    12841292    fPAE = true;
    12851293#endif
     1294}
     1295
     1296/**
     1297 * Called from MachineConfigFile::readHardware() to read cpu information.
     1298 * @param elmCpuid
     1299 * @param ll
     1300 */
     1301void MachineConfigFile::readCpuTree(const xml::ElementNode &elmCpu,
     1302                                    CpuList &ll)
     1303{
     1304    xml::NodesLoop nl1(elmCpu, "Cpu");
     1305    const xml::ElementNode *pelmCpu;
     1306    while ((pelmCpu = nl1.forAllNodes()))
     1307    {
     1308        Cpu cpu;
     1309
     1310        if (!pelmCpu->getAttributeValue("id", cpu.ulId))
     1311            throw ConfigFileError(this, pelmCpu, N_("Required Cpu/@id attribute is missing"));
     1312
     1313        ll.push_back(cpu);
     1314    }
    12861315}
    12871316
     
    15601589            }
    15611590
     1591            pelmHwChild->getAttributeValue("hotplug", hw.fCpuHotPlug);
     1592
    15621593            const xml::ElementNode *pelmCPUChild;
     1594            if (hw.fCpuHotPlug)
     1595            {
     1596                if ((pelmCPUChild = pelmHwChild->findChildElement("CpuTree")))
     1597                    readCpuTree(*pelmCPUChild, hw.llCpus);
     1598            }
     1599
    15631600            if ((pelmCPUChild = pelmHwChild->findChildElement("HardwareVirtEx")))
    15641601            {
     
    24682505        pelmCPU->createChild("SyntheticCpu")->setAttribute("enabled", hw.fSyntheticCpu);
    24692506    pelmCPU->setAttribute("count", hw.cCPUs);
     2507
     2508    if (m->sv >= SettingsVersion_v1_11)
     2509    {
     2510        pelmCPU->setAttribute("hotplug", hw.fCpuHotPlug);
     2511
     2512        xml::ElementNode *pelmCpuTree = NULL;
     2513        for (CpuList::const_iterator it = hw.llCpus.begin();
     2514             it != hw.llCpus.end();
     2515             ++it)
     2516        {
     2517            const Cpu &cpu = *it;
     2518
     2519            if (pelmCpuTree == NULL)
     2520                 pelmCpuTree = pelmCPU->createChild("CpuTree");
     2521
     2522            xml::ElementNode *pelmCpu = pelmCpuTree->createChild("Cpu");
     2523            pelmCpu->setAttribute("id", cpu.ulId);
     2524        }
     2525    }
     2526
    24702527    xml::ElementNode *pelmCpuIdTree = NULL;
    24712528    for (CpuIdLeafsList::const_iterator it = hw.llCpuIdLeafs.begin();
     
    30813138       )
    30823139        m->sv = SettingsVersion_v1_10;
     3140
     3141    // Version 1.11 is required for CPU hotplugging
     3142    if (   (m->sv < SettingsVersion_v1_11)
     3143        && (hardwareMachine.fCpuHotPlug)
     3144       )
     3145        m->sv = SettingsVersion_v1_11;
    30833146}
    30843147
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette