Follow-up to inspection patch 096830414b

Change-Id: I7ec05e501ec40802efa14cabe14752972919c7a9
This commit is contained in:
Dmitry Tantsur 2015-09-11 15:25:31 +02:00 committed by Lucas Alvares Gomes
parent f683a783af
commit e3e6000524
4 changed files with 32 additions and 4 deletions

View File

@ -66,8 +66,8 @@ initiating in-band cleaning tasks or deploying an image to the node.
Inspection
~~~~~~~~~~
IPA can conduct hardware inspection on start up and post data to the `Ironic
Inspector`_. Edit your default PXE/iPXE configuration or kernel command
options baked in the image, and set ``ipa-inspection-callback-url`` to the
Inspector`_. Edit your default PXE/iPXE configuration or IPA options
baked in the image, and set ``ipa-inspection-callback-url`` to the
full endpoint of Ironic Inspector, for example::
ipa-inspection-callback-url=http://IP:5050/v1/continue

View File

@ -15,6 +15,7 @@
import logging
import netaddr
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_utils import excutils
@ -151,6 +152,10 @@ def discover_network_properties(inventory, data, failures):
"""Discover network and BMC related properties.
Populates 'boot_interface', 'ipmi_address' and 'interfaces' keys.
:param inventory: hardware inventory from a hardware manager
:param data: mutable data that we'll send to inspector
:param failures: AccumulatedFailures object
"""
# Both boot interface and IPMI address might not be present,
# we don't count it as failure
@ -161,7 +166,9 @@ def discover_network_properties(inventory, data, failures):
data.setdefault('interfaces', {})
for iface in inventory['interfaces']:
if iface.name == 'lo' or iface.ipv4_address == '127.0.0.1':
is_loopback = (iface.ipv4_address and
netaddr.IPAddress(iface.ipv4_address).is_loopback())
if iface.name == 'lo' or is_loopback:
LOG.debug('ignoring local network interface %s', iface.name)
continue
@ -184,6 +191,13 @@ def discover_network_properties(inventory, data, failures):
def discover_scheduling_properties(inventory, data):
"""Discover properties required for nova scheduler.
This logic should eventually move to inspector itself.
:param inventory: hardware inventory from a hardware manager
:param data: mutable data that we'll send to inspector
"""
data['cpus'] = inventory['cpu'].count
data['cpu_arch'] = inventory['cpu'].architecture
data['memory_mb'] = inventory['memory'].physical_mb
@ -209,6 +223,16 @@ def discover_scheduling_properties(inventory, data):
def collect_default(data, failures):
"""The default inspection collector.
This is the only collector that is called by default. It is designed to be
both backward and future compatible:
1. it collects exactly the same data as the old bash-based ramdisk
2. it also posts the whole inventory which we'll eventually use.
:param data: mutable data that we'll send to inspector
:param failures: AccumulatedFailures object
"""
inventory = hardware.dispatch_to_managers('list_hardware_info')
# These 2 calls are required for backward compatibility and should be
# dropped after inspector is ready (probably in Mitaka cycle).

View File

@ -261,7 +261,10 @@ class TestDiscoverNetworkProperties(BaseDiscoverTest):
self.inventory['interfaces'] = [
hardware.NetworkInterface(name='lo',
mac_addr='aa:bb:cc:dd:ee:ff',
ipv4_address='127.0.0.1')
ipv4_address='127.0.0.1'),
hardware.NetworkInterface(name='local-2',
mac_addr='aa:bb:cc:dd:ee:ff',
ipv4_address='127.0.1.42'),
]
inspector.discover_network_properties(self.inventory, self.data,

View File

@ -5,6 +5,7 @@ pbr<2.0,>=1.6
Babel>=1.3
eventlet>=0.17.4
iso8601>=0.1.9
netaddr>=0.7.12,!=0.7.16
netifaces>=0.10.4
oslo.config>=2.3.0 # Apache-2.0
oslo.concurrency>=2.3.0 # Apache-2.0