summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-02-12 09:34:25 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-02-12 11:28:57 -1000
commit50f36336694a379de9f01e770808df44c60cbec9 (patch)
tree21ce386ada933ce02e290f8e100473a60b21b902
parent9717e894fe3dd171f1248fa23ab96e3ea1a7f9f6 (diff)
downloadanaconda-50f36336694a379de9f01e770808df44c60cbec9.tar.gz
anaconda-50f36336694a379de9f01e770808df44c60cbec9.tar.xz
anaconda-50f36336694a379de9f01e770808df44c60cbec9.zip
Removed partedUtils.get_partition_name()
Now provided by parted.Partition.getDeviceNodeName()
-rw-r--r--autopart.py20
-rw-r--r--bootloader.py4
-rw-r--r--fsset.py4
-rw-r--r--iw/osbootwidget.py2
-rw-r--r--iw/partition_gui.py6
-rw-r--r--partIntfHelpers.py6
-rw-r--r--partedUtils.py33
-rw-r--r--partitions.py14
-rw-r--r--raid.py2
9 files changed, 35 insertions, 56 deletions
diff --git a/autopart.py b/autopart.py
index 677a6b39b..513e927b8 100644
--- a/autopart.py
+++ b/autopart.py
@@ -136,7 +136,7 @@ def printNewRequestsCyl(diskset, newRequest):
## part.geom.dev.endSectorToCylinder(part.geom.end),))
def printFreespaceitem(part):
- return partedUtils.get_partition_name(part), part.geom.start, part.geom.end, part.getSize(unit="MB")
+ return part.getDeviceNodeName(), part.geom.start, part.geom.end, part.getSize(unit="MB")
def printFreespace(free):
print("Free Space Summary:")
@@ -179,7 +179,7 @@ class partlist:
def __str__(self):
retval = ""
for p in self.parts:
- retval = retval + "\t%s %s %s\n" % (partedUtils.get_partition_name(p), partedUtils.get_partition_file_system_type(p), p.getSize(unit="MB"))
+ retval = retval + "\t%s %s %s\n" % (p.getDeviceNodeName(), partedUtils.get_partition_file_system_type(p), p.getSize(unit="MB"))
return retval
@@ -887,13 +887,13 @@ def setPreexistParts(diskset, requests):
constraint = g.constraint_exact()
part.set_geometry(constraint, startSec, endSec)
except parted.error, msg:
- log.error("error setting geometry for partition %s: %s" %(partedUtils.get_partition_name(part), msg))
- raise PartitioningError, _("Error resizing partition %s.\n\n%s") %(partedUtils.get_partition_name(part), msg)
+ log.error("error setting geometry for partition %s: %s" %(part.getDeviceNodeName(), msg))
+ raise PartitioningError, _("Error resizing partition %s.\n\n%s") %(part.getDeviceNodeName(), msg)
if startSec != part.geom.start:
- raise PartitioningError, _("Start of partition %s was moved when resizing") %(partedUtils.get_partition_name(part),)
+ raise PartitioningError, _("Start of partition %s was moved when resizing") %(part.getDeviceNodeName(),)
- request.device = partedUtils.get_partition_name(part)
+ request.device = part.getDeviceNodeName()
if request.fstype:
if request.fstype.getName() != request.origfstype.getName():
if part.is_flag_available(parted.PARTITION_RAID):
@@ -1151,7 +1151,7 @@ def doClearPartAction(anaconda, partitions, diskset):
((part.is_flag_available(parted.PARTITION_RAID) and part.get_flag(parted.PARTITION_RAID)) or # this is a RAID
(part.is_flag_available(parted.PARTITION_LVM) and part.get_flag(parted.PARTITION_LVM)) or # or an LVM
(iutil.isMactel() and not ptype)))): # or we're on a mactel and have a blank partition from bootcamp #FIXME: this could be dangerous...
- old = partitions.getRequestByDeviceName(partedUtils.get_partition_name(part))
+ old = partitions.getRequestByDeviceName(part.getDeviceNodeName())
if old.getProtected():
part = disk.next_partition(part)
continue
@@ -1172,7 +1172,7 @@ def doClearPartAction(anaconda, partitions, diskset):
# doesn't apply on kickstart installs or if no boot flag
if iutil.isEfi() and linuxOnly == 1 and (not anaconda.isKickstart):
if partedUtils.isEfiSystemPartition(part):
- req = partitions.getRequestByDeviceName(partedUtils.get_partition_name(part))
+ req = partitions.getRequestByDeviceName(part.getDeviceNodeName())
other = partitions.getRequestByMountPoint("/boot/efi")
if not other:
@@ -1195,7 +1195,7 @@ def doClearPartAction(anaconda, partitions, diskset):
part.is_flag_available(parted.PARTITION_BOOT) and
(part.native_type == 0x41) and
part.get_flag(parted.PARTITION_BOOT)):
- req = partitions.getRequestByDeviceName(partedUtils.get_partition_name(part))
+ req = partitions.getRequestByDeviceName(part.getDeviceNodeName())
req.mountpoint = None
req.format = 0
request = None
@@ -1225,7 +1225,7 @@ def doClearPartAction(anaconda, partitions, diskset):
if ext and len(partedUtils.get_logical_partitions(disk)) == 0:
delete = partRequests.DeleteSpec(drive, ext.geom.start,
ext.geom.end)
- old = partitions.getRequestByDeviceName(partedUtils.get_partition_name(ext))
+ old = partitions.getRequestByDeviceName(ext.getDeviceNodeName())
partitions.removeRequest(old)
partitions.addDelete(delete)
deletePart(diskset, delete)
diff --git a/bootloader.py b/bootloader.py
index c88b8ed9e..259eaece6 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -68,7 +68,7 @@ def bootloaderSetupChoices(anaconda):
part = disk.next_partition()
while part:
if part.is_active() and partedUtils.isEfiSystemPartition(part):
- bootPart = partedUtils.get_partition_name(part)
+ bootPart = part.getDeviceNodeName()
break
part = disk.next_partition(part)
if bootPart:
@@ -89,7 +89,7 @@ def bootloaderSetupChoices(anaconda):
part = disk.next_partition()
while part:
if part.is_active() and part.native_type == 0x41:
- bootPart = partedUtils.get_partition_name(part)
+ bootPart = part.getDeviceNodeName()
break
part = disk.next_partition(part)
if bootPart:
diff --git a/fsset.py b/fsset.py
index 89f099b11..362005995 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1685,7 +1685,7 @@ MAILADDR root
if not bootPart:
bootPart = part
- if partedUtils.get_partition_name(part) == bootDev:
+ if part.getDeviceNodeName() == bootDev:
bootPart = part
part = disk.next_partition(part)
@@ -2686,7 +2686,7 @@ class PartedPartitionDevice(PartitionDevice):
if not self.partition:
return self.device
- return partedUtils.get_partition_name(self.partition)
+ return self.partition.getDeviceNodeName()
def solidify(self):
# drop reference on the parted partition object and note
diff --git a/iw/osbootwidget.py b/iw/osbootwidget.py
index d4a294277..481267dfa 100644
--- a/iw/osbootwidget.py
+++ b/iw/osbootwidget.py
@@ -163,7 +163,7 @@ class OSBootWidget:
for drive in disks.keys():
pedparts.extend(partedUtils.filter_partitions(disks[drive], func))
for part in pedparts:
- parts.append(partedUtils.get_partition_name(part))
+ parts.append(part.getDeviceNodeName())
del pedparts
parts.sort()
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 7e1aadd96..2d161c892 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -145,12 +145,12 @@ class DiskStripeSlice:
if self.partition.type & parted.PARTITION_FREESPACE:
rc = "Free\n"
else:
- rc = "%s\n" % (get_partition_name(self.partition),)
+ rc = "%s\n" % (self.partition.getDeviceNodeName(),)
rc = rc + "%Ld MB" % (self.partition.getSize(unit="MB"),)
return rc
def getDeviceName(self):
- return get_partition_name(self.partition)
+ return self.partition.getDeviceNodeName()
def update(self):
disk = self.parent.getDisk()
@@ -841,7 +841,7 @@ class PartitionWindow(InstallWindow):
continue
stripe.add(part)
- device = get_partition_name(part)
+ device = part.getDeviceNodeName()
request = self.partitions.getRequestByDeviceName(device)
if part.type == parted.PARTITION_EXTENDED:
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index 9dcb947d5..0b1108e7e 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -163,7 +163,7 @@ def doDeletePartitionByRequest(intf, requestlist, partition,
custom_icon="error")
return 0
else:
- device = partedUtils.get_partition_name(partition)
+ device = partition.getDeviceNodeName()
ret = requestlist.containsImmutablePart(partition)
if ret:
@@ -359,7 +359,7 @@ def doEditPartitionByRequest(intf, requestlist, part):
"which contains %s") %(ret), custom_icon="error")
return (None, None)
- name = partedUtils.get_partition_name(part)
+ name = part.getDeviceNodeName()
request = requestlist.getRequestByDeviceName(name)
if request:
state = isNotChangable(request, requestlist)
@@ -371,7 +371,7 @@ def doEditPartitionByRequest(intf, requestlist, part):
return ("PARTITION", request)
else: # shouldn't ever happen
raise ValueError, ("Trying to edit non-existent partition %s"
- % (partedUtils.get_partition_name(part)))
+ % (part.getDeviceNodeName(),))
def checkForSwapNoMatch(anaconda):
diff --git a/partedUtils.py b/partedUtils.py
index 4bfe6c803..1b8e19499 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -84,34 +84,13 @@ def get_partition_by_name(disks, partname):
disk = disks[diskname]
part = disk.next_partition()
while part:
- if get_partition_name(part) == partname:
+ if part.getDeviceNodeName() == partname:
return part
part = disk.next_partition(part)
return None
-def get_partition_name(partition):
- """Return the device name for the PedPartition partition."""
- if (partition.geom.dev.type == parted.DEVICE_DAC960
- or partition.geom.dev.type == parted.DEVICE_CPQARRAY):
- return "%sp%d" % (partition.geom.dev.path[5:],
- partition.num)
- if (parted.__dict__.has_key("DEVICE_SX8") and
- partition.geom.dev.type == parted.DEVICE_SX8):
- return "%sp%d" % (partition.geom.dev.path[5:],
- partition.num)
-
- drive = partition.geom.dev.path[5:]
- if (drive.startswith("cciss") or drive.startswith("ida") or
- drive.startswith("rd") or drive.startswith("sx8") or
- drive.startswith("mapper") or drive.startswith("mmcblk")):
- sep = "p"
- else:
- sep = ""
- return "%s%s%d" % (partition.geom.dev.path[5:], sep, partition.num)
-
-
def get_partition_file_system_type(part):
"""Return the file system type of the PedPartition part.
@@ -245,7 +224,7 @@ def isEfiSystemPartition(part):
part.get_name() == "EFI System Partition" and
part.get_flag(parted.PARTITION_BOOT) == 1 and
part.fs_type.name in ("fat16", "fat32") and
- isys.readFSLabel(get_partition_name(part)) != "ANACONDA")
+ isys.readFSLabel(part.getDeviceNodeName()) != "ANACONDA")
def labelDisk(deviceFile, forceLabelType=None):
dev = parted.PedDevice.get(deviceFile)
@@ -614,7 +593,7 @@ class DiskSet:
or part.get_flag(parted.PARTITION_LVM)))
parts = filter_partitions(disk, func)
for part in parts:
- node = get_partition_name(part)
+ node = part.getDeviceNodeName()
crypto = encryptedDevices.get(node)
if crypto and not crypto.openDevice():
node = crypto.getDevice()
@@ -781,7 +760,7 @@ class DiskSet:
disk = self.disks[drive]
part = disk.next_partition ()
while part:
- node = get_partition_name(part)
+ node = part.getDeviceNodeName()
crypto = self.anaconda.id.partitions.encryptedDevices.get(node)
if (part.is_active()
and (part.get_flag(parted.PARTITION_RAID)
@@ -1212,7 +1191,7 @@ class DiskSet:
while part:
if part.type in (parted.PARTITION_PRIMARY,
parted.PARTITION_LOGICAL):
- device = get_partition_name(part)
+ device = part.getDeviceNodeName()
if part.fs_type:
ptype = part.fs_type.name
else:
@@ -1244,7 +1223,7 @@ class DiskSet:
device = ""
fs_type_name = ""
if part.num > 0:
- device = get_partition_name(part)
+ device = part.getDeviceNodeName()
if part.fs_type:
fs_type_name = part.fs_type.name
partFlags = part.getFlags()
diff --git a/partitions.py b/partitions.py
index 61fb04d0d..ec77ebf22 100644
--- a/partitions.py
+++ b/partitions.py
@@ -313,7 +313,7 @@ class Partitions:
part = disk.next_partition(part)
continue
- device = partedUtils.get_partition_name(part)
+ device = part.getDeviceNodeName()
fs = isys.readFSType("/dev/%s" % (device,))
if fs and fs.endswith("raid"):
part = disk.next_partition(part)
@@ -399,7 +399,7 @@ class Partitions:
if ptype is None:
ptype = fsset.fileSystemTypeGet("foreign")
- device = partedUtils.get_partition_name(part)
+ device = part.getDeviceNodeName()
# parted doesn't tell ext4 from ext3
if ptype == fsset.fileSystemTypeGet("ext3"):
@@ -666,7 +666,7 @@ class Partitions:
disk = diskset.disks[device]
part = disk.next_partition()
while part:
- dev = partedUtils.get_partition_name(part)
+ dev = part.getDeviceNodeName()
request = self.getRequestByDeviceName(dev)
if request:
@@ -792,7 +792,7 @@ class Partitions:
for drive in drives:
disk = diskset.disks[drive]
for part in partedUtils.get_raid_partitions(disk):
- partname = partedUtils.get_partition_name(part)
+ partname = part.getDeviceNodeName()
used = 0
for raid in raiddevs:
if raid.raidmembers:
@@ -902,7 +902,7 @@ class Partitions:
for drive in drives:
disk = diskset.disks[drive]
for part in partedUtils.get_lvm_partitions(disk):
- partname = partedUtils.get_partition_name(part)
+ partname = part.getDeviceNodeName()
partrequest = self.getRequestByDeviceName(partname)
if partrequest.encryption is None and \
cryptodev.isLuks("/dev/%s" % partname) and \
@@ -1697,7 +1697,7 @@ class Partitions:
def deleteAllLogicalPartitions(self, part):
"""Add delete specs for all logical partitions in part."""
for partition in partedUtils.get_logical_partitions(part.disk):
- partName = partedUtils.get_partition_name(partition)
+ partName = partition.getDeviceNodeName()
request = self.getRequestByDeviceName(partName)
self.removeRequest(request)
if request.preexist:
@@ -1720,7 +1720,7 @@ class Partitions:
part = disk.next_partition(part)
continue
- device = partedUtils.get_partition_name(part)
+ device = part.getDeviceNodeName()
request = self.getRequestByDeviceName(device)
if request:
diff --git a/raid.py b/raid.py
index 117ca6fb3..0ff211cc9 100644
--- a/raid.py
+++ b/raid.py
@@ -79,7 +79,7 @@ def scanForRaid(drives):
raidParts = partedUtils.get_raid_partitions(disk)
for part in raidParts:
# if the part is encrypted, add the mapped dev instead
- pname = partedUtils.get_partition_name(part)
+ pname = part.getDeviceNodeName()
cryptoDev = partitions.Partitions.encryptedDevices.get(pname)
if cryptoDev and not cryptoDev.openDevice():
dev = cryptoDev.getDevice()