add memory quota in flavor extra specs

Registered by LiangChen

Currently nova has supportted setting cpu quota.I think we should support setting memory QOS too.
we could use libvirt's parameter "memtune" to implement it.
<memtune>
    <hard_limit unit='G'>1</hard_limit>
    <soft_limit unit='M'>128</soft_limit>
    <swap_hard_limit unit='G'>2</swap_hard_limit>
    <min_guarantee unit='bytes'>67108864</min_guarantee>
  </memtune>

memtune has the following options:
hard_limit - The optional hard_limit element is the maximum memory the guest virtual machine can use.
soft_limit - The optional soft_limit element is the memory limit to enforce during memory contention.
swap_hard_limit - The optional swap_hard_limit element is the maximum memory plus swap the guest virtual machine can use. This has to be more than hard_limit value provided
min_guarantee - The optional min_guarantee element is the guaranteed minimum memory allocation for the guest virtual machine.

Like function _format_cputune in config.py,we can add _format_memtune with value mem_reverse and mem_limit.
quota:mem_reverse
quota:mem_limit

The mem_reverse uses for setting the virtual machine caps memory.
The mem_limit uses for setting the virtual machine limit memory.

The KVM is support limit,it is not support 'min_guarantee' yet.

Blueprint information

Status:
Started
Approver:
None
Priority:
Undefined
Drafter:
LiangChen
Direction:
Needs approval
Assignee:
Xurong Yang
Definition:
Drafting
Series goal:
None
Implementation:
Started
Milestone target:
None
Started by
LiangChen

Related branches

Sprints

Whiteboard

Removed from next, as next is now reserved for near misses from the last milestone --johnthetubaguyRemoved from next, as next is now reserved for near misses from the last milestone --johnthetubaguy

If you are still working on this, please re-submit via nova-specs. If not, please mark as obsolete, and add a quick comment to describe why. --johnthetubaguy (20th April 2014)

Gerrit topic: https://review.openstack.org/#q,topic:bp/flavor-quota-memory,n,z

Addressed by: https://review.openstack.org/86600
    Add memory quota support for libvirt

Spec abandoned, un-targeting blueprint from juno-1 --johnthetubaguy (28th May 2014)

Based on the rules about BP for kilo,I don't think this feature need a spec, this feature is straightforward enough and not api change, it relate to another implemented bp(quota-instance-resource), can we review with no spce?--lizheming(11th Dec 2014)

Gerrit topic: https://review.openstack.org/#q,topic:bp/quota-instance-resource,n,z

Addressed by: https://review.openstack.org/141736
    Add support for instance Mem consumption control

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.