Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu Masters Of The Universe (http://www.linux-archive.org/ubuntu-masters-universe/)
-   -   getPartitionByPath expects the device to start with /dev/. (http://www.linux-archive.org/ubuntu-masters-universe/244140-getpartitionbypath-expects-device-start-dev.html)

David Cantrell 02-11-2009 11:54 PM

getPartitionByPath expects the device to start with /dev/.
 
From: Chris Lumens <clumens@redhat.com>

---
autopart.py | 8 ++++----
fsset.py | 2 +-
iscsi.py | 2 +-
partIntfHelpers.py | 8 ++++----
partRequests.py | 2 +-
5 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/autopart.py b/autopart.py
index 3c7d26f..f772e16 100644
--- a/autopart.py
+++ b/autopart.py
@@ -72,7 +72,7 @@ def bootRequestCheck(req, diskset):
return PARTITION_SUCCESS

for drive in req.drive:
- part = diskset.disks[drive].getPartitionByPath(req.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
if part:
break

@@ -91,7 +91,7 @@ def bootRequestCheck(req, diskset):
elif (iutil.getPPCMachine() == "pSeries" or
iutil.getPPCMachine() == "iSeries"):
for drive in req.drive:
- part = diskset.disks[drive].getPartitionByPath(req.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
if part and ((part.geometry.end * part.geometry.device.sectorSize /
(1024.0 * 1024)) > 4096):
return BOOTIPSERIES_TOO_HIGH
@@ -735,7 +735,7 @@ def growParts(diskset, requests, newParts):

# get amount of space actually used by current allocation
for drive in request.drive:
- part = diskset.disks[drive].getPartitionByPath(request.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % request.device)
if part:
break

@@ -1021,7 +1021,7 @@ def processPartitioning(diskset, requests, newParts):
# 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
for drive in request.drive:
- part = diskset.disks[drive].getPartitionByPath(request.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % request.device)
if part:
break
request.maxResizeSize = part.getMaxAvailableSize(unit="MB")
diff --git a/fsset.py b/fsset.py
index b63b1ce..86b9e79 100644
--- a/fsset.py
+++ b/fsset.py
@@ -1651,7 +1651,7 @@ MAILADDR root
break

for drive in request.drive:
- part = diskset.disks[drive].getPartitionByPath(bootDev)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % bootDev)
if part:
break

diff --git a/iscsi.py b/iscsi.py
index c9cbd08..0a27e7d 100644
--- a/iscsi.py
+++ b/iscsi.py
@@ -579,7 +579,7 @@ class iscsi(object):
root_requests = anaconda.id.partitions.getUnderlyingRequests(req)
for req in root_requests:
for drive in req.drive:
- part = anaconda.id.diskset.disks[drive].getPartitionByPath(req.device)
+ part = anaconda.id.diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)
if part:
break
if not part:
diff --git a/partIntfHelpers.py b/partIntfHelpers.py
index 659da89..278d61d 100644
--- a/partIntfHelpers.py
+++ b/partIntfHelpers.py
@@ -258,7 +258,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,

for req in requests:
for drive in req.drive:
- part = diskset.disks[drive].getPartitionByPath(req.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)

if part.type & parted.PARTITION_FREESPACE or
part.type & parted.PARTITION_METADATA or
@@ -298,7 +298,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device,

for req in left_requests:
for drive in req.drive:
- part = diskset.disks[drive].getPartitionByPath(req.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % req.device)

if part.type & parted.PARTITION_FREESPACE or
part.type & parted.PARTITION_METADATA or
@@ -402,11 +402,11 @@ def checkForSwapNoMatch(anaconda):
diskset = anaconda.id.diskset

for request in anaconda.id.partitions.requests:
- if not request.device or not request.fstype:
+ if not request.dev or not request.fstype:
continue

for drive in request.drive:
- part = diskset.disks[drive].getPartitionByPath(request.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % request.device)

if (part and (not part.type & parted.PARTITION_FREESPACE)
and (part.getFlag(parted.PARTITION_SWAP))
diff --git a/partRequests.py b/partRequests.py
index d8de5e6..e9b86c9 100644
--- a/partRequests.py
+++ b/partRequests.py
@@ -520,7 +520,7 @@ class PartitionSpec(RequestSpec):
size = 0

for drive in self.drive:
- part = diskset.disks[drive].getPartitionByPath(self.device)
+ part = diskset.disks[drive].getPartitionByPath("/dev/%s" % self.device)

if not part:
# XXX kickstart might still call this before allocating the partitions
--
1.6.1.3

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


All times are GMT. The time now is 12:33 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.