Commit Graph

27 Commits

Author SHA1 Message Date
Steve Baker 161374f763 Expose conductor online boolean for accurate alive
Currently the online database column is not considered when displaying
the "baremetal conductor list" Alive status. This means that when a
conductor is stopped gracefully it will be shown as (inaccurately)
alive for the duration of [conductor]graceful_timeout.

This change adds the online field to the alive evaluation, so the
conductor must be online *and* have a recent heartbeat.

Change-Id: Ic5a8d56ec236faca1b9797bd0d3e42c956469fab
2024-03-22 15:07:12 +13:00
Sharpz7 949387bd80 [codespell] Fixing Spelling Mistakes
This is the first in a series of commits to add support for codespell. This is continuning the process completed in ironic-python-agent.

Future Commits will add a Tox Target, CI support and potentially a git-blame-ignore-revs file if their are lots of spelling mistakes that could clutter git blame.

Change-Id: Id328ff64c352e85b58181e9d9e35973a8706ab7a
2024-02-12 19:58:56 +00:00
Steve Baker 3f9151163e Introduce conductor touch while offline
This adds an `online` argument to the conductor touch methods so that
touch can be called with `online=False`. When called periodically this
allows the conductor `updated_at` to be within the threshold to avoid
locked nodes being failed as orphans by another conductor.

This will be used by drain shutdown (and graceful shutdown) so that
tasks can complete on existing locked nodes within the shutdown timeout,
while the conductor is also removed from the hash ring so new tasks are
not started on that conductor.

This change introduces the api but the existing behaviour won't change
until BaseConductorManager.del_host() no longer calls keepalive_halt().

Change-Id: Iedd62193fac1009137b9ee47a6ef5a9a8576f261
2023-10-06 10:42:53 +13:00
Dmitry Tantsur 929907d684 Bye-bye iSCSI deploy, you served us well
The iSCSI deploy was very easy to start with, but it has since become
apparently that it suffers from scalability and maintenance issues.
It was deprecated in the Victoria cycle and can now be removed.

Hide the guide to upgrade to hardware types since it's very outdated.

I had to remove the iBMC diagram since my SVG-fu is not enough to fix it.

Change-Id: I2cd6bf7b27fe0be2c08104b0cc37654b506b2e62
2021-05-04 14:28:25 +02:00
Derek Higgins 7d85b35c84 Register all hardware_interfaces together
Prevent each driver comming online one at a time. So that
/driver returns nothign until all interfaces are registered

Story: #2008423
Task: #41368

Change-Id: I6ef3e6e36b96106faf4581509d9219e5c535a6d8
2021-01-08 15:16:53 +00:00
Kaifeng Wang e2a768f0cd Expose conductors: db and rpc
This patch lays some ground work around db and rpc to provide
conductors information from the API.

Changes in the db api and Conductor object is used to support
the implementation of /v1/conductors. Adds an argument
"online" to Conductor.get_by_hostname, so that we can get
the conductor object from database even it's not online,
this is required for the implementation of /v1/conductors/{hostname}.

Adds a new interface get_conductor_for() to get the hostname
of the conductor which is servicing the given node, it will
be used for the implementation of /v1/nodes* endpoints, as well
as listing nodes by given conductor.

Story: 1724474
Task: 28064

Change-Id: I39a7a47c5ae649f6c3200e772a9357023f21a7c4
2018-11-29 10:25:16 +08:00
Jim Rollenhagen 7929361a0b Add conductor_group field to config, node and conductor objects
Adds the fields and bumps the objects versions. Excludes the field from
the node API for now.

Also adds the conductor_group config option, and populates the field in
the conductors table.

Also fixes a fundamentally broken test in ironic.tests.unit.db.test_api.

Change-Id: Ice2f90f7739b2927712ed45c969865136a216bd6
Story: 2001795
Task: 22640
Task: 22642
2018-07-18 21:50:29 +00:00
Ruby Loo 8a98228251 conductor saves version in db
For rolling upgrades, we added a 'version' column to all the
DB object tables. However, we forgot to save the version value
for conductor objects. This patch addresses that.

Change-Id: Ic366f771491774f9708c9a81ab76dc13757d852b
Partial-Bug: #1526283
2017-08-24 16:40:44 -04:00
Ruby Loo 737cb1d3ef Add context to IronicObject._from_db_object()
There is code in oslo.versionedobjects that expects an object
class to have this method:
    _from_db_object(context, item_cls(), db_item, **extra_args)

To conform to this, this patch adds 'context' as the first
parameter of base.IronicObject._from_db_object().

As a bonus, some docstrings were cleaned up.

