[PATCH] Make pyblock compatible with new pyparted.

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

 



---
 device.py |   42 +++++++++++++++++++++---------------------
 1 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/device.py b/device.py
index 828f198..2d26b52 100644
--- a/device.py
+++ b/device.py
@@ -335,7 +335,7 @@ class MultiPath:
         
     def get_PedDevice(self):
         import parted as _parted
-        ret = _parted.PedDevice.get(self.bdev.path)
+        ret = _parted.getDevice(self.bdev.path)
         del _parted
         return ret
     PedDevice = property(get_PedDevice, None, None, "parted.PedDevice")
@@ -476,22 +476,22 @@ class MultiPath:
         dev = self.PedDevice
         dev.open()
         try:
-            disk = _parted.PedDisk.new(dev)
-        except _parted.error, msg:
+            disk = _parted.Disk(dev)
+        except _parted.DiskException, msg:
             dev.close()
             del dev
             return
-        part = disk.next_partition()
-        while part:
-            if part.is_active():
-                name = "%sp%s" % (self.name, part.num)
+
+        for part in disk.partitions:
+            if part.active:
+                name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
-                map = _PartitionDeviceMap(0, part.geom.length, bdev,
-                    part.geom.start, part.num)
+                map = _PartitionDeviceMap(0, part.geometry.length, bdev,
+                    part.geometry.start, part.number)
                 map.name = name
                 yield map
-            part = disk.next_partition(part)
+
         del disk
         dev.close()
         del dev
@@ -588,7 +588,7 @@ class RaidSet:
         
     def get_PedDevice(self):
         import parted as _parted
-        ret = _parted.PedDevice.get(self.bdev.path)
+        ret = _parted.getDevice(self.bdev.path)
         del _parted
         return ret
     PedDevice = property(get_PedDevice, None, None, "parted.PedDevice")
@@ -757,23 +757,23 @@ class RaidSet:
         dev = self.PedDevice
         dev.open()
         try:
-            disk = _parted.PedDisk.new(dev)
-        except _parted.error, msg:
+            disk = _parted.Disk(device=dev)
+        except _parted.DiskException, msg:
             dev.close()
             del dev
             return
-        part = disk.next_partition()
-        while part:
-            if part.is_active():
-                name = "%sp%s" % (self.name, part.num)
+
+        for part in disk.partitions:
+            if part.active:
+                name = "%sp%s" % (self.name, part.number)
                 bdev = BlockDev(self.prefix + self.name)
                 bdev.mode = 0600
-                map = _PartitionDeviceMap(0, part.geom.length, bdev,
-                    part.geom.start, part.num)
+                map = _PartitionDeviceMap(0, part.geometry.length, bdev,
+                    part.geometry.start, part.number)
                 map.name = name
                 map.create()
                 self._RaidSet__parts.append(map)
-            part = disk.next_partition(part)
+
         del disk
         dev.close()
         del dev
@@ -868,7 +868,7 @@ class RaidDev:
 
     def get_PedDevice(self):
         import parted as _parted
-        ret = _parted.PedDevice.get(self.bdev.path)
+        ret = _parted.getDevice(self.bdev.path)
         del _parted
         return ret
     PedDevice = property(get_PedDevice, None, None, "parted.PedDevice")
-- 
1.6.0.6

_______________________________________________
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