
This patch checks the number os memory slots needed in PowerPC and raises an error if > 32, or set it to 32. Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo@linux.vnet.ibm.com> --- src/wok/plugins/kimchi/model/vms.py | 8 ++++++++ src/wok/plugins/kimchi/vmtemplate.py | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/wok/plugins/kimchi/model/vms.py b/src/wok/plugins/kimchi/model/vms.py index af9a537..9ddeaf2 100644 --- a/src/wok/plugins/kimchi/model/vms.py +++ b/src/wok/plugins/kimchi/model/vms.py @@ -827,6 +827,10 @@ class VMModel(object): int(maxMem.text) != (host_mem << 10): force_max_mem_update = True + # max 32 slots on Power + if slots > 32: + slots = 32 + if maxMem is None: max_mem_xml = E.maxMemory( str(host_mem * 1024), @@ -885,6 +889,10 @@ class VMModel(object): # New memory value is same that current memory set return + distro, _, _ = platform.linux_distribution() + if distro == "IBM_PowerKVM" and needed_slots > 32: + raise OperationFailed('KCHVM0045E') + # Finally, we are ok to hot add the memory devices try: self._hot_add_memory_devices(dom, needed_slots) diff --git a/src/wok/plugins/kimchi/vmtemplate.py b/src/wok/plugins/kimchi/vmtemplate.py index 283d94d..d653665 100644 --- a/src/wok/plugins/kimchi/vmtemplate.py +++ b/src/wok/plugins/kimchi/vmtemplate.py @@ -18,6 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA import os +import platform import stat import time import urlparse @@ -328,13 +329,18 @@ class VMTemplate(object): # Setting maximum number of slots to avoid errors when hotplug memory # Number of slots are the numbers of chunks of 1GB that fit inside - # the max_memory of the host minus memory assigned to the VM + # the max_memory of the host minus memory assigned to the VM. It + # cannot have more than 32 slots in Power. params['slots'] = ((params['max_memory'] >> 10) - params['memory']) >> 10 if params['slots'] < 0: raise OperationFailed("KCHVM0041E") elif params['slots'] == 0: params['slots'] = 1 + elif params['slots'] > 32: + distro, _, _ = platform.linux_distribution() + if distro == "IBM_PowerKVM": + params['slots'] = 32 xml = """ <domain type='%(domain)s'> -- 2.1.0