Change-Id: I09b02f47d47cec22d03460b693f9e5c488cf04c7
Closes-Bug: #1670778
2017-04-28 02:56:44 +00:00
Jim Rollenhagen b7e6b737d7 Register/unregister hardware interfaces for conductors
This registers the intersection of supported and enabled interfaces for
each hardware type enabled in the conductor at conductor startup, and
unregisters them at conductor shutdown. Validation is left as a todo for
now.

Change-Id: I14e88bfc304de9414de008d1cc8568dda9115ecc
Partial-Bug: #1524745
2017-01-19 11:28:30 +00:00
Ruby Loo c7763a7e02 Clean up object code
This:
1. replaces hardcoded object names with the 'cls' variable where
   appropriate.
2. removes __class__ from calls to <an object>.__class__.<class method>
   since <an object>.<class method> works.

This is a follow up to reviewers' comments in
f766bbab45.

Change-Id: Iecd057ec9a166620b22a6d6c3f780eed3f60b655
2016-12-06 18:07:17 +00:00
Lucas Alvares Gomes 6dd72d9426 Extend the Conductor RPC object
This patch is extending the conductor RPC object adding a method for
registering and unregistering conductors. The touch() method was also
update to make the context parameter optional (since it's not actually
needed).

The base_manager.py module have been updated to use the new methods.

Change-Id: Ifb74909bc2cd39ce4ad056f7174285497e35035c
2016-03-18 13:18:55 +00:00
John L. Villalovos bbee55df15 Move _from_db_object() into base class
Had five copies of the def _from_db_object() function in various
classes. Move this function into their common base class.

Change-Id: I543386a708d80f7c89455e556e2abc6d532661b0
2016-02-24 06:33:31 -08:00
Grzegorz Grasza db9ddd39d3 Implement indirection_api
During a rolling upgrade, ironic conductor and api services are running
with different versions. When an object is received in an incompatible
version, IncompatibleObjectVersion is raised. Implementation of the
indirection API allows the object to be backported to a supported version
by the conductor (conductor has to be the first service to be upgraded).

This change enables backporting of objects from Mitaka. This lays the
foundation to be able to do rolling upgrades from Liberty (or from this
patch onwards) to Mitaka. There may still be other issues that will need
fixing in Mitaka before we will be able to do a full rolling upgrade.

Enabling the indirection_api causes all object methods decorated with
the remotable or remotable_classmethod to do RPC from ironic-api to
ironic-conductor service. To keep the current behavior, I'm removing all
remotable decorators on object methods and thus not enabling object RPC
calls in this patch. These calls caused random timeouts on the CI gates
(probably due to a race in which Nova calls the ironic-api service before
ironic-conductor is up). RPC calls made via the indirection_api should
be enabled one-by-one, when the implications are fully understood.

Change-Id: Ia381348da93f95d764c83f3ec2a2ed5a1db5ad6d
Closes-Bug: 1493816
Depends-On: I81400305f166d62aa4612aab54602abb8178b64c
2015-09-24 00:26:33 +00:00
Lin Tan 318f038548 Use oslo.versionedobjects remotable decorators
Use remotable decorators from oslo.versionedobjects.
remotable() treats context as option parameter, so change some tests
accordingly.

Change-Id: I84aef23cfa13a6162120e048477228015defc7e6
2015-09-17 09:34:53 +08:00
Lin Tan b94ff0bfe7 Base IronicObject on VersionedObject
Make IronicObject based on VersionedObject and introduce
VersionedObjectDictCompat class from oslo library. This is only a
temporary solution to support object['key']. Object should only be
called like object.key

Make all objects multiple inherit from these two classes can reduce the
future work to remove the support of IronicObjectDictCompat. This will be
addressed in next patches once finish the migration to oslo.versionedobject
library.

Partial-Bug: #1461239
Change-Id: Ieb2c406c10da75f9c42320085c563c166eda1703
2015-09-17 09:32:27 +08:00
Lin Tan 442633cd9e Replace metaclass registry with explicit opt-in registry from oslo
Previously, objects are registered through metaclass, which is
complicate to understand. So oslo.versionedobjects move this to
ObjectRegistry class. Each object is registered with a decorator.
This also includes registering some test-only classes,
which use the register_if(False) scheme to do the object-building step,
but without actually inserting the class into the registry. This prevents
those test classes from ever being registered at runtime by accident
(and thus send/receive-able over RPC).

Co-Author: Dan Smith <dms@danplanet.com>
Partial-Bug: #1461239
Change-Id: Ice4d47185b888d1b33e761d7d1437bb20abb3d93
2015-09-16 10:32:19 +08:00
Sinval Vieira 1a76311f07 Refactor refresh method in objects for reuse
This change refactors the "refresh" method in ironic.objects.chassis,
ironic.objects.conductor, ironic.objects.node and ironic.objects.port to
reuse a more generic method added to ironic.objects.base.IronicObject
for identifying and applying changes of fields. It make the code in
refresh method more simpler to understand by removing details of
implementation, in addition decreases the code replication in four
classes.

