diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index fcbc43c2..85e19701 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -9,6 +9,12 @@
65536
65536
4
+
+
+
+
+
+
hvm
diff --git a/tests/clitest.py b/tests/clitest.py
index e5cafd18..fec91a43 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -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
diff --git a/tests/testdriver.xml b/tests/testdriver.xml
index ceb27a47..2a630ac2 100644
--- a/tests/testdriver.xml
+++ b/tests/testdriver.xml
@@ -132,6 +132,17 @@ Foo bar baz & yeah boii < > yeahfoo
restart
destroy
9
+
+
+
+
+
+
+
+
+
+
+
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 91f035ef..c7c9b2f6 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -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")
+ # 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 #
diff --git a/virtinst/domain/__init__.py b/virtinst/domain/__init__.py
index 69bd0431..f942ee59 100644
--- a/virtinst/domain/__init__.py
+++ b/virtinst/domain/__init__.py
@@ -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")]
diff --git a/virtinst/domain/vcpus.py b/virtinst/domain/vcpus.py
new file mode 100644
index 00000000..e45690e7
--- /dev/null
+++ b/virtinst/domain/vcpus.py
@@ -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 XML
+ """
+ XML_NAME = "vcpus"
+
+ vcpu = XMLChildProperty(_DomainVCPU)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index ea5a0080..5479d4e9 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -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)