mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
virt-install: Add --blkiotune option
This patch provides the ability to tune Blkio cgroup tunable parameters for the domain. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
parent
c23de0b181
commit
3be9dd3eb3
@ -151,6 +151,15 @@ mode.
|
||||
|
||||
Use --numatune=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsNUMATuning>
|
||||
|
||||
=item --blkiotune=WEIGHT,[device_path=DEVICE_PATH,device_weight=DEVICE_WEIGHT]
|
||||
|
||||
Tune blkio policy for the domain process. Example invocations
|
||||
|
||||
--blkiotune weight=100
|
||||
--blkiotune weight=100,device_path=/home/1.img,device_weight=200
|
||||
|
||||
Use --blkiotune=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsBlockTuning>
|
||||
|
||||
=item --cpu MODEL[,+feature][,-feature][,match=MATCH][,vendor=VENDOR]
|
||||
|
||||
Configure the CPU model and CPU features exposed to the guest. The only
|
||||
|
@ -465,6 +465,7 @@ c.add_valid("--cpu somemodel") # Simple --cpu
|
||||
c.add_valid("--cpu foobar,+x2apic,+x2apicagain,-distest,forbid=foo,forbid=bar,disable=distest2,optional=opttest,require=reqtest,match=strict,vendor=meee") # Crazy --cpu
|
||||
c.add_valid("--numatune 1,2,3,5-7,^6") # Simple --numatune
|
||||
c.add_valid("--numatune 1-3,4,mode=strict") # More complex, parser should do the right thing here
|
||||
c.add_valid("--blkiotune weight=100,device_path=/home/test/1.img,device_weight=200") # --blkiotune
|
||||
c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto") # --cpuset=auto actually works
|
||||
c.add_invalid("--vcpus 32 --cpuset=969-1000") # Bogus cpuset
|
||||
c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset
|
||||
|
@ -81,5 +81,12 @@
|
||||
<memoryBacking>
|
||||
<hugepages/>
|
||||
</memoryBacking>
|
||||
<blkiotune>
|
||||
<weight>200</weight>
|
||||
<device>
|
||||
<path>/home/1.img</path>
|
||||
<weight>300</weight>
|
||||
</device>
|
||||
</blkiotune>
|
||||
<bootloader>pygrub</bootloader>
|
||||
</domain>
|
||||
|
@ -192,6 +192,11 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("memory_mode", "interleave", "strict", None)
|
||||
check("memory_nodeset", "1-5,^3,7", "2,4,6")
|
||||
|
||||
check = self._make_checker(guest.blkiotune)
|
||||
check("weight", None, 100, 200)
|
||||
check("device_weight", None, 300)
|
||||
check("device_path", None, "/home/1.img")
|
||||
|
||||
check = self._make_checker(guest.get_devices("memballoon")[0])
|
||||
check("model", "virtio", "none")
|
||||
|
||||
|
@ -26,6 +26,7 @@ from virtinst import support
|
||||
from virtinst.osxml import OSXML
|
||||
from virtinst.domainfeatures import DomainFeatures
|
||||
from virtinst.domainnumatune import DomainNumatune
|
||||
from virtinst.domainblkiotune import DomainBlkiotune
|
||||
from virtinst.clock import Clock
|
||||
from virtinst.cpu import CPU, CPUFeature
|
||||
from virtinst.seclabel import Seclabel
|
||||
|
@ -703,6 +703,8 @@ def add_guest_xml_options(geng):
|
||||
help=_("Set domain security driver configuration."))
|
||||
geng.add_argument("--numatune",
|
||||
help=_("Tune NUMA policy for the domain process."))
|
||||
geng.add_argument("--blkiotune", action="append",
|
||||
help=_("Tune blkio policy for the domain process."))
|
||||
geng.add_argument("--features",
|
||||
help=_("Set domain <features> XML. Ex:\n"
|
||||
"--features acpi=off\n"
|
||||
@ -1879,6 +1881,17 @@ class ParserPanic(VirtCLIParser):
|
||||
self.set_param(None, "iobase", setter_cb=set_iobase_cb)
|
||||
|
||||
|
||||
#######################
|
||||
# --blkiotune parsing #
|
||||
#######################
|
||||
|
||||
class ParserBlkiotune(VirtCLIParser):
|
||||
def _init_params(self):
|
||||
self.set_param("blkiotune.weight", "weight")
|
||||
self.set_param("blkiotune.device_path", "device_path")
|
||||
self.set_param("blkiotune.device_weight", "device_weight")
|
||||
|
||||
|
||||
######################################################
|
||||
# --serial, --parallel, --channel, --console parsing #
|
||||
######################################################
|
||||
@ -2041,6 +2054,7 @@ def build_parser_map(options, skip=None, only=None):
|
||||
register_parser("vcpus", ParserVCPU)
|
||||
register_parser("cpu", ParserCPU)
|
||||
register_parser("numatune", ParserNumatune)
|
||||
register_parser("blkiotune", ParserBlkiotune)
|
||||
register_parser("boot", ParserBoot)
|
||||
register_parser("security", ParserSecurity)
|
||||
register_parser("features", ParserFeatures)
|
||||
|
33
virtinst/domainblkiotune.py
Normal file
33
virtinst/domainblkiotune.py
Normal file
@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright 2014 Fujitsu Limited.
|
||||
# Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainBlkiotune(XMLBuilder):
|
||||
"""
|
||||
Class for generating <blkiotune> XML
|
||||
"""
|
||||
|
||||
_XML_ROOT_NAME = "blkiotune"
|
||||
_XML_PROP_ORDER = ["weight", "device_path", "device_weight"]
|
||||
|
||||
weight = XMLProperty("./weight", is_int=True)
|
||||
device_path = XMLProperty("./device/path")
|
||||
device_weight = XMLProperty("./device/weight", is_int=True)
|
@ -35,6 +35,7 @@ from virtinst import Clock
|
||||
from virtinst import Seclabel
|
||||
from virtinst import CPU
|
||||
from virtinst import DomainNumatune
|
||||
from virtinst import DomainBlkiotune
|
||||
from virtinst import DomainFeatures
|
||||
from virtinst import PM
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
@ -90,7 +91,7 @@ class Guest(XMLBuilder):
|
||||
_XML_ROOT_NAME = "domain"
|
||||
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
||||
"maxmemory", "memory", "hugepage", "vcpus", "curvcpus",
|
||||
"numatune", "bootloader", "os", "features", "cpu", "clock",
|
||||
"numatune", "blkiotune", "bootloader", "os", "features", "cpu", "clock",
|
||||
"on_poweroff", "on_reboot", "on_crash", "pm", "emulator", "_devices",
|
||||
"seclabel"]
|
||||
|
||||
@ -188,6 +189,7 @@ class Guest(XMLBuilder):
|
||||
cpu = XMLChildProperty(CPU, is_single=True)
|
||||
numatune = XMLChildProperty(DomainNumatune, is_single=True)
|
||||
pm = XMLChildProperty(PM, is_single=True)
|
||||
blkiotune = XMLChildProperty(DomainBlkiotune, is_single=True)
|
||||
|
||||
|
||||
###############################
|
||||
|
Loading…
Reference in New Issue
Block a user