Merge ~raharper/curtin:fix/preserve-disk-no-ptable into curtin:master

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: 4f9731e403347b413af9b722a62861cf32a3dc84
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/preserve-disk-no-ptable
Merge into: curtin:master
Diff against target: 26 lines (+2/-2)
2 files modified
curtin/commands/block_meta.py (+1/-1)
tests/unittests/test_commands_block_meta.py (+1/-1)
Reviewer Review Type Date Requested Status
Dan Watkins (community) Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+382441@code.launchpad.net

Commit message

block-meta: Don't check the ptable type of a disk with no ptable

When re-using a disk without a partition table we do not need to check
the current partition table.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Dan Watkins (oddbloke) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index 6c145e3..484da41 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -560,7 +560,7 @@ def disk_handler(info, storage_config):
560 disk = get_path_to_storage_volume(info.get('id'), storage_config)560 disk = get_path_to_storage_volume(info.get('id'), storage_config)
561 if config.value_as_boolean(info.get('preserve')):561 if config.value_as_boolean(info.get('preserve')):
562 # Handle preserve flag, verifying if ptable specified in config562 # Handle preserve flag, verifying if ptable specified in config
563 if ptable != PTABLE_UNSUPPORTED:563 if ptable and ptable != PTABLE_UNSUPPORTED:
564 current_ptable = block.get_part_table_type(disk)564 current_ptable = block.get_part_table_type(disk)
565 LOG.debug('disk: current ptable type: %s', current_ptable)565 LOG.debug('disk: current ptable type: %s', current_ptable)
566 if current_ptable not in PTABLES_SUPPORTED:566 if current_ptable not in PTABLES_SUPPORTED:
diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py
index 7b4f99c..2622a6d 100644
--- a/tests/unittests/test_commands_block_meta.py
+++ b/tests/unittests/test_commands_block_meta.py
@@ -1264,7 +1264,7 @@ class TestDiskHandler(CiTestCase):
1264 m_getpath.return_value = disk_path1264 m_getpath.return_value = disk_path
1265 block_meta.disk_handler(info, storage_config)1265 block_meta.disk_handler(info, storage_config)
1266 m_getpath.assert_called_with(info['id'], storage_config)1266 m_getpath.assert_called_with(info['id'], storage_config)
1267 self.assertEqual(1, m_block.get_part_table_type.call_count)1267 self.assertEqual(0, m_block.get_part_table_type.call_count)
12681268
1269 @patch('curtin.commands.block_meta.block')1269 @patch('curtin.commands.block_meta.block')
1270 @patch('curtin.commands.block_meta.util')1270 @patch('curtin.commands.block_meta.util')

Subscribers

People subscribed via source and target branches