Fix root UUID for streamed partition images
The root UUID changes after a streamed partition image is written to the block device, causing later deployment failure when assuming the old UUID. This change updates the root UUID after streaming the partition image is complete. This issue may have been missed in local testing because deploying the same image repeatedly will result in stable root UUID across runs. Change-Id: Ice4630c16fc216980488d1427f3b02e1b8a417fa
This commit is contained in:
parent
85b3afd863
commit
e61336602f
@ -600,6 +600,10 @@ class StandbyExtension(base.BaseAgentExtension):
|
||||
except exception.InstanceDeployFailure:
|
||||
# Note: the catch internal to the helper method logs any errors.
|
||||
pass
|
||||
# Fix the root partition UUID
|
||||
root_uuid = disk_utils.block_uuid(device)
|
||||
LOG.info("{} UUID is now {}".format(device, root_uuid))
|
||||
self.partition_uuids['root uuid'] = root_uuid
|
||||
|
||||
def _fix_up_partition_uuids(self, image_info, device):
|
||||
if self.partition_uuids is None:
|
||||
|
@ -1169,12 +1169,14 @@ class TestStandbyExtension(base.IronicAgentTest):
|
||||
download_mock.assert_called_once_with(image_info)
|
||||
write_mock.assert_called_once_with(image_info, device)
|
||||
|
||||
@mock.patch('ironic_lib.disk_utils.block_uuid', autospec=True)
|
||||
@mock.patch('ironic_lib.disk_utils.fix_gpt_partition', autospec=True)
|
||||
@mock.patch('hashlib.md5', autospec=True)
|
||||
@mock.patch('builtins.open', autospec=True)
|
||||
@mock.patch('requests.get', autospec=True)
|
||||
def test_stream_raw_image_onto_device(self, requests_mock, open_mock,
|
||||
md5_mock, fix_gpt_mock):
|
||||
md5_mock, fix_gpt_mock,
|
||||
block_uuid_mock):
|
||||
image_info = _build_fake_image_info()
|
||||
response = requests_mock.return_value
|
||||
response.status_code = 200
|
||||
@ -1184,6 +1186,9 @@ class TestStandbyExtension(base.IronicAgentTest):
|
||||
file_mock.read.return_value = None
|
||||
hexdigest_mock = md5_mock.return_value.hexdigest
|
||||
hexdigest_mock.return_value = image_info['checksum']
|
||||
self.agent_extension.partition_uuids = {}
|
||||
|
||||
block_uuid_mock.return_value = 'aaaabbbb'
|
||||
|
||||
self.agent_extension._stream_raw_image_onto_device(image_info,
|
||||
'/dev/foo')
|
||||
@ -1194,6 +1199,11 @@ class TestStandbyExtension(base.IronicAgentTest):
|
||||
expected_calls = [mock.call('some'), mock.call('content')]
|
||||
file_mock.write.assert_has_calls(expected_calls)
|
||||
fix_gpt_mock.assert_called_once_with('/dev/foo', node_uuid=None)
|
||||
block_uuid_mock.assert_called_once_with('/dev/foo')
|
||||
self.assertEqual(
|
||||
'aaaabbbb',
|
||||
self.agent_extension.partition_uuids['root uuid']
|
||||
)
|
||||
|
||||
@mock.patch('hashlib.md5', autospec=True)
|
||||
@mock.patch('builtins.open', autospec=True)
|
||||
|
5
releasenotes/notes/streaming-uuid-fdf136a7745fbb3d.yaml
Normal file
5
releasenotes/notes/streaming-uuid-fdf136a7745fbb3d.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixes incorrect root partition UUID after streaming a raw partition
|
||||
image.
|
Loading…
x
Reference in New Issue
Block a user