qubes-installer-qubes-os/anaconda/0028-anaconda-don-t-crash-when-no-target-disk-is-availabl.patch

52 lines
2.3 KiB
Diff
Raw Normal View History

2018-10-19 06:14:46 +00:00
From c247cc5c37932dbe1c1db85d7d948a4b83da112e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
<marmarek@invisiblethingslab.com>
Date: Fri, 19 Oct 2018 08:02:12 +0200
Subject: [PATCH] anaconda: don't crash when no target disk is available
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
self.storage.root_device may be None in such case. Instead, allow proper reporting that no space is available.
Signed-off-by: Frédéric Pierret <frederic.epitre@orange.fr>
---
pyanaconda/ui/lib/space.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/lib/space.py b/pyanaconda/ui/lib/space.py
index 3679a33eb..9b15c474f 100644
--- a/pyanaconda/ui/lib/space.py
+++ b/pyanaconda/ui/lib/space.py
@@ -75,8 +75,11 @@ class FileSystemSpaceChecker(object):
log.info("fs space: %s needed: %s", free, needed)
self.success = (free > needed)
if not self.success:
- dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format)
- self.deficit = dev_required_size - self.storage.root_device.size
+ if self.storage.root_device:
+ dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format)
+ self.deficit = dev_required_size - self.storage.root_device.size
+ else:
+ self.deficit = needed - free
self.error_message = _(self.error_template) % self.deficit
return self.success
@@ -107,8 +110,11 @@ class DirInstallSpaceChecker(FileSystemSpaceChecker):
log.info("fs space: %s needed: %s", free, needed)
self.success = (free > needed)
if not self.success:
- dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format)
- self.deficit = dev_required_size - self.storage.root_device.size
+ if self.storage.root_device:
+ dev_required_size = self.payload.requiredDeviceSize(self.storage.root_device.format)
+ self.deficit = dev_required_size - self.storage.root_device.size
+ else:
+ self.deficit = needed - free
self.error_message = _(self.error_template) % self.deficit
return self.success
--
2.14.4