summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2009-03-17 10:37:29 -0400
committerChris Lumens <clumens@redhat.com>2009-03-17 10:38:57 -0400
commitfeba2676ea103d9c8ab0a89b26d213e7f17deaab (patch)
treed4927d7894ff2d61c50e4166ea3571bf8ee9240e
parent2538723c53378bfe2044aa9fbc466e8a0d940607 (diff)
downloadanaconda-feba2676ea103d9c8ab0a89b26d213e7f17deaab.tar.gz
anaconda-feba2676ea103d9c8ab0a89b26d213e7f17deaab.tar.xz
anaconda-feba2676ea103d9c8ab0a89b26d213e7f17deaab.zip
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.
-rwxr-xr-xcommand-stubs/list-harddrives-stub42
1 files changed, 10 insertions, 32 deletions
diff --git a/command-stubs/list-harddrives-stub b/command-stubs/list-harddrives-stub
index a282984d6..ceb60368d 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