Changeset 99604 in vbox
- Timestamp:
- May 4, 2023 1:53:06 PM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 157124
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
r99523 r99604 757 757 RTPrintf(Appliance::tr("%2u: Guest memory specified with --memory: %RU32 MB\n"), 758 758 a, ulMemMB); 759 760 /* IVirtualSystemDescription guest memory size is in bytes. 761 It's alway stored in bytes in VSD according to the old internal agreement within the team */ 762 uint64_t ullMemBytes = (uint64_t)ulMemMB * _1M; 763 strOverride = Utf8StrFmt("%RU64", ullMemBytes); 759 764 bstrFinalValue = strOverride; 760 765 } … … 765 770 { 766 771 strOverride = aVBoxValues[a]; 767 uint64_t ullMemMB = strOverride.toUInt64() ;772 uint64_t ullMemMB = strOverride.toUInt64() / _1M; 768 773 RTPrintf(Appliance::tr("%2u: Guest memory: %RU64 MB\n (change with \"--vsys %u --memory <MB>\")\n"), 769 774 a, ullMemMB, i); -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp
r99522 r99604 354 354 , m_enmVSDType(enmVSDType) 355 355 , m_strRef(strRef) 356 , m_strOrigValue( strOrigValue)357 , m_strConfigValue( strConfigValue)356 , m_strOrigValue(enmVSDType == KVirtualSystemDescriptionType_Memory ? UITranslator::byteStringToMegaByteString(strOrigValue) : strOrigValue) 357 , m_strConfigValue(enmVSDType == KVirtualSystemDescriptionType_Memory ? UITranslator::byteStringToMegaByteString(strConfigValue) : strConfigValue) 358 358 , m_strConfigDefaultValue(strConfigValue) 359 , m_strExtraConfigValue( strExtraConfigValue)359 , m_strExtraConfigValue(enmVSDType == KVirtualSystemDescriptionType_Memory ? UITranslator::byteStringToMegaByteString(strExtraConfigValue) : strExtraConfigValue) 360 360 , m_checkState(Qt::Checked) 361 361 , m_fModified(false) … … 1303 1303 { 1304 1304 finalStates[m_iNumber] = m_checkState == Qt::Checked; 1305 finalValues[m_iNumber] = m_strConfigValue; 1306 finalExtraValues[m_iNumber] = m_strExtraConfigValue; 1305 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 1306 finalValues[m_iNumber] = m_enmVSDType == KVirtualSystemDescriptionType_Memory ? UITranslator::megabyteStringToByteString(m_strConfigValue) : m_strConfigValue; 1307 finalExtraValues[m_iNumber] = m_enmVSDType == KVirtualSystemDescriptionType_Memory ? UITranslator::megabyteStringToByteString(m_strExtraConfigValue) : m_strExtraConfigValue; 1307 1308 1308 1309 UIApplianceModelItem::putBack(finalStates, finalValues, finalExtraValues); -
trunk/src/VBox/Main/include/ovfreader.h
r99523 r99604 635 635 HardwareItemVector vecHardwareItems; //< vector containing all virtual hardware items in parsing order. 636 636 637 uint64_t ullMemorySize; // always in Megabytes, copied from llHardwareItems; default = 0 (unspecified)637 uint64_t ullMemorySize; // always in bytes, 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
r99523 r99604 187 187 strCpuCount); 188 188 189 /* Memory */190 Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB );189 /* Memory, it's alway stored in bytes in VSD according to the old internal agreement within the team */ 190 Utf8Str strMemory = Utf8StrFmt("%RI64", (uint64_t)ulMemSizeMB * _1M); 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); 1619 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 1620 lVirtualQuantity = (int32_t)(uTemp / _1M); 1620 1621 strAllocationUnits = "MegaBytes"; 1621 1622 strCaption = Utf8StrFmt("%d MB of memory", lVirtualQuantity); // without this ovftool -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r99523 r99604 342 342 if ( vsysThis.pelmVBoxMachine 343 343 && pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB) 344 ullMemSizeVBox = (uint64_t)pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB ;344 ullMemSizeVBox = (uint64_t)pNewDesc->m->pConfig->hardwareMachine.ulMemorySizeMB * _1M; 345 345 else 346 ullMemSizeVBox = vsysThis.ullMemorySize; /* already in Megabytes via OVFReader::HandleVirtualSystemContent() */ 346 /* already in bytes via OVFReader::HandleVirtualSystemContent() */ 347 ullMemSizeVBox = vsysThis.ullMemorySize; 347 348 /* Check for the constraints */ 348 349 if ( ullMemSizeVBox != 0 349 && ( ullMemSizeVBox < MM_RAM_MIN _IN_MB350 || ullMemSizeVBox > MM_RAM_MAX _IN_MB350 && ( ullMemSizeVBox < MM_RAM_MIN 351 || ullMemSizeVBox > MM_RAM_MAX 351 352 ) 352 353 ) … … 355 356 "however VirtualBox supports a minimum of %u MB and a maximum of %u MB " 356 357 "of memory."), 357 vsysThis.strName.c_str(), ullMemSizeVBox , MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB);358 vsysThis.strName.c_str(), ullMemSizeVBox / _1M, MM_RAM_MIN_IN_MB, MM_RAM_MAX_IN_MB); 358 359 ullMemSizeVBox = RT_MIN(RT_MAX(ullMemSizeVBox, MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB); 359 360 } … … 369 370 else 370 371 memSizeVBox2 = 1024; 371 /* IGuestOSType::recommendedRAM() returns the size in MB */ 372 ullMemSizeVBox = (uint64_t)memSizeVBox2; 373 } 372 /* IGuestOSType::recommendedRAM() returns the size in MB so convert to bytes */ 373 ullMemSizeVBox = (uint64_t)memSizeVBox2 * _1M; 374 } 375 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 374 376 pNewDesc->i_addEntry(VirtualSystemDescriptionType_Memory, 375 377 "", … … 1532 1534 1533 1535 // RAM 1536 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 1534 1537 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory); 1535 1538 if (aVBoxValues.size() == 0)//1024MB by default, 1,073,741,824 in bytes 1536 1539 vsd->AddDescription(VirtualSystemDescriptionType_Memory, 1537 Bstr("10 24").raw(),1540 Bstr("1073741824").raw(), 1538 1541 NULL); 1539 1542 … … 1797 1800 } 1798 1801 1799 ULONG memory = 1024;//1024MB by default, 1,073,741,824 in bytes 1800 pGuestOSType->COMGETTER(RecommendedRAM)(&memory); 1802 ULONG memory; 1803 pGuestOSType->COMGETTER(RecommendedRAM)(&memory);//returned in MB 1804 memory *= _1M;//convert to bytes 1801 1805 { 1802 / /note! Memory must be stored in Megabytes on the earlier stages for the correct comparison here1806 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 1803 1807 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory); //aVBoxValues is set in this #define 1804 1808 if (aVBoxValues.size() != 0) 1805 1809 { 1806 1810 vsdData = aVBoxValues[0]; 1807 memory = RT_MIN(RT_MAX(vsdData.toUInt 32(), MM_RAM_MIN_IN_MB), MM_RAM_MAX_IN_MB);1811 memory = RT_MIN(RT_MAX(vsdData.toUInt64(), MM_RAM_MIN), MM_RAM_MAX); 1808 1812 1809 1813 } 1810 //and set in ovf::VirtualSystem in Megabytes1814 //and set in ovf::VirtualSystem in bytes 1811 1815 vsys.ullMemorySize = memory; 1812 LogRel(("%s: Size of RAM is %d MB\n", __FUNCTION__, vsys.ullMemorySize ));1816 LogRel(("%s: Size of RAM is %d MB\n", __FUNCTION__, vsys.ullMemorySize / _1M)); 1813 1817 } 1814 1818 … … 6116 6120 if (vsdeRAM.size() != 1) 6117 6121 throw setError(VBOX_E_FILE_ERROR, tr("RAM size missing")); 6118 / /Returned value must be in MB6119 uint64_t ullMemorySizeMB = vsdeRAM.front()->strVBoxCurrent.toUInt64() ;6122 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 6123 uint64_t ullMemorySizeMB = vsdeRAM.front()->strVBoxCurrent.toUInt64() / _1M; 6120 6124 stack.ulMemorySizeMB = (uint32_t)ullMemorySizeMB; 6121 6125 -
trunk/src/VBox/Main/xml/ovfreader.cpp
r99523 r99604 521 521 522 522 case ResourceType_Memory: // 4 523 /* It's alway stored in bytes in VSD according to the old internal agreement within the team */ 523 524 if ( i.strAllocationUnits == "MegaBytes" // found in OVF created by OVF toolkit 524 525 || i.strAllocationUnits == "MB" // found in MS docs 525 526 || i.strAllocationUnits == "byte * 2^20" // suggested by OVF spec DSP0243 page 21 526 527 ) 527 vsys.ullMemorySize = i.ullVirtualQuantity ;528 vsys.ullMemorySize = i.ullVirtualQuantity * _1M; 528 529 else if ( i.strAllocationUnits == "GigaBytes" 529 530 || i.strAllocationUnits == "GB" 530 531 || i.strAllocationUnits == "byte * 2^30" 531 532 ) 532 vsys.ullMemorySize = i.ullVirtualQuantity /_1K;//back to MB533 vsys.ullMemorySize = i.ullVirtualQuantity * _1G; 533 534 else 534 535 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.