VirtualBox

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


Ignore:
Timestamp:
Sep 19, 2023 12:55:37 PM (17 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159141
Message:

Main: Fixed reading the CPU properties (like CPU count). bugref:10384

File:
1 edited

Legend:

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

    r101154 r101168  
    53025302 *
    53035303 * @param elmPlatformOrHardware     Platform or Hardware node to read from.
     5304 * @param hw                        Where to store the hardware settings.
    53045305 * @param plat                      Where to store the platform settings.
    53055306 */
    53065307void MachineConfigFile::readPlatform(const xml::ElementNode &elmPlatformOrHardware,
    5307                                      Platform &plat)
     5308                                     Hardware &hw, Platform &plat)
    53085309{
    53095310    /*
     
    53145315    while ((pelmChild = nl1.forAllNodes()))
    53155316    {
    5316         if (pelmChild->nameEquals("Chipset"))
     5317        if (pelmChild->nameEquals("CPU"))
     5318        {
     5319            if (!pelmChild->getAttributeValue("count", hw.cCPUs))
     5320            {
     5321                // pre-1.5 variant; not sure if this actually exists in the wild anywhere
     5322                const xml::ElementNode *pelmCPUChild;
     5323                if ((pelmCPUChild = pelmChild->findChildElement("CPUCount")))
     5324                    pelmCPUChild->getAttributeValue("count", hw.cCPUs);
     5325            }
     5326
     5327            pelmChild->getAttributeValue("hotplug", hw.fCpuHotPlug);
     5328            pelmChild->getAttributeValue("executionCap", hw.ulCpuExecutionCap);
     5329
     5330            const xml::ElementNode *pelmCPUChild;
     5331            if (hw.fCpuHotPlug)
     5332            {
     5333                if ((pelmCPUChild = pelmChild->findChildElement("CpuTree")))
     5334                    readCpuTree(*pelmCPUChild, hw.llCpus);
     5335            }
     5336
     5337            if ((pelmCPUChild = pelmChild->findChildElement("SyntheticCpu")))
     5338            {
     5339                bool fSyntheticCpu = false;
     5340                pelmCPUChild->getAttributeValue("enabled", fSyntheticCpu);
     5341                hw.uCpuIdPortabilityLevel = fSyntheticCpu ? 1 : 0;
     5342            }
     5343            pelmChild->getAttributeValue("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
     5344            pelmChild->getAttributeValue("CpuProfile", hw.strCpuProfile);
     5345        }
     5346        else if (pelmChild->nameEquals("Chipset"))
    53175347        {
    53185348            Utf8Str strChipsetType;
     
    54675497    while ((pelmHwChild = nl1.forAllNodes()))
    54685498    {
    5469         if (pelmHwChild->nameEquals("CPU"))
    5470         {
    5471             if (!pelmHwChild->getAttributeValue("count", hw.cCPUs))
    5472             {
    5473                 // pre-1.5 variant; not sure if this actually exists in the wild anywhere
    5474                 const xml::ElementNode *pelmCPUChild;
    5475                 if ((pelmCPUChild = pelmHwChild->findChildElement("CPUCount")))
    5476                     pelmCPUChild->getAttributeValue("count", hw.cCPUs);
    5477             }
    5478 
    5479             pelmHwChild->getAttributeValue("hotplug", hw.fCpuHotPlug);
    5480             pelmHwChild->getAttributeValue("executionCap", hw.ulCpuExecutionCap);
    5481 
    5482             const xml::ElementNode *pelmCPUChild;
    5483             if (hw.fCpuHotPlug)
    5484             {
    5485                 if ((pelmCPUChild = pelmHwChild->findChildElement("CpuTree")))
    5486                     readCpuTree(*pelmCPUChild, hw.llCpus);
    5487             }
    5488 
    5489             if ((pelmCPUChild = pelmHwChild->findChildElement("SyntheticCpu")))
    5490             {
    5491                 bool fSyntheticCpu = false;
    5492                 pelmCPUChild->getAttributeValue("enabled", fSyntheticCpu);
    5493                 hw.uCpuIdPortabilityLevel = fSyntheticCpu ? 1 : 0;
    5494             }
    5495             pelmHwChild->getAttributeValue("CpuIdPortabilityLevel", hw.uCpuIdPortabilityLevel);
    5496             pelmHwChild->getAttributeValue("CpuProfile", hw.strCpuProfile);
    5497         }
    5498         else if (pelmHwChild->nameEquals("Memory"))
     5499        if (pelmHwChild->nameEquals("Memory"))
    54995500        {
    55005501            pelmHwChild->getAttributeValue("RAMSize", hw.ulMemorySizeMB);
     
    61146115     * For newer settings (>= v1.20) we read the platform settings outside readHardware(). */
    61156116    if (m->sv < SettingsVersion_v1_20)
    6116         readPlatform(elmHardware, hw.platformSettings);
     6117        readPlatform(elmHardware, hw, hw.platformSettings);
    61176118
    61186119    if (hw.ulMemorySizeMB == (uint32_t)-1)
     
    67416742            if (!(pelmPlatform = pElement->findChildElement("Platform")))
    67426743                throw ConfigFileError(this, pElement, N_("Required Snapshot/@Platform element is missing"));
    6743             readPlatform(*pelmPlatform, pSnap->hardware.platformSettings);
     6744            readPlatform(*pelmPlatform, pSnap->hardware, pSnap->hardware.platformSettings);
    67446745        }
    67456746
     
    69446945            if (!(pelmPlatform = elmMachine.findChildElement("Platform")))
    69456946                throw ConfigFileError(this, &elmMachine, N_("Required Machine/@Platform element is missing"));
    6946             readPlatform(*pelmPlatform, hardwareMachine.platformSettings);
     6947            readPlatform(*pelmPlatform, hardwareMachine, hardwareMachine.platformSettings);
    69476948        }
    69486949
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