Commit 30b12688 authored by Jose A. Lopes's avatar Jose A. Lopes Committed by Jose A. Lopes

Fix 'hvparams' of '_InstanceStartupMemory' on hypervisors

Most hypervisors were calling '_InstanceStartupMemory' but not passing
the 'hvparams' keyword argument.  Actually, it is not necessary to
pass this argument given that it is an attribute in the instance
object, which is passed.  This patch removes the 'hvparams' arg all
together, fixes the function and the calls to it.

Fixes issue 691.
Signed-off-by: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent c9c67b50
......@@ -381,7 +381,7 @@ class BaseHypervisor(object):
"""
raise NotImplementedError
def _InstanceStartupMemory(self, instance, hvparams=None):
def _InstanceStartupMemory(self, instance):
"""Get the correct startup memory for an instance
This function calculates how much memory an instance should be started
......@@ -394,7 +394,7 @@ class BaseHypervisor(object):
@return: memory the instance should be started with
"""
free_memory = self.GetNodeInfo(hvparams=hvparams)["memory_free"]
free_memory = self.GetNodeInfo(hvparams=instance.hvparams)["memory_free"]
max_start_mem = min(instance.beparams[constants.BE_MAXMEM], free_memory)
start_mem = max(instance.beparams[constants.BE_MINMEM], max_start_mem)
return start_mem
......
......@@ -585,8 +585,7 @@ class XenHypervisor(hv_base.BaseHypervisor):
"""Start an instance.
"""
startup_memory = self._InstanceStartupMemory(instance,
hvparams=instance.hvparams)
startup_memory = self._InstanceStartupMemory(instance)
self._MakeConfigFile(instance, startup_memory, block_devices)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment