summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-02-12 09:37:07 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-02-12 11:29:24 -1000
commit501b1cf15a48973a0dbab735d89026a512760ec0 (patch)
tree180808e3d85c308e760a38d3bfd99a2947868427
parent7554d826252c21b247e2baf11d2a89233c9ec336 (diff)
downloadanaconda-501b1cf15a48973a0dbab735d89026a512760ec0.tar.gz
anaconda-501b1cf15a48973a0dbab735d89026a512760ec0.tar.xz
anaconda-501b1cf15a48973a0dbab735d89026a512760ec0.zip
Removed partedUtils.get_partition_by_name()
Now provided by pyparted as parted.getPartitionByName()
-rw-r--r--autopart.py10
-rw-r--r--bootloader.py3
-rw-r--r--fsset.py2
-rw-r--r--iscsi.py3
-rw-r--r--iw/raid_dialog_gui.py3
-rw-r--r--partIntfHelpers.py9
-rw-r--r--partRequests.py2
-rw-r--r--partedUtils.py21
8 files changed, 14 insertions, 39 deletions
diff --git a/autopart.py b/autopart.py
index 7d09d95b7..6094d23c3 100644
--- a/autopart.py
+++ b/autopart.py
@@ -70,7 +70,7 @@ else:
def bootRequestCheck(req, diskset):
if not req.device or req.ignoreBootConstraints:
return PARTITION_SUCCESS
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
if not part:
return PARTITION_SUCCESS
@@ -85,7 +85,7 @@ def bootRequestCheck(req, diskset):
return bootAlphaCheckRequirements(part)
elif (iutil.getPPCMachine() == "pSeries" or
iutil.getPPCMachine() == "iSeries"):
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
if part and ((part.geom.end * part.geom.dev.sector_size /
(1024.0 * 1024)) > 4096):
return BOOTIPSERIES_TOO_HIGH
@@ -130,7 +130,7 @@ def printNewRequestsCyl(diskset, newRequest):
if req.type != REQUEST_NEW:
continue
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
## print(req)
## print("Start Cyl:%s End Cyl: %s" % (part.geom.dev.startSectorToCylinder(part.geom.start),
## part.geom.dev.endSectorToCylinder(part.geom.end),))
@@ -737,7 +737,7 @@ def growParts(diskset, requests, newParts):
donegrowing = 0
# get amount of space actually used by current allocation
- part = partedUtils.get_partition_by_name(diskset.disks, request.device)
+ part = parted.getPartitionByName(request.device)
startSize = part.geometry.length
# compute fraction of freespace which to give to this
@@ -1025,7 +1025,7 @@ def processPartitioning(diskset, requests, newParts):
elif request.preexist:
# we need to keep track of the max size of preexisting partitions
# FIXME: we should also get the max size for LVs at some point
- part = partedUtils.get_partition_by_name(diskset.disks, request.device)
+ part = parted.getPartitionByName(request.device)
request.maxResizeSize = part.getMaxAvailableSize(unit="MB")
## print("disk layout after everything is done")
diff --git a/bootloader.py b/bootloader.py
index 259eaece6..5c495cf3c 100644
--- a/bootloader.py
+++ b/bootloader.py
@@ -129,8 +129,7 @@ def bootloaderSetupChoices(anaconda):
bootDev = anaconda.id.fsset.getEntryByMountPoint("/")
if not bootDev:
bootDev = anaconda.id.fsset.getEntryByMountPoint("/boot")
- part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks,
- bootDev.device.getDevice())
+ part = parted.getPartitionByName(bootDev.device.getDevice())
if part and part.geom.dev.endSectorToCylinder(part.geom.end) >= 1024:
anaconda.id.bootloader.above1024 = 1
diff --git a/fsset.py b/fsset.py
index 362005995..0f6356f76 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1646,7 +1646,7 @@ MAILADDR root
bootDev = dev.device
if dev.getName() != "RAIDDevice":
- part = partedUtils.get_partition_by_name(diskset.disks, bootDev)
+ part = parted.getPartitionByName(bootDev)
drive = partedUtils.get_partition_drive(part)
# on EFI systems, *only* /boot/efi should be marked bootable
diff --git a/iscsi.py b/iscsi.py
index fbd33c390..a1612da49 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -301,8 +301,7 @@ class iscsi(object):
root_requests = anaconda.id.partitions.getUnderlyingRequests(req)
for req in root_requests:
# req.drive is unreliable <sigh> so figure it out ourselves
- part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks,
- req.device)
+ part = parted.getPartitionByName(req.device)
if not part:
continue
drive = partedUtils.get_partition_drive(part)
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 8e905cf2c..21cb2bcb8 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -494,8 +494,7 @@ class RaidCloneDialog:
requests = []
for req in allrequests:
try:
- part = partedUtils.get_partition_by_name(self.diskset.disks,
- req.device)
+ part = parted.getPartitionByName(req.device)
except:
part = None
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index 0b1108e7e..2766970c8 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -254,7 +254,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,
# get list of unique IDs of these requests
reqIDs = []
for req in requests:
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA or part.type & parted.PARTITION_PROTECTED:
continue
reqIDs.append(req.uniqueID)
@@ -265,7 +265,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,
req = requestlist.getRequestByID(id)
if req is None:
continue
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
rc = doDeletePartitionByRequest(intf, requestlist, part,
confirm=0, quiet=1)
if not rc:
@@ -280,7 +280,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,
# get list of unique IDs of these requests
leftIDs = []
for req in left_requests:
- part = partedUtils.get_partition_by_name(diskset.disks, req.device)
+ part = parted.getPartitionByName(req.device)
if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA or part.type & parted.PARTITION_PROTECTED:
continue
leftIDs.append(req.uniqueID)
@@ -380,8 +380,7 @@ def checkForSwapNoMatch(anaconda):
if not request.device or not request.fstype:
continue
- part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks,
- request.device)
+ part = parted.getPartitionByName(request.device)
if (part and (not part.type & parted.PARTITION_FREESPACE)
and (part.native_type == 0x82)
and (request.fstype and request.fstype.getName() != "swap")
diff --git a/partRequests.py b/partRequests.py
index fc108f218..d768bd388 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -517,7 +517,7 @@ class PartitionSpec(RequestSpec):
def getActualSize(self, partitions, diskset):
"""Return the actual size allocated for the request in megabytes."""
- part = partedUtils.get_partition_by_name(diskset.disks, self.device)
+ part = parted.getPartitionByName(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"
diff --git a/partedUtils.py b/partedUtils.py
index 35175859b..90f601395 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -48,27 +48,6 @@ log = logging.getLogger("anaconda")
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
-def get_partition_by_name(disks, partname):
- """Return the parted part object associated with partname.
-
- Arguments:
- disks -- Dictionary of diskname->PedDisk objects
- partname -- Name of partition to find
-
- Return:
- PedPartition object with name partname. None if no such partition.
- """
- for diskname in disks.keys():
- disk = disks[diskname]
- part = disk.next_partition()
- while part:
- if part.getDeviceNodeName() == partname:
- return part
-
- part = disk.next_partition(part)
-
- return None
-
def get_partition_file_system_type(part):
"""Return the file system type of the PedPartition part.