Merge ~mwhudson/curtin:disk_handler-empty-vtoc into curtin:master

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: 8d535e1368d3035539c81368556c777db0723bd6
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~mwhudson/curtin:disk_handler-empty-vtoc
Merge into: curtin:master
Diff against target: 35 lines (+12/-2)
2 files modified
curtin/commands/block_meta.py (+1/-2)
tests/unittests/test_commands_block_meta.py (+11/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dimitri John Ledkov (community) Approve
curtin developers Pending
Review via email: mp+394153@code.launchpad.net

Commit message

create an empty vtoc in disk_handler

Another merge proposal I have uses fdasd to get the block and track size
when partitioning a disk. But the wiping disk_handler can do can do
enough damage to stop fdasd working at all. Putting an empty vtoc onto
the disk allows fdasd to report the sizes when needed.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

FAILED: Continuous integration, rev:8d535e1368d3035539c81368556c777db0723bd6

No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself):
https://code.launchpad.net/~mwhudson/curtin/+git/curtin/+merge/394153/+edit-commit-message

https://jenkins.ubuntu.com/server/job/curtin-ci/11/
Executed test runs:
    SUCCESS: https://jenkins.ubuntu.com/server/job/curtin-ci/nodes=metal-amd64/11/
    SUCCESS: https://jenkins.ubuntu.com/server/job/curtin-ci/nodes=metal-arm64/11/
    SUCCESS: https://jenkins.ubuntu.com/server/job/curtin-ci/nodes=metal-ppc64el/11/
    SUCCESS: https://jenkins.ubuntu.com/server/job/curtin-ci/nodes=metal-s390x/11/

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/curtin-ci/11//rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

normally no dasd drives ever are without a vtoc. However, one can try very hard to destory them, or actually come up for the first time in the z/vm environment. In such cases, it's near impossible to operate on the dasd in any sensible manner, thus creating vtoc is the only right way forward. After doing that, it becomes much easier to add/remove partitions or wipe the device (in cutin terms).

review: Approve
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
2index eada650..874ccbb 100644
3--- a/curtin/commands/block_meta.py
4+++ b/curtin/commands/block_meta.py
5@@ -611,8 +611,7 @@ def disk_handler(info, storage_config):
6 elif ptable in _dos_names:
7 util.subp(["parted", disk, "--script", "mklabel", "msdos"])
8 elif ptable == "vtoc":
9- # ignore dasd partition tables
10- pass
11+ util.subp(["fdasd", "-c", "/dev/null", disk])
12 holders = clear_holders.get_holders(disk)
13 if len(holders) > 0:
14 LOG.info('Detected block holders on disk %s: %s', disk, holders)
15diff --git a/tests/unittests/test_commands_block_meta.py b/tests/unittests/test_commands_block_meta.py
16index 98be573..ffec434 100644
17--- a/tests/unittests/test_commands_block_meta.py
18+++ b/tests/unittests/test_commands_block_meta.py
19@@ -1294,6 +1294,17 @@ class TestDiskHandler(CiTestCase):
20 m_getpath.assert_called_with(info['id'], storage_config)
21 m_block.get_part_table_type.assert_called_with(disk_path)
22
23+ @patch('curtin.commands.block_meta.util.subp')
24+ @patch('curtin.commands.block_meta.clear_holders.get_holders')
25+ @patch('curtin.commands.block_meta.get_path_to_storage_volume')
26+ def test_disk_handler_calls_fdasd_for_vtoc(self, m_getpath,
27+ m_get_holders, m_subp):
28+ info = {'ptable': 'vtoc', 'type': 'disk', 'id': 'disk-foobar'}
29+ path = m_getpath.return_value = self.random_string()
30+ m_get_holders.return_value = []
31+ block_meta.disk_handler(info, OrderedDict())
32+ m_subp.assert_called_once_with(['fdasd', '-c', '/dev/null', path])
33+
34
35 class TestLvmVolgroupHandler(CiTestCase):
36

Subscribers

People subscribed via source and target branches