Follow the same process of root device selection as in IPA
which changed in https://review.opendev.org/c/openstack/ironic-python-agent/+/850861
The change introduces 'skip_block_devices' field into properties which
contains a list of hints pointing to devices that cannot be root devices
Change-Id: I94c8607ef9c610eadf1b5bce4fb154e97939a643
follow-up to Icd3de82877c6a53d32b4c9fd3e500d3cd9d7fb17
Use id attribute instead of uuid. This caused an exception when an unexpected
port was being deleted.
Story: 2008698
Task: 42007
Change-Id: Ib4978f5e3e4f1b64faa1bfae3cdcf46199bb2f21
Apparently, virtual floppies on some machines are represented as normal
block devices, but with size = 0. We should filter them out in ironic-lib,
but for now at least don't fail miserably.
Story: #2007907
Task: #40308
Change-Id: Ia96a9a8b85841612fb13616754bfdbf651b212d8
Link local address is a valid address on IPv6 network when we are using
SLAAC instead of DHCPv6, current interface validation bypass link local
address and fails the introspection.
Interfaces without link carrier don't have link local addresses so this
should be fine.
Change-Id: I4cf195fc8906a2d91989df3f588e1e96ca9684b1
Story: 2007816
Task: 40094
Using autospec ensures that mocked functions are called with correct
arguments, so it's highly desired to have it.
Change-Id: I9c8395adf852495d2ef6db732d727990e8abd5d7
This is a follow up to comments on https://review.opendev.org/720010.
Adding autospect=True requires an update to ironic_inspector.test.\
base.BaseTest.assertCalledWithPatch.
Also add autospec=True in several mocks where it was not used.
Change-Id: Ia340d7a8ecde1c8cf191555de87b11b19b30f06c
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: Ic67f09a223ae2d0cb460771a10a4122307afa05b
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This patches removes the ironic-client dependency from the
ironic module in favor of openstacksdk.
Increase minimum required version of openstacksdk to use
recent added features.
Change-Id: I31964179835ad454e8205a59f483b419de4fb62d
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
looking back.
Change-Id: Ic443c7e4d5a5a849c4dc220207f8957e4c90bf53
Short-circuit the port update logic for active nodes to allow only
for the addition of new ports.
Story: #2006956
Task: #37645
Change-Id: Ifd870a8465b6643578299dc86e2eae023db6ae43
When processing introspection data from IPA, ironic inspector only accept IPv4
address of an interface. In a IPv6 environment, the port will not be collected
if processing.add_ports is not set to 'all'.
Story: #1744073
Task: #11374
Co-Authored-By: Kaifeng Wang <kaifeng.w@gmail.com>
Change-Id: I0e1839df4d0e3b89f182ab98549486199d64c4ad
Inspector sets API urls for ironic and swift from the config.
The better way would be to discovery them from the keystone
catalog.
Supporting this requires to register keystoneauth adapter
options to all config sections for service clients auth.
swiftclient still does not support adapter session client, so
pass all options from adapter explicitly.
New options were added 'service_type`, `service_name`, `region_name`
`endpoint_override`, `interfaces`.
Related-Bug: #1699547
Change-Id: I2e7ec02fdeeea21ef43136ddeabc98d499a8ba7f
Co-Authored-By: Anton Arefiev <aarefiev@mirantis.com>
Use latest version of flake8-import-order package, like we do in
openstack/ironic
Fix the issues detected by new version.
Change-Id: I3b016e35f98c8f88500824e612838f9923b4c3b9
The scheduling hook will be deprecated, so handling local_gb (useful
e.g. for image size validation) needs a new home.
Change-Id: I29041879dea8a2d7f2abc6a988d4814ee121442e
oslo.config now sets enforce_type=True by default since [1], so
there is no need to check in ValidateInterfacesHook that the value
set in the config file is one of the valid values.
[1] https://review.openstack.org/328692
Closes-Bug: #1683732
Change-Id: I5830466cb21f200ae1c33021cce4d166a26456be
Set it to True for the PXE-booting port, to False for all the others.
Create an extended functional tests covering various operations with ports.
Change-Id: I435a5c04884b6c4da70cb7260b305fbde23eebc0
Closes-Bug: #1667472
Currently port logic is placed inconsistently: port creation is in core processing,
while port deletion is in validate_interfaces before_update. This changes moves
port creation there as well. This should only affect deployments that tamper with
validation_interfaces hook, as previously port creation was run just before running
before_update hooks.
This allows deployments to replace port creation logic by replacing the
validate_interfaces hook.
Change-Id: Idd8f748fdf31fc694bd7b554837e509024716c18
Partial-Bug: #1667472
There is a demand to use introspection on diskless nodes to figure out
what is possible to figure out.
We might need more changes to properly support diskless nodes, this
change is just to allow people to play with it.
The property ``local_gb == 0`` for a diskless node.
Change-Id: I21b2f2c069fdbf767367ec3d1fbf77bab6292b25
Partial-Bug: #1554243
This patch is replacing the ironic-inspector own implementation for
validating the root device hints in favor of the standard one from
ironic-lib.
The implementation in ironic-lib is flexible enough and fits in
ironic-inspector well so no big updates to functional or unittests
are needed.
A new dependency for ironic-lib was added to requirements.txt.
Change-Id: I0f2b8f463232d0d5b42d0b6e343d5c6e336d32c7
Closes-Bug: #1648133
Currently, state of a node introspection isn't kept in the database.
This change introduces:
* a new database column to keep the node introspection state
* an automaton to manage the node introspection state
* a decorator to declare a function performing an introspection state
transition
* a version_id column is added, to enhance database consistency, that
is consulted whenever node_info is committed
This change is part of the HA_Inspector effort[1]
[1] https://specs.openstack.org/openstack/ironic-inspector-specs/specs/HA_inspector.html
Closes-Bug: #1618835
Partial-Bug: #1525218
Change-Id: I18cb45f0d1194414715ccbe826d8a95610ec718d
From now on only rely on the IPA inventory and 2 additional fields:
boot_interface and root_device.
Also updated unit tests to use one inventory example.
Also removed duplicating unit tests and checks in test_process.
Also removed devstack support for the old ramdisk.
Change-Id: Ib382328295fc2c1b9143171b1047304febadcaca
Previously the ramdisk logs were only stored if the ramdisk reported an error.
However, we are moving from ramdisk-side validation to server-side, so we need
ramdisk logs to be available if processing fails too.
This change moves storing ramdisk logs from a ramdisk_error plugin to core
processing code. As before, it can be disabled by setting ramdisk_logs_dir to
an empty value.
Change-Id: Ib3742ee1c1d4f2f96d29466626e1121694610dc3
Closes-Bug: #1564448
This refoctor is needed for tempest test work as tempest tests
will placed in test dir. So move unit tests to separate directory
"unit" under test.
Change-Id: Ic99df6111ef30947148a9e38b9435a54f3d37064