cli: --vcpus: add vcpus.vcpu[0-9]* config
This adds the following suboptions to configure the <domain><vcpus> list: - vcpus.vcpu[0-9]*.id - vcpus.vcpu[0-9]*.enabled - vcpus.vcpu[0-9]*.hotpluggable - vcpus.vcpu[0-9]*.order
This commit is contained in:
parent
908faaffee
commit
334d18ab93
|
@ -9,6 +9,12 @@
|
|||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu placement="static">4</vcpu>
|
||||
<vcpus>
|
||||
<vcpu id="3" enabled="yes" order="3"/>
|
||||
<vcpu id="2" enabled="yes"/>
|
||||
<vcpu id="0" enabled="no"/>
|
||||
<vcpu id="1" enabled="yes" hotpluggable="no"/>
|
||||
</vcpus>
|
||||
<os>
|
||||
<type arch="x86_64" machine="q35">hvm</type>
|
||||
</os>
|
||||
|
|
|
@ -483,7 +483,11 @@ cache.mode=emulate,cache.level=3
|
|||
# Device testing #1
|
||||
|
||||
c.add_compare("""
|
||||
--vcpus 4,cores=1,placement=static
|
||||
--vcpus 4,cores=1,placement=static,\
|
||||
vcpus.vcpu2.id=0,vcpus.vcpu2.enabled=no,\
|
||||
vcpus.vcpu3.id=1,vcpus.vcpu3.hotpluggable=no,vcpus.vcpu3.enabled=yes,\
|
||||
vcpus.vcpu.id=3,vcpus.vcpu0.enabled=yes,vcpus.vcpu0.order=3,\
|
||||
vcpus.vcpu1.id=2,vcpus.vcpu1.enabled=yes
|
||||
--cpu none
|
||||
|
||||
--disk /dev/default-pool/UPPER,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,boot_order=2
|
||||
|
|
|
@ -132,6 +132,17 @@ Foo bar baz & yeah boii < > yeahfoo
|
|||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<vcpu cpuset="1,2,5-9,11,13-14">9</vcpu>
|
||||
<vcpus>
|
||||
<vcpu id='0' enabled='no' hotpluggable='yes' order='1'/>
|
||||
<vcpu id='1' enabled='yes' hotpluggable='no'/>
|
||||
<vcpu id='2' enabled='no' hotpluggable='yes' order='2'/>
|
||||
<vcpu id='3' enabled='yes' hotpluggable='no'/>
|
||||
<vcpu id='4' enabled='no' hotpluggable='yes'/>
|
||||
<vcpu id='5' enabled='yes' hotpluggable='no'/>
|
||||
<vcpu id='6' enabled='no' hotpluggable='yes'/>
|
||||
<vcpu id='7' enabled='yes' hotpluggable='no'/>
|
||||
<vcpu id='8' enabled='yes' hotpluggable='no'/>
|
||||
</vcpus>
|
||||
<numatune>
|
||||
<memory mode='interleave' placement='auto'/>
|
||||
</numatune>
|
||||
|
|
|
@ -1968,6 +1968,12 @@ class ParserVCPU(VirtCLIParser):
|
|||
# Option handling #
|
||||
###################
|
||||
|
||||
def vcpu_find_inst_cb(self, *args, **kwargs):
|
||||
cliarg = "vcpu" # vcpu[0-9]*
|
||||
list_propname = "vcpulist.vcpu" # guest.vcpulist.vcpu
|
||||
cb = self._make_find_inst_cb(cliarg, list_propname)
|
||||
return cb(*args, **kwargs)
|
||||
|
||||
def set_cpuset_cb(self, inst, val, virtarg):
|
||||
if not val:
|
||||
return
|
||||
|
@ -2002,6 +2008,16 @@ class ParserVCPU(VirtCLIParser):
|
|||
can_comma=True, cb=cls.set_cpuset_cb)
|
||||
cls.add_arg("vcpu.placement", "vcpu_placement")
|
||||
|
||||
# <domain><vcpus> options
|
||||
cls.add_arg("vcpus.vcpu[0-9]*.id", "id",
|
||||
find_inst_cb=cls.vcpu_find_inst_cb)
|
||||
cls.add_arg("vcpus.vcpu[0-9]*.enabled", "enabled",
|
||||
find_inst_cb=cls.vcpu_find_inst_cb, is_onoff=True)
|
||||
cls.add_arg("vcpus.vcpu[0-9]*.hotpluggable", "hotpluggable",
|
||||
find_inst_cb=cls.vcpu_find_inst_cb, is_onoff=True)
|
||||
cls.add_arg("vcpus.vcpu[0-9]*.order", "order",
|
||||
find_inst_cb=cls.vcpu_find_inst_cb)
|
||||
|
||||
|
||||
##################
|
||||
# --boot parsing #
|
||||
|
|
|
@ -17,6 +17,7 @@ from .pm import DomainPm
|
|||
from .resource import DomainResource
|
||||
from .seclabel import DomainSeclabel
|
||||
from .sysinfo import DomainSysinfo
|
||||
from .vcpus import DomainVCPUs
|
||||
from .xmlnsqemu import DomainXMLNSQemu
|
||||
|
||||
__all__ = [l for l in locals() if l.startswith("Domain")]
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# Copyright 2019 Red Hat, Inc.
|
||||
#
|
||||
# This work is licensed under the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
class _DomainVCPU(XMLBuilder):
|
||||
XML_NAME = "vcpu"
|
||||
_XML_PROP_ORDER = ["id", "enabled", "hotpluggable", "order"]
|
||||
|
||||
id = XMLProperty("./@id", is_int=True)
|
||||
enabled = XMLProperty("./@enabled", is_yesno=True)
|
||||
hotpluggable = XMLProperty("./@hotpluggable", is_yesno=True)
|
||||
order = XMLProperty("./@order", is_int=True)
|
||||
|
||||
|
||||
class DomainVCPUs(XMLBuilder):
|
||||
"""
|
||||
Class for generating <vcpus> XML
|
||||
"""
|
||||
XML_NAME = "vcpus"
|
||||
|
||||
vcpu = XMLChildProperty(_DomainVCPU)
|
|
@ -149,7 +149,7 @@ class Guest(XMLBuilder):
|
|||
"maxMemory", "maxMemorySlots", "memory", "_currentMemory",
|
||||
"blkiotune", "memtune", "memoryBacking",
|
||||
"_vcpus", "vcpu_current", "vcpu_placement",
|
||||
"vcpu_cpuset", "numatune", "resource", "sysinfo",
|
||||
"vcpu_cpuset", "vcpulist", "numatune", "resource", "sysinfo",
|
||||
"bootloader", "os", "idmap", "features", "cpu", "clock",
|
||||
"on_poweroff", "on_reboot", "on_crash",
|
||||
"pm", "emulator", "devices", "seclabels"]
|
||||
|
@ -225,6 +225,7 @@ class Guest(XMLBuilder):
|
|||
on_crash = XMLProperty("./on_crash")
|
||||
on_lockfailure = XMLProperty("./on_lockfailure")
|
||||
|
||||
vcpulist = XMLChildProperty(DomainVCPUs, is_single=True)
|
||||
seclabels = XMLChildProperty(DomainSeclabel)
|
||||
os = XMLChildProperty(DomainOs, is_single=True)
|
||||
features = XMLChildProperty(DomainFeatures, is_single=True)
|
||||
|
|
Loading…
Reference in New Issue