Skip to content

Commit ec0c45a

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Merge config drive extension response into server controller"
2 parents fbc8ab2 + 67d3448 commit ec0c45a

File tree

6 files changed

+15
-120
lines changed

6 files changed

+15
-120
lines changed

nova/api/openstack/compute/config_drive.py

Lines changed: 0 additions & 45 deletions
This file was deleted.

nova/api/openstack/compute/routes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from nova.api.openstack.compute import cells
2929
from nova.api.openstack.compute import certificates
3030
from nova.api.openstack.compute import cloudpipe
31-
from nova.api.openstack.compute import config_drive
3231
from nova.api.openstack.compute import console_auth_tokens
3332
from nova.api.openstack.compute import console_output
3433
from nova.api.openstack.compute import consoles
@@ -268,7 +267,6 @@ def _create_controller(main_controller, controller_list,
268267
server_controller = functools.partial(_create_controller,
269268
servers.ServersController,
270269
[
271-
config_drive.ConfigDriveController,
272270
extended_server_attributes.ExtendedServerAttributesController,
273271
extended_status.ExtendedStatusController,
274272
extended_volumes.ExtendedVolumesController,

nova/api/openstack/compute/servers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,8 @@ def update(self, req, id, body):
718718
update_dict)
719719
return self._view_builder.show(req, instance,
720720
extend_address=False,
721-
show_AZ=False)
721+
show_AZ=False,
722+
show_config_drive=False)
722723
except exception.InstanceNotFound:
723724
msg = _("Instance could not be found")
724725
raise exc.HTTPNotFound(explanation=msg)
@@ -983,7 +984,8 @@ def _action_rebuild(self, req, id, body):
983984
instance = self._get_server(context, req, id, is_detail=True)
984985

985986
view = self._view_builder.show(req, instance, extend_address=False,
986-
show_AZ=False)
987+
show_AZ=False,
988+
show_config_drive=False)
987989

988990
# Add on the admin_password attribute since the view doesn't do it
989991
# unless instance passwords are disabled

nova/api/openstack/compute/views/servers.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def get_show_expected_attrs(self, expected_attrs=None):
111111
return sorted(list(set(self._show_expected_attrs + expected_attrs)))
112112

113113
def show(self, request, instance, extend_address=True,
114-
show_extra_specs=None, show_AZ=True):
114+
show_extra_specs=None, show_AZ=True, show_config_drive=True):
115115
"""Detailed view of a single instance."""
116116
ip_v4 = instance.get('access_ip_v4')
117117
ip_v6 = instance.get('access_ip_v6')
@@ -169,6 +169,9 @@ def show(self, request, instance, extend_address=True,
169169
# with v2.0.
170170
server["server"]["OS-EXT-AZ:availability_zone"] = az or ''
171171

172+
if show_config_drive:
173+
server["server"]["config_drive"] = instance["config_drive"]
174+
172175
if api_version_request.is_supported(request, min_version="2.9"):
173176
server["server"]["locked"] = (True if instance["locked_by"]
174177
else False)

nova/tests/unit/api/openstack/compute/test_config_drive.py

Lines changed: 0 additions & 70 deletions
This file was deleted.

nova/tests/unit/api/openstack/compute/test_serversV21.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ def _get_server_data_dict(self, uuid, image_bookmark, flavor_bookmark,
378378
"accessIPv4": '',
379379
"accessIPv6": '',
380380
"OS-EXT-AZ:availability_zone": "nova",
381+
"config_drive": None,
381382
}
382383
}
383384

@@ -2088,6 +2089,7 @@ def test_rebuild_response_has_no_show_server_only_attributes(self):
20882089
body=body).obj
20892090

20902091
self.assertNotIn('OS-EXT-AZ:availability_zone', body['server'])
2092+
self.assertNotIn('config_drive', body['server'])
20912093

20922094
@mock.patch.object(compute_api.API, 'start')
20932095
def test_start(self, mock_start):
@@ -2683,6 +2685,7 @@ def test_update_response_has_no_show_server_only_attributes(self):
26832685
req = self._get_request(body)
26842686
res_dict = self.controller.update(req, FAKE_UUID, body=body)
26852687
self.assertNotIn('OS-EXT-AZ:availability_zone', res_dict['server'])
2688+
self.assertNotIn('config_drive', res_dict['server'])
26862689

26872690
def test_update_server_name_too_long(self):
26882691
body = {'server': {'name': 'x' * 256}}
@@ -5992,6 +5995,7 @@ def test_build_server_detail(self):
59925995
"accessIPv4": '',
59935996
"accessIPv6": '',
59945997
"OS-EXT-AZ:availability_zone": "nova",
5998+
"config_drive": None,
59955999
}
59966000
}
59976001

@@ -6072,6 +6076,7 @@ def test_build_server_detail_with_fault(self):
60726076
"accessIPv4": '',
60736077
"accessIPv6": '',
60746078
"OS-EXT-AZ:availability_zone": "nova",
6079+
"config_drive": None,
60756080
}
60766081
}
60776082

@@ -6251,6 +6256,7 @@ def test_build_server_detail_active_status(self):
62516256
"accessIPv4": '',
62526257
"accessIPv6": '',
62536258
"OS-EXT-AZ:availability_zone": "nova",
6259+
"config_drive": None,
62546260
}
62556261
}
62566262

@@ -6328,6 +6334,7 @@ def test_build_server_detail_with_metadata(self):
63286334
"accessIPv4": '',
63296335
"accessIPv6": '',
63306336
"OS-EXT-AZ:availability_zone": "nova",
6337+
"config_drive": None,
63316338
}
63326339
}
63336340

0 commit comments

Comments
 (0)