cli: --cputune: cleanup

This commit is contained in:
Hugues Fafard
2021-08-06 17:09:31 +02:00
committed by Cole Robinson
parent 5cfbbf5701
commit 95721ae8d7
2 changed files with 22 additions and 20 deletions

View File

@@ -2349,27 +2349,27 @@ class ParserCputune(VirtCLIParser):
remove_first = "model"
stub_none = False
def vcpu_find_inst_cb(self, *args, **kwargs):
def vcpupin_find_inst_cb(self, *args, **kwargs):
cliarg = "vcpupin" # vcpupin[0-9]*
list_propname = "vcpus"
list_propname = "vcpupins" # cputune.vcpupins
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def iothreadpin_find_inst_cb(self, *args, **kwargs):
cliarg = "iothreadpin" # iothreadpin[0-9]*
list_propname = "iothreadpin"
list_propname = "iothreadpins" # cputune.iothreadpins
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def vcpusched_find_inst_cb(self, *args, **kwargs):
cliarg = "vcpusched" # vcpusched[0-9]*
list_propname = "vcpusched"
list_propname = "vcpuscheds" # cputune.vcpuscheds
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
def cachetune_find_inst_cb(self, *args, **kwargs):
cliarg = "cachetune" # cachetune[0-9]*
list_propname = "cachetune"
list_propname = "cachetunes" # cputune.cachetunes
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
@@ -2384,7 +2384,7 @@ class ParserCputune(VirtCLIParser):
def memorytune_find_inst_cb(self, *args, **kwargs):
cliarg = "memorytune" # memorytune[0-9]*
list_propname = "memorytune"
list_propname = "memorytunes" # cputune.memorytunes
cb = self._make_find_inst_cb(cliarg, list_propname)
return cb(*args, **kwargs)
@@ -2413,9 +2413,9 @@ class ParserCputune(VirtCLIParser):
# Options for CPU.vcpus config
cls.add_arg("vcpupin[0-9]*.vcpu", "vcpu",
find_inst_cb=cls.vcpu_find_inst_cb)
find_inst_cb=cls.vcpupin_find_inst_cb)
cls.add_arg("vcpupin[0-9]*.cpuset", "cpuset", can_comma=True,
find_inst_cb=cls.vcpu_find_inst_cb)
find_inst_cb=cls.vcpupin_find_inst_cb)
cls.add_arg("emulatorpin.cpuset", "emulatorpin_cpuset", can_comma=True)
cls.add_arg("iothreadpin[0-9]*.iothread", "iothread",
find_inst_cb=cls.iothreadpin_find_inst_cb)

View File

@@ -6,6 +6,10 @@
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
###############
# CPU Pinning #
###############
class _VCPUPin(XMLBuilder):
"""
Class for generating <cputune> child <vcpupin> XML
@@ -91,12 +95,10 @@ class DomainCputune(XMLBuilder):
Class for generating <cpu> XML
"""
XML_NAME = "cputune"
_XML_PROP_ORDER = ["shares", "period", "quota",
"global_period", "global_quota",
"emulator_period", "emulator_quota",
"iothread_period", "iothread_quota",
"vcpus", "emulatorpin_cpuset", "iothreadpin",
"cachetune", "memorytune", "vcpusched"]
_XML_PROP_ORDER = ["shares", "period", "quota", "global_period", "global_quota",
"emulator_period", "emulator_quota", "iothread_period", "iothread_quota",
"vcpupins", "emulatorpin_cpuset", "iothreadpins",
"cachetunes", "memorytunes", "vcpuscheds"]
# Resource quotas
shares = XMLProperty("./shares", is_int=True)
@@ -109,10 +111,10 @@ class DomainCputune(XMLBuilder):
iothread_period = XMLProperty("./iothread_period", is_int=True)
iothread_quota = XMLProperty("./iothread_quota", is_int=True)
vcpus = XMLChildProperty(_VCPUPin)
iothreadpin = XMLChildProperty(_IOThreadPin)
cachetune = XMLChildProperty(_CacheTuneCPU)
memorytune = XMLChildProperty(_MemoryTuneCPU)
vcpusched = XMLChildProperty(_VCPUSched)
# CPU Pinning
vcpupins = XMLChildProperty(_VCPUPin)
emulatorpin_cpuset = XMLProperty("./emulatorpin/@cpuset")
iothreadpins = XMLChildProperty(_IOThreadPin)
cachetunes = XMLChildProperty(_CacheTuneCPU)
memorytunes = XMLChildProperty(_MemoryTuneCPU)
vcpuscheds = XMLChildProperty(_VCPUSched)