Files
ironic/ironic/objects/indirection.py
T
Julia Kreger 67da8d8c31 Optional indirection API use
Adds the capability to utilize the indirection API model.

The vast majority of this change is the removal of legacy
comments and the swap of decorators on object methods to
allow the Versioned Objects Indirection API to route the
calls upon objects through the RPC layer to the conductor.

In order to make these calls occur, we need to also send along
a context, which is required to call the RPC layer, which is
fine. Original tests still work in that API surface calls still
ultimately trigger DB API calls in the backend, thus test changes
are actually minimal, similar to very slight changes in trait
retrieval as well. In that we really can't nest objects across
the indirection layer.

Change-Id: Ia161fef67b8a116fdf7cad9b2e559ba75263e196
Signed-off-by: Julia Kreger <juliaashleykreger@gmail.com>
2025-08-18 09:53:11 -07:00

38 lines
1.8 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_versionedobjects import base as object_base
from ironic.conductor import rpcapi as conductor_api
# NOTE(TheJulia): The whole purpose of the indirection API is to disjoint
# the interactions to the conductor through a class based upon the
# VersionedObjectIndirectionAPI class provided by oslo.versionedobjects.
class IronicObjectIndirectionAPI(object_base.VersionedObjectIndirectionAPI):
def __init__(self):
super(IronicObjectIndirectionAPI, self).__init__()
self._conductor = conductor_api.ConductorAPI()
def object_action(self, context, objinst, objmethod, args, kwargs):
return self._conductor.object_action(context, objinst, objmethod,
args, kwargs)
def object_class_action_versions(self, context, objname, objmethod,
object_versions, args, kwargs):
return self._conductor.object_class_action_versions(
context, objname, objmethod, object_versions, args, kwargs)
def object_backport_versions(self, context, objinst, object_versions):
return self._conductor.object_backport_versions(context, objinst,
object_versions)