Merge ~dbungert/curtin:ntfsresize-force into curtin:master

Proposed by Dan Bungert
Status: Merged
Approved by: Dan Bungert
Approved revision: 6caa799551b19dc85cb1e901e013b12be326aff1
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~dbungert/curtin:ntfsresize-force
Merge into: curtin:master
Diff against target: 52 lines (+30/-1)
2 files modified
curtin/commands/block_meta_v2.py (+3/-1)
tests/integration/test_block_meta.py (+27/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Dimitri John Ledkov (community) prejudice Approve
curtin developers Pending
Review via email: mp+441347@code.launchpad.net

Commit message

block: ntfsresize with force options

To match Ubiquity behavior, we should run ntfsresize with the force
options and sending 'y\n' on input.

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
Dimitri John Ledkov (xnox) wrote :

i hate it.
ship it.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/curtin/commands/block_meta_v2.py b/curtin/commands/block_meta_v2.py
index 552ab98..79dfd39 100644
--- a/curtin/commands/block_meta_v2.py
+++ b/curtin/commands/block_meta_v2.py
@@ -85,7 +85,9 @@ def resize_ext(path, size):
8585
8686
87def resize_ntfs(path, size):87def resize_ntfs(path, size):
88 util.subp(['ntfsresize', '-s', str(size), path])88 util.subp(['ntfsresize', '-f', '-s', str(size), path],
89 data=b'y\n',
90 capture=True)
8991
9092
91def perform_resize(kname, resize):93def perform_resize(kname, resize):
diff --git a/tests/integration/test_block_meta.py b/tests/integration/test_block_meta.py
index d7c52d8..b25d2ce 100644
--- a/tests/integration/test_block_meta.py
+++ b/tests/integration/test_block_meta.py
@@ -631,6 +631,33 @@ class TestBlockMeta(IntegrationTestCase):
631 ])631 ])
632 self.check_fssize(dev, p1, fstype, end)632 self.check_fssize(dev, p1, fstype, end)
633633
634 def test_multi_resize(self):
635 img = self.tmp_path('image.img')
636 config = StorageConfigBuilder(version=2)
637 config.add_image(path=img, size='200M', ptable='gpt')
638
639 def size_to(size):
640 p1['size'] = size
641 self.run_bm(config.render())
642 with loop_dev(img) as dev:
643 self.assertEqual('ntfs', _get_volume_fstype(f'{dev}p1'))
644 self.create_data(dev, p1)
645 self.assertEqual(
646 summarize_partitions(dev), [
647 PartData(number=1, offset=1 << 20, size=size),
648 ])
649 self.check_fssize(dev, p1, 'ntfs', size)
650
651 p1 = config.add_part(size=180 << 20, offset=1 << 20, number=1,
652 fstype='ntfs')
653 size_to(180 << 20)
654
655 config.set_preserve()
656 p1['resize'] = True
657
658 size_to(160 << 20)
659 size_to(140 << 20)
660
634 def test_resize_up_ext2(self):661 def test_resize_up_ext2(self):
635 self._do_test_resize(40, 80, 'ext2')662 self._do_test_resize(40, 80, 'ext2')
636663

Subscribers

People subscribed via source and target branches