libvirt: Enable driver configuring PMEM namespaces

Add one configuration option CONF.libvirt.pmem_namespaces:
"$LABEL:$NSNAME[|$NSNAME][,$LABEL:$NSNAME[|$NSNAME]]"

e.g. "128G:ns0|ns1|ns2|ns3,262144MB:ns4|ns5,MEDIUM:ns6|ns7"

Change-Id: I98e5ddbd7a9f2211a16221b5049bc36452a49a75
Partially-Implements: blueprint virtual-persistent-memory
Co-Authored-By: He Jie Xu <hejie.xu@intel.com>
This commit is contained in:
LuyaoZhong 2019-09-05 06:41:04 +00:00 committed by Eric Fried
parent 9b2e00e015
commit 0e4ca43311
3 changed files with 53 additions and 1 deletions

View File

@ -1335,6 +1335,32 @@ maximum number of retry attempts that can be made to discover the NVMe device.
"""),
]
libvirt_pmem_opts = [
cfg.ListOpt('pmem_namespaces',
item_type=cfg.types.String(),
default=[],
help="""
Configure persistent memory(pmem) namespaces.
These namespaces must have been already created on the host. This config
option is in the following format::
"$LABEL:$NSNAME[|$NSNAME][,$LABEL:$NSNAME[|$NSNAME]]"
* ``$NSNAME`` is the name of the pmem namespace.
* ``$LABEL`` represents one resource class, this is used to generate
the resource class name as ``CUSTOM_PMEM_NAMESPACE_$LABEL``.
For example::
[libvirt]
pmem_namespaces=128G:ns0|ns1|ns2|ns3,262144MB:ns4|ns5,MEDIUM:ns6|ns7
"""),
]
ALL_OPTS = list(itertools.chain(
libvirt_general_opts,
libvirt_imagebackend_opts,
@ -1354,6 +1380,7 @@ ALL_OPTS = list(itertools.chain(
libvirt_volume_vzstorage_opts,
libvirt_virtio_queue_sizes,
libvirt_volume_nvmeof_opts,
libvirt_pmem_opts,
))

View File

@ -435,7 +435,8 @@ class LibvirtDriver(driver.ComputeDriver):
self.cpu_models_mapping = {}
self.cpu_model_flag_mapping = {}
self._vpmems_by_name, self._vpmems_by_rc = self._discover_vpmems()
self._vpmems_by_name, self._vpmems_by_rc = self._discover_vpmems(
vpmem_conf=CONF.libvirt.pmem_namespaces)
def _discover_vpmems(self, vpmem_conf=None):
"""Discover vpmems on host and configuration.

View File

@ -0,0 +1,24 @@
---
features:
- |
The libvirt driver now supports booting instances with virtual persistent
memory (vPMEM), also called persistent memory (PMEM) namespaces.
To enable vPMEM support, the user should specify the PMEM namespaces
in the ``nova.conf`` by using the configuration option
``[libvirt]/pmem_namespaces``. For example::
[libvirt]
# pmem_namespaces=$LABEL:$NSNAME[|$NSNAME][,$LABEL:$NSNAME[|$NSNAME]]
pmem_namespaces = 128G:ns0|ns1|ns2|ns3,262144MB:ns4|ns5,MEDIUM:ns6|ns7
Only PMEM namespaces listed in the configuration file can be used by
instances. To identify the available PMEM namespaces on the host or create
new namespaces, the ``ndctl`` utility can be used::
ndctl create-namespace -m devdax -s $SIZE -M mem -n $NSNAME
Nova will invoke this utility to identify available PMEM namespaces.
Then users can specify vPMEM resources in a flavor by adding flavor's
extra specs::
openstack flavor set --property hw:pmem=6GB,64GB <flavor-id>