Revision a295eb80 lib/cmdlib/instance_utils.py
b/lib/cmdlib/instance_utils.py | ||
---|---|---|
450 | 450 |
return "originstname+%s" % instance.name |
451 | 451 |
|
452 | 452 |
|
453 |
def CheckNodeFreeMemory(lu, node, reason, requested, hypervisor_name):
|
|
453 |
def CheckNodeFreeMemory(lu, node, reason, requested, hvname, hvparams):
|
|
454 | 454 |
"""Checks if a node has enough free memory. |
455 | 455 |
|
456 | 456 |
This function checks if a given node has the needed amount of free |
... | ... | |
466 | 466 |
@param reason: string to use in the error message |
467 | 467 |
@type requested: C{int} |
468 | 468 |
@param requested: the amount of memory in MiB to check for |
469 |
@type hypervisor_name: C{str} |
|
470 |
@param hypervisor_name: the hypervisor to ask for memory stats |
|
469 |
@type hvname: string |
|
470 |
@param hvname: the hypervisor's name |
|
471 |
@type hvparams: dict of strings |
|
472 |
@param hvparams: the hypervisor's parameters |
|
471 | 473 |
@rtype: integer |
472 | 474 |
@return: node current free memory |
473 | 475 |
@raise errors.OpPrereqError: if the node doesn't have enough memory, or |
474 | 476 |
we cannot check the node |
475 | 477 |
|
476 | 478 |
""" |
477 |
nodeinfo = lu.rpc.call_node_info([node], None, [hypervisor_name], False)
|
|
479 |
nodeinfo = lu.rpc.call_node_info([node], None, [(hvname, hvparams)], False)
|
|
478 | 480 |
nodeinfo[node].Raise("Can't get data from node %s" % node, |
479 | 481 |
prereq=True, ecode=errors.ECODE_ENVIRON) |
480 | 482 |
(_, _, (hv_info, )) = nodeinfo[node].payload |
Also available in: Unified diff