Revision 0bbec3af lib/hypervisor/hv_base.py
b/lib/hypervisor/hv_base.py | ||
---|---|---|
210 | 210 |
"""Get the list of running instances.""" |
211 | 211 |
raise NotImplementedError |
212 | 212 |
|
213 |
def GetInstanceInfo(self, instance_name): |
|
213 |
def GetInstanceInfo(self, instance_name, hvparams=None):
|
|
214 | 214 |
"""Get instance properties. |
215 | 215 |
|
216 | 216 |
@type instance_name: string |
217 | 217 |
@param instance_name: the instance name |
218 |
@type hvparams: dict of strings |
|
219 |
@param hvparams: hvparams to be used with this instance |
|
218 | 220 |
|
219 | 221 |
@return: tuple (name, id, memory, vcpus, state, times) |
220 | 222 |
|
... | ... | |
371 | 373 |
""" |
372 | 374 |
raise NotImplementedError |
373 | 375 |
|
374 |
def _InstanceStartupMemory(self, instance): |
|
376 |
def _InstanceStartupMemory(self, instance, hvparams=None):
|
|
375 | 377 |
"""Get the correct startup memory for an instance |
376 | 378 |
|
377 | 379 |
This function calculates how much memory an instance should be started |
... | ... | |
384 | 386 |
@return: memory the instance should be started with |
385 | 387 |
|
386 | 388 |
""" |
387 |
free_memory = self.GetNodeInfo()["memory_free"] |
|
389 |
free_memory = self.GetNodeInfo(hvparams=hvparams)["memory_free"]
|
|
388 | 390 |
max_start_mem = min(instance.beparams[constants.BE_MAXMEM], free_memory) |
389 | 391 |
start_mem = max(instance.beparams[constants.BE_MINMEM], max_start_mem) |
390 | 392 |
return start_mem |
Also available in: Unified diff