If two hardware managers have the same clean step, for example
'erase_devices' in the GenericHardwareManager and a custom manager,
IPA must determine which step should be kept and which should be run
in order to prevent running the step multiple times.
This patch uses the following filtering logic to decide which step
"wins":
- Keep the step that belongs to HardwareManager with highest
HardwareSupport (larger int) value.
- If equal support level, keep the step with the higher defined
priority (larger int).
- If equal support level and priority, keep the step associated with
the HardwareManager whose name comes earlier in the alphabet.
Other than individual step priority, picking which step to keep does
not actually impact the cleaning run. However, in order to make
testing easier, this change ensures deterministic, predictable
results.
Co-Authored-By: Mario Villaplana <mario.villaplana@gmail.com>
Co-Authored-By: Jay Faulkner <jay@jvf.cc>
Co-Authored-By: Brad Morgan <brad@morgabra.com>
Change-Id: Iaeea4200c38ee22cab72ba81c1dbae3389e675e4
Now pyudev raises DeviceNotFoundByFileError which does not inherit
from EnvironmentError, so our 'except' block in hardware.py no longer
catch the exception. It broke unit tests, but it can also potentially
break the deploy.
This patch updates hardware.py to catch both old a new exceptions.
Change-Id: Iaefd6089f6f766a241054d8e132b2f3098c8130d
Closes-Bug: #1522756
This patch is a follow up patch fixing some nits left by the review
da9c3b0adc67efa916fc534d975823c0a45948a1, this patch adds the
wwn_with_extension and wwn_vendor_extension root device hints to the
"serializable_fields" list attribute of the BlockDevice class and fixes
some tests.
Change-Id: I6039be535988319276f9ac355c80997d34328ce8
This patch is extending the root device hints to also look at
ID_WWN_WITH_EXTENSION and ID_WWN_VENDOR_EXTENSION from udev.
Prior to this patch the IPA ramdisk only cared about ID_WWN but in some
systems in some platforms with a RAID controller, this ID can be same
even if they are different disks (see bug 1516641).
Closes-Bug: #1516641
Change-Id: Ic3e9a1111dfcc99702190c173562a0dccf5f94c4
This is a follow-up patch for commit
3af9ab36bfae3a369fdb3d2b6d02ac803c39ee17
The review requested that a LOG.debug() message be added.
Change-Id: I36fbd4269c948812f4bee66d0130150afd0c0279
Bring ironic-python-agent in line with the other ironic projects.
Stop ignoring all E12* errors except E129
Stop ignoring E711
Change-Id: Icb9bc198473d1b5e807c20869eb2af7f4d7ac360
This patches updates the get_clean_steps() method to make the
erase_devices step abortable. Erasing devices is something that can be
cancelled without damaging the machine.
When a clean step is aborted the provision state of the Ironic node
will go to CLEANFAIL state. The operator can then do what is needed to
fix the problem (i.e network booting issues) and restart the cleaning
later on.
Partial-Bug: #1455825
Change-Id: Ic181ac3712810c6f6925e8b627ee79e77ecf4d83
Put the columns to retrieve from lsblk into a list so that future
modifications to columns will require fewer code changes.
Also add a 'block_type' parameter which defaults to 'disk'. To make the
function more flexible if callers wanted a different block type.
Update and add unit tests
Change-Id: If06460e13a5b56dc8d6efca9ff5b58ac6ba1f357
Currently we only use these disk properties for root device hints.
However, they'll be really useful for inspector, especially for also
implementing root device hints.
Change-Id: I48aa6b6d2d198d16f2f8e387970f7230066cf8a2
Create a SerializableComparable class derived from the Serializable
class.
Added the following functions to the SerializableComparable class:
'__eq__'
'__ne__'
Disable the '__hash__' function in the SerializableComparable class as
some derived classes are mutable.
Use the SerializableComparable class in hardware.py and
extensions/base.py
This should make unit testing users of the class easier when doing a
self.assertEqual() or self.assertNotEqual()
Added some initial unit testing for encoding.py
Change-Id: If0f14b3bfe7f1391f65dd730a16a534afed0da82
Adds a new module ironic_python_agent.inspector and new entry point
for extensions, which will allow vendor-specific inspection.
Inspection is run on service start up just before the lookup.
Due to this early start, and due to the fact we don't even know
MAC address of nodes on inspection (to say nothing about IP addresses),
exception handling is a bit different from other agent features:
we try hard not to error out until we send at least something to inspector.
Change-Id: I00932463d41819fd0a050782e2c88eddf6fc08c6
Instead of silently failing, raise DeviceNotFound when no root device
hints were provided and all found block devices are smaller than 4GB.
Change-Id: Idd2e2c5905adf847f00ad15a84a817c3715225dd
Closes-Bug: #1490761
Hardware managers should load at runtime. This will ensure the agent is
ready to respond to API calls before it begins heartbeating. Also, it
means in case of a syntax or other error in a HardwareManager, the agent
will crash before it heartbeats, which is better than it working until a
hardware manager method is needed.
Change-Id: I9403ce7bedc8d5af20b6d84371367253b26b74c2
Closes-bug: 1490008
There is no way for two hardware managers to handle erasing two disks
in two different ways. dispatch_to_managers was designed specifically
for this case, and the default behavior will remain the same for the
GenericHardwareManager (erase_block_device will pick up each disk).
Also return the result of the dispatch calls, so they'll be logged by
Ironic and give more cleaning insight.
Change-Id: I19e9dc8539a0729fbb96cae92fe633e24608fc68
This function is useful in any HardwareManager that interacts with
disks. Subclassing GenericHardwareManager is not ideal for any
hardware manager that interacts with only specific devices.
Change-Id: Ib20e68a8916590513c0a825e44407a110cfbb441
* Added NetworkInterface.ip4_address
* Added HardwareManager.get_bmc_address()
* Added Memory.physical_mb
This is total memory as reported by dmidecode, and yes,
it's different from total, as it includes kernel reserved space.
* Added CPU.architecture
As a side effect, get_cpus was switched to lscpu.
Also fixes problem when get_cpus reported the current frequency
instead of maximum one.
Change-Id: I4080d4d551eb0bb995a94ef9a300351910c09fb9
The param was added to the GenericHardwareManager but it wasn't added
to the base class.
This is a breaking API change for the hardware managers.
Change-Id: Ia73fe14308986496e3a4f8d71bc2298a9130cffa
Debugging the agent is a huge pain point. Tracebacks are rarely logged,
error messages are often only returned via the API, and lack of
info logging makes it hard to determine where some failures occur.
Some errors only return a 500 with no error message or logs.
Change-Id: I0a127de6e4abf62e20d5c5ad583ba46738604d2d
Was running into 'expected string, int found' when calling
shred with an Int for iterations.
Change-Id: Iffce247caba5b0d62ac89b6411402c8d975cfd2f
Closes-Bug: #1469838
Today, there is no option to configure number of iterations to be
done for shred block device erasing and defaults it to 1. This patch
adds a configuration option to change the number of passes to be done
to erase a block device.
Change-Id: I1921d33a6b364c4682b6c9baaf61ac092cfa11d7
Partial-Bug:#1465130
in-band disk erase using shred fails with error "'module' object has no
attribute 'ProcessExecutionError'". This commit is to fix the issue.
Change-Id: Ia0c426074b2f0e9d534ed96a3e213933160edc61
Closes-Bug:#144799
In-band disk erase using shred fails for agent_ilo driver as it tries to
erase the virtual floppy device attached.This fix is to skip the virtual
media devices and continue with other disks.
Change-Id: I26745985382d440f7d4b3fbfffb14545067fcca6
Closes-Bug:#1450298
The docstrings here were all giving WARNINGs or ERRORs during the docs
build, and were generally making unappealing looking developer
documentation. I corrected the syntax and did what was neccessary to
make the build come out clean.
Change-Id: I74b00a7f125770b0468cff3bdf26d0d52cd054d7
(cherry picked from commit c0921cdff372ce1fd6df1c4ab4eb5463e2cba0e4)
This prevents devices from failing cleaning if they don't support ATA
security erase. Instead, the device will be erased by overwriting using
GNU shred.
Change-Id: Ie4f88b97c8c34efe2397538662622abd0b963aea
This will add support for in band cleaning operations to IPA and
replace the decom API that was unused.
Adds API support for get_clean_steps, which returns a list of
supported clean steps for the node, execute_clean_step, to execute
one of the steps returned by get_clean_steps.
Adds versioning and naming for hardware managers, so if a new hardware
manager version is deployed in the middle of cleaning/zapping, the
cleaning/zapping will be restarted to avoid incompatabilities.
blueprint implement-cleaning-states
blueprint inband-raid-configuration
blueprint implement-zaping-states
Depends-On: Ia2500ed5afb72058b4c5e8f41307169381cbce48
Change-Id: I750b80b9bf98b3ddc5643bb4c14a67d2052239af
This patch add support for root device hints on IPA. Instead of picking
the first disk >= 4G, if the hints are specified IPA will look at it
to decide which device it should pick for the deployment. The initial
patch supports the following hints: Size, model, WWN, serial, vendor.
Implements: blueprint ipa-as-default-ramdisk
Implements: blueprint root-device-hints
Change-Id: I2b00b3fb3b61001033750dd8951f9353d6f2e361
This allows the agent to call a method on all hardware managers
that support the hardware and return a list of their responses. This
will be useful for implementing get_clean_steps() in cleaning.
Also fixes a leaky test in dispatch_to_managers. The function
wrapper was holding global state, which leaked into other tests
if a function was called again later, messing up the call count.
Implements blueprint implement-cleaning-states
Change-Id: I76bf8ec18df1dc16c4b9d942800b8a1efcde9e65
Added support for secure erase enhanced option when doing an ATA secure erase.
Also made it prefer the enhanced version if hdparm claims the device
supports it.
Change-Id: I2ce04d0b967d6c176acd40ea10a05bcab5dbf2d0
Currently we pick the most specific manager and use it. Instead, call
each method on each hardware manager in priority order, and consider the
call successful if the method exists and doesn't throw
IncompatibleHardwareMethodError.
This is an API breaking change for anyone with out-of-tree
HardwareManagers.
Closes-bug: 1408469
Change-Id: I30c65c9259acd4f200cb554e7d688344b7486a58
This code was here to allow IPA to be ran inside a docker container
with /sys bind-mounted in to /mnt/sys. IPA no longer can run inside
a docker container anyway, so remove this.
Change-Id: Ia6a9c2e49870b7a74087e3fed2fc42d5b8b6b81c
Closes-Bug: #1404362
The previous implementation of list_block_devices used blockdev,
which would list partitions, software RAID and other devices as block devices.
By switching to lsblk, the agent can filter down to only physical block
devices, which is all the agent cares about for any of its operations.
This change adds two new fields to the BlockDevice class: model, a string of
the block devices reported model, and rotational, a boolean representing a
spinning disk (True) or a solid state disk (False). This data can be useful
for vendor hardware managers.
Change-Id: I385c3bb378c2c49385bca14a1d7efa074933becf
Closes-Bug: 1344351
Finding an IPv4 address to advertise fails and crashes if the
interface exists but has no valid IPs. This can be fixed by
adding KeyError to the exceptions caught.
Change-Id: I60204427ec5201696d02c5c26f4b43a00d794413
Closes-Bug: #1342448
The agent attempts to sort the HardwareManager implementations found
by stevedore in order of suitability. This patch fixes a bug in the
sorting order that caused the GenericHardwareManager to always be
loaded.
Fixes bug 1327923
Change-Id: I1cc20e5351a704325f0cf41dab205c9164799f6a
During the first heartbeat, the heartbeater asks the agent to check
its advertised address; if the advertised IP is still the default
(None), the agent tries to replace it with the IP of the first network
interface it finds. If it fails to find either a network interface or
an IP address, the agent raises an exception.
Change-Id: I6d435d39e99ed0ff5c8b4883b6aa0b356f6cb4ae
Closes-Bug: #1309110
Add erase_devices method to the HardwareManager class. By default this
method iterates block devices, and calls a new abstract
erase_block_device method for each device. This patch includes a
simple implementation of erase_block_device on the
GenericHardwareManager which attempts to issue an ATA secure erase on
supported devices.
Change-Id: I81da065395b8785f636f1b0a0d60c9f1c045441e
The HardwareManager class was missing a few abstract method
declarations which it is expected to have. Add those.
Change-Id: I1d07b7f08a4fc23929bc09f65b897fdfa0da1770
Introduce `serializable_fields` to express which class attributes
to be serialized.
Get rid of OrderedDict. Just replacing it with regular dict.
Change-Id: I3f7639dab171d3d62e92d0d1bb6d7b071cf963ad