Deprecate not providing resource_class (again)

It is not going to be compatible with the proposed allocation API,
because the API will have to be compatible with Placement, which
requires resource class.

Change-Id: Ib288e7f933f421d6ff756e6bc4877fd344515c74
Story: #2004341
Task: #28027
This commit is contained in:
Dmitry Tantsur 2018-11-21 13:03:45 +01:00
parent cea2cda604
commit b9cdef8ced
1 changed files with 5 additions and 2 deletions

View File

@ -80,8 +80,7 @@ class Provisioner(object):
node = provisioner.reserve_node("compute",
capabilities={"boot_mode": "uefi"})
:param resource_class: Requested resource class. If ``None``, a node
with any resource class can be chosen.
:param resource_class: Requested resource class.
:param conductor_group: Conductor group to pick the nodes from.
Value ``None`` means any group, use empty string "" for nodes
from the default group.
@ -98,6 +97,10 @@ class Provisioner(object):
:raises: :py:class:`metalsmith.exceptions.ReservationFailed`
"""
capabilities = capabilities or {}
if resource_class is None:
warnings.warn("Not providing resource_class is deprecated as it's "
"not compatible with the proposed allocation API",
DeprecationWarning)
if candidates:
nodes = [self._api.get_node(node) for node in candidates]