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>
|
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]
|
=item --cpu MODEL[,+feature][,-feature][,match=MATCH][,vendor=VENDOR]
|
||||||
|
|
||||||
Configure the CPU model and CPU features exposed to the guest. The only
|
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("--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,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("--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_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=969-1000") # Bogus cpuset
|
||||||
c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset
|
c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset
|
||||||
|
|
|
@ -81,5 +81,12 @@
|
||||||
<memoryBacking>
|
<memoryBacking>
|
||||||
<hugepages/>
|
<hugepages/>
|
||||||
</memoryBacking>
|
</memoryBacking>
|
||||||
|
<blkiotune>
|
||||||
|
<weight>200</weight>
|
||||||
|
<device>
|
||||||
|
<path>/home/1.img</path>
|
||||||
|
<weight>300</weight>
|
||||||
|
</device>
|
||||||
|
</blkiotune>
|
||||||
<bootloader>pygrub</bootloader>
|
<bootloader>pygrub</bootloader>
|
||||||
</domain>
|
</domain>
|
||||||
|
|
|
@ -192,6 +192,11 @@ class XMLParseTest(unittest.TestCase):
|
||||||
check("memory_mode", "interleave", "strict", None)
|
check("memory_mode", "interleave", "strict", None)
|
||||||
check("memory_nodeset", "1-5,^3,7", "2,4,6")
|
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 = self._make_checker(guest.get_devices("memballoon")[0])
|
||||||
check("model", "virtio", "none")
|
check("model", "virtio", "none")
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ from virtinst import support
|
||||||
from virtinst.osxml import OSXML
|
from virtinst.osxml import OSXML
|
||||||
from virtinst.domainfeatures import DomainFeatures
|
from virtinst.domainfeatures import DomainFeatures
|
||||||
from virtinst.domainnumatune import DomainNumatune
|
from virtinst.domainnumatune import DomainNumatune
|
||||||
|
from virtinst.domainblkiotune import DomainBlkiotune
|
||||||
from virtinst.clock import Clock
|
from virtinst.clock import Clock
|
||||||
from virtinst.cpu import CPU, CPUFeature
|
from virtinst.cpu import CPU, CPUFeature
|
||||||
from virtinst.seclabel import Seclabel
|
from virtinst.seclabel import Seclabel
|
||||||
|
|
|
@ -703,6 +703,8 @@ def add_guest_xml_options(geng):
|
||||||
help=_("Set domain security driver configuration."))
|
help=_("Set domain security driver configuration."))
|
||||||
geng.add_argument("--numatune",
|
geng.add_argument("--numatune",
|
||||||
help=_("Tune NUMA policy for the domain process."))
|
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",
|
geng.add_argument("--features",
|
||||||
help=_("Set domain <features> XML. Ex:\n"
|
help=_("Set domain <features> XML. Ex:\n"
|
||||||
"--features acpi=off\n"
|
"--features acpi=off\n"
|
||||||
|
@ -1879,6 +1881,17 @@ class ParserPanic(VirtCLIParser):
|
||||||
self.set_param(None, "iobase", setter_cb=set_iobase_cb)
|
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 #
|
# --serial, --parallel, --channel, --console parsing #
|
||||||
######################################################
|
######################################################
|
||||||
|
@ -2041,6 +2054,7 @@ def build_parser_map(options, skip=None, only=None):
|
||||||
register_parser("vcpus", ParserVCPU)
|
register_parser("vcpus", ParserVCPU)
|
||||||
register_parser("cpu", ParserCPU)
|
register_parser("cpu", ParserCPU)
|
||||||
register_parser("numatune", ParserNumatune)
|
register_parser("numatune", ParserNumatune)
|
||||||
|
register_parser("blkiotune", ParserBlkiotune)
|
||||||
register_parser("boot", ParserBoot)
|
register_parser("boot", ParserBoot)
|
||||||
register_parser("security", ParserSecurity)
|
register_parser("security", ParserSecurity)
|
||||||
register_parser("features", ParserFeatures)
|
register_parser("features", ParserFeatures)
|
||||||
|
|
|
@ -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 Seclabel
|
||||||
from virtinst import CPU
|
from virtinst import CPU
|
||||||
from virtinst import DomainNumatune
|
from virtinst import DomainNumatune
|
||||||
|
from virtinst import DomainBlkiotune
|
||||||
from virtinst import DomainFeatures
|
from virtinst import DomainFeatures
|
||||||
from virtinst import PM
|
from virtinst import PM
|
||||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
from virtinst.xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||||
|
@ -90,7 +91,7 @@ class Guest(XMLBuilder):
|
||||||
_XML_ROOT_NAME = "domain"
|
_XML_ROOT_NAME = "domain"
|
||||||
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
||||||
"maxmemory", "memory", "hugepage", "vcpus", "curvcpus",
|
"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",
|
"on_poweroff", "on_reboot", "on_crash", "pm", "emulator", "_devices",
|
||||||
"seclabel"]
|
"seclabel"]
|
||||||
|
|
||||||
|
@ -188,6 +189,7 @@ class Guest(XMLBuilder):
|
||||||
cpu = XMLChildProperty(CPU, is_single=True)
|
cpu = XMLChildProperty(CPU, is_single=True)
|
||||||
numatune = XMLChildProperty(DomainNumatune, is_single=True)
|
numatune = XMLChildProperty(DomainNumatune, is_single=True)
|
||||||
pm = XMLChildProperty(PM, is_single=True)
|
pm = XMLChildProperty(PM, is_single=True)
|
||||||
|
blkiotune = XMLChildProperty(DomainBlkiotune, is_single=True)
|
||||||
|
|
||||||
|
|
||||||
###############################
|
###############################
|
||||||
|
|
Loading…
Reference in New Issue