Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS Docs (http://www.linux-archive.org/centos-docs/)
-   -   booty make getDiskPart use the devicetree (http://www.linux-archive.org/centos-docs/377842-booty-make-getdiskpart-use-devicetree.html)

Hans de Goede 05-28-2010 03:58 PM

booty make getDiskPart use the devicetree
 
---
booty/util.py | 36 +++++++-----------------------------
1 files changed, 7 insertions(+), 29 deletions(-)

diff --git a/booty/util.py b/booty/util.py
index 48c3194..9b79e73 100644
--- a/booty/util.py
+++ b/booty/util.py
@@ -1,33 +1,11 @@
-import string
-from flags import flags
-
def getDiskPart(dev, storage):
- path = storage.devicetree.getDeviceByName(dev).path[5:]
- cut = len(dev)
- if dev[-1] in string.digits:
- if (path.startswith('rd/') or path.startswith('ida/') or
- path.startswith('cciss/') or path.startswith('sx8/') or
- path.startswith('mapper/') or path.startswith('mmcblk') or
- path.startswith('md')):
- if dev[-2] == 'p':
- cut = -2
- elif dev[-3] == 'p' and dev[-2] in string.digits:
- cut = -3
- else:
- if dev[-2] in string.digits:
- cut = -2
- else:
- cut = -1
-
- name = dev[:cut]
+ dev = storage.devicetree.getDeviceByName(dev)

- if cut < 0:
- part = dev[cut:]
- if part[0] == 'p':
- part = part[1:]
- partNum = int(part) - 1
+ if dev.type == "partition":
+ partNum = dev.partedPartition.number - 1
+ disk = dev.disk
else:
partNum = None
-
- return (name, partNum)
-
+ disk = dev
+
+ return (disk.name, partNum)
--
1.7.0.1

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

Martin Sivak 05-31-2010 12:39 PM

booty make getDiskPart use the devicetree
 
Ack.

--
Martin Sivák
msivak@redhat.com
Red Hat Czech
Anaconda team / Brno, CZ

----- "Hans de Goede" <hdegoede@redhat.com> wrote:

> ---
> booty/util.py | 36 +++++++-----------------------------
> 1 files changed, 7 insertions(+), 29 deletions(-)
>
> diff --git a/booty/util.py b/booty/util.py
> index 48c3194..9b79e73 100644
> --- a/booty/util.py
> +++ b/booty/util.py
> @@ -1,33 +1,11 @@
> -import string
> -from flags import flags
> -
> def getDiskPart(dev, storage):
> - path = storage.devicetree.getDeviceByName(dev).path[5:]
> - cut = len(dev)
> - if dev[-1] in string.digits:
> - if (path.startswith('rd/') or path.startswith('ida/') or
> - path.startswith('cciss/') or path.startswith('sx8/')
> or
> - path.startswith('mapper/') or
> path.startswith('mmcblk') or
> - path.startswith('md')):
> - if dev[-2] == 'p':
> - cut = -2
> - elif dev[-3] == 'p' and dev[-2] in string.digits:
> - cut = -3
> - else:
> - if dev[-2] in string.digits:
> - cut = -2
> - else:
> - cut = -1
> -
> - name = dev[:cut]
> + dev = storage.devicetree.getDeviceByName(dev)
>
> - if cut < 0:
> - part = dev[cut:]
> - if part[0] == 'p':
> - part = part[1:]
> - partNum = int(part) - 1
> + if dev.type == "partition":
> + partNum = dev.partedPartition.number - 1
> + disk = dev.disk
> else:
> partNum = None
> -
> - return (name, partNum)
> -
> + disk = dev
> +
> + return (disk.name, partNum)
> --
> 1.7.0.1
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

_______________________________________________
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 10:35 AM.

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