summaryrefslogtreecommitdiff
path: root/novaclient/v2
diff options
context:
space:
mode:
authorTakashi NATSUME <natsume.takashi@lab.ntt.co.jp>2019-07-08 10:34:37 +0900
committerTakashi NATSUME <natsume.takashi@lab.ntt.co.jp>2019-07-10 08:54:36 +0900
commit3ac90a52737039fa027502376575d5ce792a018d (patch)
tree84993eafa5c2f8bddf446f426088950b2812a79f /novaclient/v2
parent66611f26d33a5883d1f261b6c8c4f46bf3fdbf92 (diff)
downloadpython-novaclient-3ac90a52737039fa027502376575d5ce792a018d.tar.gz
Deprecate cells v1 and extension commands and APIs
The API extension has been deprecated since 12.0.0 Liberty release (*1) and the cells v1 has been deprecated since 16.0.0 Pike release (*2) in the nova side. The API extension has already been removed (merged into main controllers and schema) since 19.0.0 Stein release (*3) and the cells v1 APIs has already been removed since Iddb519008515f591cf1d884872a5887afbe766f2. In the python-novaclient side, deprecate commands and API bindings related to the API extension and the cells v1 at first. Then the CLIs and API bindings will be removed in the first major release after Nova 20.0.0 Train is released. *1: I084444b11dceda7cf8f88c157aa67d36490fce49 *2: I1a173f7ce0715e684850e030c358e8175fa8724c *3: https://review.opendev.org/#/q/topic:bp/api-extensions-merge-stein Change-Id: I8dc4df95ac7f6974c5280e4107e449d04cd1402e Closes-Bug: #1835699
Diffstat (limited to 'novaclient/v2')
-rw-r--r--novaclient/v2/cells.py16
-rw-r--r--novaclient/v2/list_extensions.py14
-rw-r--r--novaclient/v2/shell.py24
3 files changed, 49 insertions, 5 deletions
diff --git a/novaclient/v2/cells.py b/novaclient/v2/cells.py
index e6a16667..44cadddb 100644
--- a/novaclient/v2/cells.py
+++ b/novaclient/v2/cells.py
@@ -13,32 +13,44 @@
# License for the specific language governing permissions and limitations
# under the License.
+import warnings
+
from novaclient import base
+from novaclient.i18n import _
+
+CELL_V1_DEPRECATION_WARNING = _(
+ 'The cells v1 interface has been deprecated in Nova since 16.0.0 Pike '
+ 'Release. This API binding will be removed in the first major release '
+ 'after the Nova server 20.0.0 Train release.')
class Cell(base.Resource):
+ """DEPRECATED"""
def __repr__(self):
return "<Cell: %s>" % self.name
class CellsManager(base.Manager):
+ """DEPRECATED"""
resource_class = Cell
def get(self, cell_name):
"""
- Get a cell.
+ DEPRECATED Get a cell.
:param cell_name: Name of the :class:`Cell` to get.
:rtype: :class:`Cell`
"""
+ warnings.warn(CELL_V1_DEPRECATION_WARNING, DeprecationWarning)
return self._get("/os-cells/%s" % cell_name, "cell")
def capacities(self, cell_name=None):
"""
- Get capacities for a cell.
+ DEPRECATED Get capacities for a cell.
:param cell_name: Name of the :class:`Cell` to get capacities for.
:rtype: :class:`Cell`
"""
+ warnings.warn(CELL_V1_DEPRECATION_WARNING, DeprecationWarning)
path = ["%s/capacities" % cell_name, "capacities"][cell_name is None]
return self._get("/os-cells/%s" % path, "cell")
diff --git a/novaclient/v2/list_extensions.py b/novaclient/v2/list_extensions.py
index faeead60..e7043e31 100644
--- a/novaclient/v2/list_extensions.py
+++ b/novaclient/v2/list_extensions.py
@@ -13,12 +13,23 @@
# License for the specific language governing permissions and limitations
# under the License.
+import warnings
+
from novaclient import base
+from novaclient.i18n import _
+
+EXTENSION_DEPRECATION_WARNING = _(
+ 'The API extension interface has been deprecated since 12.0.0 Liberty '
+ 'Release. This API binding will be removed in the first major release '
+ 'after the Nova server 20.0.0 Train release.')
class ListExtResource(base.Resource):
+ """DEPRECATED"""
@property
def summary(self):
+ """DEPRECATED"""
+ warnings.warn(EXTENSION_DEPRECATION_WARNING, DeprecationWarning)
descr = self.description.strip()
if not descr:
return '??'
@@ -30,7 +41,10 @@ class ListExtResource(base.Resource):
class ListExtManager(base.Manager):
+ """DEPRECATED"""
resource_class = ListExtResource
def show_all(self):
+ """DEPRECATED"""
+ warnings.warn(EXTENSION_DEPRECATION_WARNING, DeprecationWarning)
return self._list("/extensions", 'extensions')
diff --git a/novaclient/v2/shell.py b/novaclient/v2/shell.py
index 6653aa2f..dbee93e5 100644
--- a/novaclient/v2/shell.py
+++ b/novaclient/v2/shell.py
@@ -48,6 +48,21 @@ from novaclient.v2 import servers
logger = logging.getLogger(__name__)
+CELL_V1_DEPRECATION_WARNING = _(
+ 'The cells v1 interface has been deprecated. This command will be removed '
+ 'in the first major release after the Nova server 20.0.0 Train release.')
+
+EXTENSION_DEPRECATION_WARNING = _(
+ 'The API extension interface has been deprecated. This command will be '
+ 'removed in the first major release after the Nova server 20.0.0 Train '
+ 'release.')
+
+
+# NOTE(takashin): Remove this along with the deprecated commands in the first
+# major python-novaclient release AFTER the nova server 20.0.0 Train release.
+def _emit_deprecation_warning(message):
+ print(message, file=sys.stderr)
+
def emit_duplicated_image_with_warning(img, image_with):
img_uuid_list = [str(image.id) for image in img]
@@ -4855,7 +4870,8 @@ def do_server_tag_delete_all(cs, args):
metavar='<cell-name>',
help=_('Name of the cell.'))
def do_cell_show(cs, args):
- """Show details of a given cell."""
+ """DEPRECATED Show details of a given cell."""
+ _emit_deprecation_warning(CELL_V1_DEPRECATION_WARNING)
cell = cs.cells.get(args.cell)
utils.print_dict(cell.to_dict())
@@ -4866,7 +4882,8 @@ def do_cell_show(cs, args):
help=_("Name of the cell to get the capacities."),
default=None)
def do_cell_capacities(cs, args):
- """Get cell capacities for all cells or a given cell."""
+ """DEPRECATED Get cell capacities for all cells or a given cell."""
+ _emit_deprecation_warning(CELL_V1_DEPRECATION_WARNING)
cell = cs.cells.capacities(args.cell)
print(_("Ram Available: %s MiB") % cell.capacities['ram_free']['total_mb'])
utils.print_dict(cell.capacities['ram_free']['units_by_mb'],
@@ -5300,8 +5317,9 @@ def do_instance_action_list(cs, args):
def do_list_extensions(cs, _args):
"""
- List all the os-api extensions that are available.
+ DEPRECATED List all the os-api extensions that are available.
"""
+ _emit_deprecation_warning(EXTENSION_DEPRECATION_WARNING)
extensions = cs.list_extensions.show_all()
fields = ["Name", "Summary", "Alias", "Updated"]
utils.print_list(extensions, fields)