Skip to content

Commit 9fa5636

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "compute: Skip cinder_encryption_key_id check when booting from volume"
2 parents 2f18450 + f9b6789 commit 9fa5636

File tree

2 files changed

+12
-19
lines changed

2 files changed

+12
-19
lines changed

nova/compute/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,12 @@ def _detect_nonbootable_image_from_properties(image_id, image):
627627
return
628628

629629
image_properties = image.get('properties', {})
630-
if image_properties.get('cinder_encryption_key_id'):
630+
# NOTE(lyarwood) Skip this check when image_id is None indicating that
631+
# the instance is booting from a volume that was itself initially
632+
# created from an image. As such we don't care if
633+
# cinder_encryption_key_id was against the original image as we are now
634+
# booting from an encrypted volume.
635+
if image_properties.get('cinder_encryption_key_id') and image_id:
631636
reason = _('Direct booting of an image uploaded from an '
632637
'encrypted volume is unsupported.')
633638
raise exception.ImageUnacceptable(image_id=image_id,

nova/tests/functional/regressions/test_bug_1895696.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,9 @@ def test_nonbootable_metadata_bfv_image_metadata(self):
122122
'volume_size': 1,
123123
}]
124124

125-
# FIXME(lyarwood) n-api should ignore cinder_encryption_key_id in the
126-
# original image in this case and accept the request.
127-
ex = self.assertRaises(
128-
client.OpenStackApiException, self.api.post_server,
129-
{'server': server})
130-
self.assertEqual(400, ex.response.status_code)
131-
self.assertIn(
132-
"Direct booting of an image uploaded from an encrypted volume is "
133-
"unsupported", str(ex))
125+
# Assert that this request is accepted and the server moves to ACTIVE
126+
server = self.api.post_server({'server': server})
127+
self._wait_for_state_change(server, 'ACTIVE')
134128

135129
def test_nonbootable_metadata_bfv_volume_image_metadata(self):
136130
"""Assert behaviour when c-api has created volume using encrypted image
@@ -147,12 +141,6 @@ def test_nonbootable_metadata_bfv_volume_image_metadata(self):
147141
'uuid': uuids.cinder_encrypted_volume_uuid,
148142
}]
149143

150-
# FIXME(lyarwood) n-api should ignore cinder_encryption_key_id in the
151-
# volume volume_image_metadata in this case and accept the request.
152-
ex = self.assertRaises(
153-
client.OpenStackApiException, self.api.post_server,
154-
{'server': server})
155-
self.assertEqual(400, ex.response.status_code)
156-
self.assertIn(
157-
"Direct booting of an image uploaded from an encrypted volume is "
158-
"unsupported", str(ex))
144+
# Assert that this request is accepted and the server moves to ACTIVE
145+
server = self.api.post_server({'server': server})
146+
self._wait_for_state_change(server, 'ACTIVE')

0 commit comments

Comments
 (0)