Merge "Add nova file_backed_memory and memory_backing_dir support for qemu.conf"

This commit is contained in:
Zuul 2018-10-19 18:55:40 +00:00 committed by Gerrit Code Review
commit 319da5f77e
4 changed files with 86 additions and 0 deletions

View File

@ -125,6 +125,14 @@ parameters:
type: string
tags:
- role_specific
QemuMemoryBackingDir:
type: string
description: >
Directory used for memoryBacking source if configured as file.
NOTE: big files will be stored here
default: ''
tags:
- role_specific
conditions:
@ -165,6 +173,11 @@ conditions:
- {get_param: LibvirtVncCACert}
- ''
memory_backing_dir_set:
not:
equals:
- {get_param: QemuMemoryBackingDir}
- ''
resources:
RoleParametersValue:
@ -175,9 +188,11 @@ resources:
map_replace:
- map_replace:
- vhostuser_socket_group: VhostuserSocketGroup
memory_backing_dir: QemuMemoryBackingDir
- values: {get_param: [RoleParameters]}
- values:
VhostuserSocketGroup: {get_param: VhostuserSocketGroup}
QemuMemoryBackingDir: {get_param: QemuMemoryBackingDir}
ContainersCommon:
@ -362,6 +377,15 @@ outputs:
- get_param: LibvirtVncCACert
- /etc/pki/libvirt-vnc:/var/lib/kolla/config_files/src-libvirt-vnc-pki:ro
- null
-
if:
- memory_backing_dir_set
-
- str_replace:
template: "MEMORY_BACKING_DIR:MEMORY_BACKING_DIR"
params:
MEMORY_BACKING_DIR: {get_attr: [RoleParametersValue, value, memory_backing_dir]}
- null
environment:
- KOLLA_CONFIG_STRATEGY=COPY_ALWAYS
step_4:

View File

@ -189,6 +189,13 @@ parameters:
- allowed_values: [ 256, 512, 1024 ]
tags:
- role_specific
NovaLibvirtFileBackedMemory:
description: >
Available capacity in MiB for file-backed memory.
default: 0
type: number
tags:
- role_specific
conditions:
enable_live_migration_tunnelled:
@ -196,6 +203,12 @@ conditions:
- equals: [{get_param: NovaNfsEnabled}, true]
- equals: [{get_param: NovaEnableRbdBackend}, true]
libvirt_file_backed_memory_enabled:
not:
or:
- equals: [{get_param: NovaLibvirtFileBackedMemory}, '']
- equals: [{get_param: NovaLibvirtFileBackedMemory}, 0]
resources:
NovaBase:
type: ./nova-base.yaml
@ -224,6 +237,7 @@ resources:
nova::compute::resume_guests_state_on_host_boot: NovaResumeGuestsStateOnHostBoot
nova::compute::libvirt::rx_queue_size: NovaLibvirtRxQueueSize
nova::compute::libvirt::tx_queue_size: NovaLibvirtTxQueueSize
nova::compute::libvirt::file_backed_memory: NovaLibvirtFileBackedMemory
- values: {get_param: [RoleParameters]}
- values:
NovaVcpuPinSet: {get_param: NovaVcpuPinSet}
@ -234,6 +248,7 @@ resources:
NovaResumeGuestsStateOnHostBoot: {get_param: NovaResumeGuestsStateOnHostBoot}
NovaLibvirtRxQueueSize: {get_param: NovaLibvirtRxQueueSize}
NovaLibvirtTxQueueSize: {get_param: NovaLibvirtTxQueueSize}
NovaLibvirtFileBackedMemory: {get_param: NovaLibvirtFileBackedMemory}
outputs:
role_data:
@ -313,6 +328,12 @@ outputs:
nova::vncproxy::common::vncproxy_host: {get_param: [EndpointMap, NovaVNCProxyPublic, host_nobrackets]}
nova::vncproxy::common::vncproxy_port: {get_param: [EndpointMap, NovaVNCProxyPublic, port]}
nova::compute::verify_glance_signatures: {get_param: [VerifyGlanceSignatures]}
# if libvirt_file_backed_memory_enabled we have to set ram_allocation_ratio to 1.0
nova::ram_allocation_ratio:
if:
- libvirt_file_backed_memory_enabled
- '1.0'
- null
step_config: |
# TODO(emilien): figure how to deal with libvirt profile.
# We'll probably treat it like we do with Neutron plugins.

View File

@ -130,6 +130,14 @@ parameters:
description: The password for the libvirt service when TLS is enabled
type: string
hidden: true
QemuMemoryBackingDir:
type: string
description: >
Directory used for memoryBacking source if configured as file.
NOTE: big files will be stored here
default: ''
tags:
- role_specific
conditions:
@ -173,6 +181,20 @@ resources:
RoleName: {get_param: RoleName}
RoleParameters: {get_param: RoleParameters}
# Merging role-specific parameters (RoleParameters) with the default parameters.
# RoleParameters will have the precedence over the default parameters.
RoleParametersValue:
type: OS::Heat::Value
properties:
type: json
value:
map_replace:
- map_replace:
- nova::compute::libvirt::qemu::memory_backing_dir: QemuMemoryBackingDir
- values: {get_param: [RoleParameters]}
- values:
QemuMemoryBackingDir: {get_param: QemuMemoryBackingDir}
outputs:
role_data:
description: Role data for the Libvirt service.
@ -182,6 +204,7 @@ outputs:
config_settings:
map_merge:
- get_attr: [NovaBase, role_data, config_settings]
- get_attr: [RoleParametersValue, value]
# we include ::nova::compute::libvirt::services in nova/libvirt profile
- nova::compute::libvirt::manage_libvirt_services: false
# we manage migration in nova common puppet profile

View File

@ -0,0 +1,18 @@
---
features:
- |
Add nova file_backed_memory and memory_backing_dir support for qemu.conf
The libvirt driver now allows utilizing file backed memory for qemu/KVM
virtual machines, via a new configuration attribute
``[libvirt]/file_backed_memory``, defaulting to 0 (disabled).
``[libvirt]/file_backed_memory`` specifies the available capacity in MiB
for file backed memory, at the directory configured for
``memory_backing_dir`` in libvirt's ``qemu.conf``. When enabled, the
libvirt driver will report the configured value for the total memory
capacity of the node, and will report used memory as the sum of all
configured guest memory.
Running Nova with file_backed_memory requires libvirt version 4.0.0 and
qemu version 2.6.0