Fix nits from change I676291ec0faa1dea0bd5050ef8e3426d171de4c6
Change-Id: If6ea6701d73a4a8abb6a75c54308a386eec7a4b2 Implements: blueprint libvirt-file-backed-memory
This commit is contained in:
parent
88213a0352
commit
8566dcfef4
@ -1,5 +1,5 @@
|
||||
==================
|
||||
File backed memory
|
||||
File-backed memory
|
||||
==================
|
||||
|
||||
.. important::
|
||||
@ -7,7 +7,7 @@ File backed memory
|
||||
As of the 18.0.0 Rocky release, the functionality described below is
|
||||
only supported by the libvirt/KVM driver.
|
||||
|
||||
The file backed memory feature in Openstack allows a Nova node to serve guest
|
||||
The file-backed memory feature in Openstack allows a Nova node to serve guest
|
||||
memory from a file backing store. This mechanism uses the libvirt file memory
|
||||
source, causing guest instance memory to be allocated as files within the
|
||||
libvirt memory backing directory.
|
||||
@ -17,48 +17,46 @@ this feature works best when used with very fast block devices or virtual file
|
||||
systems - such as flash or RAM devices.
|
||||
|
||||
When configured, ``nova-compute`` will report the capacity configured for
|
||||
file backed memory to placement in place of the total system memory capacity.
|
||||
file-backed memory to placement in place of the total system memory capacity.
|
||||
This allows the node to run more instances than would normally fit
|
||||
within system memory.
|
||||
|
||||
To enable file backed memory, follow the steps below:
|
||||
To enable file-backed memory, follow the steps below:
|
||||
|
||||
#. `Configure the backing store`_
|
||||
|
||||
#. `Configure Nova Compute for file backed memory`_
|
||||
#. `Configure Nova Compute for file-backed memory`_
|
||||
|
||||
.. important::
|
||||
|
||||
It is not possible to live migrate from a node running a version of
|
||||
OpenStack that does not support file backed memory to a node with file
|
||||
OpenStack that does not support file-backed memory to a node with file
|
||||
backed memory enabled. It is recommended that all Nova compute nodes are
|
||||
upgraded to Rocky before enabling file backed memory.
|
||||
upgraded to Rocky before enabling file-backed memory.
|
||||
|
||||
Prerequisites and Limitations
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Libvirt
|
||||
File backed memory requires libvirt version 4.0.0 or newer
|
||||
File-backed memory requires libvirt version 4.0.0 or newer
|
||||
|
||||
Qemu
|
||||
File backed memory requires qemu version 2.6.0 or newer
|
||||
File-backed memory requires qemu version 2.6.0 or newer
|
||||
|
||||
Memory overcommit
|
||||
File backed memory is not compatible with memory overcommit.
|
||||
File-backed memory is not compatible with memory overcommit.
|
||||
``ram_allocation_ratio`` must be set to ``1.0`` in ``nova.conf``, and the
|
||||
host must not be added to a host aggregate with ``ram_allocation_ratio``
|
||||
set to anything but ``1.0``.
|
||||
|
||||
Huge pages
|
||||
File backed memory is not compatible with huge pages. Instances with huge
|
||||
pages configured will not start on a host with file backed memory enabled. It
|
||||
File-backed memory is not compatible with huge pages. Instances with huge
|
||||
pages configured will not start on a host with file-backed memory enabled. It
|
||||
is recommended to use host aggregates to ensure instances configured for
|
||||
huge pages are not placed on hosts with file backed memory configured
|
||||
huge pages are not placed on hosts with file-backed memory configured.
|
||||
|
||||
Handling these limitations could be optimized with a scheduler filter in the
|
||||
future
|
||||
|
||||
|
||||
future.
|
||||
|
||||
Configure the backing store
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
@ -95,12 +93,12 @@ store mounted at (or above) this location.
|
||||
|
||||
# mount /dev/sdb /var/lib/libvirt/qemu/ram
|
||||
|
||||
Configure Nova Compute for file backed memory
|
||||
Configure Nova Compute for file-backed memory
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#. Enable File backed memory in ``nova-compute``
|
||||
#. Enable File-backed memory in ``nova-compute``
|
||||
|
||||
Configure Nova to utilize file backed memory with the capacity of the
|
||||
Configure Nova to utilize file-backed memory with the capacity of the
|
||||
backing store in MiB. 1048576 MiB (1 TiB) is used in this example.
|
||||
|
||||
Edit ``/etc/nova/nova.conf``
|
||||
|
@ -56,8 +56,8 @@ Enabling huge pages on the host
|
||||
-------------------------------
|
||||
|
||||
.. important::
|
||||
Huge pages may not be used on a host configured for file backed memory. See
|
||||
`File backed memory`_ for details
|
||||
Huge pages may not be used on a host configured for file-backed memory. See
|
||||
:doc:`file-backed-memory` for details
|
||||
|
||||
Persistent huge pages are required owing to their guaranteed availability.
|
||||
However, persistent huge pages are not enabled by default in most environments.
|
||||
@ -240,4 +240,3 @@ guide.
|
||||
.. _`Linux THP guide`: https://www.kernel.org/doc/Documentation/vm/transhuge.txt
|
||||
.. _`Linux hugetlbfs guide`: https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
|
||||
.. _`Image metadata`: https://docs.openstack.org/image-guide/image-metadata.html
|
||||
.. _`File backed memory`: https://docs.openstack.org/nova/latest/admin/file-backed-memory.html
|
||||
|
@ -1476,6 +1476,7 @@ driver-impl-ironic=missing
|
||||
driver-impl-libvirt-vz-vm=complete
|
||||
driver-impl-libvirt-vz-ct=complete
|
||||
driver-impl-powervm=missing
|
||||
|
||||
[operation.file-backed-memory]
|
||||
title=File backed memory
|
||||
status=optional
|
||||
@ -1487,9 +1488,9 @@ notes=The file backed memory feature in Openstack allows a Nova node to serve
|
||||
cli=
|
||||
driver-impl-xenserver=missing
|
||||
driver-impl-libvirt-kvm-x86=complete
|
||||
driver-impl-libvirt-kvm-aarch64=complete
|
||||
driver-impl-libvirt-kvm-ppc64=complete
|
||||
driver-impl-libvirt-kvm-s390x=complete
|
||||
driver-impl-libvirt-kvm-aarch64=unknown
|
||||
driver-impl-libvirt-kvm-ppc64=unknown
|
||||
driver-impl-libvirt-kvm-s390x=unknown
|
||||
driver-impl-libvirt-qemu-x86=complete
|
||||
driver-impl-libvirt-lxc=missing
|
||||
driver-impl-libvirt-xen=missing
|
||||
|
@ -747,9 +747,9 @@ Default value '0' moves calculating amount of ports to libvirt.
|
||||
default=0,
|
||||
min=0,
|
||||
help="""
|
||||
Available capacity in MiB for file backed memory.
|
||||
Available capacity in MiB for file-backed memory.
|
||||
|
||||
Set to 0 to disable file backed memory.
|
||||
Set to 0 to disable file-backed memory.
|
||||
|
||||
When enabled, instances will create memory files in the directory specified
|
||||
in ``/etc/libvirt/qemu.conf``'s ``memory_backing_dir`` option. The default
|
||||
|
@ -239,7 +239,7 @@ class _TestLibvirtLiveMigrateData(object):
|
||||
data = lambda x: x['nova_object.data']
|
||||
|
||||
primitive = data(obj.obj_to_primitive())
|
||||
self.assertIn('serial_listen_addr', primitive)
|
||||
self.assertIn('dst_wants_file_backed_memory', primitive)
|
||||
primitive = data(obj.obj_to_primitive(target_version='1.0'))
|
||||
self.assertNotIn('target_connect_addr', primitive)
|
||||
self.assertNotIn('supported_perf_events', primitive)
|
||||
|
@ -1069,12 +1069,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
drvr.init_host("dummyhost")
|
||||
|
||||
@mock.patch.object(
|
||||
libvirt_driver.LibvirtDriver, "_check_file_backed_memory_support",)
|
||||
def test_file_backed_memory_support_called(self, mock_file_backed_support):
|
||||
def test_file_backed_memory_support_called(self):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
drvr.init_host("dummyhost")
|
||||
self.assertTrue(mock_file_backed_support.called)
|
||||
with mock.patch.object(drvr,
|
||||
'_check_file_backed_memory_support') as mock_check_fb_support:
|
||||
drvr.init_host("dummyhost")
|
||||
self.assertTrue(mock_check_fb_support.called)
|
||||
|
||||
@mock.patch.object(fakelibvirt.Connection, 'getLibVersion',
|
||||
return_value=versionutils.convert_version_to_int(
|
||||
|
@ -676,9 +676,7 @@ class HostTestCase(test.NoDBTestCase):
|
||||
self.assertEqual('one', self.host.get_memory_mb_total())
|
||||
|
||||
def test_get_memory_total_file_backed(self):
|
||||
self.flags(file_backed_memory=1048576,
|
||||
group="libvirt")
|
||||
|
||||
self.flags(file_backed_memory=1048576, group="libvirt")
|
||||
self.assertEqual(1048576, self.host.get_memory_mb_total())
|
||||
|
||||
def test_get_memory_used(self):
|
||||
|
@ -607,8 +607,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
'qemu': libvirt_utils.version_to_string(
|
||||
MIN_QEMU_FILE_BACKED_VERSION)})
|
||||
|
||||
# file backed memory doesn't work with memory overcommit.
|
||||
# Block service startup if file backed memory is enabled and
|
||||
# file-backed memory doesn't work with memory overcommit.
|
||||
# Block service startup if file-backed memory is enabled and
|
||||
# ram_allocation_ratio is not 1.0
|
||||
if CONF.ram_allocation_ratio != 1.0:
|
||||
raise exception.InternalError(
|
||||
@ -4713,7 +4713,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
wantsfilebacked = CONF.libvirt.file_backed_memory > 0
|
||||
|
||||
if wantsmempages and wantsfilebacked:
|
||||
# Can't use file backed memory with hugepages
|
||||
# Can't use file-backed memory with hugepages
|
||||
LOG.warning("Instance requested huge pages, but file-backed "
|
||||
"memory is enabled, and incompatible with huge pages")
|
||||
raise exception.MemoryPagesUnsupported()
|
||||
@ -6552,7 +6552,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||
"""
|
||||
|
||||
# TODO(zcornelius): Remove this check in Stein, as we'll only support
|
||||
# Rocky and newer computes.
|
||||
# Rocky and newer computes.
|
||||
# If file_backed_memory is enabled on this host, we have to make sure
|
||||
# the source is new enough to support it. Since the source generates
|
||||
# the XML for the destination, we depend on the source generating a
|
||||
|
@ -224,14 +224,14 @@ def _update_perf_events_xml(xml_doc, migrate_data):
|
||||
|
||||
|
||||
def _update_memory_backing_xml(xml_doc, migrate_data):
|
||||
"""Update libvirt domain XML for file backed memory
|
||||
"""Update libvirt domain XML for file-backed memory
|
||||
|
||||
If incoming XML has a memoryBacking element, remove access, source,
|
||||
and allocation children elements to get it to a known consistent state.
|
||||
|
||||
If no incoming memoryBacking element, create one.
|
||||
|
||||
If destination wants file backed memory, add source, access,
|
||||
If destination wants file-backed memory, add source, access,
|
||||
and allocation children.
|
||||
"""
|
||||
old_xml_has_memory_backing = True
|
||||
@ -248,7 +248,7 @@ def _update_memory_backing_xml(xml_doc, migrate_data):
|
||||
old_xml_has_memory_backing = False
|
||||
else:
|
||||
memory_backing = memory_backing[0]
|
||||
# Remove existing file backed memory tags, if they exist.
|
||||
# Remove existing file-backed memory tags, if they exist.
|
||||
for name in ("access", "source", "allocation"):
|
||||
tag = memory_backing.findall(name)
|
||||
if tag:
|
||||
|
Loading…
Reference in New Issue
Block a user