I might be missing something, but I think Scott is right.
Here is get_effective_power_parameters() from node.py:
def get_effective_power_parameters(self):
"""Return effective power parameters, including any defaults."""
[...]
# The "mac" parameter defaults to the node's primary MAC
# address, but only if not already set.
if 'mac_address' not in power_params: primary_mac = self.get_primary_mac()
if primary_mac is not None:
mac = primary_mac.mac_address.get_raw() power_params['mac_address'] = mac
return power_params
We can see that the primary MAC (i.e. the first MAC from the *host*) is put in the power_params if it doesn't already contain a value for the key 'mac_address'.
Later on, in src/provisioningserver/tasks.py, we use this MAC address to find the corresponding IP using ARP:
def issue_power_action(power_type, power_change, **kwargs):
"""Issue a power action to a node.
:param power_type: The node's power type. Must have a corresponding
power template.
:param power_change: The change to request: 'on' or 'off'.
:param **kwargs: Keyword arguments are passed on to :class:`PowerAction`.
"""
assert power_change in ('on', 'off'), (
"Unknown power change keyword: %s" % power_change)
kwargs['power_change'] = power_change
if 'mac_address' in kwargs: kwargs['ip_address'] = find_ip_via_arp(kwargs['mac_address'])
[...]
I might be missing something, but I think Scott is right.
Here is get_effective_ power_parameter s() from node.py:
def get_effective_ power_parameter s(self) :
primary_ mac = self.get_ primary_ mac() mac.mac_ address. get_raw( )
power_ params[ 'mac_address' ] = mac
"""Return effective power parameters, including any defaults."""
[...]
# The "mac" parameter defaults to the node's primary MAC
# address, but only if not already set.
if 'mac_address' not in power_params:
if primary_mac is not None:
mac = primary_
return power_params
We can see that the primary MAC (i.e. the first MAC from the *host*) is put in the power_params if it doesn't already contain a value for the key 'mac_address'.
Later on, in src/provisionin gserver/ tasks.py, we use this MAC address to find the corresponding IP using ARP:
def issue_power_ action( power_type, power_change, **kwargs):
"""Issue a power action to a node.
:param power_type: The node's power type. Must have a corresponding `PowerAction` . 'power_ change' ] = power_change
kwargs[ 'ip_address' ] = find_ip_ via_arp( kwargs[ 'mac_address' ])
power template.
:param power_change: The change to request: 'on' or 'off'.
:param **kwargs: Keyword arguments are passed on to :class:
"""
assert power_change in ('on', 'off'), (
"Unknown power change keyword: %s" % power_change)
kwargs[
if 'mac_address' in kwargs:
[...]