Changeset 99523 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 24, 2023 2:44:16 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 157024
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ovfreader.h
r98103 r99523 635 635 HardwareItemVector vecHardwareItems; //< vector containing all virtual hardware items in parsing order. 636 636 637 uint64_t ullMemorySize; // always in bytes, copied from llHardwareItems; default = 0 (unspecified)637 uint64_t ullMemorySize; // always in Megabytes, copied from llHardwareItems; default = 0 (unspecified) 638 638 uint16_t cCPUs; // no. of CPUs, copied from llHardwareItems; default = 1 639 639 -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r98322 r99523 188 188 189 189 /* Memory */ 190 Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB * _1M);190 Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB); 191 191 pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory, 192 192 "", … … 1617 1617 type = ovf::ResourceType_Memory; // 4 1618 1618 desc.strVBoxCurrent.toInt(uTemp); 1619 lVirtualQuantity = (int32_t)(uTemp / _1M);1619 lVirtualQuantity = (int32_t)(uTemp); 1620 1620 strAllocationUnits = "MegaBytes"; 1621 1621 strCaption = Utf8StrFmt("%d MB of memory", lVirtualQuantity); // without this ovftool … … 1815 1815 tr("Missing or bad extra config string in hard disk image: \"%s\""), 1816 1816 desc.strExtraConfigCurrent.c_str()); 1817 1818 1817 stack.mapDisks[strDiskID] = &desc; 1819 1818 -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r98782 r99523 342 342 if ( vsysThis.pelmVBoxMachine 343 343 && pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB) 344 ullMemSizeVBox = (uint64_t)pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB * _1M;344 ullMemSizeVBox = (uint64_t)pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB; 345 345 else 346 ullMemSizeVBox = vsysThis.ullMemorySize; /* already in bytes via OVFReader::HandleVirtualSystemContent() */346 ullMemSizeVBox = vsysThis.ullMemorySize; /* already in Megabytes via OVFReader::HandleVirtualSystemContent() */ 347 347 /* Check for the constraints */ 348 348 if ( ullMemSizeVBox != 0 349 && ( ullMemSizeVBox < MM_RAM_MIN 350 || ullMemSizeVBox > MM_RAM_MAX 349 && ( ullMemSizeVBox < MM_RAM_MIN_IN_MB 350 || ullMemSizeVBox > MM_RAM_MAX_IN_MB 351 351 ) 352 352 ) … … 355 355 "however VirtualBox supports a minimum of %u MB and a maximum of %u MB " 356 356 "of memory."), 357 vsysThis.strName.c_str(), ullMemSizeVBox / _1M, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);358 ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, MM_RAM_MIN ), MM_RAM_MAX);357 vsysThis.strName.c_str(), ullMemSizeVBox, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB); 358 ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB); 359 359 } 360 360 if (vsysThis.ullMemorySize == 0) … … 369 369 else 370 370 memSizeVBox2 = 1024; 371 /* IGuestOSType::recommendedRAM() returns the size in MB so convert to bytes*/372 ullMemSizeVBox = (uint64_t)memSizeVBox2 * _1M;371 /* IGuestOSType::recommendedRAM() returns the size in MB */ 372 ullMemSizeVBox = (uint64_t)memSizeVBox2; 373 373 } 374 374 pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory, … … 1533 1533 // RAM 1534 1534 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory); 1535 if (aVBoxValues.size() == 0)//10 00MB by default1535 if (aVBoxValues.size() == 0)//1024MB by default, 1,073,741,824 in bytes 1536 1536 vsd->AddDescription(VirtualSystemDescriptionType_Memory, 1537 Bstr("10 00").raw(),1537 Bstr("1024").raw(), 1538 1538 NULL); 1539 1539 … … 1797 1797 } 1798 1798 1799 ULONG memory ;//Mb1799 ULONG memory = 1024;//1024MB by default, 1,073,741,824 in bytes 1800 1800 pGuestOSType->COMGETTER(RecommendedRAM)(&memory); 1801 1801 { 1802 //note! Memory must be stored in Megabytes on the earlier stages for the correct comparison here 1802 1803 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory); //aVBoxValues is set in this #define 1803 1804 if (aVBoxValues.size() != 0) 1804 1805 { 1805 1806 vsdData = aVBoxValues[0]; 1806 if (memory > vsdData.toUInt32())1807 memory = vsdData.toUInt32(); 1807 memory = RT_MIN(RT_MAX(vsdData.toUInt32(), MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB); 1808 1808 1809 } 1810 //and set in ovf::VirtualSystem in Megabytes 1809 1811 vsys.ullMemorySize = memory; 1810 1812 LogRel(("%s: Size of RAM is %d MB\n", __FUNCTION__, vsys.ullMemorySize)); … … 6114 6116 if (vsdeRAM.size() != 1) 6115 6117 throw setError(VBOX_E_FILE_ERROR, tr("RAM size missing")); 6116 uint64_t ullMemorySizeMB = vsdeRAM.front()->strVBoxCurrent.toUInt64() / _1M; 6118 //Returned value must be in MB 6119 uint64_t ullMemorySizeMB = vsdeRAM.front()->strVBoxCurrent.toUInt64(); 6117 6120 stack.ulMemorySizeMB = (uint32_t)ullMemorySizeMB; 6118 6121 -
trunk/src/VBox/Main/xml/ovfreader.cpp
r98103 r99523 525 525 || i.strAllocationUnits == "byte * 2^20" // suggested by OVF spec DSP0243 page 21 526 526 ) 527 vsys.ullMemorySize = i.ullVirtualQuantity * _1M; 527 vsys.ullMemorySize = i.ullVirtualQuantity; 528 else if ( i.strAllocationUnits == "GigaBytes" 529 || i.strAllocationUnits == "GB" 530 || i.strAllocationUnits == "byte * 2^30" 531 ) 532 vsys.ullMemorySize = i.ullVirtualQuantity/_1K;//back to MB 528 533 else 529 534 throw OVFLogicError(N_("Error reading \"%s\": Invalid allocation unit \"%s\" specified with memory size item, line %d"),
Note:
See TracChangeset
for help on using the changeset viewer.