Changeset 35761 in vbox
- Timestamp:
- Jan 28, 2011 1:19:26 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 14 edited
-
Frontends/VBoxManage/VBoxManage.h (modified) (2 diffs)
-
Frontends/VBoxManage/VBoxManageControlVM.cpp (modified) (7 diffs)
-
Frontends/VBoxManage/VBoxManageInfo.cpp (modified) (2 diffs)
-
Frontends/VBoxManage/VBoxManageList.cpp (modified) (2 diffs)
-
Frontends/VBoxManage/VBoxManageModifyVM.cpp (modified) (2 diffs)
-
Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp (modified) (3 diffs)
-
Frontends/VirtualBox/src/globals/VBoxGlobal.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/runtime/UISession.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/selector/UIVMDesktop.cpp (modified) (1 diff)
-
Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp (modified) (4 diffs)
-
Main/idl/VirtualBox.xidl (modified) (4 diffs)
-
Main/include/SystemPropertiesImpl.h (modified) (2 diffs)
-
Main/src-server/SystemPropertiesImpl.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r35707 r35761 163 163 /* VBoxManageControlVM.cpp */ 164 164 int handleControlVM(HandlerArg *a); 165 ULONG getMaxNics(IVirtualBox* vbox, IMachine* mach); 165 166 166 167 /* VBoxManageModifyVM.cpp */ … … 256 257 257 258 #endif /* !___H_VBOXMANAGE */ 258 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r35707 r35761 65 65 66 66 67 ULONG 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 67 86 int handleControlVM(HandlerArg *a) 68 87 { … … 265 284 { 266 285 /* 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); 271 287 272 288 unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC"); … … 311 327 { 312 328 /* 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); 318 330 unsigned n = parseNum(&a->argv[1][12], NetworkAdapterCount, "NIC"); 319 331 if (!n) … … 356 368 { 357 369 /* 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); 362 371 363 372 unsigned n = parseNum(&a->argv[1][8], NetworkAdapterCount, "NIC"); … … 406 415 { 407 416 /* Get the number of network adapters */ 408 ULONG NetworkAdapterCount = 0; 409 ComPtr <ISystemProperties> info; 417 ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, sessionMachine); 410 418 ComPtr<INATEngine> engine; 411 CHECK_ERROR_BREAK(a->virtualBox, COMGETTER(SystemProperties)(info.asOutParam()));412 CHECK_ERROR_BREAK(info, COMGETTER(NetworkAdapterCount)(&NetworkAdapterCount));413 419 unsigned n = parseNum(&a->argv[1][5], NetworkAdapterCount, "NIC"); 414 420 if (!n) … … 503 509 { 504 510 /* 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) ; 510 512 unsigned n = parseNum(&a->argv[1][3], NetworkAdapterCount, "NIC"); 511 513 if (!n) … … 1035 1037 return SUCCEEDED(rc) ? 0 : 1; 1036 1038 } 1037 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r35707 r35761 787 787 } 788 788 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 794 792 for (ULONG currentNIC = 0; currentNIC < maxNICs; currentNIC++) 795 793 { … … 1122 1120 1123 1121 /* get the maximum amount of UARTs */ 1122 ComPtr<ISystemProperties> sysProps; 1123 virtualBox->COMGETTER(SystemProperties)(sysProps.asOutParam()); 1124 1124 1125 ULONG maxUARTs = 0; 1125 1126 sysProps->COMGETTER(SerialPortCount)(&maxUARTs); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageList.cpp
r35085 r35761 847 847 systemProperties->COMGETTER(InfoVDSize)(&i64Value); 848 848 RTPrintf("Virtual disk limit (info): %lld Bytes\n", i64Value); 849 systemProperties->COMGETTER(NetworkAdapterCount)(&ulValue);850 RTPrintf("Maximum Network Adapter count: %u\n", ulValue);851 849 systemProperties->COMGETTER(SerialPortCount)(&ulValue); 852 850 RTPrintf("Maximum Serial Port count: %u\n", ulValue); … … 855 853 systemProperties->COMGETTER(MaxBootPosition)(&ulValue); 856 854 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); 857 859 systemProperties->GetMaxInstancesOfStorageBus(ChipsetType_PIIX3, StorageBus_IDE, &ulValue); 858 860 RTPrintf("Maximum PIIX3 IDE Controllers: %u\n", ulValue); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r35239 r35761 318 318 return errorSyntax(USAGE_MODIFYVM, "Not enough parameters"); 319 319 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 }327 320 ULONG SerialPortCount = 0; 328 321 { … … 335 328 CHECK_ERROR_RET(a->virtualBox, FindMachine(Bstr(a->argv[0]).raw(), 336 329 machine.asOutParam()), 1); 330 331 332 /* Get the number of network adapters */ 333 ULONG NetworkAdapterCount = getMaxNics(a->virtualBox, machine); 337 334 338 335 /* open a session for the VM */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxVMInformationDlg.cpp
r33386 r35761 274 274 275 275 /* Network statistics: */ 276 ulong count = vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount();276 ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 277 277 for (ulong i = 0; i < count; ++ i) 278 278 { … … 587 587 588 588 /* Network Adapters list */ 589 ulong count = vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount();589 ulong count = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 590 590 for (ulong slot = 0; slot < count; ++ slot) 591 591 { … … 690 690 return result; 691 691 } 692 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r35730 r35761 1814 1814 QString item; 1815 1815 1816 ulong count = mVBox.GetSystemProperties().Get NetworkAdapterCount();1816 ulong count = mVBox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 1817 1817 int rows = 2; /* including section header and footer */ 1818 1818 for (ulong slot = 0; slot < count; slot ++) -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r33394 r35761 270 270 QString strFullData; 271 271 272 ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount();272 ulong uMaxCount = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 273 273 274 274 QString strToolTip = QApplication::translate("UIIndicatorsPool", -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r35686 r35761 980 980 { 981 981 bool fAtLeastOneAdapterActive = false; 982 ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount();982 ULONG uSlots = vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 983 983 for (ULONG uSlot = 0; uSlot < uSlots; ++uSlot) 984 984 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIVMDesktop.cpp
r35415 r35761 726 726 QString item; 727 727 728 ulong count = m_vbox.GetSystemProperties().Get NetworkAdapterCount();728 ulong count = m_vbox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3); 729 729 for (ulong slot = 0; slot < count; slot ++) 730 730 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsNetwork.cpp
r34094 r35761 626 626 627 627 /* How many adapters to display */ 628 ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount());628 ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3)); 629 629 /* Add the tab pages to parent tab widget. Needed for space calculations. */ 630 630 for (ulong iSlot = 0; iSlot < uCount; ++iSlot) … … 681 681 mIntList.clear(); 682 682 CVirtualBox vbox = vboxGlobal().virtualBox(); 683 ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().Get NetworkAdapterCount());683 ulong count = qMin ((ULONG) 4, vbox.GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3)); 684 684 CMachineVector vec = vbox.GetMachines(); 685 685 for (CMachineVector::ConstIterator m = vec.begin(); m != vec.end(); ++ m) … … 750 750 751 751 /* Load adapters data: */ 752 ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().Get NetworkAdapterCount());752 ulong uCount = qMin((ULONG)4, vboxGlobal().virtualBox().GetSystemProperties().GetMaxNetworkAdapters(KChipsetType_PIIX3)); 753 753 for (ulong uSlot = 0; uSlot < uCount; ++uSlot) 754 754 { … … 984 984 } 985 985 } 986 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r35676 r35761 7387 7387 name="ISystemProperties" 7388 7388 extends="$unknown" 7389 uuid=" 51c81048-b261-4fa2-a44e-fd756f0db589"7389 uuid="2f89cdfe-2d10-43d4-b37f-61760f877f29" 7390 7390 wsmap="managed" 7391 7391 > … … 7432 7432 </attribute> 7433 7433 7434 <attribute name=" networkAdapterCount" type="unsigned long" readonly="yes">7435 <desc> 7436 Number of network adapters associated with every7434 <attribute name="serialPortCount" type="unsigned long" readonly="yes"> 7435 <desc> 7436 Maximum number of serial ports associated with every 7437 7437 <link to="IMachine"/> instance. 7438 7438 </desc> 7439 7439 </attribute> 7440 7440 7441 <attribute name="serialPortCount" type="unsigned long" readonly="yes">7442 <desc>7443 Number of serial ports associated with every7444 <link to="IMachine"/> instance.7445 </desc>7446 </attribute>7447 7448 7441 <attribute name="parallelPortCount" type="unsigned long" readonly="yes"> 7449 7442 <desc> 7450 Number of parallel ports associated with every7443 Maximum number of parallel ports associated with every 7451 7444 <link to="IMachine"/> instance. 7452 7445 </desc> … … 7646 7639 </attribute> 7647 7640 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 7648 7681 <method name="getMaxDevicesPerPortForStorageBus"> 7649 7682 <desc>Returns the maximum number of devices which can be attached to a port … … 7655 7688 7656 7689 <param name="maxDevicesPerPort" type="unsigned long" dir="return"> 7657 <desc>The maximum number of devices which can ebattached to the port for the given7690 <desc>The maximum number of devices which can be attached to the port for the given 7658 7691 storage bus.</desc> 7659 7692 </param> -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r35638 r35761 67 67 STDMETHOD(COMGETTER(MaxGuestMonitors))(ULONG *maxMonitors); 68 68 STDMETHOD(COMGETTER(InfoVDSize))(LONG64 *infoVDSize); 69 STDMETHOD(COMGETTER(NetworkAdapterCount))(ULONG *count);70 69 STDMETHOD(COMGETTER(SerialPortCount))(ULONG *count); 71 70 STDMETHOD(COMGETTER(ParallelPortCount))(ULONG *count); … … 94 93 STDMETHOD(COMGETTER(DefaultAudioDriver))(AudioDriverType_T *aAudioDriver); 95 94 95 STDMETHOD(GetMaxNetworkAdapters)(ChipsetType_T aChipset, ULONG *aMaxInstances); 96 STDMETHOD(GetMaxNetworkAdaptersOfType)(ChipsetType_T aChipset, NetworkAttachmentType_T aType, ULONG *aMaxInstances); 96 97 STDMETHOD(GetMaxDevicesPerPortForStorageBus)(StorageBus_T aBus, ULONG *aMaxDevicesPerPort); 97 98 STDMETHOD(GetMinPortCountForStorageBus)(StorageBus_T aBus, ULONG *aMinPortCount); -
trunk/src/VBox/Main/src-server/SystemPropertiesImpl.cpp
r35638 r35761 275 275 } 276 276 277 STDMETHODIMP SystemProperties::COMGETTER( NetworkAdapterCount)(ULONG *count)277 STDMETHODIMP SystemProperties::COMGETTER(SerialPortCount)(ULONG *count) 278 278 { 279 279 CheckComArgOutPointerValid(count); … … 283 283 284 284 /* 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 290 STDMETHODIMP SystemProperties::COMGETTER(ParallelPortCount)(ULONG *count) 291 291 { 292 292 CheckComArgOutPointerValid(count); … … 296 296 297 297 /* 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 303 STDMETHODIMP 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 317 STDMETHODIMP SystemProperties::GetMaxNetworkAdapters(ChipsetType_T aChipset, ULONG *count) 304 318 { 305 319 CheckComArgOutPointerValid(count); … … 308 322 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 309 323 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 344 STDMETHODIMP 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 328 377 329 378 STDMETHODIMP SystemProperties::GetMaxDevicesPerPortForStorageBus(StorageBus_T aBus, … … 1086 1135 return S_OK; 1087 1136 } 1088
Note:
See TracChangeset
for help on using the changeset viewer.

