VirtualBox

Changeset 101126 in vbox


Ignore:
Timestamp:
Sep 15, 2023 2:08:59 PM (19 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159099
Message:

FE/VBoxManage: Improved "show systemproperties": Removed the hardcoded limitation of only showing PIIX3 / ICH9 chipset information, added support for dynamically showing supported platforms + their supported chipsets. Grouping of output for better readability. Needs a bit more polishing wrt uniform output (see @todo) though. bugref:10384

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r101035 r101126  
    720720}
    721721
    722 
    723 /**
    724  * List system properties.
     722/**
     723 * Returns the chipset type as a string.
     724 *
     725 * @return Chipset type as a string.
     726 * @param  enmType               Chipset type to convert.
     727 */
     728static const char *chipsetTypeToStr(ChipsetType_T enmType)
     729{
     730    switch (enmType)
     731    {
     732        case ChipsetType_PIIX3:        return "PIIX3";
     733        case ChipsetType_ICH9:         return "ICH9";
     734        case ChipsetType_ARMv8Virtual: return "ARMv8Virtual";
     735        case ChipsetType_Null:
     736        default:
     737            break;
     738    }
     739
     740    return "<Unknown>";
     741}
     742
     743/**
     744 * Returns a platform architecture as a string.
     745 *
     746 * @return Platform architecture as a string.
     747 * @param  enmArch               Platform architecture to convert.
     748 */
     749static const char *platformArchitectureToStr(PlatformArchitecture_T enmArch)
     750{
     751    switch (enmArch)
     752    {
     753        case PlatformArchitecture_x86: return "x86";
     754        case PlatformArchitecture_ARM: return "ARMv8";
     755        default:
     756            break;
     757    }
     758
     759    return "<Unknown>";
     760}
     761
     762/** @todo r=andy Make use of SHOW_ULONG_PROP and friends like in VBoxManageInfo to have a more uniform / prettier output.
     763 *               Use nesting (as padding / tabs). */
     764
     765/**
     766 * List chipset properties.
    725767 *
    726768 * @returns See produceList.
    727769 * @param   pVirtualBox         Reference to the IVirtualBox smart pointer.
    728770 */
     771static HRESULT listPlatformChipsetProperties(const ComPtr<IPlatformProperties> &pPlatformProperties, ChipsetType_T enmChipsetType)
     772{
     773    const char *pszChipset = chipsetTypeToStr(enmChipsetType);
     774    AssertPtrReturn(pszChipset, E_INVALIDARG);
     775
     776    /* Note: Keep the chipset name within the description -- makes it easier to grep for specific chipsts manually. */
     777    ULONG ulValue;
     778    pPlatformProperties->GetMaxNetworkAdapters(enmChipsetType, &ulValue);
     779    RTPrintf(List::tr("Maximum %s Network Adapter count:   %u\n"), pszChipset, ulValue);
     780    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_IDE, &ulValue);
     781    RTPrintf(List::tr("Maximum %s IDE Controllers:   %u\n"), pszChipset, ulValue);
     782    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SATA, &ulValue);
     783    RTPrintf(List::tr("Maximum %s SATA Controllers:  %u\n"), pszChipset, ulValue);
     784    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SCSI, &ulValue);
     785    RTPrintf(List::tr("Maximum %s SCSI Controllers:  %u\n"), pszChipset, ulValue);
     786    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_SAS, &ulValue);
     787    RTPrintf(List::tr("Maximum %s SAS Controllers:   %u\n"), pszChipset, ulValue);
     788    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_PCIe, &ulValue);
     789    RTPrintf(List::tr("Maximum %s NVMe Controllers:  %u\n"), pszChipset, ulValue);
     790    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_VirtioSCSI, &ulValue);
     791    RTPrintf(List::tr("Maximum %s virtio-scsi Controllers:  %u\n"), pszChipset, ulValue);
     792    pPlatformProperties->GetMaxInstancesOfStorageBus(enmChipsetType, StorageBus_Floppy, &ulValue);
     793    RTPrintf(List::tr("Maximum %s Floppy Controllers:%u\n"), pszChipset, ulValue);
     794
     795    return S_OK;
     796}
     797
     798static HRESULT listPlatformProperties(const ComPtr<IPlatformProperties> &platformProperties)
     799{
     800    ULONG ulValue;
     801    platformProperties->COMGETTER(SerialPortCount)(&ulValue);
     802    RTPrintf(List::tr("Maximum Serial Port count:              %u\n"), ulValue);
     803    platformProperties->COMGETTER(ParallelPortCount)(&ulValue);
     804    RTPrintf(List::tr("Maximum Parallel Port count:            %u\n"), ulValue);
     805    platformProperties->COMGETTER(MaxBootPosition)(&ulValue);
     806    RTPrintf(List::tr("Maximum Boot Position:                  %u\n"), ulValue);
     807    platformProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
     808    RTPrintf(List::tr("Maximum Floppy Port count:              %u\n"), ulValue);
     809    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
     810    RTPrintf(List::tr("Maximum Floppy Devices per Port:        %u\n"), ulValue);
     811    platformProperties->GetMaxPortCountForStorageBus(StorageBus_VirtioSCSI, &ulValue);
     812    RTPrintf(List::tr("Maximum virtio-scsi Port count:         %u\n"), ulValue);
     813    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_VirtioSCSI, &ulValue);
     814    RTPrintf(List::tr("Maximum virtio-scsi Devices per Port:   %u\n"), ulValue);
     815    platformProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
     816    RTPrintf(List::tr("Maximum IDE Port count:                 %u\n"), ulValue);
     817    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
     818    RTPrintf(List::tr("Maximum IDE Devices per port:           %u\n"), ulValue);
     819    platformProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
     820    RTPrintf(List::tr("Maximum SATA Port count:                %u\n"), ulValue);
     821    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
     822    RTPrintf(List::tr("Maximum SATA Device per port:          %u\n"), ulValue);
     823    platformProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
     824    RTPrintf(List::tr("Maximum SCSI Port count:                %u\n"), ulValue);
     825    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
     826    RTPrintf(List::tr("Maximum SCSI Devices per port:          %u\n"), ulValue);
     827    platformProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
     828    RTPrintf(List::tr("Maximum SAS Port count:                 %u\n"), ulValue);
     829    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
     830    RTPrintf(List::tr("Maximum SAS Devices per Port:           %u\n"), ulValue);
     831    platformProperties->GetMaxPortCountForStorageBus(StorageBus_PCIe, &ulValue);
     832    RTPrintf(List::tr("Maximum NVMe Port count:                %u\n"), ulValue);
     833    platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_PCIe, &ulValue);
     834    RTPrintf(List::tr("Maximum NVMe Devices per Port:          %u\n"), ulValue);
     835
     836    SafeArray <ChipsetType_T> saChipset;
     837    platformProperties->COMGETTER(SupportedChipsetTypes(ComSafeArrayAsOutParam(saChipset)));
     838
     839    RTPrintf(List::tr("Supported chipsets:                     "));
     840    for (size_t i = 0; i < saChipset.size(); i++)
     841    {
     842        if (i > 0)
     843            RTPrintf(", ");
     844        RTPrintf("%s", chipsetTypeToStr(saChipset[i]));
     845    }
     846    RTPrintf("\n");
     847
     848    for (size_t i = 0; i < saChipset.size(); i++)
     849    {
     850        if (i > 0)
     851            RTPrintf("\n");
     852        RTPrintf(List::tr("%s chipset properties:\n"), chipsetTypeToStr(saChipset[i]));
     853        listPlatformChipsetProperties(platformProperties, saChipset[i]);
     854    }
     855
     856    return S_OK;
     857}
     858
     859/**
     860 * List system properties.
     861 *
     862 * @returns See produceList.
     863 * @param   pVirtualBox         Reference to the IVirtualBox smart pointer.
     864 */
    729865static HRESULT listSystemProperties(const ComPtr<IVirtualBox> &pVirtualBox)
    730866{
     
    732868    CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(SystemProperties)(systemProperties.asOutParam()), hrcCheck);
    733869
    734     ComPtr<IPlatformProperties> platformProperties;
    735     CHECK_ERROR2I_RET(systemProperties, COMGETTER(Platform)(platformProperties.asOutParam()), hrcCheck);
     870    ComPtr<IPlatformProperties> hostPlatformProperties;
     871    CHECK_ERROR2I_RET(systemProperties, COMGETTER(Platform)(hostPlatformProperties.asOutParam()), hrcCheck);
    736872
    737873    Bstr str;
     
    760896    systemProperties->COMGETTER(InfoVDSize)(&i64Value);
    761897    RTPrintf(List::tr("Virtual disk limit (info):       %lld Bytes\n", "" , i64Value), i64Value);
    762     platformProperties->COMGETTER(SerialPortCount)(&ulValue);
    763     RTPrintf(List::tr("Maximum Serial Port count:       %u\n"), ulValue);
    764     platformProperties->COMGETTER(ParallelPortCount)(&ulValue);
    765     RTPrintf(List::tr("Maximum Parallel Port count:     %u\n"), ulValue);
    766     platformProperties->COMGETTER(MaxBootPosition)(&ulValue);
    767     RTPrintf(List::tr("Maximum Boot Position:           %u\n"), ulValue);
    768     platformProperties->GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulValue);
    769     RTPrintf(List::tr("Maximum PIIX3 Network Adapter count:   %u\n"), ulValue);
    770     platformProperties->GetMaxNetworkAdapters(ChipsetType_ICH9,  &ulValue);
    771     RTPrintf(List::tr("Maximum ICH9 Network Adapter count:   %u\n"), ulValue);
    772     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue);
    773     RTPrintf(List::tr("Maximum PIIX3 IDE Controllers:   %u\n"), ulValue);
    774     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_IDE, &ulValue);
    775     RTPrintf(List::tr("Maximum ICH9 IDE Controllers:    %u\n"), ulValue);
    776     platformProperties->GetMaxPortCountForStorageBus(StorageBus_IDE, &ulValue);
    777     RTPrintf(List::tr("Maximum IDE Port count:          %u\n"), ulValue);
    778     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_IDE, &ulValue);
    779     RTPrintf(List::tr("Maximum Devices per IDE Port:    %u\n"), ulValue);
    780     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SATA, &ulValue);
    781     RTPrintf(List::tr("Maximum PIIX3 SATA Controllers:  %u\n"), ulValue);
    782     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SATA, &ulValue);
    783     RTPrintf(List::tr("Maximum ICH9 SATA Controllers:   %u\n"), ulValue);
    784     platformProperties->GetMaxPortCountForStorageBus(StorageBus_SATA, &ulValue);
    785     RTPrintf(List::tr("Maximum SATA Port count:         %u\n"), ulValue);
    786     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SATA, &ulValue);
    787     RTPrintf(List::tr("Maximum Devices per SATA Port:   %u\n"), ulValue);
    788     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SCSI, &ulValue);
    789     RTPrintf(List::tr("Maximum PIIX3 SCSI Controllers:  %u\n"), ulValue);
    790     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SCSI, &ulValue);
    791     RTPrintf(List::tr("Maximum ICH9 SCSI Controllers:   %u\n"), ulValue);
    792     platformProperties->GetMaxPortCountForStorageBus(StorageBus_SCSI, &ulValue);
    793     RTPrintf(List::tr("Maximum SCSI Port count:         %u\n"), ulValue);
    794     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SCSI, &ulValue);
    795     RTPrintf(List::tr("Maximum Devices per SCSI Port:   %u\n"), ulValue);
    796     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_SAS, &ulValue);
    797     RTPrintf(List::tr("Maximum SAS PIIX3 Controllers:   %u\n"), ulValue);
    798     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_SAS, &ulValue);
    799     RTPrintf(List::tr("Maximum SAS ICH9 Controllers:    %u\n"), ulValue);
    800     platformProperties->GetMaxPortCountForStorageBus(StorageBus_SAS, &ulValue);
    801     RTPrintf(List::tr("Maximum SAS Port count:          %u\n"), ulValue);
    802     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_SAS, &ulValue);
    803     RTPrintf(List::tr("Maximum Devices per SAS Port:    %u\n"), ulValue);
    804     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_PCIe, &ulValue);
    805     RTPrintf(List::tr("Maximum NVMe PIIX3 Controllers:  %u\n"), ulValue);
    806     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_PCIe, &ulValue);
    807     RTPrintf(List::tr("Maximum NVMe ICH9 Controllers:   %u\n"), ulValue);
    808     platformProperties->GetMaxPortCountForStorageBus(StorageBus_PCIe, &ulValue);
    809     RTPrintf(List::tr("Maximum NVMe Port count:         %u\n"), ulValue);
    810     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_PCIe, &ulValue);
    811     RTPrintf(List::tr("Maximum Devices per NVMe Port:   %u\n"), ulValue);
    812     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_VirtioSCSI, &ulValue);
    813     RTPrintf(List::tr("Maximum virtio-scsi PIIX3 Controllers:  %u\n"), ulValue);
    814     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_VirtioSCSI, &ulValue);
    815     RTPrintf(List::tr("Maximum virtio-scsi ICH9 Controllers:   %u\n"), ulValue);
    816     platformProperties->GetMaxPortCountForStorageBus(StorageBus_VirtioSCSI, &ulValue);
    817     RTPrintf(List::tr("Maximum virtio-scsi Port count:         %u\n"), ulValue);
    818     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_VirtioSCSI, &ulValue);
    819     RTPrintf(List::tr("Maximum Devices per virtio-scsi Port:   %u\n"), ulValue);
    820     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_Floppy, &ulValue);
    821     RTPrintf(List::tr("Maximum PIIX3 Floppy Controllers:%u\n"), ulValue);
    822     platformProperties->GetMaxInstancesOfStorageBus(ChipsetType_ICH9, StorageBus_Floppy, &ulValue);
    823     RTPrintf(List::tr("Maximum ICH9 Floppy Controllers: %u\n"), ulValue);
    824     platformProperties->GetMaxPortCountForStorageBus(StorageBus_Floppy, &ulValue);
    825     RTPrintf(List::tr("Maximum Floppy Port count:       %u\n"), ulValue);
    826     platformProperties->GetMaxDevicesPerPortForStorageBus(StorageBus_Floppy, &ulValue);
    827     RTPrintf(List::tr("Maximum Devices per Floppy Port: %u\n"), ulValue);
     898
    828899#if 0
    829900    systemProperties->GetFreeDiskSpaceWarning(&i64Value);
     
    838909    systemProperties->COMGETTER(DefaultMachineFolder)(str.asOutParam());
    839910    RTPrintf(List::tr("Default machine folder:          %ls\n"), str.raw());
    840     platformProperties->COMGETTER(RawModeSupported)(&fValue);
     911    hostPlatformProperties->COMGETTER(RawModeSupported)(&fValue);
    841912    RTPrintf(List::tr("Raw-mode Supported:              %s\n"), fValue ? List::tr("yes") : List::tr("no"));
    842     platformProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
     913    hostPlatformProperties->COMGETTER(ExclusiveHwVirt)(&fValue);
    843914    RTPrintf(List::tr("Exclusive HW virtualization use: %s\n"), fValue ? List::tr("on") : List::tr("off"));
    844915    systemProperties->COMGETTER(DefaultHardDiskFormat)(str.asOutParam());
     
    899970    RTPrintf(List::tr("User language:                   %ls\n"), str.raw());
    900971#endif
     972
     973    RTPrintf("Host platform properties:\n");
     974    listPlatformProperties(hostPlatformProperties);
     975
     976    /* Separate host system / platform properties stuff from guest platform properties a bit. */
     977    RTPrintf("\n");
     978
     979    SafeArray <PlatformArchitecture_T> saPlatformArch;
     980    systemProperties->COMGETTER(SupportedPlatformArchitectures(ComSafeArrayAsOutParam(saPlatformArch)));
     981    RTPrintf("Supported platform architectures: ");
     982    for (size_t i = 0; i < saPlatformArch.size(); ++i)
     983    {
     984        if (i > 0)
     985            RTPrintf(",");
     986        RTPrintf(platformArchitectureToStr(saPlatformArch[i]));
     987    }
     988    RTPrintf("\n\n");
     989
     990    for (size_t i = 0; i < saPlatformArch.size(); ++i)
     991    {
     992        if (i > 0)
     993            RTPrintf("\n");
     994        ComPtr<IPlatformProperties> platformProperties;
     995        CHECK_ERROR2I_RET(pVirtualBox, COMGETTER(PlatformProperties)(saPlatformArch[i], platformProperties.asOutParam()), hrcCheck);
     996        RTPrintf(List::tr("%s platform properties:\n"), platformArchitectureToStr(saPlatformArch[i]));
     997        listPlatformProperties(platformProperties);
     998    }
     999
    9011000    return S_OK;
    9021001}
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