Merge "Change exception type while deattaching root device"
This commit is contained in:
@@ -433,7 +433,7 @@ class VolumeAttachmentController(wsgi.Controller):
|
||||
|
||||
if bdm.is_root:
|
||||
msg = _("Cannot detach a root device volume")
|
||||
raise exc.HTTPForbidden(explanation=msg)
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
|
||||
try:
|
||||
self.compute_api.detach_volume(context, instance, volume)
|
||||
|
@@ -541,7 +541,7 @@ class VolumeAttachTestsV21(test.NoDBTestCase):
|
||||
new_callable=mock.PropertyMock)
|
||||
def test_detach_vol_root(self, mock_isroot):
|
||||
mock_isroot.return_value = True
|
||||
self.assertRaises(exc.HTTPForbidden,
|
||||
self.assertRaises(exc.HTTPBadRequest,
|
||||
self.attachments.delete,
|
||||
self.req,
|
||||
FAKE_UUID,
|
||||
|
Reference in New Issue
Block a user