Commit Graph

44 Commits

Author SHA1 Message Date
Jakub Jelinek 5ab429d528 Introduce skip list to inspector
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
2022-09-20 11:18:36 +01:00
Francois Rigault 22853a74b5 Fix port id vs uuid in ValidateInterfacesHook
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
2021-03-06 16:47:30 +01:00
Dmitry Tantsur 95e103d21c Do not try to set local_gb to -1 when the matched root device size is 0
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
2020-07-09 16:40:22 +02:00
Kaifeng Wang b31888a4ee Fix incorrect pxe-enabled was set during introspection
Morden bare metals usually support PXEs from all NICs, in
our current logic only the port matching mac address in the
BOOTIF will be set to pxe-enabled. This does not work for UEFI
nor user friendly to bonding.

This patch adds a configuration option [processing]update_pxe_enabled
to control whether this field should be updated according to
introspection data, defaults to False to keep backwards compatibility.

Change-Id: I6f3b00180f62dc6f500ac2cdb5d8f8cc7c7190cf
2020-06-22 23:05:50 +08:00
Kaifeng Wang 71666178f4 Accept IPv6 link local address during interface validation
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
2020-06-17 14:20:41 +08:00
Riccardo Pittau 3accdfbbc6 Use openstacksdk for ironic module
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
2020-03-23 14:28:09 +01:00
Riccardo Pittau 9b1450398c Stop using six library
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
2019-12-17 09:23:01 +01:00
Serena Ziviani 78dbcf603a Do not update/delete ports upon inspection of active nodes
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
2019-12-03 15:30:00 +01:00
Zuul 3e702f65db Merge "Use bmc ipv6 address while processing introspection data" 2019-07-03 20:01:29 +00:00
Nikolay Fedotov fcb0ca8a6e Use bmc ipv6 address while processing introspection data
Change-Id: Id6d56860a4e47f28c875ed6032e1f99a997aea9b
Story: #2005779
Task: #33503
2019-06-19 15:03:07 +03:00
Dmitry Tantsur 463d0a2f54 Stop failing on missing memory or CPU
They have been optional for scheduling since Pike and are not used
by Nova at all since Stein.

Change-Id: Idd4d727d3bbcbb8898a0d989d3c496070bc41d8a
2019-06-14 10:10:02 +02:00
zhengyong a1c44d29e6 Support IPv6 address when validating interfaces
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
2018-11-19 11:06:37 +08:00
Dmitry Tantsur 6e82571cf3 Move processing of local_gb to root_disk_selection hook
The scheduling hook will be deprecated, so handling local_gb (useful
e.g. for image size validation) needs a new home.

Change-Id: I29041879dea8a2d7f2abc6a988d4814ee121442e
2017-11-02 12:39:37 +01:00
Dmitry Tantsur a1d19d97b5 Do not rely on the older ipmi_address field on lookup
We need to always use bmc_address from inventory, the ipmi_address field is
there only for compatibility with older processing hooks.

Change-Id: Ibf00ecd9278af4ee9318ada44c7c670d13ac22aa
Closes-Bug: #1714944
2017-09-04 14:43:13 +02:00
Chris Krelle f61a75aaa0 add disabled option to VALID_ADD_PORTS_VALUES
This allows inspector to create nodes without creating ports for the node.

Change-Id: Ife4c06d20e9217f0a308fef19177884596c6cf2d
Closes-Bug: #1693892
2017-06-23 10:09:45 -07:00
Dmitry Tantsur 7f3f8b0188 Remove redundant copy operation in pxe_enabled update code
I cannot remember why I added it, I assume it's not needed.
This is a follow-up to 782ee92c45.

Change-Id: Iaa892e072db87fbcff0804cecd932670edf823df
2017-04-28 12:13:33 +02:00
Jenkins 68cbd1286f Merge "Set pxe_enabled on new and existing ports on introspection" 2017-04-25 16:32:34 +00:00
Javier Pena dffdf36ebd Remove unneeded validation code in ValidateInterfacesHook
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
2017-04-19 14:37:46 +02:00
Dmitry Tantsur 782ee92c45 Set pxe_enabled on new and existing ports on introspection
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
2017-04-18 10:20:49 +00:00
Dmitry Tantsur 9575d31920 Move port creation to validate_interfaces hook
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
2017-04-11 17:58:56 +02:00
Annie Lezil c06a9a7f24 Remove translation of log messages Part-1
The i18n team has decided not to translate the logs because it seems
like it not very useful.

This are the files as of now do not have merge conflicts.

