[virt-tools-list] [virt-manager PATCH] virt-install: add --partition support for resource partitioning
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Wed May 28 02:54:54 UTC 2014
This patch will enable setting resource partitioning configuration.
Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
man/virt-install.pod | 6 ++++++
.../cli-test-xml/compare/virt-xml-edit-simple-partition.xml | 10 ++++++++++
tests/clitest.py | 1 +
tests/xmlparse-xml/change-guest-out.xml | 3 +++
tests/xmlparse.py | 1 +
virtinst/cli.py | 13 +++++++++++++
virtinst/guest.py | 3 ++-
7 files changed, 36 insertions(+), 1 deletion(-)
create mode 100644 tests/cli-test-xml/compare/virt-xml-edit-simple-partition.xml
diff --git a/man/virt-install.pod b/man/virt-install.pod
index 8aa7ead..f1d44c2 100644
--- a/man/virt-install.pod
+++ b/man/virt-install.pod
@@ -129,6 +129,12 @@ Specify events values for the guest. Possible options include on_poweroff, on_re
Use --events=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsEvents>
+=item --partition=VAL
+
+Specify resource partitioning values for the guest.
+
+Use --partition=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#resPartition>
+
=item --vcpus=VCPUS[,maxvcpus=MAX][,sockets=#][,cores=#][,threads=#][,cpuset=CPUSET]
Number of virtual cpus to configure for the guest. If 'maxvcpus' is specified,
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-partition.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-partition.xml
new file mode 100644
index 0000000..10aded6
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-partition.xml
@@ -0,0 +1,10 @@
+ <address type="isa" iobase="0x505"/>
+ </panic>
+ </devices>
++ <resource>
++ <partition>/virtualmachines/production</partition>
++ </resource>
+ </domain>
+
+Domain 'test-many-devices' defined successfully.
+Changes will take effect after the next domain shutdown.
\ No newline at end of file
diff --git a/tests/clitest.py b/tests/clitest.py
index 95c7667..2b673ec 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -806,6 +806,7 @@ c.add_compare("""--metadata name=foo-my-new-name,uuid=12345678-12F4-1234-1234-12
new
very,very=new desc\\\'",title="This is my,funky=new title" """, "edit-simple-metadata")
c.add_compare("--events on_poweroff=destroy,on_reboot=restart,on_crash=preserve", "edit-simple-events")
+c.add_compare("--partition /virtualmachines/production", "edit-simple-partition")
c.add_compare("--memory 500,maxmemory=1000,hugepages=off", "edit-simple-memory")
c.add_compare("--vcpus 10,maxvcpus=20,cores=5,sockets=4,threads=1", "edit-simple-vcpus")
c.add_compare("--cpu model=pentium2,+x2apic,forbid=pbe", "edit-simple-cpu")
diff --git a/tests/xmlparse-xml/change-guest-out.xml b/tests/xmlparse-xml/change-guest-out.xml
index 5b1a12b..355578d 100644
--- a/tests/xmlparse-xml/change-guest-out.xml
+++ b/tests/xmlparse-xml/change-guest-out.xml
@@ -78,6 +78,9 @@
</seclabel>
<title>Hey title changed!</title>
<description>Hey desc changed&</description>
+ <resource>
+ <partition>/virtualmachines/production</partition>
+ </resource>
<memoryBacking>
<hugepages/>
<nosharepages/>
diff --git a/tests/xmlparse.py b/tests/xmlparse.py
index 980df27..f5390d2 100644
--- a/tests/xmlparse.py
+++ b/tests/xmlparse.py
@@ -114,6 +114,7 @@ class XMLParseTest(unittest.TestCase):
check("uuid", "12345678-1234-1234-1234-123456789012",
"11111111-2222-3333-4444-555555555555")
check("emulator", "/usr/lib/xen/bin/qemu-dm", "/usr/binnnn/fooemu")
+ check("partition", None, "/virtualmachines/production")
check("type", "kvm", "test")
check("bootloader", None, "pygrub")
check("on_poweroff", "destroy", "restart")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index a84cee8..180c2ed 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -798,6 +798,7 @@ def add_guest_xml_options(geng):
"--clock offset=localtime,rtc_tickpolicy=catchup"))
geng.add_argument("--pm", help=_("Config power management features"))
geng.add_argument("--events", help=_("Config OS lifecycle operation management features"))
+ geng.add_argument("--partition", help=_("Config OS resource partitioning features"))
def add_boot_options(insg):
@@ -1237,6 +1238,17 @@ class ParserEvents(VirtCLIParser):
self.set_param("on_crash", "on_crash")
+##########################
+# --partitioning parsing #
+##########################
+
+class ParserPartition(VirtCLIParser):
+ def _init_params(self):
+ self.remove_first = "partition"
+
+ self.set_param("partition", "partition")
+
+
######################
# --numatune parsing #
######################
@@ -2225,6 +2237,7 @@ def build_parser_map(options, skip=None, only=None):
register_parser("metadata", ParserMetadata)
register_parser("events", ParserEvents)
+ register_parser("partition", ParserPartition)
register_parser("memory", ParserMemory)
register_parser("memtune", ParserMemorytune)
register_parser("vcpus", ParserVCPU)
diff --git a/virtinst/guest.py b/virtinst/guest.py
index df43a5e..45b0713 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -92,7 +92,7 @@ class Guest(XMLBuilder):
_XML_ROOT_NAME = "domain"
- _XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
+ _XML_PROP_ORDER = ["type", "name", "uuid", "title", "description", "partition",
"maxmemory", "memory", "memoryBacking", "vcpus", "curvcpus", "memtune",
"numatune", "blkiotune", "bootloader", "os", "idmap", "features",
"cpu", "clock", "on_poweroff", "on_reboot", "on_crash", "pm",
@@ -184,6 +184,7 @@ class Guest(XMLBuilder):
default_cb=lambda s: "destroy")
on_reboot = XMLProperty("./on_reboot")
on_crash = XMLProperty("./on_crash")
+ partition = XMLProperty("./resource/partition")
os = XMLChildProperty(OSXML, is_single=True)
features = XMLChildProperty(DomainFeatures, is_single=True)
--
1.9.0
More information about the virt-tools-list
mailing list