[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Add a basic method for checking the minimal size needed for a backend



Add a basic way to query a backend for how much space is needed on a
per-partition basis.  This isn't always able to be known and if it's
unknown, then you'll get back 0.  Add the implementation for / on
livecd
---
 backend.py |    4 ++++
 livecd.py  |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/backend.py b/backend.py
index ad0285e..3008671 100644
--- a/backend.py
+++ b/backend.py
@@ -188,6 +188,10 @@ class AnacondaBackend:
     def kernelVersionList(self, rootPath="/"):
         return []
 
+    def getMinimumSizeMB(self, part):
+        """Return the minimal size for part in megabytes if we can."""
+        return 0
+
     def doBackendSetup(self, anaconda):
         log.warning("doBackendSetup not implemented for backend!")
         raise NotImplementedError
diff --git a/livecd.py b/livecd.py
index f3afc20..5d7d3f7 100644
--- a/livecd.py
+++ b/livecd.py
@@ -366,6 +366,11 @@ class LiveCDCopyBackend(backend.AnacondaBackend):
     def kernelVersionList(self, rootPath = "/"):
         return packages.rpmKernelVersionList(rootPath)
 
+    def getMinimumSizeMB(self, part):
+        if part == "/":
+            return self._getLiveSizeMB()
+        return 0
+
     def doBackendSetup(self, anaconda):
         # ensure there's enough space on the rootfs
         # FIXME: really, this should be in the general sanity checking, but
-- 
1.6.0.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]