enabling per node filtering of mempage sizes

Registered by sean mooney

For certain workloads how a guest memory is allocated can be an important
factor for performance or security reasons. In some scenarios implementation
constraints may require the use of large pages for all guests on a node. This
blueprint extends nova to allow operators declare what page sizes may be
consumed on a particular compute node.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
sean mooney
Direction:
Needs approval
Assignee:
sean mooney
Definition:
Obsolete
Series goal:
None
Implementation:
Unknown
Milestone target:
None
Completed by
sean mooney

Related branches

Sprints

Whiteboard

Problem description
===================

In the Kilo cycle, the virt drivers large pages feature[1] is introduced
to allow a guest to request the type of memory backing that they desire
via a flavor or image metadata.

In certain configurations, it may be desired or required to filter the
memory pages available to vms booted on a node. At present no mechanism
exists to allow filtering of reported memory pages.

Use Cases
----------

On a host that only supports vhost-user or ivshmem,
all vms are required to use large page memory.
If a vm is booted with standard pages with these interfaces,
network connectivity will not available.

In this case it is desirable to filter out small/4k pages when reporting
available memory to the scheduler.

Proposed change
===============

This blueprint proposes adding a new config variable (allowed_memory_pagesize)
to the libvirt section of the nova.conf.

cfg.ListOpt('allowed_memory_pagesize',
                default=['any'],
                help='List of allowed memory page sizes'
                     'Syntax is SizeA,SizeB e.g. small,large'
                     'valid sizes are: small,large,any,4,2048,1048576')

The _get_host_capabilities function in nova/nova/virt/libvirt/driver.py
will be modified to filter the mempages reported for each cell based on the
value of CONF.libvirt.allowed_memory_pagesize

If small is set then only 4k pages will be reported.
If large is set 2MB and 1GB will be reported.
If any is set no filtering will be applied.

The default value of "any" was chosen to ensure that this change has no effect on
existing deployment.

References
==========
[1] - https://blueprints.launchpad.net/nova/+spec/virt-driver-large-pages

alternative
========
a new filter (AggregateMemoryBackingFilter) can be introduced

The AggregateMemoryBackingFilter would work as follows.
The AggregateMemoryBackingFilter will compare the extra specifications associated with the instance and enforces the constraints set in the aggregate metadata.

A new MemoryBacking attribute will be added to the aggregate metadata.
The MemoryBacking attribute can be set to 1 or more of the flowing: small,large,4,2048,1048576 Syntax is SizeA,SizeB e.g. 2048,1048576

If small is set then host will only be passed if the vm requests small or 4k pages.
If large is set then host will only be passed if the vm requests 2MB or 1GB.
If the MemoryBacking element is not set for an aggregate the AggregateMemoryBackingFilter will pass all hosts

If this alternative is preferred I will resubmit as a new blueprint and mark this as superseded.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.