Re: [patch] this is a pyparted patch for 429185

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

 



On Sat, 2008-05-10 at 18:22 +0200, Joel Andres Granados wrote:
> I'm posting the patch here because I don't know where pyparted discussion list lives :)
> 
> You can find the patch at https://bugzilla.redhat.com/attachment.cgi?id=305028
> 
> pyparted needs to search the valid partitions before it returns anything in the py_ped_disk_next_partition function.  With this patch we can now save anaconda tracebacks to usb keys.  I build pyparted but didn't test the patch extensively.
> Comments are greatly appreciated.

This significantly changes the semantics of the next_partition() API
call.  While there aren't a lot of cases where you care about the
non-active partitions, there are a few.  

I think that actually the right fix for the bug is probably something
along the lines of (completely untested)
diff --git a/partedUtils.py b/partedUtils.py
index 573bf4c..22bccb6 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -1362,7 +1362,7 @@ class DiskSet:
 
         drives = []
         for d in isys.removableDriveDict().items():
-            func = lambda p: not p.get_flag(parted.PARTITION_RAID) and
not p.get_flag(parted.PARTITION_LVM) and p.fs_type.name in ["ext3",
"ext2", "fat16", "fat32"]
+            func = lambda p: p.is_active and not
p.get_flag(parted.PARTITION_RAID) and not
p.get_flag(parted.PARTITION_LVM) and p.fs_type.name in ["ext3", "ext2",
"fat16", "fat32"]
 
             disk = self.disks[d[0]]
             parts = filter_partitions(disk, func)


You have to ensure that the partition is an active one before doing any
of get_flag or fs_type, etc.  Yeah, it's a little ugly, but it's a part
of the API and until we completely replace it, I think we have to live
with it

Jeremy

_______________________________________________
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