VirtualBox

source: vbox/trunk/src/VBox/Main/include/BandwidthGroupImpl.h@ 34587

Last change on this file since 34587 was 34587, checked in by vboxsync, 14 years ago

Main: Bandwidth groups for disks (and later network)

This introduces two new interfaces. The first one named IBandwidthGroup
represents one I/O limit and can be assigned to several mediums which
share this limit (which works only for harddisk images with the disabled
host cache).
The second one IBandwdithControl manages the groups and can create new ones
and destroy them if not required anymore.

VBoxManage: commands to access the bandwidth groups

Syntax:
VBoxManage storageattach <uuid|vmname>

...
--bandwidthgroup <name>

--bandwidthgroup assigns the specified device to the given group.

VBoxManage bandwidthctl <uuid|vmname>

--name <name>
--add disk|network
--limit <megabytes per second>
--delete

The --name parameter gives the name of the bandwidth group.
--add creates a new group of the given type (only disk is implemented so far)

with the given name.

--limit sets the limit to the given amount of MB/s

Note that limit can be changed while the VM is running. The VM
will immediately pick up the new limit for the given group name.

--delete deletes the group with the given name if it isn't used anymore.

Trying to delete a still used group will result in an error.

Example:

VBoxManage bandwidthctl "Test VM" --name Limit --add disk --limit 20
Creates a group named Test having a 20 MB/s limit.

VBoxManage storageattach "Test VM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium test.vdi --bandwidthgroup Limit
Adds a new disk to the SATA controller and assigns the bandwidth group Limit to it.

VBoxManage storageattach "Test VM" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium test.vdi --bandwidthgroup none
Removes the bandwidth limit from the disk.

VBoxManage bandwidthctl "Test VM" --name Limit --add disk --limit 10
Changes the limit of bandwidth group Limit to 10 MB/s. If the VM is running the limit will be picked up
immediately.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2009 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_BANDWIDTHGROUPIMPL
19#define ____H_BANDWIDTHGROUPIMPL
20
21#include "VirtualBoxBase.h"
22#include "BandwidthControlImpl.h"
23
24class ATL_NO_VTABLE BandwidthGroup :
25 public VirtualBoxBase,
26 VBOX_SCRIPTABLE_IMPL(IBandwidthGroup)
27{
28public:
29 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT(BandwidthGroup, IBandwidthGroup)
30
31 DECLARE_NOT_AGGREGATABLE(BandwidthGroup)
32
33 DECLARE_PROTECT_FINAL_CONSTRUCT()
34
35 BEGIN_COM_MAP(BandwidthGroup)
36 COM_INTERFACE_ENTRY(ISupportErrorInfo)
37 COM_INTERFACE_ENTRY(IBandwidthGroup)
38 COM_INTERFACE_ENTRY(IDispatch)
39 END_COM_MAP()
40
41 BandwidthGroup() { };
42 ~BandwidthGroup() { };
43
44 // public initializer/uninitializer for internal purposes only
45 HRESULT init(BandwidthControl *aParent,
46 const Utf8Str &aName,
47 BandwidthGroupType_T aType,
48 ULONG aMaxMbPerSec);
49 HRESULT init(BandwidthControl *aParent, BandwidthGroup *aThat, bool aReshare = false);
50 HRESULT initCopy(BandwidthControl *aParent, BandwidthGroup *aThat);
51 void uninit();
52
53 HRESULT FinalConstruct();
54 void FinalRelease();
55
56 STDMETHOD(COMGETTER(Name))(BSTR *aName);
57 STDMETHOD(COMGETTER(Type))(BandwidthGroupType_T *aType);
58 STDMETHOD(COMGETTER(Reference))(ULONG *aReferences);
59 STDMETHOD(COMGETTER(MaxMbPerSec))(ULONG *aMaxMbPerSec);
60 STDMETHOD(COMSETTER(MaxMbPerSec))(ULONG aMaxMbPerSec);
61
62 // public methods only for internal purposes
63 void rollback();
64 void commit();
65 void unshare();
66
67 const Utf8Str &getName() const;
68 BandwidthGroupType_T getType() const;
69 ULONG getMaxMbPerSec() const;
70 ULONG getReferences() const;
71
72 void reference();
73 void release();
74
75 ComObjPtr<BandwidthGroup> getPeer();
76
77private:
78 struct Data;
79 Data *m;
80};
81
82#endif // ____H_BANDWIDTHGROUPIMPL
83/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette