ironic.objects.indirection module

class ironic.objects.indirection.IronicObjectIndirectionAPI[source]

Bases: VersionedObjectIndirectionAPI

object_action(context, objinst, objmethod, args, kwargs)[source]

Perform an action on a VersionedObject instance.

When indirection_api is set on a VersionedObject (to a class implementing this interface), method calls on remotable methods will cause this to be executed to actually make the desired call. This often involves performing RPC.

Parameters:
  • context – The context within which to perform the action

  • objinst – The object instance on which to perform the action

  • objmethod – The name of the action method to call

  • args – The positional arguments to the action method

  • kwargs – The keyword arguments to the action method

Returns:

The result of the action method

object_backport_versions(context, objinst, object_versions)[source]

Perform a backport of an object instance.

This method is basically just like object_backport() but instead of providing a specific target version for the toplevel object and relying on the service-side mapping to handle sub-objects, this sends a mapping of all the dependent objects and their client-supported versions. The server will backport objects within the tree starting at objinst to the versions specified in object_versions, removing objects that have no entry. Use obj_tree_get_versions() to generate this mapping.

NOTE: This was not in the initial spec for this interface, so the base class raises NotImplementedError if you don’t implement it. For backports, this method will be tried first, and if unimplemented, will fall back to object_backport().

Parameters:
  • context – The context within which to perform the backport

  • objinst – An instance of a VersionedObject to be backported

  • object_versions – A dict of {objname: version} mappings

object_class_action(context, objname, objmethod, objver, args, kwargs)[source]

Deprecated since version 0.10.0.

Use object_class_action_versions() instead.

Perform an action on a VersionedObject class.

When indirection_api is set on a VersionedObject (to a class implementing this interface), classmethod calls on remotable_classmethod methods will cause this to be executed to actually make the desired call. This usually involves performing RPC.

Parameters:
  • context – The context within which to perform the action

  • objname – The registry name of the object

  • objmethod – The name of the action method to call

  • objver – The (remote) version of the object on which the action is being taken

  • args – The positional arguments to the action method

  • kwargs – The keyword arguments to the action method

Returns:

The result of the action method, which may (or may not) be an instance of the implementing VersionedObject class.

object_class_action_versions(context, objname, objmethod, object_versions, args, kwargs)[source]

Perform an action on a VersionedObject class.

When indirection_api is set on a VersionedObject (to a class implementing this interface), classmethod calls on remotable_classmethod methods will cause this to be executed to actually make the desired call. This usually involves performing RPC.

This differs from object_class_action() in that it is provided with object_versions, a manifest of client-side object versions for easier nested backports. The manifest is the result of calling obj_tree_get_versions().

NOTE: This was not in the initial spec for this interface, so the base class raises NotImplementedError if you don’t implement it. For backports, this method will be tried first, and if unimplemented, will fall back to object_class_action(). New implementations should provide this method instead of object_class_action()

Parameters:
  • context – The context within which to perform the action

  • objname – The registry name of the object

  • objmethod – The name of the action method to call

  • object_versions – A dict of {objname: version} mappings

  • args – The positional arguments to the action method

  • kwargs – The keyword arguments to the action method

Returns:

The result of the action method, which may (or may not) be an instance of the implementing VersionedObject class.