FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 03-17-2009, 01:40 PM
Chris Lumens
 
Default Use minihal instead of isys.hardDriveDict in list-harddrives (#488122).

list-harddrives was completely broken in the new storage world. Incidentally,
this patch also fixes the referenced bug by removing all the unnecessary
imports that were dragging in zonetab.
---
command-stubs/list-harddrives-stub | 42 ++++++++---------------------------
1 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub
index a282984..ceb6036 100755
--- a/command-stubs/list-harddrives-stub
+++ b/command-stubs/list-harddrives-stub
@@ -2,7 +2,7 @@
#
# scan system for harddrives and output device name/size
#
-# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007, 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,42 +18,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

-import os
import sys

-# for testing
-if (os.path.exists('isys')):
- sys.path.append('isys')
-
sys.path.append('/usr/lib/anaconda')

-import anaconda_log
-import parted
-import partedUtils
-import isys
-
-drives = isys.hardDriveDict()
-
-driveList = drives.keys()
-driveList.sort()
-
-for drive in driveList:
- if not isys.mediaPresent(drive):
- continue
-
- # try to open and get size
- skip = 0
- deviceFile = "/dev/%s" % (drive,)
+import minihal

- try:
- dev = parted.PedDevice.get(deviceFile)
- except:
- skip = 1
+lst = []

- if skip:
- continue
+for drive in minihal.get_devices_by_type("volume"):
+ if not drive.has_key("device") or not drive.has_key("volume.size"):
+ continue

- sizeMB = (float(dev.heads * dev.cylinders * dev.sectors) / (1024 * 1024)
- * dev.sectorSize)
+ lst.append("%s %s" % (drive["device"], drive["volume_size"]/(1024*1024)))

- print drive, sizeMB
+lst.sort()
+for entry in lst:
+ print lst
--
1.6.1.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-17-2009, 01:53 PM
Jeremy Katz
 
Default Use minihal instead of isys.hardDriveDict in list-harddrives (#488122).

On Tuesday, March 17 2009, Chris Lumens said:
> list-harddrives was completely broken in the new storage world. Incidentally,
> this patch also fixes the referenced bug by removing all the unnecessary
> imports that were dragging in zonetab.

Nice. Looks good

Jeremy

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

Thread Tools




All times are GMT. The time now is 03:22 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org