Re: [PATCH 46/47] Fix PartitionSpec.getActualSize()

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

 



Not following the question. self.drive is a list of drives, so iterate over that and try to get a parted.Partition for the device on that drive. Add in the size of that partition. Failing all that, return requestSize.

The reason I'm iterating over request.drive is because it can be a list and in my mind, that's valid for things like RAID. But all of this code is likely to vanish soon anyway. Just what we have now.

Martin Sivak wrote:
The code looks ok, but i wonder why to use if not drive: ... if drive: ... instead of the plain and simple if drive: .. else: ...

Martin

----- "David Cantrell" <dcantrell@xxxxxxxxxx> wrote:

Fix autopart run with the new pyparted.
---
 partRequests.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/partRequests.py b/partRequests.py
index e9b86c9..d4b41ce 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -522,11 +522,11 @@ class PartitionSpec(RequestSpec):
         for drive in self.drive:
             part = diskset.disks[drive].getPartitionByPath("/dev/%s"
% self.device)
- if not part:
-                # XXX kickstart might still call this before
allocating the partitions
-                raise RuntimeError, "Checking the size of a partition
which hasn't been allocated yet"
+            if part:
+                size += part.getSize(unit="MB")
- size += part.getSize(unit="MB")
+        if size == 0:
+            return self.requestSize
return size --
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux