VirtualBox

Changeset 35761 in vbox


Ignore:
Timestamp:
Jan 28, 2011 1:19:26 PM (14 years ago)
Author:
vboxsync
Message:

Main, frontends: proper description for maximal number of NICs per VM

Location:
trunk/src/VBox
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r35707 r35761  
    163163/* VBoxManageControlVM.cpp */
    164164int handleControlVM(HandlerArg *a);
     165ULONG getMaxNics(IVirtualBox* vbox, IMachine* mach);
    165166
    166167/* VBoxManageModifyVM.cpp */
     
    256257
    257258#endif /* !___H_VBOXMANAGE */
    258 
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r35707 r35761  
    6565
    6666
     67ULONG getMaxNics(IVirtualBox* vbox, IMachine* mach)
     68{
     69    ComPtr <ISystemProperties> info;
     70    ChipsetType_T aChipset;
     71    ULONG NetworkAdapterCount = 0;
     72    HRESULT rc;
     73
     74    do {
     75        CHECK_ERROR_BREAK(vbox, COMGETTER(SystemProperties)(info.asOutParam()));
     76        CHECK_ERROR_BREAK(mach, COMGETTER(ChipsetType)(&aChipset));
     77        CHECK_ERROR_BREAK(info, GetMaxNetworkAdapters(aChipset, &NetworkAdapterCount));
     78
     79        return NetworkAdapterCount;
     80    } while (0);
     81
     82    return 0;
     83}
     84
     85
    6786int handleControlVM(HandlerArg *a)
    6887{
     
    265284        {
    266285            /* Get the number of network adapters */
    267             ULONG NetworkAdapterCount = 0;
    268             ComPtr <ISystemProperties> info;
    269             CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
    270             CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
     286            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
    271287
    272288            unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC");
     
    311327        {
    312328            /* Get the number of network adapters */
    313             ULONG NetworkAdapterCount = 0;
    314             ComPtr <ISystemProperties> info;
    315             CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
    316             CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
    317 
     329            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
    318330            unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC");
    319331            if (!n)
     
    356368        {
    357369            /* Get the number of network adapters */
    358             ULONG NetworkAdapterCount = 0;
    359             ComPtr <ISystemProperties> info;
    360             CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
    361             CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
     370            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
    362371
    363372            unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC");
     
    406415        {
    407416            /* Get the number of network adapters */
    408             ULONG NetworkAdapterCount = 0;
    409             ComPtr <ISystemProperties> info;
     417            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine);
    410418            ComPtr<INATEngine> engine;
    411             CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
    412             CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
    413419            unsigned n = parseNum(&a->argv[1][5], NetworkAdapterCount, "NIC");
    414420            if (!n)
     
    503509        {
    504510            /* Get the number of network adapters */
    505             ULONG NetworkAdapterCount = 0;
    506             ComPtr <ISystemProperties> info;
    507             CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));
    508             CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));
    509 
     511            ULONG NetworkAdapterCount = getMaxNics(a->virtualBox,sessionMachine) ;
    510512            unsigned n = parseNum(&a->argv[1][3], NetworkAdapterCount, "NIC");
    511513            if (!n)
     
    10351037    return SUCCEEDED(rc) ? 0 : 1;
    10361038}
    1037 
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r35707 r35761  
    787787    }
    788788
    789     /* get the maximum amount of NICS */
    790     ComPtr<ISystemProperties> sysProps;
    791     virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
    792     ULONG maxNICs = 0;
    793     sysProps->COMGETTER(NetworkAdapterCount)(&maxNICs);
     789    /* get the maximum amount of NICS */   
     790    ULONG maxNICs = getMaxNics(virtualBox, machine);
     791   
    794792    for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++)
    795793    {
     
    11221120
    11231121    /* get the maximum amount of UARTs */
     1122    ComPtr<ISystemProperties> sysProps;
     1123    virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam());
     1124
    11241125    ULONG maxUARTs = 0;
    11251126    sysProps->COMGETTER(SerialPortCount)(&maxUARTs);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp

    r35085 r35761  
    847847            systemProperties->COMGETTER(InfoVDSize)(&i64Value);
    848848            RTPrintf("Virtual disk limit (info):       %lld Bytes\n", i64Value);
    849             systemProperties->COMGETTER(NetworkAdapterCount)(&ulValue);
    850             RTPrintf("Maximum Network Adapter count:   %u\n", ulValue);
    851849            systemProperties->COMGETTER(SerialPortCount)(&ulValue);
    852850            RTPrintf("Maximum Serial Port count:       %u\n", ulValue);
     
    855853            systemProperties->COMGETTER(MaxBootPosition)(&ulValue);
    856854            RTPrintf("Maximum Boot Position:           %u\n", ulValue);
     855            systemProperties->GetMaxNetworkAdapters(ChipsetType_PIIX3, &ulValue);
     856            RTPrintf("Maximum PIIX3 Network Adapter count:   %u\n", ulValue);
     857            systemProperties->GetMaxNetworkAdapters(ChipsetType_ICH9,  &ulValue);
     858            RTPrintf("Maximum ICH9 Network Adapter count:   %u\n", ulValue);
    857859            systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue);
    858860            RTPrintf("Maximum PIIX3 IDE Controllers:   %u\n", ulValue);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r35239 r35761  
    318318        return errorSyntax(USAGE_MODIFYVM, "Not enough parameters");
    319319
    320     /* Get the number of network adapters */
    321     ULONG NetworkAdapterCount = 0;
    322     {
    323         ComPtr <ISystemProperties> info;
    324         CHECK_ERROR_RET(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()), 1);
    325         CHECK_ERROR_RET(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount), 1);
    326     }
    327320    ULONG SerialPortCount = 0;
    328321    {
     
    335328    CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(),
    336329                                               machine.asOutParam()), 1);
     330
     331
     332    /* Get the number of network adapters */
     333    ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine);
    337334
    338335    /* open a session for the VM */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp

    r33386 r35761  
    274274
    275275    /* Network statistics: */
    276     ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount();
     276    ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    277277    for (ulong i = 0; i < count; ++ i)
    278278    {
     
    587587
    588588        /* Network Adapters list */
    589         ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount();
     589        ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    590590        for (ulong slot = 0; slot < count; ++ slot)
    591591        {
     
    690690    return result;
    691691}
    692 
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r35730 r35761  
    18141814        QString item;
    18151815
    1816         ulong count = mVBox.GetSystemProperties().GetNetworkAdapterCount();
     1816        ulong count = mVBox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    18171817        int rows = 2; /* including section header and footer */
    18181818        for (ulong slot = 0; slot < count; slot ++)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r33394 r35761  
    270270        QString strFullData;
    271271
    272         ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount();
     272        ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    273273
    274274        QString strToolTip = QApplication::translate("UIIndicatorsPool",
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r35686 r35761  
    980980    {
    981981        bool fAtLeastOneAdapterActive = false;
    982         ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount();
     982        ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    983983        for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot)
    984984        {
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp

    r35415 r35761  
    726726            QString item;
    727727
    728             ulong count = m_vbox.GetSystemProperties().GetNetworkAdapterCount();
     728            ulong count = m_vbox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3);
    729729            for (ulong slot = 0; slot < count; slot ++)
    730730            {
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp

    r34094 r35761  
    626626
    627627    /* How many adapters to display */
    628     ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount());
     628    ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3));
    629629    /* Add the tab pages to parent tab widget. Needed for space calculations. */
    630630    for (ulong iSlot = 0; iSlot < uCount; ++iSlot)
     
    681681        mIntList.clear();
    682682        CVirtualBox vbox = vboxGlobal().virtualBox();
    683         ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().GetNetworkAdapterCount());
     683        ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3));
    684684        CMachineVector vec = vbox.GetMachines();
    685685        for (CMachineVector::ConstIterator m = vec.begin(); m != vec.end(); ++ m)
     
    750750
    751751    /* Load adapters data: */
    752     ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetNetworkAdapterCount());
     752    ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3));
    753753    for (ulong uSlot = 0; uSlot < uCount; ++uSlot)
    754754    {
     
    984984    }
    985985}
    986 
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r35676 r35761  
    73877387    name="ISystemProperties"
    73887388    extends="$unknown"
    7389     uuid="51c81048-b261-4fa2-a44e-fd756f0db589"
     7389    uuid="2f89cdfe-2d10-43d4-b37f-61760f877f29"
    73907390    wsmap="managed"
    73917391    >
     
    74327432    </attribute>
    74337433
    7434     <attribute name="networkAdapterCount" type="unsigned long" readonly="yes">
    7435       <desc>
    7436         Number of network adapters associated with every
     7434    <attribute name="serialPortCount" type="unsigned long" readonly="yes">
     7435      <desc>
     7436        Maximum number of serial ports associated with every
    74377437        <link to="IMachine"/> instance.
    74387438      </desc>
    74397439    </attribute>
    74407440
    7441     <attribute name="serialPortCount" type="unsigned long" readonly="yes">
    7442       <desc>
    7443         Number of serial ports associated with every
    7444         <link to="IMachine"/> instance.
    7445       </desc>
    7446     </attribute>
    7447 
    74487441    <attribute name="parallelPortCount" type="unsigned long" readonly="yes">
    74497442      <desc>
    7450         Number of parallel ports associated with every
     7443        Maximum number of parallel ports associated with every
    74517444        <link to="IMachine"/> instance.
    74527445      </desc>
     
    76467639    </attribute>
    76477640
     7641
     7642    <method name="getMaxNetworkAdapters">
     7643      <desc>
     7644        Maximum total number of network adapters associated with every
     7645        <link to="IMachine"/> instance.
     7646      </desc>
     7647
     7648      <param name="chipset" type="ChipsetType" dir="in">
     7649        <desc>The chipset type to get the value for.</desc>
     7650      </param>
     7651
     7652
     7653      <param name="maxNetworkAdapters" type="unsigned long" dir="return">
     7654        <desc>The maximum total number of network adapters allowed.</desc>
     7655      </param>
     7656
     7657    </method>
     7658
     7659    <method name="getMaxNetworkAdaptersOfType">
     7660      <desc>
     7661        Maximum number of network adapters of a given attachment type,
     7662        associated with every <link to="IMachine"/> instance.
     7663      </desc>
     7664
     7665      <param name="chipset" type="ChipsetType" dir="in">
     7666        <desc>The chipset type to get the value for.</desc>
     7667      </param>
     7668
     7669      <param name="type" type="NetworkAttachmentType" dir="in">
     7670        <desc>Type of attachment.</desc>
     7671      </param>
     7672
     7673      <param name="maxNetworkAdapters" type="unsigned long" dir="return">
     7674        <desc>The maximum number of network adapters allowed for
     7675          particular chipset and attachment  type.</desc>
     7676      </param>
     7677
     7678    </method>
     7679
     7680
    76487681    <method name="getMaxDevicesPerPortForStorageBus">
    76497682      <desc>Returns the maximum number of devices which can be attached to a port
     
    76557688
    76567689      <param name="maxDevicesPerPort" type="unsigned long" dir="return">
    7657         <desc>The maximum number of devices which can eb attached to the port for the given
     7690        <desc>The maximum number of devices which can be attached to the port for the given
    76587691        storage bus.</desc>
    76597692      </param>
  • trunk/src/VBox/Main/include/SystemPropertiesImpl.h

    r35638 r35761  
    6767    STDMETHOD(COMGETTER(MaxGuestMonitors))(ULONG *maxMonitors);
    6868    STDMETHOD(COMGETTER(InfoVDSize))(LONG64 *infoVDSize);
    69     STDMETHOD(COMGETTER(NetworkAdapterCount))(ULONG *count);
    7069    STDMETHOD(COMGETTER(SerialPortCount))(ULONG *count);
    7170    STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count);
     
    9493    STDMETHOD(COMGETTER(DefaultAudioDriver))(AudioDriverType_T *aAudioDriver);
    9594
     95    STDMETHOD(GetMaxNetworkAdapters)(ChipsetType_T aChipset, ULONG *aMaxInstances);
     96    STDMETHOD(GetMaxNetworkAdaptersOfType)(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *aMaxInstances);
    9697    STDMETHOD(GetMaxDevicesPerPortForStorageBus)(StorageBus_T aBus, ULONG *aMaxDevicesPerPort);
    9798    STDMETHOD(GetMinPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMinPortCount);
  • trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp

    r35638 r35761  
    275275}
    276276
    277 STDMETHODIMP SystemProperties::COMGETTER(NetworkAdapterCount)(ULONG *count)
     277STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count)
    278278{
    279279    CheckComArgOutPointerValid(count);
     
    283283
    284284    /* no need to lock, this is const */
    285     *count = SchemaDefs::NetworkAdapterCount;
    286 
    287     return S_OK;
    288 }
    289 
    290 STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count)
     285    *count = SchemaDefs::SerialPortCount;
     286
     287    return S_OK;
     288}
     289
     290STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count)
    291291{
    292292    CheckComArgOutPointerValid(count);
     
    296296
    297297    /* no need to lock, this is const */
    298     *count = SchemaDefs::SerialPortCount;
    299 
    300     return S_OK;
    301 }
    302 
    303 STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count)
     298    *count = SchemaDefs::ParallelPortCount;
     299
     300    return S_OK;
     301}
     302
     303STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition)
     304{
     305    CheckComArgOutPointerValid(aMaxBootPosition);
     306
     307    AutoCaller autoCaller(this);
     308    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     309
     310    /* no need to lock, this is const */
     311    *aMaxBootPosition = SchemaDefs::MaxBootPosition;
     312
     313    return S_OK;
     314}
     315
     316
     317STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count)
    304318{
    305319    CheckComArgOutPointerValid(count);
     
    308322    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    309323
    310     /* no need to lock, this is const */
    311     *count = SchemaDefs::ParallelPortCount;
    312 
    313     return S_OK;
    314 }
    315 
    316 STDMETHODIMP SystemProperties::COMGETTER(MaxBootPosition)(ULONG *aMaxBootPosition)
    317 {
    318     CheckComArgOutPointerValid(aMaxBootPosition);
    319 
    320     AutoCaller autoCaller(this);
    321     if (FAILED(autoCaller.rc())) return autoCaller.rc();
    322 
    323     /* no need to lock, this is const */
    324     *aMaxBootPosition = SchemaDefs::MaxBootPosition;
    325 
    326     return S_OK;
    327 }
     324    ULONG uResult = 0;
     325
     326    /* no need for locking, no state */
     327    switch (aChipset)
     328    {
     329        case ChipsetType_PIIX3:
     330            uResult = SchemaDefs::NetworkAdapterCount; /* == 8 */
     331            break;
     332        case ChipsetType_ICH9:
     333            uResult = 36;
     334            break;
     335        default:
     336            AssertMsgFailed(("Invalid chipset type %d\n", aChipset));
     337    }
     338
     339    *count = uResult;
     340
     341    return S_OK;
     342}
     343
     344STDMETHODIMP SystemProperties::GetMaxNetworkAdaptersOfType(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *count)
     345{
     346    CheckComArgOutPointerValid(count);
     347
     348    AutoCaller autoCaller(this);
     349    if (FAILED(autoCaller.rc())) return autoCaller.rc();
     350
     351    ULONG uResult = 0;
     352    HRESULT rc = GetMaxNetworkAdapters(aChipset, &uResult);
     353   
     354
     355    /* no need for locking, no state */
     356    switch (aType)
     357    {
     358        case NetworkAttachmentType_NAT:       
     359        case NetworkAttachmentType_Internal:
     360            /* chipset default is OK */
     361            break;
     362        case NetworkAttachmentType_Bridged:
     363            /* Maybe use current host interface count here? */
     364            break;
     365        case NetworkAttachmentType_HostOnly:
     366            uResult = 8;
     367            break;
     368        default:
     369            AssertMsgFailed(("Unhandled attachment type %d\n", aType));
     370    }
     371
     372    *count = uResult;
     373
     374    return S_OK;
     375}
     376
    328377
    329378STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aBus,
     
    10861135    return S_OK;
    10871136}
    1088 
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