From 64fe0abb653950c85d455dedd09ef42856c6b07b Mon Sep 17 00:00:00 2001 From: manchandavishal Date: Tue, 29 Jun 2021 23:38:41 +0530 Subject: [PATCH] Fix Unable to use multiattach volume as boot for new server If we try to create a new server from a bootable volume that supports multiattach, it will fail to create with an error message that ``multiattach volumes are only supported starting with compute API version 2.60``. This patch fixes the issue. Closes-Bug: #1931440 Change-Id: Ic8330b947b1a733f70c3bdad8b3493f20a2f26fb --- openstack_dashboard/api/microversions.py | 4 ++-- openstack_dashboard/api/nova.py | 3 ++- openstack_dashboard/test/unit/api/test_nova.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openstack_dashboard/api/microversions.py b/openstack_dashboard/api/microversions.py index ef28a1ae44..9d33952ecd 100644 --- a/openstack_dashboard/api/microversions.py +++ b/openstack_dashboard/api/microversions.py @@ -29,12 +29,12 @@ LOG = logging.getLogger(__name__) MICROVERSION_FEATURES = { "nova": { "locked_attribute": ["2.9", "2.42"], - "instance_description": ["2.19", "2.42"], + "instance_description": ["2.19", "2.60"], "remote_console_mks": ["2.8", "2.53"], "servergroup_soft_policies": ["2.15", "2.60"], "servergroup_user_info": ["2.13", "2.60"], "multiattach": ["2.60"], - "auto_allocated_network": ["2.37", "2.42"], + "auto_allocated_network": ["2.37", "2.60"], "key_types": ["2.2", "2.9"], "key_type_list": ["2.9"], }, diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index bfdf650cbc..394d893e31 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -411,7 +411,8 @@ def server_create(request, name, image, flavor, key_name, user_data, availability_zone=None, instance_count=1, admin_pass=None, disk_config=None, config_drive=None, meta=None, scheduler_hints=None, description=None): - microversion = get_microversion(request, ("instance_description", + microversion = get_microversion(request, ("multiattach", + "instance_description", "auto_allocated_network")) nova_client = _nova.novaclient(request, version=microversion) diff --git a/openstack_dashboard/test/unit/api/test_nova.py b/openstack_dashboard/test/unit/api/test_nova.py index d72dcc363e..d394b78f74 100644 --- a/openstack_dashboard/test/unit/api/test_nova.py +++ b/openstack_dashboard/test/unit/api/test_nova.py @@ -784,7 +784,7 @@ class ComputeApiTests(test.APIMockTestCase): self.assertIsInstance(ret, api.nova.Server) self.mock_get_microversion.assert_called_once_with( - mock.sentinel.request, ('instance_description', + mock.sentinel.request, ('multiattach', 'instance_description', 'auto_allocated_network')) self.mock_novaclient.assert_called_once_with( mock.sentinel.request, version=mock.sentinel.microversion)