VirtualBox

vbox的更動 34587 路徑 trunk/src/VBox/Main/xml


忽略:
時間撮記:
2010-12-1 下午08:30:02 (14 年 以前)
作者:
vboxsync
訊息:

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.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/xml/Settings.cpp

    r34574 r34587  
    16341634                  && (llGuestProperties         == h.llGuestProperties)
    16351635                  && (strNotificationPatterns   == h.strNotificationPatterns)
     1636                  && (ioSettings                == h.ioSettings)
    16361637                )
    16371638            );
     
    16521653                  && (uuid                      == a.uuid)
    16531654                  && (strHostDriveSrc           == a.strHostDriveSrc)
    1654                   && (ulBandwidthLimit          == a.ulBandwidthLimit)
     1655                  && (strBwGroup                == a.strBwGroup)
    16551656                )
    16561657           );
     
    26562657        else if (pelmHwChild->nameEquals("IO"))
    26572658        {
     2659            const xml::ElementNode *pelmBwGroups;
    26582660            const xml::ElementNode *pelmIoChild;
    26592661
     
    26622664                pelmIoChild->getAttributeValue("enabled", hw.ioSettings.fIoCacheEnabled);
    26632665                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                }
    26642694            }
    26652695        }
     
    28782908                    throw ConfigFileError(this, pelmImage, N_("Required AttachedDevice/@device attribute is missing"));
    28792909
    2880                 pelmAttached->getAttributeValue("bandwidthLimit", att.ulBandwidthLimit);
     2910                pelmAttached->getAttributeValue("bandwidthGroup", att.strBwGroup);
    28812911                sctl.llAttachedDevices.push_back(att);
    28822912            }
     
    37603790        xml::ElementNode *pelmIo = pelmHardware->createChild("IO");
    37613791        xml::ElementNode *pelmIoCache;
    3762         xml::ElementNode *pelmIoBandwidth;
    37633792
    37643793        pelmIoCache = pelmIo->createChild("IoCache");
    37653794        pelmIoCache->setAttribute("enabled", hw.ioSettings.fIoCacheEnabled);
    37663795        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        }
    37683817    }
    37693818
     
    40074056            pelmDevice->setAttribute("device", att.lDevice);
    40084057
    4009             if (att.ulBandwidthLimit)
    4010                 pelmDevice->setAttribute("bandwidthLimit", att.ulBandwidthLimit);
     4058            if (att.strBwGroup.length())
     4059                pelmDevice->setAttribute("bandwidthGroup", att.strBwGroup);
    40114060
    40124061            // attached image, if any
     
    43254374    {
    43264375        // 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.
    43284377        if (    hardwareMachine.audioAdapter.controllerType == AudioControllerType_HDA
    43294378             || hardwareMachine.ulCpuExecutionCap != 100
     
    43384387             || !hardwareMachine.vrdeSettings.strAuthLibrary.isEmpty()
    43394388             || machineUserData.strOsType == "JRockitVE"
     4389             || hardwareMachine.ioSettings.llBandwidthGroups.size()
    43404390           )
    43414391            m->sv = SettingsVersion_v1_11;
     
    44374487                // Bandwidth limitations are new in VirtualBox 4.0 (1.11)
    44384488                if (    (m->sv < SettingsVersion_v1_11)
    4439                      && (att.ulBandwidthLimit != 0)
     4489                     && (att.strBwGroup.length() != 0)
    44404490                   )
    44414491                {
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

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