Skip to content

Commit

Permalink
Make LUKS format resizable.
Browse files Browse the repository at this point in the history
Related: #56

* Set _resizable True.
* Set up resize class.
* Fix up size tests that break when LUKS format becomes resizable.

Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed Jun 18, 2015
1 parent 916f51a commit 97a6af4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions blivet/formats/luks.py
Expand Up @@ -48,6 +48,8 @@ class LUKS(DeviceFormat):
_minSize = crypto.LUKS_METADATA_SIZE
_plugin = availability.BLOCKDEV_CRYPTO_PLUGIN
_sizeinfoClass = lukstasks.LUKSSize
_resizeClass = lukstasks.LUKSResize
_resizable = True

def __init__(self, **kwargs):
"""
Expand Down
5 changes: 4 additions & 1 deletion tests/formats_test/luks_test.py
Expand Up @@ -53,11 +53,14 @@ def testSize(self):
# update the size info
self.fmt.updateSizeInfo()

# set target size to imitate FS constructor
self.fmt.targetSize = self.fmt._size

# the size is greater than zero and less than the size of the device
self.assertLess(self.fmt.size, self.DEFAULT_STORE_SIZE)
self.assertGreater(self.fmt.size, Size(0))

self.assertEqual(self.fmt.currentSize, self.fmt.size)
self.assertEqual(self.fmt.targetSize, Size(0))
self.assertEqual(self.fmt.targetSize, self.fmt.size)

self.fmt.teardown()

0 comments on commit 97a6af4

Please sign in to comment.