From 25074cbe6cdf8091f0e9cee06f0018db73444d74 Mon Sep 17 00:00:00 2001 From: zhangbailin Date: Thu, 29 Aug 2019 08:33:25 +0800 Subject: [PATCH] Follow up for specifying az to unshelve Because of the 'availability_zone' was required in microversion 2.77, so in v2.77, the 'availability_zone' is True. The logical of https://review.opendev.org/#/c/663851/43/nova/api/openstack/compute/shelve.py@90 is duplicated and redundant, so remove it. Change-Id: I4618e4a08465c12daae793ec4ade2712e43637aa --- nova/api/openstack/compute/rest_api_version_history.rst | 1 + nova/api/openstack/compute/shelve.py | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nova/api/openstack/compute/rest_api_version_history.rst b/nova/api/openstack/compute/rest_api_version_history.rst index 4bdc30c1f7..de216ef29d 100644 --- a/nova/api/openstack/compute/rest_api_version_history.rst +++ b/nova/api/openstack/compute/rest_api_version_history.rst @@ -996,5 +996,6 @@ through ``GET /servers/{server_id}/os-instance-actions`` and 2.77 ---- + API microversion 2.77 adds support for specifying availability zone when unshelving a shelved offloaded server. diff --git a/nova/api/openstack/compute/shelve.py b/nova/api/openstack/compute/shelve.py index 3293e07fa0..b08a4ac7e9 100644 --- a/nova/api/openstack/compute/shelve.py +++ b/nova/api/openstack/compute/shelve.py @@ -87,10 +87,9 @@ class ShelveController(wsgi.Controller): new_az = None unshelve_dict = body['unshelve'] - if unshelve_dict and 'availability_zone' in unshelve_dict: - support_az = api_version_request.is_supported(req, '2.77') - if support_az: - new_az = unshelve_dict['availability_zone'] + support_az = api_version_request.is_supported(req, '2.77') + if support_az and unshelve_dict: + new_az = unshelve_dict['availability_zone'] # We could potentially move this check to conductor and avoid the # extra API call to neutron when we support move operations with ports