The cinder.openstack.common.versionutils Module

Helpers for comparing version strings.

class deprecated(as_of, in_favor_of=None, remove_in=2, what=None)

Bases: object

A decorator to mark callables as deprecated.

This decorator logs a deprecation message when the callable it decorates is used. The message will include the release where the callable was deprecated, the release where it may be removed and possibly an optional replacement.

Examples:

  1. Specifying the required deprecated release
>>> @deprecated(as_of=deprecated.ICEHOUSE)
... def a(): pass
  1. Specifying a replacement:
>>> @deprecated(as_of=deprecated.ICEHOUSE, in_favor_of='f()')
... def b(): pass
  1. Specifying the release where the functionality may be removed:
>>> @deprecated(as_of=deprecated.ICEHOUSE, remove_in=+1)
... def c(): pass
FOLSOM = 'F'
GRIZZLY = 'G'
HAVANA = 'H'
ICEHOUSE = 'I'
is_compatible(requested_version, current_version, same_major=True)

Determine whether requested_version is satisfied by current_version; in other words, current_version is >= requested_version.

Parameters:
  • requested_version – version to check for compatibility
  • current_version – version to check against
  • same_major – if True, the major version must be identical between requested_version and current_version. This is used when a major-version difference indicates incompatibility between the two versions. Since this is the common-case in practice, the default is True.
Returns:

True if compatible, False if not

Previous topic

The cinder.openstack.common.uuidutils Module

Next topic

The cinder.policy Module

This Page