Changeset 34587 in vbox
- Timestamp:
- Dec 1, 2010 8:30:02 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r34574 r34587 653 653 * your settings might never get saved. 654 654 */ 655 struct BandwidthGroup 656 { 657 BandwidthGroup() 658 : cMaxMbPerSec(0), 659 enmType(BandwidthGroupType_Null) 660 {} 661 662 bool operator==(const BandwidthGroup &i) const 663 { 664 return ( (strName == i.strName) 665 && (cMaxMbPerSec == i.cMaxMbPerSec) 666 && (enmType == i.enmType)); 667 } 668 669 com::Utf8Str strName; 670 uint32_t cMaxMbPerSec; 671 BandwidthGroupType_T enmType; 672 }; 673 typedef std::list<BandwidthGroup> BandwidthGroupList; 674 675 /** 676 * NOTE: If you add any fields in here, you must update a) the constructor and b) 677 * the operator== which is used by MachineConfigFile::operator==(), or otherwise 678 * your settings might never get saved. 679 */ 655 680 struct IoSettings 656 681 { … … 659 684 bool operator==(const IoSettings &i) const 660 685 { 661 return ( (fIoCacheEnabled == i.fIoCacheEnabled) 662 && (ulIoCacheSize == i.ulIoCacheSize)); 686 return ( (fIoCacheEnabled == i.fIoCacheEnabled) 687 && (ulIoCacheSize == i.ulIoCacheSize) 688 && (llBandwidthGroups == i.llBandwidthGroups)); 663 689 } 664 690 665 bool fIoCacheEnabled; 666 uint32_t ulIoCacheSize; 691 bool fIoCacheEnabled; 692 uint32_t ulIoCacheSize; 693 BandwidthGroupList llBandwidthGroups; 667 694 }; 668 695 … … 754 781 fPassThrough(false), 755 782 lPort(0), 756 lDevice(0), 757 ulBandwidthLimit(0) 783 lDevice(0) 758 784 {} 759 785 … … 767 793 int32_t lPort; 768 794 int32_t lDevice; 769 770 uint32_t ulBandwidthLimit;771 795 772 796 // if an image file is attached to the device (ISO, RAW, or hard disk image such as VDI), … … 777 801 // for DVDs and floppies, the attachment can also be a host device: 778 802 com::Utf8Str strHostDriveSrc; // if != NULL, value of <HostDrive>/@src 803 804 // Bandwidth group the device is attached to. 805 com::Utf8Str strBwGroup; 779 806 }; 780 807 typedef std::list<AttachedDevice> AttachedDevicesList; -
trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk
r33590 r34587 50 50 VBoxManageSnapshot.cpp \ 51 51 VBoxManageStorageController.cpp \ 52 VBoxManageUSB.cpp 52 VBoxManageUSB.cpp \ 53 VBoxManageBandwidthControl.cpp 53 54 endif # !VBOX_ONLY_DOCS 54 55 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r34244 r34587 432 432 { "dhcpserver", USAGE_DHCPSERVER, handleDHCPServer}, 433 433 { "extpack", USAGE_EXTPACK, handleExtPack}, 434 { "bandwidthctl", USAGE_BANDWIDTHCONTROL, handleBandwidthControl}, 434 435 { NULL, 0, NULL } 435 436 }; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r34244 r34587 98 98 #define USAGE_PASSWORDHASH RT_BIT_64(54) 99 99 #define USAGE_EXTPACK RT_BIT_64(55) 100 #define USAGE_BANDWIDTHCONTROL RT_BIT_64(56) 100 101 #define USAGE_ALL (~(uint64_t)0) 101 102 /** @} */ … … 241 242 int handleDHCPServer(HandlerArg *a); 242 243 244 /* VBoxManageBandwidthControl.cpp */ 245 int handleBandwidthControl(HandlerArg *a); 246 243 247 #endif /* !VBOX_ONLY_DOCS */ 244 248 -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r34574 r34587 464 464 " <uuid>|<filename>|host:<drive>]\n" 465 465 " [--passthrough on|off]\n" 466 " [--bandwidthgroup <name>]\n" 466 467 " [--forceunmount]\n" 467 468 "\n"); … … 481 482 " [--bootable on|off]\n" 482 483 " [--remove]\n" 484 "\n"); 485 } 486 487 if (u64Cmd & USAGE_BANDWIDTHCONTROL) 488 { 489 RTStrmPrintf(pStrm, 490 "VBoxManage bandwidthctl <uuid|vmname>\n" 491 " --name <name>\n" 492 " [--add disk|network]\n" 493 " [--limit <megabytes per second>\n" 494 " [--delete]\n" 483 495 "\n"); 484 496 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageStorageController.cpp
r34010 r34587 51 51 { "--type", 't', RTGETOPT_REQ_STRING }, 52 52 { "--passthrough", 'h', RTGETOPT_REQ_STRING }, 53 { "--bandwidthgroup", 'b', RTGETOPT_REQ_STRING }, 53 54 { "--forceunmount", 'f', RTGETOPT_REQ_NOTHING }, 54 55 }; … … 65 66 const char *pszMedium = NULL; 66 67 const char *pszPassThrough = NULL; 68 const char *pszBandwidthGroup = NULL; 67 69 RTGETOPTUNION ValueUnion; 68 70 RTGETOPTSTATE GetState; … … 127 129 if (ValueUnion.psz) 128 130 pszPassThrough = ValueUnion.psz; 131 else 132 rc = E_FAIL; 133 break; 134 } 135 136 case 'b': // bandwidthgroup <name> 137 { 138 if (ValueUnion.psz) 139 pszBandwidthGroup = ValueUnion.psz; 129 140 else 130 141 rc = E_FAIL; … … 185 196 { 186 197 errorArgument("Drive passthrough state can't be changed while the VM is running\n"); 198 goto leave; 199 } 200 201 if (fRunTime && pszBandwidthGroup) 202 { 203 errorArgument("Bandwidth group can't be changed while the VM is running\n"); 187 204 goto leave; 188 205 } … … 626 643 } 627 644 645 if ( pszBandwidthGroup 646 && !fRunTime 647 && SUCCEEDED(rc)) 648 { 649 650 if (!RTStrICmp(pszBandwidthGroup, "none")) 651 { 652 /* Just remove the bandwidth gorup. */ 653 CHECK_ERROR(machine, SetBandwidthGroupForDevice(Bstr(pszCtl).raw(), 654 port, device, NULL)); 655 } 656 else 657 { 658 ComPtr<IBandwidthControl> bwCtrl; 659 ComPtr<IBandwidthGroup> bwGroup; 660 661 CHECK_ERROR(machine, COMGETTER(BandwidthControl)(bwCtrl.asOutParam())); 662 663 if (SUCCEEDED(rc)) 664 { 665 CHECK_ERROR(bwCtrl, GetBandwidthGroup(Bstr(pszBandwidthGroup).raw(), bwGroup.asOutParam())); 666 if (SUCCEEDED(rc)) 667 { 668 CHECK_ERROR(machine, SetBandwidthGroupForDevice(Bstr(pszCtl).raw(), 669 port, device, bwGroup)); 670 } 671 } 672 } 673 } 674 628 675 /* commit changes */ 629 676 if (SUCCEEDED(rc)) -
trunk/src/VBox/Main/ConsoleImpl.cpp
r34558 r34587 97 97 #include <VBox/ssm.h> 98 98 #include <VBox/version.h> 99 #include <VBox/pdmasynccompletion.h> 99 100 #ifdef VBOX_WITH_USB 100 101 # include <VBox/pdmusb.h> … … 4321 4322 return E_FAIL; 4322 4323 #endif /* !VBOX_WITH_USB */ 4324 } 4325 4326 /** 4327 * Called by IInternalSessionControl::OnBandwidthGroupChange(). 4328 * 4329 * @note Locks this object for writing. 4330 */ 4331 HRESULT Console::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) 4332 { 4333 LogFlowThisFunc(("\n")); 4334 4335 AutoCaller autoCaller(this); 4336 AssertComRCReturnRC(autoCaller.rc()); 4337 4338 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 4339 4340 HRESULT rc = S_OK; 4341 4342 /* don't trigger the CPU priority change if the VM isn't running */ 4343 if (mpVM) 4344 { 4345 /* protect mpVM */ 4346 AutoVMCaller autoVMCaller(this); 4347 if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 4348 4349 if ( mMachineState == MachineState_Running 4350 || mMachineState == MachineState_Teleporting 4351 || mMachineState == MachineState_LiveSnapshotting 4352 ) 4353 { 4354 /* No need to call in the EMT thread. */ 4355 ULONG cMax; 4356 Bstr strName; 4357 rc = aBandwidthGroup->COMGETTER(Name)(strName.asOutParam()); 4358 if (SUCCEEDED(rc)) 4359 rc = aBandwidthGroup->COMGETTER(MaxMbPerSec)(&cMax); 4360 4361 if (SUCCEEDED(rc)) 4362 { 4363 int vrc; 4364 vrc = PDMR3AsyncCompletionBwMgrSetMaxForFile(mpVM, Utf8Str(strName).c_str(), 4365 cMax * _1M); 4366 AssertRC(vrc); 4367 } 4368 } 4369 else 4370 rc = setInvalidMachineStateError(); 4371 } 4372 4373 /* notify console callbacks on success */ 4374 if (SUCCEEDED(rc)) 4375 fireBandwidthGroupChangedEvent(mEventSource, aBandwidthGroup); 4376 4377 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 4378 return rc; 4323 4379 } 4324 4380 -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r34515 r34587 805 805 hrc = pMachine->COMGETTER(IoCacheSize)(&ioCacheSize); H(); 806 806 InsertConfigInteger(pPDMBlkCache, "CacheSize", ioCacheSize * _1M); 807 808 /* 809 * Bandwidth groups. 810 */ 811 PCFGMNODE pAc; 812 PCFGMNODE pAcFile; 813 PCFGMNODE pAcFileBwGroups; 814 ComPtr<IBandwidthControl> bwCtrl; 815 com::SafeIfaceArray<IBandwidthGroup> bwGroups; 816 817 hrc = pMachine->COMGETTER(BandwidthControl)(bwCtrl.asOutParam()); H(); 818 819 hrc = bwCtrl->GetAllBandwidthGroups(ComSafeArrayAsOutParam(bwGroups)); H(); 820 821 InsertConfigNode(pPDM, "AsyncCompletion", &pAc); 822 InsertConfigNode(pAc, "File", &pAcFile); 823 InsertConfigNode(pAcFile, "BwGroups", &pAcFileBwGroups); 824 825 for (size_t i = 0; i < bwGroups.size(); i++) 826 { 827 Bstr strName; 828 ULONG cMaxMbPerSec; 829 BandwidthGroupType_T enmType; 830 831 hrc = bwGroups[i]->COMGETTER(Name)(strName.asOutParam()); H(); 832 hrc = bwGroups[i]->COMGETTER(Type)(&enmType); H(); 833 hrc = bwGroups[i]->COMGETTER(MaxMbPerSec)(&cMaxMbPerSec); H(); 834 835 if (enmType == BandwidthGroupType_Disk) 836 { 837 PCFGMNODE pBwGroup; 838 InsertConfigNode(pAcFileBwGroups, Utf8Str(strName).c_str(), &pBwGroup); 839 InsertConfigInteger(pBwGroup, "Max", cMaxMbPerSec * _1M); 840 InsertConfigInteger(pBwGroup, "Start", cMaxMbPerSec * _1M); 841 InsertConfigInteger(pBwGroup, "Step", 0); 842 } 843 } 807 844 808 845 /* … … 2851 2888 BOOL fPassthrough; 2852 2889 hrc = pMediumAtt->COMGETTER(Passthrough)(&fPassthrough); H(); 2890 2891 ComObjPtr<IBandwidthGroup> pBwGroup; 2892 Bstr strBwGroup; 2893 hrc = pMediumAtt->COMGETTER(BandwidthGroup)(pBwGroup.asOutParam()); H(); 2894 2895 if (!pBwGroup.isNull()) 2896 { 2897 hrc = pBwGroup->COMGETTER(Name)(strBwGroup.asOutParam()); H(); 2898 } 2899 2853 2900 rc = configMedium(pLunL0, 2854 2901 !!fPassthrough, … … 2859 2906 uMergeSource, 2860 2907 uMergeTarget, 2908 strBwGroup.isEmpty() ? NULL : Utf8Str(strBwGroup).c_str(), 2861 2909 pMedium, 2862 2910 aMachineState, … … 2899 2947 unsigned uMergeSource, 2900 2948 unsigned uMergeTarget, 2949 const char *pcszBwGroup, 2901 2950 IMedium *pMedium, 2902 2951 MachineState_T aMachineState, … … 3093 3142 InsertConfigString(pCfg, "Type", "HardDisk"); 3094 3143 } 3144 3145 if (pcszBwGroup) 3146 InsertConfigString(pCfg, "BwGroup", pcszBwGroup); 3095 3147 3096 3148 /* Pass all custom parameters. */ -
trunk/src/VBox/Main/MachineImpl.cpp
r34360 r34587 49 49 #include "DisplayImpl.h" 50 50 #include "DisplayUtils.h" 51 #include "BandwidthControlImpl.h" 51 52 52 53 #ifdef VBOX_WITH_USB … … 3657 3658 aType, 3658 3659 fIndirect, 3659 0 /* No bandwidth limit */);3660 NULL); 3660 3661 if (FAILED(rc)) return rc; 3661 3662 … … 3784 3785 return S_OK; 3785 3786 } 3787 3788 STDMETHODIMP Machine::SetBandwidthGroupForDevice(IN_BSTR aControllerName, LONG aControllerPort, 3789 LONG aDevice, IBandwidthGroup *aBandwidthGroup) 3790 { 3791 CheckComArgStrNotEmptyOrNull(aControllerName); 3792 3793 LogFlowThisFunc(("aControllerName=\"%ls\" aControllerPort=%ld aDevice=%ld\n", 3794 aControllerName, aControllerPort, aDevice)); 3795 3796 AutoCaller autoCaller(this); 3797 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 3798 3799 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3800 3801 HRESULT rc = checkStateDependency(MutableStateDep); 3802 if (FAILED(rc)) return rc; 3803 3804 AssertReturn(mData->mMachineState != MachineState_Saved, E_FAIL); 3805 3806 if (Global::IsOnlineOrTransient(mData->mMachineState)) 3807 return setError(VBOX_E_INVALID_VM_STATE, 3808 tr("Invalid machine state: %s"), 3809 Global::stringifyMachineState(mData->mMachineState)); 3810 3811 MediumAttachment *pAttach = findAttachment(mMediaData->mAttachments, 3812 aControllerName, 3813 aControllerPort, 3814 aDevice); 3815 if (!pAttach) 3816 return setError(VBOX_E_OBJECT_NOT_FOUND, 3817 tr("No storage device attached to device slot %d on port %d of controller '%ls'"), 3818 aDevice, aControllerPort, aControllerName); 3819 3820 3821 setModified(IsModified_Storage); 3822 mMediaData.backup(); 3823 3824 ComObjPtr<BandwidthGroup> group = static_cast<BandwidthGroup*>(aBandwidthGroup); 3825 if (aBandwidthGroup && group.isNull()) 3826 return setError(E_INVALIDARG, "The given bandwidth group pointer is invalid"); 3827 3828 AutoWriteLock attLock(pAttach COMMA_LOCKVAL_SRC_POS); 3829 3830 pAttach->updateBandwidthGroup(group); 3831 3832 return S_OK; 3833 } 3834 3786 3835 3787 3836 STDMETHODIMP Machine::MountMedium(IN_BSTR aControllerName, … … 5768 5817 SafeIfaceArray<IPciDeviceAttachment> assignments(mPciDeviceAssignments); 5769 5818 assignments.detachTo(ComSafeArrayOutArg(aAssignments)); 5819 5820 return S_OK; 5821 } 5822 5823 STDMETHODIMP Machine::COMGETTER(BandwidthControl)(IBandwidthControl **aBandwidthControl) 5824 { 5825 CheckComArgOutPointerValid(aBandwidthControl); 5826 5827 AutoCaller autoCaller(this); 5828 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5829 5830 mBandwidthControl.queryInterfaceTo(aBandwidthControl); 5770 5831 5771 5832 return S_OK; … … 6628 6689 } 6629 6690 6691 /* create the bandwidth control */ 6692 unconst(mBandwidthControl).createObject(); 6693 mBandwidthControl->init(this); 6694 6630 6695 return S_OK; 6631 6696 } … … 6648 6713 6649 6714 /* tell all our other child objects we've been uninitialized */ 6715 if (mBandwidthControl) 6716 { 6717 mBandwidthControl->uninit(); 6718 unconst(mBandwidthControl).setNull(); 6719 } 6650 6720 6651 6721 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) … … 7269 7339 mHWData->mIoCacheEnabled = data.ioSettings.fIoCacheEnabled; 7270 7340 mHWData->mIoCacheSize = data.ioSettings.ulIoCacheSize; 7341 7342 // Bandwidth control 7343 rc = mBandwidthControl->loadSettings(data.ioSettings); 7344 if (FAILED(rc)) return rc; 7271 7345 7272 7346 #ifdef VBOX_WITH_GUEST_PROPS … … 7504 7578 break; 7505 7579 7580 /* Bandwidth groups are loaded at this point. */ 7581 ComObjPtr<BandwidthGroup> pBwGroup; 7582 7583 if (!dev.strBwGroup.isEmpty()) 7584 { 7585 rc = mBandwidthControl->getBandwidthGroupByName(dev.strBwGroup, pBwGroup, false /* aSetError */); 7586 if (FAILED(rc)) 7587 return setError(E_FAIL, 7588 tr("Device '%s' with unknown bandwidth group '%s' is attached to the virtual machine '%s' ('%s')"), 7589 medium->getLocationFull().c_str(), 7590 dev.strBwGroup.c_str(), 7591 mUserData->s.strName.c_str(), 7592 mData->m_strConfigFileFull.c_str()); 7593 } 7594 7506 7595 const Bstr controllerName = aStorageController->getName(); 7507 7596 ComObjPtr<MediumAttachment> pAttachment; … … 7514 7603 dev.deviceType, 7515 7604 dev.fPassThrough, 7516 dev.ulBandwidthLimit);7605 pBwGroup); 7517 7606 if (FAILED(rc)) break; 7518 7607 … … 8300 8389 data.ioSettings.ulIoCacheSize = mHWData->mIoCacheSize; 8301 8390 8391 /* BandwidthControl (required) */ 8392 rc = mBandwidthControl->saveSettings(data.ioSettings); 8393 if (FAILED(rc)) throw rc; 8394 8302 8395 // guest properties 8303 8396 data.llGuestProperties.clear(); … … 8417 8510 MediumAttachment *pAttach = *it; 8418 8511 Medium *pMedium = pAttach->getMedium(); 8512 BandwidthGroup *pBwGroup = pAttach->getBandwidthGroup(); 8419 8513 8420 8514 dev.deviceType = pAttach->getType(); … … 8428 8522 dev.uuid = pMedium->getId(); 8429 8523 dev.fPassThrough = pAttach->getPassthrough(); 8524 } 8525 8526 if (pBwGroup) 8527 { 8528 dev.strBwGroup = pBwGroup->getName(); 8430 8529 } 8431 8530 … … 8703 8802 DeviceType_HardDisk, 8704 8803 true /* aImplicit */, 8705 0 /* No bandwidth limit */);8804 pAtt->getBandwidthGroup()); 8706 8805 if (FAILED(rc)) throw rc; 8707 8806 … … 9369 9468 mUSBController->rollback(); 9370 9469 9470 if (mBandwidthControl && (mData->flModifications & IsModified_BandwidthControl)) 9471 mBandwidthControl->rollback(); 9472 9371 9473 ComPtr<INetworkAdapter> networkAdapters[RT_ELEMENTS(mNetworkAdapters)]; 9372 9474 ComPtr<ISerialPort> serialPorts[RT_ELEMENTS(mSerialPorts)]; … … 9428 9530 if (flModifications & IsModified_Storage) 9429 9531 that->onStorageControllerChange(); 9532 9533 #if 0 9534 if (flModifications & IsModified_BandwidthControl) 9535 that->onBandwidthControlChange(); 9536 #endif 9430 9537 } 9431 9538 } … … 9463 9570 mAudioAdapter->commit(); 9464 9571 mUSBController->commit(); 9572 mBandwidthControl->commit(); 9465 9573 9466 9574 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) … … 9593 9701 mAudioAdapter->copyFrom(aThat->mAudioAdapter); 9594 9702 mUSBController->copyFrom(aThat->mUSBController); 9703 mBandwidthControl->copyFrom(aThat->mBandwidthControl); 9595 9704 9596 9705 /* create private copies of all controllers */ … … 9946 10055 } 9947 10056 10057 /* create another bandwidth control object that will be mutable */ 10058 unconst(mBandwidthControl).createObject(); 10059 mBandwidthControl->init(this, aMachine->mBandwidthControl); 10060 9948 10061 /* default is to delete saved state on Saved -> PoweredOff transition */ 9949 10062 mRemoveSavedState = true; … … 11203 11316 11204 11317 /** 11318 * @note Locks this object for reading. 11319 */ 11320 HRESULT SessionMachine::onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) 11321 { 11322 LogFlowThisFunc(("\n")); 11323 11324 AutoCaller autoCaller(this); 11325 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 11326 11327 ComPtr<IInternalSessionControl> directControl; 11328 { 11329 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 11330 directControl = mData->mSession.mDirectControl; 11331 } 11332 11333 /* ignore notifications sent after #OnSessionEnd() is called */ 11334 if (!directControl) 11335 return S_OK; 11336 11337 return directControl->OnBandwidthGroupChange(aBandwidthGroup); 11338 } 11339 11340 /** 11205 11341 * Returns @c true if this machine's USB controller reports it has a matching 11206 11342 * filter for the given USB device and @c false otherwise. -
trunk/src/VBox/Main/Makefile.kmk
r34416 r34587 319 319 DisplayPNGUtil.cpp \ 320 320 DisplayResampleImage.cpp \ 321 BandwidthControlImpl.cpp \ 322 BandwidthGroupImpl.cpp \ 321 323 $(VBOX_AUTOGEN_EVENT_CPP) \ 322 324 VRDEServerImpl.cpp \ -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r33078 r34587 19 19 #include "MachineImpl.h" 20 20 #include "MediumImpl.h" 21 #include "BandwidthGroupImpl.h" 21 22 #include "Global.h" 22 23 24 #include "AutoStateDep.h" 23 25 #include "AutoCaller.h" 24 26 #include "Logging.h" … … 39 41 type(DeviceType_Null), 40 42 fPassthrough(false), 41 fImplicit(false), 42 mBandwidthLimit(0) 43 fImplicit(false) 43 44 { } 44 45 45 46 ComObjPtr<Medium> pMedium; 47 ComObjPtr<BandwidthGroup> pBwGroup; 46 48 /* Since MediumAttachment is not a first class citizen when it 47 49 * comes to managing settings, having a reference to the storage … … 55 57 bool fPassthrough; 56 58 bool fImplicit; 57 ULONG mBandwidthLimit;58 59 }; 59 60 … … 108 109 DeviceType_T aType, 109 110 bool aPassthrough, 110 ULONG aBandwidthLimit)111 BandwidthGroup *aBandwidthGroup) 111 112 { 112 113 LogFlowThisFuncEnter(); … … 126 127 m->bd.allocate(); 127 128 m->bd->pMedium = aMedium; 129 if (aBandwidthGroup) 130 aBandwidthGroup->reference(); 131 m->bd->pBwGroup = aBandwidthGroup; 128 132 unconst(m->bd->bstrControllerName) = aControllerName; 129 133 unconst(m->bd->lPort) = aPort; … … 135 139 * associated with them. Implicit diff image creation happens later. */ 136 140 m->bd->fImplicit = false; 137 138 m->bd->mBandwidthLimit = aBandwidthLimit;139 141 140 142 /* Confirm a successful initialization when it's the case */ … … 278 280 } 279 281 280 STDMETHODIMP MediumAttachment::COMGETTER(Bandwidth Limit) (ULONG *aLimit)281 { 282 CheckComArgOutPointerValid(a Limit);282 STDMETHODIMP MediumAttachment::COMGETTER(BandwidthGroup) (IBandwidthGroup **aBwGroup) 283 { 284 CheckComArgOutPointerValid(aBwGroup); 283 285 284 286 AutoCaller autoCaller(this); … … 287 289 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 288 290 289 *aLimit = m->bd->mBandwidthLimit; 290 return S_OK; 291 } 292 293 STDMETHODIMP MediumAttachment::COMSETTER(BandwidthLimit) (ULONG aLimit) 294 { 295 AutoCaller autoCaller(this); 296 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 297 298 /* the machine doesn't need to be mutable */ 299 300 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 301 302 if (aLimit != m->bd->mBandwidthLimit) 303 { 304 m->bd.backup(); 305 m->bd->mBandwidthLimit = aLimit; 306 307 /* todo: not all storage attachments will support this. */ 308 } 291 m->bd->pBwGroup.queryInterfaceTo(aBwGroup); 292 309 293 return S_OK; 310 294 } … … 386 370 AutoReadLock lock(this COMMA_LOCKVAL_SRC_POS); 387 371 return m->bd->fPassthrough; 372 } 373 374 const ComObjPtr<BandwidthGroup>& MediumAttachment::getBandwidthGroup() const 375 { 376 return m->bd->pBwGroup; 388 377 } 389 378 … … 417 406 } 418 407 408 void MediumAttachment::updateBandwidthGroup(const ComObjPtr<BandwidthGroup> &aBandwidthGroup) 409 { 410 Assert(isWriteLockOnCurrentThread()); 411 412 m->bd.backup(); 413 if (!aBandwidthGroup.isNull()) 414 aBandwidthGroup->reference(); 415 416 if (!m->bd->pBwGroup.isNull()) 417 { 418 m->bd->pBwGroup->release(); 419 } 420 m->bd->pBwGroup = aBandwidthGroup; 421 } 422 -
trunk/src/VBox/Main/SessionImpl.cpp
r33952 r34587 704 704 705 705 return mConsole->onShowWindow(aCheck, aCanShow, aWinId); 706 } 707 708 STDMETHODIMP Session::OnBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup) 709 { 710 LogFlowThisFunc(("\n")); 711 712 AutoCaller autoCaller(this); 713 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 714 715 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 716 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 717 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 718 719 return mConsole->onBandwidthGroupChange(aBandwidthGroup); 706 720 } 707 721 -
trunk/src/VBox/Main/SnapshotImpl.cpp
r33921 r34587 1032 1032 mParallelPorts[slot]->initCopy(this, mPeer->mParallelPorts[slot]); 1033 1033 } 1034 1035 unconst(mBandwidthControl).createObject(); 1036 mBandwidthControl->initCopy(this, mPeer->mBandwidthControl); 1034 1037 1035 1038 /* Confirm a successful initialization when it's the case */ … … 1123 1126 mParallelPorts[slot]->init(this, slot); 1124 1127 } 1128 1129 unconst(mBandwidthControl).createObject(); 1130 mBandwidthControl->init(this); 1125 1131 1126 1132 /* load hardware and harddisk settings */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r34574 r34587 3476 3476 <interface 3477 3477 name="IMachine" extends="$unknown" 3478 uuid=" 711cbb73-75af-463c-af17-8b7860c01fe8"3478 uuid="662c175e-a69d-40b8-a77a-1d719d0ab062" 3479 3479 wsmap="managed" 3480 3480 > … … 4069 4069 </attribute> 4070 4070 4071 <attribute name="bandwidthControl" type="IBandwidthControl" readonly="yes"> 4072 <desc> 4073 Bandwidth control manager. 4074 </desc> 4075 </attribute> 4076 4071 4077 <attribute name="pciDeviceAssignments" type="IPciDeviceAttachment" readonly="yes" safearray="yes"> 4072 4078 <desc>Array of PCI devices assigned to this machine, to get list of all PCI devices … … 4519 4525 <param name="passthrough" type="boolean" dir="in"> 4520 4526 <desc>New value for the passthrough setting.</desc> 4527 </param> 4528 </method> 4529 4530 <method name="setBandwidthGroupForDevice"> 4531 <desc> 4532 Sets the passthrough mode of an existing DVD device. Changing the 4533 setting while the VM is running is forbidden. The setting is only used 4534 if at VM start the device is configured as a host DVD drive, in all 4535 other cases it is ignored. The device must already exist; see 4536 <link to="IMachine::attachDevice"/> for how to attach a new device. 4537 4538 The @a controllerPort and @a device parameters specify the device slot and 4539 have have the same meaning as with <link to="IMachine::attachDevice" />. 4540 4541 <result name="E_INVALIDARG"> 4542 SATA device, SATA port, IDE port or IDE slot out of range. 4543 </result> 4544 <result name="VBOX_E_INVALID_OBJECT_STATE"> 4545 Attempt to modify an unregistered virtual machine. 4546 </result> 4547 <result name="VBOX_E_INVALID_VM_STATE"> 4548 Invalid machine state. 4549 </result> 4550 4551 </desc> 4552 <param name="name" type="wstring" dir="in"> 4553 <desc>Name of the storage controller.</desc> 4554 </param> 4555 <param name="controllerPort" type="long" dir="in"> 4556 <desc>Storage controller port.</desc> 4557 </param> 4558 <param name="device" type="long" dir="in"> 4559 <desc>Device slot in the given port.</desc> 4560 </param> 4561 <param name="bandwidthGroup" type="IBandwidthGroup" dir="in"> 4562 <desc>New value for the bandwidth group or NULL for no group.</desc> 4521 4563 </param> 4522 4564 </method> … … 8829 8871 <interface 8830 8872 name="IMediumAttachment" extends="$unknown" 8831 uuid=" c29452cc-ca72-404b-9261-cfc514f1e412"8873 uuid="aa4b4840-934f-454d-9a28-23e8f4235edf" 8832 8874 wsmap="struct" 8833 8875 > … … 8882 8924 </attribute> 8883 8925 8884 <attribute name="bandwidthLimit" type="unsigned long"> 8885 <desc> 8886 Maximum throughput allowed for this medium attachment, in units of 1 mbps. 8887 A zero value means uncapped/unlimited. 8888 </desc> 8926 <attribute name="bandwidthGroup" type="IBandwidthGroup" readonly="yes"> 8927 <desc>The bandwidth group this medium attachment is assigned to.</desc> 8889 8928 </attribute> 8890 8929 … … 12835 12874 <interface 12836 12875 name="IInternalSessionControl" extends="$unknown" 12837 uuid=" 06ef98a7-f7c0-45ba-bf99-9aca7a4d5530"12876 uuid="a2fbf834-149d-41da-ae52-0dc3b0f032b3" 12838 12877 internal="yes" 12839 12878 wsmap="suppress" … … 13136 13175 <param name="canShow" type="boolean" dir="out"/> 13137 13176 <param name="winId" type="long long" dir="out"/> 13177 </method> 13178 13179 <method name="onBandwidthGroupChange"> 13180 <desc> 13181 Notification when one of the bandwidth groups change. 13182 </desc> 13183 <param name="bandwidthGroup" type="IBandwidthGroup" dir="in"> 13184 <desc>The bandwidth group which changed.</desc> 13185 </param> 13138 13186 </method> 13139 13187 … … 14419 14467 14420 14468 <!-- 14469 // BandwidthGroupType 14470 ///////////////////////////////////////////////////////////////////////// 14471 --> 14472 <enum 14473 name="BandwidthGroupType" 14474 uuid="1d92b67d-dc69-4be9-ad4c-93a01e1e0c8e"> 14475 14476 <desc> 14477 Type of a bandwidth control group. 14478 </desc> 14479 14480 <const name="Null" value="0"> 14481 <desc> 14482 Null type, must be first. 14483 </desc> 14484 </const> 14485 14486 <const name="Disk" value="1"> 14487 <desc> 14488 The bandwidth group controls disk I/O. 14489 </desc> 14490 </const> 14491 14492 <const name="Network" value="2"> 14493 <desc> 14494 The bandwidth group controls network I/O. 14495 </desc> 14496 </const> 14497 14498 </enum> 14499 14500 <!-- 14501 // IBandwidthGroup 14502 ///////////////////////////////////////////////////////////////////////// 14503 --> 14504 <interface 14505 name="IBandwidthGroup" extends="$unknown" 14506 uuid="badea2d7-0261-4146-89f0-6a57cc34833d" 14507 wsmap="managed" 14508 > 14509 <desc>Represents one bandwidth group.</desc> 14510 14511 <attribute name="name" type="wstring" readonly="yes"> 14512 <desc>Name of the group.</desc> 14513 </attribute> 14514 14515 <attribute name="type" type="BandwidthGroupType" readonly="yes"> 14516 <desc>Type of the group.</desc> 14517 </attribute> 14518 14519 <attribute name="reference" type="unsigned long" readonly="yes"> 14520 <desc>How many devices/medium attachements use this group.</desc> 14521 </attribute> 14522 14523 <attribute name="maxMbPerSec" type="unsigned long"> 14524 <desc>The maximum number of MB which can be transfered by all 14525 entities attached to this group during one second.</desc> 14526 </attribute> 14527 14528 </interface> 14529 14530 <!-- 14531 // IBandwidthControl 14532 ///////////////////////////////////////////////////////////////////////// 14533 --> 14534 <interface 14535 name="IBandwidthControl" extends="$unknown" 14536 uuid="d0a24db0-f756-11df-98cf-0800200c9a66" 14537 wsmap="managed" 14538 > 14539 <desc> 14540 Controls the bandwidth groups of one machine used to cap I/O done by a VM. 14541 This includes network and disk I/O. 14542 </desc> 14543 14544 <attribute name="numGroups" type="unsigned long" readonly="yes"> 14545 <desc> 14546 The current number of existing bandwidth groups managed. 14547 </desc> 14548 </attribute> 14549 14550 <method name="CreateBandwidthGroup"> 14551 <desc> 14552 Creates a new bandwidth group. 14553 </desc> 14554 14555 <param name="name" type="wstring" dir="in"> 14556 <desc>Name of the bandwidth group.</desc> 14557 </param> 14558 <param name="type" type="BandwidthGroupType" dir="in"> 14559 <desc>The type of the bandwidth group (network or disk).</desc> 14560 </param> 14561 <param name="maxBytesPerSec" type="unsigned long" dir="in"> 14562 <desc>The maximum number of bytes which can be transfered by all 14563 entities attached to this group during one second.</desc> 14564 </param> 14565 </method> 14566 14567 <method name="DeleteBandwidthGroup"> 14568 <desc> 14569 Deletes a new bandwidth group. 14570 </desc> 14571 14572 <param name="name" type="wstring" dir="in"> 14573 <desc>Name of the bandwidth group to delete.</desc> 14574 </param> 14575 </method> 14576 14577 <method name="GetBandwidthGroup" const="yes"> 14578 <desc> 14579 Get a bandwidth group by name. 14580 </desc> 14581 14582 <param name="name" type="wstring" dir="in"> 14583 <desc>Name of the bandwidth group to get.</desc> 14584 </param> 14585 <param name="bandwidthGroup" type="IBandwidthGroup" dir="return"> 14586 <desc>Where to store the bandwidth group on success.</desc> 14587 </param> 14588 </method> 14589 14590 <method name="GetAllBandwidthGroups" const="yes"> 14591 <desc> 14592 Get all managed bandwidth groups. 14593 </desc> 14594 14595 <param name="bandwidthGroups" type="IBandwidthGroup" dir="return" safearray="yes"> 14596 <desc>The array of managed bandwidth groups.</desc> 14597 </param> 14598 </method> 14599 </interface> 14600 14601 <!-- 14421 14602 // IVirtualBoxClient 14422 14603 ///////////////////////////////////////////////////////////////////////// … … 14463 14644 <enum 14464 14645 name="VBoxEventType" 14465 uuid=" BA0F90B2-3F41-4222-840D-EDD5055476A8"14646 uuid="c9412a17-c1e1-46db-b4b7-18de9c967e85" 14466 14647 > 14467 14648 … … 14706 14887 </desc> 14707 14888 </const> 14889 <const name="OnBandwidthGroupChanged" value="69"> 14890 <desc> 14891 See <link to="IBandwidthGroupChangedEvent">IBandwidthGroupChangedEvent</link>. 14892 </desc> 14893 </const> 14708 14894 14709 14895 <!-- Last event marker --> 14710 <const name="Last" value=" 69">14896 <const name="Last" value="70"> 14711 14897 <desc> 14712 14898 Must be last event, used for iterations and structures relying on numerical event values. … … 16000 16186 </interface> 16001 16187 16188 <interface 16189 name="IBandwidthGroupChangedEvent" extends="IEvent" 16190 uuid="334df94a-7556-4cbc-8c04-043096b02d82" 16191 wsmap="managed" autogen="VBoxEvent" id="OnBandwidthGroupChanged" 16192 > 16193 <desc> 16194 Notification when one of the bandwidth groups changed 16195 </desc> 16196 <attribute name="bandwidthGroup" type="IBandwidthGroup" readonly="yes"> 16197 <desc> 16198 The changed bandwidth group. 16199 </desc> 16200 </attribute> 16201 </interface> 16202 16002 16203 <module name="VBoxSVC" context="LocalServer"> 16003 16204 <class name="VirtualBox" uuid="B1A7A4F2-47B9-4A1E-82B2-07CCD5323C3F" -
trunk/src/VBox/Main/include/ConsoleImpl.h
r34434 r34587 191 191 HRESULT onUSBDeviceAttach(IUSBDevice *aDevice, IVirtualBoxErrorInfo *aError, ULONG aMaskedIfs); 192 192 HRESULT onUSBDeviceDetach(IN_BSTR aId, IVirtualBoxErrorInfo *aError); 193 HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); 193 194 HRESULT getGuestProperty(IN_BSTR aKey, BSTR *aValue, LONG64 *aTimestamp, BSTR *aFlags); 194 195 HRESULT setGuestProperty(IN_BSTR aKey, IN_BSTR aValue, IN_BSTR aFlags); … … 482 483 unsigned uMergeSource, 483 484 unsigned uMergeTarget, 485 const char *pcszBwGroup, 484 486 IMedium *pMedium, 485 487 MachineState_T aMachineState, -
trunk/src/VBox/Main/include/MachineImpl.h
r34331 r34587 32 32 #include "BIOSSettingsImpl.h" 33 33 #include "StorageControllerImpl.h" // required for MachineImpl.h to compile on Windows 34 #include "BandwidthControlImpl.h" 34 35 #include "VBox/settings.h" 35 36 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 468 469 STDMETHOD(DetachDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice); 469 470 STDMETHOD(PassthroughDevice)(IN_BSTR aControllerName, LONG aControllerPort, LONG aDevice, BOOL aPassthrough); 471 STDMETHOD(SetBandwidthGroupForDevice)(IN_BSTR aControllerName, LONG aControllerPort, 472 LONG aDevice, IBandwidthGroup *aBandwidthGroup); 470 473 STDMETHOD(MountMedium)(IN_BSTR aControllerName, LONG aControllerPort, 471 474 LONG aDevice, IMedium *aMedium, BOOL aForce); … … 523 526 STDMETHOD(DetachHostPciDevice(LONG hostAddress)); 524 527 STDMETHOD(COMGETTER(PciDeviceAssignments))(ComSafeArrayOut(IPciDeviceAttachment *, aAssignments)); 528 STDMETHOD(COMGETTER(BandwidthControl))(IBandwidthControl **aBandwidthControl); 525 529 // public methods only for internal purposes 526 530 … … 610 614 IsModified_BIOS = 0x0200, 611 615 IsModified_SharedFolders = 0x0400, 612 IsModified_Snapshots = 0x0800 616 IsModified_Snapshots = 0x0800, 617 IsModified_BandwidthControl = 0x1000 613 618 }; 614 619 … … 628 633 virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; } 629 634 virtual HRESULT onSharedFolderChange() { return S_OK; } 635 virtual HRESULT onBandwidthGroupChange(IBandwidthGroup */* aBandwidthGroup */) { return S_OK; } 630 636 631 637 HRESULT saveRegistryEntry(settings::MachineRegistryEntry &data); … … 860 866 const ComObjPtr<BIOSSettings> mBIOSSettings; 861 867 const ComObjPtr<NetworkAdapter> mNetworkAdapters[SchemaDefs::NetworkAdapterCount]; 868 const ComObjPtr<BandwidthControl> mBandwidthControl; 862 869 863 870 typedef std::list< ComObjPtr<StorageController> > StorageControllerList; … … 980 987 IVirtualBoxErrorInfo *aError); 981 988 HRESULT onSharedFolderChange(); 989 HRESULT onBandwidthGroupChange(IBandwidthGroup *aBandwidthGroup); 982 990 983 991 bool hasMatchingUSBFilter(const ComObjPtr<HostUSBDevice> &aDevice, ULONG *aMaskedIfs); -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r33078 r34587 20 20 21 21 #include "VirtualBoxBase.h" 22 #include "BandwidthGroupImpl.h" 22 23 23 24 class ATL_NO_VTABLE MediumAttachment : … … 49 50 DeviceType_T aType, 50 51 bool fPassthrough, 51 ULONG aBandwidthLimit);52 BandwidthGroup *aBandwidthGroup); 52 53 void uninit(); 53 54 … … 62 63 STDMETHOD(COMGETTER(Type))(DeviceType_T *aType); 63 64 STDMETHOD(COMGETTER(Passthrough))(BOOL *aPassthrough); 64 STDMETHOD(COMGETTER(BandwidthLimit))(ULONG *aLimit); 65 STDMETHOD(COMSETTER(BandwidthLimit))(ULONG aLimit); 65 STDMETHOD(COMGETTER(BandwidthGroup))(IBandwidthGroup **aBwGroup); 66 66 67 67 // public internal methods … … 80 80 DeviceType_T getType() const; 81 81 bool getPassthrough() const; 82 const ComObjPtr<BandwidthGroup>& getBandwidthGroup() const; 82 83 83 84 bool matches(CBSTR aControllerName, LONG aPort, LONG aDevice); … … 88 89 /** Must be called from under this object's write lock. */ 89 90 void updatePassthrough(bool aPassthrough); 91 92 /** Must be called from under this object's write lock. */ 93 void updateBandwidthGroup(const ComObjPtr<BandwidthGroup> &aBandwidthGroup); 90 94 91 95 /** Get a unique and somewhat descriptive name for logging. */ -
trunk/src/VBox/Main/include/SessionImpl.h
r33952 r34587 97 97 STDMETHOD(OnUSBDeviceDetach)(IN_BSTR aId, IVirtualBoxErrorInfo *aError); 98 98 STDMETHOD(OnShowWindow)(BOOL aCheck, BOOL *aCanShow, LONG64 *aWinId); 99 STDMETHOD(OnBandwidthGroupChange)(IBandwidthGroup *aBandwidthGroup); 99 100 STDMETHOD(AccessGuestProperty)(IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags, 100 101 BOOL aIsSetter, BSTR *aRetValue, LONG64 *aRetTimestamp, BSTR *aRetFlags); -
trunk/src/VBox/Main/xml/Settings.cpp
r34574 r34587 1634 1634 && (llGuestProperties == h.llGuestProperties) 1635 1635 && (strNotificationPatterns == h.strNotificationPatterns) 1636 && (ioSettings == h.ioSettings) 1636 1637 ) 1637 1638 ); … … 1652 1653 && (uuid == a.uuid) 1653 1654 && (strHostDriveSrc == a.strHostDriveSrc) 1654 && ( ulBandwidthLimit == a.ulBandwidthLimit)1655 && (strBwGroup == a.strBwGroup) 1655 1656 ) 1656 1657 ); … … 2656 2657 else if (pelmHwChild->nameEquals("IO")) 2657 2658 { 2659 const xml::ElementNode *pelmBwGroups; 2658 2660 const xml::ElementNode *pelmIoChild; 2659 2661 … … 2662 2664 pelmIoChild->getAttributeValue("enabled", hw.ioSettings.fIoCacheEnabled); 2663 2665 pelmIoChild->getAttributeValue("size", hw.ioSettings.ulIoCacheSize); 2666 } 2667 2668 if ((pelmBwGroups = pelmHwChild->findChildElement("BandwidthGroups"))) 2669 { 2670 xml::NodesLoop nl2(*pelmBwGroups, "BandwidthGroup"); 2671 const xml::ElementNode *pelmBandwidthGroup; 2672 while ((pelmBandwidthGroup = nl2.forAllNodes())) 2673 { 2674 BandwidthGroup gr; 2675 Utf8Str strTemp; 2676 2677 pelmBandwidthGroup->getAttributeValue("name", gr.strName); 2678 2679 if (pelmBandwidthGroup->getAttributeValue("type", strTemp)) 2680 { 2681 if (strTemp == "Disk") 2682 gr.enmType = BandwidthGroupType_Disk; 2683 else if (strTemp == "Network") 2684 gr.enmType = BandwidthGroupType_Network; 2685 else 2686 throw ConfigFileError(this, pelmBandwidthGroup, N_("Invalid value '%s' in BandwidthGroup/@type attribute"), strTemp.c_str()); 2687 } 2688 else 2689 throw ConfigFileError(this, pelmBandwidthGroup, N_("Missing BandwidthGroup/@type attribute")); 2690 2691 pelmBandwidthGroup->getAttributeValue("maxMbPerSec", gr.cMaxMbPerSec); 2692 hw.ioSettings.llBandwidthGroups.push_back(gr); 2693 } 2664 2694 } 2665 2695 } … … 2878 2908 throw ConfigFileError(this, pelmImage, N_("Required AttachedDevice/@device attribute is missing")); 2879 2909 2880 pelmAttached->getAttributeValue("bandwidth Limit", att.ulBandwidthLimit);2910 pelmAttached->getAttributeValue("bandwidthGroup", att.strBwGroup); 2881 2911 sctl.llAttachedDevices.push_back(att); 2882 2912 } … … 3760 3790 xml::ElementNode *pelmIo = pelmHardware->createChild("IO"); 3761 3791 xml::ElementNode *pelmIoCache; 3762 xml::ElementNode *pelmIoBandwidth;3763 3792 3764 3793 pelmIoCache = pelmIo->createChild("IoCache"); 3765 3794 pelmIoCache->setAttribute("enabled", hw.ioSettings.fIoCacheEnabled); 3766 3795 pelmIoCache->setAttribute("size", hw.ioSettings.ulIoCacheSize); 3767 pelmIoBandwidth = pelmIo->createChild("IoBandwidth"); 3796 3797 if (m->sv >= SettingsVersion_v1_11) 3798 { 3799 xml::ElementNode *pelmBandwidthGroups = pelmIo->createChild("BandwidthGroups"); 3800 for (BandwidthGroupList::const_iterator it = hw.ioSettings.llBandwidthGroups.begin(); 3801 it != hw.ioSettings.llBandwidthGroups.end(); 3802 ++it) 3803 { 3804 const BandwidthGroup &gr = *it; 3805 const char *pcszType; 3806 xml::ElementNode *pelmThis = pelmBandwidthGroups->createChild("BandwidthGroup"); 3807 pelmThis->setAttribute("name", gr.strName); 3808 switch (gr.enmType) 3809 { 3810 case BandwidthGroupType_Network: pcszType = "Network"; break; 3811 default: /* BandwidthGrouptype_Disk */ pcszType = "Disk"; break; 3812 } 3813 pelmThis->setAttribute("type", pcszType); 3814 pelmThis->setAttribute("maxMbPerSec", gr.cMaxMbPerSec); 3815 } 3816 } 3768 3817 } 3769 3818 … … 4007 4056 pelmDevice->setAttribute("device", att.lDevice); 4008 4057 4009 if (att. ulBandwidthLimit)4010 pelmDevice->setAttribute("bandwidth Limit", att.ulBandwidthLimit);4058 if (att.strBwGroup.length()) 4059 pelmDevice->setAttribute("bandwidthGroup", att.strBwGroup); 4011 4060 4012 4061 // attached image, if any … … 4325 4374 { 4326 4375 // VirtualBox 4.0 adds HD audio, CPU priorities, fault tolerance, 4327 // per-machine media registries, VRDE and JRockitVE.4376 // per-machine media registries, VRDE, JRockitVE and bandwidth gorups. 4328 4377 if ( hardwareMachine.audioAdapter.controllerType == AudioControllerType_HDA 4329 4378 || hardwareMachine.ulCpuExecutionCap != 100 … … 4338 4387 || !hardwareMachine.vrdeSettings.strAuthLibrary.isEmpty() 4339 4388 || machineUserData.strOsType == "JRockitVE" 4389 || hardwareMachine.ioSettings.llBandwidthGroups.size() 4340 4390 ) 4341 4391 m->sv = SettingsVersion_v1_11; … … 4437 4487 // Bandwidth limitations are new in VirtualBox 4.0 (1.11) 4438 4488 if ( (m->sv < SettingsVersion_v1_11) 4439 && (att. ulBandwidthLimit!= 0)4489 && (att.strBwGroup.length() != 0) 4440 4490 ) 4441 4491 { -
trunk/src/VBox/Main/xpcom/server.cpp
r33842 r34587 95 95 # include <ExtPackManagerImpl.h> 96 96 #endif 97 #include <BandwidthGroupImpl.h> 98 #include <BandwidthControlImpl.h> 97 99 98 100 /* implement nsISupports parts of our objects with support for nsIClassInfo */ … … 211 213 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ExtPackManager, IExtPackManager) 212 214 #endif 215 216 NS_DECL_CLASSINFO(BandwidthGroup) 217 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthGroup, IBandwidthGroup) 218 219 NS_DECL_CLASSINFO(BandwidthControl) 220 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(BandwidthControl, IBandwidthControl) 213 221 214 222 ////////////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.