Browse Source

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
Dmitry Tantsur 5 months ago
parent
commit
b9cdef8ced
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      metalsmith/_provisioner.py

+ 5
- 2
metalsmith/_provisioner.py View File

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

Loading…
Cancel
Save