Change-Id: I6171203690cfd282fa1250dbe0204151f5c665fb
2015-07-23 09:13:29 -03:00
Lucas Alvares Gomes f049c8a00f Migrate RPC objects to oslo.versionedobjects Fields
This patch also makes the Field object able to be called like a function,
which emulates the old interface that objects are expecting. This should
be removed once objects/base.py is updated to stop using the old interface
for the fields

Partial-Bug: #1461239
Change-Id: I34c0203e40d249348626a65584baf2e68cb1b642
2015-07-09 11:20:07 +01:00
Sam Betts 8c07c4fda3 Enforce flake8 E123/6/7/8 in ironic
This patch enforces the rules E123, E126, E127, and E128 in the ironic
code base:

E123 - closing bracket does not match indentation of opening
bracket’s line
E126 - continuation line over-indented for hanging indent
E127 - continuation line over-indented for visual indent
E128 - continuation line under-indented for visual indent

This fixes any parts of the current code which fails these rules and
removes these rules from the tox.ini flake8 ignore list.

Change-Id: Ia96582b5e9abc088d6c1694afc93c59be4a4065c
Closes-Bug: 1421522
2015-06-04 12:56:51 +01:00
Lucas Alvares Gomes b55f6e5148 Do not use the context parameter on refresh()
Now all RPC objects already have a context embedded within them so we
can ignore the context parameter on the refresh() method (it was the
last method using this parameter). This patch also:

* Update the Docstrings from the @remotable methods to let the user know
  that the context parameter is not being used. The @remotable decorator
  still requires that the method it's decorating have a context as it's
  first argument, but that's going to change in the future.

* All code and tests were updated to not pass the context to refresh(),
  save() and destroy() methods.

Closes-Bug: #1314732
Change-Id: Ibb338b909d99862ae048d605e66b8831d8c2128d
2014-09-23 13:58:52 +01:00
Lucas Alvares Gomes 4d7c3e828a Do not set the context twice when forming RPC objects
The context is already being set once the object is instantiated so
there's no need to set it again. This patch fixes that and update tests
to validate if the right context has been added to the object.

Change-Id: I7eb3d734a990eb70e4fbfce6c539b268900b5241
Partial-Bug: #1314732
2014-09-22 17:40:07 +01:00
Lucas Alvares Gomes 654ea01741 Make context mandatory when instantiating a RPC object
RPC objects should have a context within it, this patch is making passing
the context mandatory when instantiating the object and is a plumbing
work to remove passing the context later for things like create(),
refresh(), destroy() and save().

Partial-Bug: #1314732
Change-Id: If9b175fa874bcb96c77cf22d176f1111f450f796
2014-09-22 14:59:43 +01:00
Vladyslav Drok 39a5a507bf Remove gettextutils _ injection
Now that ironic supports oslo.i18n, using the install function to
inject _ into the builtin has been deprecated. New i18n common module
used instead. In one module _ was imported from gettextutils, now
also changed to i18n import.

Closes-bug: #1346406
Change-Id: I672a975d479991982c24031e834a26e2c2811890
2014-08-29 15:36:28 -07:00
Lucas Alvares Gomes 9a9752e50a Remove objectify decorator from dbapi's {get, register}_conductor()
This patch removes the objectify decorator from the get_conductor and
register_conductor dbapi's methods.

For get_condutor() method there's an objects interface to it so this patch
make the code/tests use the object interface vs direct calls to dbapi.

The problem with the objectify decorator is that dbapi methods
doesn't get the context, so when forming the RPC object using the
decorator we can't store the context within the object (which is what
we want to do to have consistent object interfaces).

Partial-Bug: 1314732
Change-Id: I1a955a59435b35277f3bbff2c02c07dd1a4c1d66
2014-08-14 16:11:30 +01:00
He Yongli 110074a594 Remove extraneous vim configuration comments for ironic
Remove vim setting:

comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4

at the top of source code files, except for files in
openstack/common.

Change-Id: Ie80f76f08e27b7f5f747227c4cca8d79ad98bec6
Partial-Bug: #1229324
2014-02-26 09:24:48 +08:00
Devananda van der Veen d40f8e3935 Conductors maintan driver list in the DB
To facilitate exposing a list of drivers in the API,
and keep track of which ironic-conductor instance status,
this patch ...
* adds a new 'conductors' table in the DB
* adds a Conductor object class (with intentionally limited
  functionality)
* adds db/api methods for register/unregister/get/touch
* adds periodic task to conductor to maintain its updated_at field
* adds an additional db/api method to retrieve a list of drivers
  which are registered by active conductor instances

Change-Id: I1ebdb92d5c2d6ad1a6d1717dd13ff51be181ccc0
2013-10-24 17:28:09 -07:00