Change-Id: I082f6302f120a8c0c81482b73be301e83fe3a3a8
Partial-Bug: #1674374
2017-03-24 21:45:04 +00:00
Moshe Levi 1dce3b12d3 Adding InfiniBand Support
InfiniBand is computer-networking communications standard
used in high-performance computing, features very high
throughput and very low latency.
This patch allow ironic-inspector to add the client_id
to ironic port extra. The client_id option allow pxe boot
from InfiniBand interface.

Closes-Bug: #1532534
Depends-On: Ifad453977e5d3be64b34e544f269835a72b4d73f
Change-Id: I479d54c29bcacb6bd5c1ab20033ae6e428b0e744
2017-02-01 08:34:38 -05:00
Dmitry Tantsur 6e2ea6242d Allow diskless nodes introspection
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
2017-01-26 17:08:56 +01:00
Lucas Alvares Gomes 891639612b Use the device hints matching mechanism from ironic-lib
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
2016-12-16 16:55:51 +00:00
Luong Anh Tuan 185effbb18 Use function is_valid_mac from oslo.utils
Oslo.utils 3.17 provides same function, just use it.

Change-Id: I16e3775a239b017c3431c425d86085380e28da4c
2016-11-22 12:59:53 +00:00
Dmitry Tantsur 0b58e31e3e Remove support for the old bash ramdisk
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
2016-06-06 13:36:05 +02:00
Dmitry Tantsur 8fe0344cfd Always convert the size root device hints to an integer
This matches the IPA behaviour and is more user-friendly.

Change-Id: Ic7134c338e703361fedbf9917a3484c0bcc9d493
Closes-Bug: #1580664
2016-05-23 13:05:18 +02:00
Dmitry Tantsur b65ab065ea Store ramdisk logs on all processing failures, not only reported by the ramdisk
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
2016-05-04 12:46:59 +02:00
Dmitry Tantsur b638c70f82 Use all valid MAC's for lookup
Currently we are using only the resulting MAC(s) when doing a node lookup.
In many cases it is the MAC of the PXE-booting NIC. However, it's not necessary
the MAC that people used for enrolling the Ironic node, which will lead to
lookup failures on the virtual environment. This change makes the lookup
procedure use all of the valid MAC's.

Similarly, the enroll node_not_found_hook now checks all MAC's before creating
a node.

Code in the validate_interfaces hook was reordered to ensure we only keep
interfaces with valid MAC's even in the "all_interfaces" list.

Change-Id: Ie7df05d9a7855716fb835c90cfb0ac7fc4cd66df
2016-03-18 13:41:04 +01:00
Anton Arefiev ea93510cef Small ValidateInterfacesHook cleanup
- move all interface validation  checks to _validate_interfaces
  method;
- remove redundant args.

Change-Id: I06a269c1694cdc91bf3a85a78037dfea094c5187
2016-02-17 11:53:51 +02:00
Dmitry Tantsur cc422c0a5e Remove deprecated support for passing patches lists into hooks
Long time ago we had an idea of batching node updates. However,
it fails miserably when a plugin or an introspection rule has to inspect
existing node properties, because it receives possibly stale values.
We've deprecated support for batching patches back in Liberty, this
patch removes the associated bits from the hook interface.

Change-Id: Ia482ff50ca276ce1ffec631f016c6a6b54d5a4ab
Closes-Bug: #1506348
2016-02-09 12:36:07 +01:00
Dmitry Tantsur 2a1807af0a Switch to IPA as a primary ramdisk
* Stop requiring memory_mb, local_gb, cpu, cpu_arch, ipmi_address, interfaces;
  take them from inventory instead
* Issue a warning when inventory is not supplied
* Raise an error when root device hints are requested but inventory
  is not supplied
* Logging improvement around network interfaces handling

Closes-Bug: #1528831
Change-Id: Iaa1c34092463ff216379e30bcef55235517f6c92
2016-01-13 17:30:56 +01:00
Dmitry Tantsur 0423d93736 Track node identification during the whole processing
Currently our logging in processing is very inconsistent:
some log strings mention node UUID, some - node BMC IP, some nothing.
This change introduces a common prefix for all processing logs
based on as much information as possible.
Only code that actually have some context about the node (either
NodeInfo or introspection data) is updated.

Also logging BMC addresses can be disabled now.

Updates example.conf (a lot of updated comments from oslo).

Change-Id: Ib20f2acdc60bfaceed7a33467557b92857c32798
2016-01-13 12:23:15 +01:00
Dmitry Tantsur 5a5f885e3e Enable ramdisk log collection in devstack plugin and improve logging
Add info logging to actually see the resulting file name, make other
logging improvement.

Also set ironic-inspector to always store logs.

