[master 5/19] Define an updateSizeInfo method in LUKS format.

mulkieran installerbot-noreply at redhat.com
Thu Jun 18 21:04:06 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: #56

Use LUKSSize task to obtain the info.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/formats/luks.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/blivet/formats/luks.py b/blivet/formats/luks.py
index f729e1e..df24ee1 100644
--- a/blivet/formats/luks.py
+++ b/blivet/formats/luks.py
@@ -30,6 +30,7 @@
 from ..flags import flags
 from ..i18n import _, N_
 from ..tasks import availability
+from ..tasks import lukstasks
 
 import logging
 log = logging.getLogger("blivet")
@@ -46,6 +47,7 @@ class LUKS(DeviceFormat):
     _packages = ["cryptsetup"]          # required packages
     _minSize = crypto.LUKS_METADATA_SIZE
     _plugin = availability.BLOCKDEV_CRYPTO_PLUGIN
+    _sizeinfoClass = lukstasks.LUKSSize
 
     def __init__(self, **kwargs):
         """
@@ -80,6 +82,9 @@ def __init__(self, **kwargs):
         """
         log_method_call(self, **kwargs)
         DeviceFormat.__init__(self, **kwargs)
+
+        self._sizeinfo = self._sizeinfoClass(self)
+
         self.cipher = kwargs.get("cipher")
         self.key_size = kwargs.get("key_size")
         self.mapName = kwargs.get("name")
@@ -263,6 +268,12 @@ def escrow(self, directory, backupPassphrase):
                                       directory, backupPassphrase)
         log.debug("escrow: escrowVolume done for %s", repr(self.device))
 
+    def updateSizeInfo(self):
+        """ Update this format's current size. """
+        try:
+            self._size = self._sizeinfo.doTask()
+        except LUKSError as e:
+            log.warning("Failed to obtain current size for device %s: %s", self.device, e)
 
 register_device_format(LUKS)
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/1db99c8e54b0282629bfba12b78024bed33db496


More information about the anaconda-patches mailing list