mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: introduce support for <maxMemory> element
This element controls hot(un)plugable memory for the guest in addition to the initial memory configured by <memory> element. One has to configure <maxMemory> and guest numa nodes using <numa> element to enable hot(un)plug of memory modules. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
07eecfdcc7
commit
3ebbeef80e
@ -93,8 +93,11 @@ running C<virt-install>.
|
||||
|
||||
=item B<--memory> OPTIONS
|
||||
|
||||
Memory to allocate for the guest, in MiB. Sub options are available,
|
||||
like 'maxmemory' and 'hugepages'. This deprecates the -r/--ram option.
|
||||
Memory to allocate for the guest, in MiB. This deprecates the -r/--ram option.
|
||||
Sub options are available, like 'maxmemory', 'hugepages', 'hotplugmemorymax'
|
||||
and 'hotplugmemoryslots'. The memory parameter is mapped to <currentMemory> element,
|
||||
the 'maxmemory' sub-option is mapped to <memory> element and 'hotplugmemorymax'
|
||||
and 'hotplugmemoryslots' are mapped to <maxMemory> element.
|
||||
|
||||
Use --memory=? to see a list of all available sub options. Complete details at L<http://libvirt.org/formatdomain.html#elementsMemoryAllocation>
|
||||
|
||||
|
43
tests/cli-test-xml/compare/virt-install-memory-hotplug.xml
Normal file
43
tests/cli-test-xml/compare/virt-install-memory-hotplug.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<domain type="test">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<maxMemory slots="2">2097152</maxMemory>
|
||||
<memory>1048576</memory>
|
||||
<currentMemory>1048576</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<pae/>
|
||||
</features>
|
||||
<cpu>
|
||||
<numa>
|
||||
<cell cpus="0" memory="1048576"/>
|
||||
</numa>
|
||||
</cpu>
|
||||
<clock offset="utc"/>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/test-hv</emulator>
|
||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
||||
<controller type="usb" index="0" model="ich9-uhci1">
|
||||
<master startport="0"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci2">
|
||||
<master startport="2"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<console type="pty"/>
|
||||
</devices>
|
||||
</domain>
|
@ -552,6 +552,13 @@ c.add_compare(""" \
|
||||
""", "spice-gl", compare_check=support.SUPPORT_CONN_VMPORT)
|
||||
|
||||
|
||||
######################################
|
||||
# Memory hot(un)plug install options #
|
||||
######################################
|
||||
|
||||
c = vinst.add_category("memory-hotplug", "--nographics --noautoconsole --import --disk none")
|
||||
c.add_compare("--memory 1024,hotplugmemorymax=2048,hotplugmemoryslots=2 --cpu cell0.cpus=0,cell0.memory=1048576", "memory-hotplug")
|
||||
|
||||
|
||||
####################################################
|
||||
# CPU/RAM/numa and other singleton VM config tests #
|
||||
|
@ -595,7 +595,9 @@ def add_memory_option(grp, backcompat=False):
|
||||
grp.add_argument("--memory",
|
||||
help=_("Configure guest memory allocation. Ex:\n"
|
||||
"--memory 1024 (in MiB)\n"
|
||||
"--memory 512,maxmemory=1024"))
|
||||
"--memory 512,maxmemory=1024\n"
|
||||
"--memory 512,maxmemory=1024,hotplugmemorymax=2048,"
|
||||
"hotplugmemoryslots=2"))
|
||||
if backcompat:
|
||||
grp.add_argument("-r", "--ram", type=int, dest="oldmemory",
|
||||
help=argparse.SUPPRESS)
|
||||
@ -1351,6 +1353,9 @@ _register_virt_parser(ParserMemory)
|
||||
ParserMemory.add_arg("memory", "memory", cb=ParserMemory.set_memory_cb)
|
||||
ParserMemory.add_arg("maxmemory", "maxmemory", cb=ParserMemory.set_memory_cb)
|
||||
ParserMemory.add_arg("memoryBacking.hugepages", "hugepages", is_onoff=True)
|
||||
ParserMemory.add_arg("hotplugmemorymax", "hotplugmemorymax",
|
||||
cb=ParserMemory.set_memory_cb)
|
||||
ParserMemory.add_arg("hotplugmemoryslots", "hotplugmemoryslots")
|
||||
|
||||
|
||||
#####################
|
||||
|
@ -105,9 +105,9 @@ class Guest(XMLBuilder):
|
||||
|
||||
_XML_ROOT_NAME = "domain"
|
||||
_XML_PROP_ORDER = ["type", "name", "uuid", "title", "description",
|
||||
"maxmemory", "memory", "blkiotune", "memtune", "memoryBacking",
|
||||
"vcpus", "curvcpus", "vcpu_placement", "cpuset",
|
||||
"numatune", "resource", "sysinfo", "bootloader", "os", "idmap",
|
||||
"hotplugmemorymax", "hotplugmemoryslots", "maxmemory", "memory", "blkiotune",
|
||||
"memtune", "memoryBacking", "vcpus", "curvcpus", "vcpu_placement",
|
||||
"cpuset", "numatune", "resource", "sysinfo", "bootloader", "os", "idmap",
|
||||
"features", "cpu", "clock", "on_poweroff", "on_reboot", "on_crash",
|
||||
"pm", "emulator", "_devices", "seclabels"]
|
||||
|
||||
@ -163,6 +163,8 @@ class Guest(XMLBuilder):
|
||||
default_cb=lambda s: 1,
|
||||
set_converter=_set_memory)
|
||||
maxmemory = XMLProperty("./memory", is_int=True)
|
||||
hotplugmemorymax = XMLProperty("./maxMemory", is_int=True)
|
||||
hotplugmemoryslots = XMLProperty("./maxMemory/@slots", is_int=True)
|
||||
|
||||
def _set_vcpus(self, val):
|
||||
if val is None:
|
||||
|
Loading…
Reference in New Issue
Block a user