Change-Id: I75fe35a9ce564b0fd23fbe6f5027e0b576195bcd
2015-12-14 14:24:49 +01:00
Dmitry Tantsur 9c14f354f7 Issue a warning when add_ports=pxe and not PXE NIC address is provided
Change-Id: I89692473052c1eb43549453a004cdbc996c20c2a
2015-11-16 20:29:47 +01:00
Zhenguo Niu bcd8d5dfa0 Replace deprecated LOG.warn with LOG.warning
Closes-Bug: #1508442
Change-Id: Ifcc2004f3274808d868c9947ed2b0b484f815daa
2015-10-22 06:18:47 +00:00
Dmitry Tantsur 13b11c8052 Smart root disk selection including support for root device hints
Creates a new plugin root_disk_selection which uses root device hints
and IPA inventory to calculate a root disk.

Update scheduler plugin to support 'root_disk' field in introspection
data. This field is populated by both root_disk_selection plugin
and IPA itself. The latter value is now used when root device hints
are not provided.

New option disk_partitioning_spacing regulates whether to substract
1 GiB from local_gb. Previously it was unconditionally done by
the ramdisk.

Change-Id: I8d60e3483ab5d7d181e231fe413fcd16192e0e97
Depends-On: Ie19b82ff2a914873ff4b2395b02643e086b934b1
Implements: blueprint root-device-hints
2015-09-16 19:22:32 +02:00
Dmitry Tantsur 105aa64f60 Deprecate returning patches from plugins
This approach was an optimization, but it proved to bring more
troubles than benefits - see LP issue for details.

Precautions are made to avoid breakage. Still, some 3rdparty
hooks might get broken by this change.

Change-Id: I5a84512758e92c87091d6306c8d5baa944955e55
Closes-Bug: #1492946
2015-09-14 16:53:04 +02:00
Dmitry Tantsur 5b02639716 Move update functions to NodeInfo object
Accept ironic object in NodeInfo __init__ instead of every method
to reduce number of times we need to pass it around.

Add new methods to NodeInfo: patch, update_properties,
update_capabilities, patch_port and delete_port.

Change-Id: Ida03ac70e743f53f887bb194f61b0011950d4dfd
Partial-Bug: #1492946
2015-09-10 14:14:52 +02:00
Yuiko Takada 6ce87e8f42 Migrate to oslo_log
Use oslo_log instead of logging module.

Change-Id: I0e9c9b9b68ba9c8c4f1c0cdd0746991c53e2d7e5
Closes-bug: #1475690
2015-08-12 09:23:18 +09:00
Dmitry Tantsur ea73ac3d49 Move create_ports to NodeInfo
Makes code more consistent and fixes bug with ironicclient error
reporting.

Also make NodeInfo.ports() return a dict to be more useful
for callers (like process.py).

Change-Id: I6ba587a31e839aba511c16fbf93047c7fdc54cc2
Closes-Bug: #1464184
2015-06-15 15:21:20 +02:00
Dmitry Tantsur ff44040d2c Rework processing hook interface for 2.0.0
This is a backward incompatible change of hooks interfaces.
The goal is to make these interfaces easier extensible, and to give
hooks access to NodeInfo instance.

Change-Id: I5b00a71e86a5a57111c25b0e16c662107074c21f
Implements: blueprint plugin-interface-v2
2015-06-11 15:47:34 +02:00
Dmitry Tantsur d09da96e02 Naming clean up
This refactoring patch fixes a few naming problems:
* namespace for processing hooks implied that it's the only type
  of hooks, added ".processing" postfix
* node_info -> introspection_data
* cached_node -> node_info

Change-Id: I8401f95236e269583257c3c5ba3762d0920d32e8
Implements: blueprint plugin-interface-v2
2015-06-09 15:42:46 +02:00
Dmitry Tantsur d6404d2f99 Rename discoverd -> inspector
As agreed on the summit I'm renaming the python modules
and doing some adjustments:
* This is a breaking change, so version is bumped to 2.0.0
* Used this chance to split conf options over proper sections
* RELEASES.rst is gone; it's too hard to keep it up-to-date;
  anyway git does better job at doing history
* Dropped deprecated option ports_for_inactive_interfaces
* Dropped old /v1/discover endpoint and associated client call
* No longer set on_discovery and newly_discovered in Node.extra
  (deprecated since 1.0.0, superseded by the get status API)
* Default firewall chain name is "ironic-inspector" and
  is configurable

Notes:
* Some links will be updated after real move.
* Stable branches will probably use the old name.
* Some usage of discovery word is left in context of
  "discovered data"
* DIB element will probably be deprecated, so leaving it
  alone for now.
* Some usages of word "discovery" in the README will be updated
  later to make this patch a bit smaller
* Ramdisk code will be moved to IPA, so not touching it too much

Change-Id: I59f1f5bfb1248ab69973dab845aa028df493054e
2015-05-29 09:06:56 +02:00