Skip to content

Commit 95721ae

Browse files
Antagonymcrobinso
authored andcommitted
cli: --cputune: cleanup
1 parent 5cfbbf5 commit 95721ae

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

virtinst/cli.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,27 +2349,27 @@ class ParserCputune(VirtCLIParser):
23492349
remove_first = "model"
23502350
stub_none = False
23512351

2352-
def vcpu_find_inst_cb(self, *args, **kwargs):
2352+
def vcpupin_find_inst_cb(self, *args, **kwargs):
23532353
cliarg = "vcpupin" # vcpupin[0-9]*
2354-
list_propname = "vcpus"
2354+
list_propname = "vcpupins" # cputune.vcpupins
23552355
cb = self._make_find_inst_cb(cliarg, list_propname)
23562356
return cb(*args, **kwargs)
23572357

23582358
def iothreadpin_find_inst_cb(self, *args, **kwargs):
23592359
cliarg = "iothreadpin" # iothreadpin[0-9]*
2360-
list_propname = "iothreadpin"
2360+
list_propname = "iothreadpins" # cputune.iothreadpins
23612361
cb = self._make_find_inst_cb(cliarg, list_propname)
23622362
return cb(*args, **kwargs)
23632363

23642364
def vcpusched_find_inst_cb(self, *args, **kwargs):
23652365
cliarg = "vcpusched" # vcpusched[0-9]*
2366-
list_propname = "vcpusched"
2366+
list_propname = "vcpuscheds" # cputune.vcpuscheds
23672367
cb = self._make_find_inst_cb(cliarg, list_propname)
23682368
return cb(*args, **kwargs)
23692369

23702370
def cachetune_find_inst_cb(self, *args, **kwargs):
23712371
cliarg = "cachetune" # cachetune[0-9]*
2372-
list_propname = "cachetune"
2372+
list_propname = "cachetunes" # cputune.cachetunes
23732373
cb = self._make_find_inst_cb(cliarg, list_propname)
23742374
return cb(*args, **kwargs)
23752375

@@ -2384,7 +2384,7 @@ def cache_find_inst_cb(self, inst, *args, **kwargs):
23842384

23852385
def memorytune_find_inst_cb(self, *args, **kwargs):
23862386
cliarg = "memorytune" # memorytune[0-9]*
2387-
list_propname = "memorytune"
2387+
list_propname = "memorytunes" # cputune.memorytunes
23882388
cb = self._make_find_inst_cb(cliarg, list_propname)
23892389
return cb(*args, **kwargs)
23902390

@@ -2413,9 +2413,9 @@ def _init_class(cls, **kwargs):
24132413

24142414
# Options for CPU.vcpus config
24152415
cls.add_arg("vcpupin[0-9]*.vcpu", "vcpu",
2416-
find_inst_cb=cls.vcpu_find_inst_cb)
2416+
find_inst_cb=cls.vcpupin_find_inst_cb)
24172417
cls.add_arg("vcpupin[0-9]*.cpuset", "cpuset", can_comma=True,
2418-
find_inst_cb=cls.vcpu_find_inst_cb)
2418+
find_inst_cb=cls.vcpupin_find_inst_cb)
24192419
cls.add_arg("emulatorpin.cpuset", "emulatorpin_cpuset", can_comma=True)
24202420
cls.add_arg("iothreadpin[0-9]*.iothread", "iothread",
24212421
find_inst_cb=cls.iothreadpin_find_inst_cb)

virtinst/domain/cputune.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
77

88

9+
###############
10+
# CPU Pinning #
11+
###############
12+
913
class _VCPUPin(XMLBuilder):
1014
"""
1115
Class for generating <cputune> child <vcpupin> XML
@@ -91,12 +95,10 @@ class DomainCputune(XMLBuilder):
9195
Class for generating <cpu> XML
9296
"""
9397
XML_NAME = "cputune"
94-
_XML_PROP_ORDER = ["shares", "period", "quota",
95-
"global_period", "global_quota",
96-
"emulator_period", "emulator_quota",
97-
"iothread_period", "iothread_quota",
98-
"vcpus", "emulatorpin_cpuset", "iothreadpin",
99-
"cachetune", "memorytune", "vcpusched"]
98+
_XML_PROP_ORDER = ["shares", "period", "quota", "global_period", "global_quota",
99+
"emulator_period", "emulator_quota", "iothread_period", "iothread_quota",
100+
"vcpupins", "emulatorpin_cpuset", "iothreadpins",
101+
"cachetunes", "memorytunes", "vcpuscheds"]
100102

101103
# Resource quotas
102104
shares = XMLProperty("./shares", is_int=True)
@@ -109,10 +111,10 @@ class DomainCputune(XMLBuilder):
109111
iothread_period = XMLProperty("./iothread_period", is_int=True)
110112
iothread_quota = XMLProperty("./iothread_quota", is_int=True)
111113

112-
vcpus = XMLChildProperty(_VCPUPin)
113-
iothreadpin = XMLChildProperty(_IOThreadPin)
114-
cachetune = XMLChildProperty(_CacheTuneCPU)
115-
memorytune = XMLChildProperty(_MemoryTuneCPU)
116-
vcpusched = XMLChildProperty(_VCPUSched)
117-
114+
# CPU Pinning
115+
vcpupins = XMLChildProperty(_VCPUPin)
118116
emulatorpin_cpuset = XMLProperty("./emulatorpin/@cpuset")
117+
iothreadpins = XMLChildProperty(_IOThreadPin)
118+
cachetunes = XMLChildProperty(_CacheTuneCPU)
119+
memorytunes = XMLChildProperty(_MemoryTuneCPU)
120+
vcpuscheds = XMLChildProperty(_VCPUSched)

0 commit comments

Comments
 (0)