[PATCH 7/9] Explicitly define the LUKS metadata size in devicelibs.crypto.
David Lehman
dlehman at redhat.com
Wed Jul 25 21:48:32 UTC 2012
---
pyanaconda/storage/devicelibs/crypto.py | 2 ++
pyanaconda/storage/devices.py | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/storage/devicelibs/crypto.py b/pyanaconda/storage/devicelibs/crypto.py
index ee57322..35c813f 100644
--- a/pyanaconda/storage/devicelibs/crypto.py
+++ b/pyanaconda/storage/devicelibs/crypto.py
@@ -29,6 +29,8 @@ from ..errors import *
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
+LUKS_METADATA_SIZE = 2.0 # MB
+
# Keep the character set size a power of two to make sure all characters are
# equally likely
GENERATED_PASSPHRASE_CHARSET = ("0123456789"
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index 8552179..c99c3c2 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -105,6 +105,7 @@ from devicelibs import lvm
from devicelibs import dm
from devicelibs import loop
from devicelibs import btrfs
+from devicelibs import crypto
import parted
import _ped
import block
@@ -1934,8 +1935,7 @@ class LUKSDevice(DMCryptDevice):
@property
def size(self):
if not self.exists or not self.partedDevice:
- # the LUKS metadata area is 2MB
- size = float(self.slave.size) - 2.0
+ size = float(self.slave.size) - crypto.LUKS_METADATA_SIZE
else:
size = self.partedDevice.getSize()
return size
--
1.7.7.6
More information about the anaconda-patches
mailing list