summaryrefslogtreecommitdiffstats
path: root/iw
diff options
context:
space:
mode:
authorDavid Lehman <dlehman@redhat.com>2009-12-09 01:23:11 -0600
committerDavid Lehman <dlehman@redhat.com>2009-12-09 15:12:59 -0600
commit414e70f9d87771eeb45875fea69b54d7ce9444af (patch)
treecdad5e9bab52f266015b55ca0f5c50a398180495 /iw
parent429d97802d036413ddfc3f60148a39618e032b6e (diff)
downloadanaconda-414e70f9d87771eeb45875fea69b54d7ce9444af.tar.gz
anaconda-414e70f9d87771eeb45875fea69b54d7ce9444af.tar.xz
anaconda-414e70f9d87771eeb45875fea69b54d7ce9444af.zip
Add support for whole-disk formatting.
Whole-disk formats are recognized but cannot be edited in any way.
Diffstat (limited to 'iw')
-rw-r--r--iw/bootloader_main_gui.py10
-rw-r--r--iw/partition_dialog_gui.py6
-rw-r--r--iw/partition_gui.py119
-rw-r--r--iw/partition_ui_helpers_gui.py2
-rw-r--r--iw/raid_dialog_gui.py4
5 files changed, 74 insertions, 67 deletions
diff --git a/iw/bootloader_main_gui.py b/iw/bootloader_main_gui.py
index 213083ad6..5f2fec502 100644
--- a/iw/bootloader_main_gui.py
+++ b/iw/bootloader_main_gui.py
@@ -136,7 +136,10 @@ class MainBootloaderWindow(InstallWindow):
lbl = dxml.get_widget("bd%dLabel" %(i,))
combo.show()
lbl.show()
- m = __genStore(combo, anaconda.id.storage.disks, self.driveorder[i - 1])
+ partitioned = anaconda.id.storage.partitioned
+ disks = anaconda.id.storage.disks
+ bl_disks = [d.name for d in disks if d in partitioned]
+ m = __genStore(combo, bl_disks, self.driveorder[i - 1])
dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices)
__driveChange(dxml.get_widget("bd1Combo"), dxml, choices)
@@ -190,10 +193,11 @@ class MainBootloaderWindow(InstallWindow):
self.bl = anaconda.id.bootloader
self.intf = anaconda.intf
- disks = anaconda.id.storage.disks
self.driveorder = self.bl.drivelist
if len(self.driveorder) == 0:
- self.driveorder = [d.name for d in disks]
+ partitioned = anaconda.id.storage.partitioned
+ disks = anaconda.id.storage.disks
+ self.driveorder = [d.name for d in disks if d in partitioned]
if self.bl.getPassword():
self.usePass = 1
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index c9781e02b..7f76c8630 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -164,14 +164,14 @@ class PartitionEditor:
iter = model.iter_next(iter)
- if len(allowdrives) == len(self.storage.disks):
+ if len(allowdrives) == len(self.storage.partitioned):
allowdrives = None
size = self.sizespin.get_value_as_int()
disks = []
if allowdrives:
for drive in allowdrives:
- for disk in self.storage.disks:
+ for disk in self.storage.partitioned:
if disk.name == drive:
disks.append(disk)
@@ -403,7 +403,7 @@ class PartitionEditor:
maintable.attach(lbl, 0, 1, row, row + 1)
req_disk_names = [d.name for d in self.origrequest.req_disks]
- self.driveview = createAllowedDrivesList(self.storage.disks,
+ self.driveview = createAllowedDrivesList(self.storage.partitioned,
req_disk_names,
disallowDrives=[self.anaconda.updateSrc])
lbl.set_mnemonic_widget(self.driveview)
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 04c9988ea..a17fd709f 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -1017,62 +1017,66 @@ class PartitionWindow(InstallWindow):
parent = self.tree.append(drvparent)
self.tree[parent]['PyObject'] = disk
- part = disk.format.firstPartition
- extendedParent = None
- while part:
- if part.type & parted.PARTITION_METADATA:
- part = part.nextPartition()
- continue
-
- partName = devicePathToName(part.getDeviceNodeName())
- device = self.storage.devicetree.getDeviceByName(partName)
- if not device and not part.type & parted.PARTITION_FREESPACE:
- log.debug("can't find partition %s in device"
- " tree" % partName)
-
- # ignore the tiny < 1 MB free space partitions (#119479)
- if part.getSize(unit="MB") <= 1.0 and \
- part.type & parted.PARTITION_FREESPACE:
- if not part.active or not device.bootable:
+ if disk.partitioned:
+ part = disk.format.firstPartition
+ extendedParent = None
+ while part:
+ if part.type & parted.PARTITION_METADATA:
part = part.nextPartition()
continue
- if device and device.isExtended:
- if extendedParent:
- raise RuntimeError, ("can't handle more than "
- "one extended partition per disk")
- extendedParent = self.tree.append(parent)
- iter = extendedParent
- elif device and device.isLogical:
- if not extendedParent:
- raise RuntimeError, ("crossed logical partition "
- "before extended")
- iter = self.tree.append(extendedParent)
- else:
- iter = self.tree.append(parent)
-
- if device and not device.isExtended:
- self.addDevice(device, iter)
- else:
- # either extended or freespace
- if part.type & parted.PARTITION_FREESPACE:
- devstring = _("Free")
- ptype = ""
+ partName = devicePathToName(part.getDeviceNodeName())
+ device = self.storage.devicetree.getDeviceByName(partName)
+ if not device and not part.type & parted.PARTITION_FREESPACE:
+ log.debug("can't find partition %s in device"
+ " tree" % partName)
+
+ # ignore the tiny < 1 MB free space partitions (#119479)
+ if part.getSize(unit="MB") <= 1.0 and \
+ part.type & parted.PARTITION_FREESPACE:
+ if not part.active or not device.bootable:
+ part = part.nextPartition()
+ continue
+
+ if device and device.isExtended:
+ if extendedParent:
+ raise RuntimeError, ("can't handle more than "
+ "one extended partition per disk")
+ extendedParent = self.tree.append(parent)
+ iter = extendedParent
+ elif device and device.isLogical:
+ if not extendedParent:
+ raise RuntimeError, ("crossed logical partition "
+ "before extended")
+ iter = self.tree.append(extendedParent)
else:
- devstring = device.name
- ptype = _("Extended")
-
- self.tree[iter]['Device'] = devstring
- self.tree[iter]['Type'] = ptype
- size = part.getSize(unit="MB")
- if size < 1.0:
- sizestr = "< 1"
+ iter = self.tree.append(parent)
+
+ if device and not device.isExtended:
+ self.addDevice(device, iter)
else:
- sizestr = "%Ld" % (size)
- self.tree[iter]['Size (MB)'] = sizestr
- self.tree[iter]['PyObject'] = device
+ # either extended or freespace
+ if part.type & parted.PARTITION_FREESPACE:
+ devstring = _("Free")
+ ptype = ""
+ else:
+ devstring = device.name
+ ptype = _("Extended")
+
+ self.tree[iter]['Device'] = devstring
+ self.tree[iter]['Type'] = ptype
+ size = part.getSize(unit="MB")
+ if size < 1.0:
+ sizestr = "< 1"
+ else:
+ sizestr = "%Ld" % (size)
+ self.tree[iter]['Size (MB)'] = sizestr
+ self.tree[iter]['PyObject'] = device
- part = part.nextPartition()
+ part = part.nextPartition()
+ else:
+ # whole-disk formatting
+ self.addDevice(disk, parent)
# Insert a '\n' when device string is too long. Usually when it
# contains '/dev/mapper'. First column should be around 20 chars.
@@ -1116,7 +1120,7 @@ class PartitionWindow(InstallWindow):
# Display a create dialog.
stripe_dev = disp_stripe.obj
- if isinstance(stripe_dev, storage.DiskDevice):
+ if stripe_dev.partitioned:
tempformat = self.storage.defaultFSType
device = self.storage.newPartition(fmt_type=tempformat, size=200)
self.editPartition(device, isNew = True)
@@ -1145,7 +1149,7 @@ class PartitionWindow(InstallWindow):
# FIXME: This code might repeat itself. might be a good idea to
# put it in a function.
curr_parent = self.tree[iparent]["PyObject"]
- if isinstance(curr_parent, storage.DiskDevice):
+ if curr_parent.partitioned:
tempformat = self.storage.defaultFSType
device = self.storage.newPartition(fmt_type=tempformat, size=200)
self.editPartition(device, isNew = True)
@@ -1187,7 +1191,7 @@ class PartitionWindow(InstallWindow):
if not device:
# This is free space.
parent = self.tree[iparent]["PyObject"]
- if isinstance(parent, storage.DiskDevice):
+ if parent.partitioned:
if not isinstance(self.stripeGraph, DiskStripeGraph):
self.stripeGraph.shutDown()
self.stripeGraph = DiskStripeGraph(self.storage,
@@ -1203,7 +1207,7 @@ class PartitionWindow(InstallWindow):
dcCB = self.barviewActivateCB)
self.stripeGraph.setDisplayed(parent)
- elif isinstance(device, storage.DiskDevice):
+ elif device.partitioned:
if not isinstance(self.stripeGraph, DiskStripeGraph):
self.stripeGraph.shutDown()
self.stripeGraph = DiskStripeGraph(self.storage,
@@ -1273,7 +1277,7 @@ class PartitionWindow(InstallWindow):
devices. This will need some work when that time comes.
"""
device = self.tree.getCurrentDevice()
- if device.format.type == "disklabel":
+ if device.partitioned:
if doClearPartitionedDevice(self.intf,
self.storage,
device):
@@ -1281,8 +1285,7 @@ class PartitionWindow(InstallWindow):
elif doDeleteDevice(self.intf,
self.storage,
device):
- if isinstance(device, storage.devices.DiskDevice) or \
- isinstance(device, storage.devices.PartitionDevice):
+ if isinstance(device, storage.devices.PartitionDevice):
justRedraw = False
else:
justRedraw = True
@@ -1327,7 +1330,7 @@ class PartitionWindow(InstallWindow):
# FIXME: Why do I need availraidparts to clone?
activate_create_raid_clone = False
- if (len(self.storage.disks) > 1
+ if (len(self.storage.partitioned) > 1
and availraidparts > 0):
activate_create_raid_clone = True
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 39b2561f2..ee6d0acde 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -420,7 +420,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
# do tests we just want in UI for now, not kickstart
def doUIRAIDLVMChecks(request, storage):
fstype = request.format.name
- numdrives = len(storage.disks)
+ numdrives = len(storage.partitioned)
## if fstype and fstype.getName() == "physical volume (LVM)":
## if request.grow:
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 8431e71a7..086c562ee 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -812,7 +812,7 @@ class RaidCloneDialog:
lbl = gtk.Label(_("Source Drive:"))
lbl.set_alignment(0.0, 0.0)
box.pack_start(lbl, padding=5)
- (sw, self.sourceView) = self.createDriveList(storage.disks)
+ (sw, self.sourceView) = self.createDriveList(storage.partitioned)
selection = self.sourceView.get_selection()
selection.set_mode(gtk.SELECTION_SINGLE)
box.pack_start(sw, padding=5)
@@ -820,7 +820,7 @@ class RaidCloneDialog:
lbl = gtk.Label(_("Target Drive(s):"))
lbl.set_alignment(0.0, 0.0)
box.pack_start(lbl, padding=5)
- (sw, self.targetView) = self.createDriveList(storage.disks)
+ (sw, self.targetView) = self.createDriveList(storage.partitioned)
selection = self.targetView.get_selection()
selection.set_mode(gtk.SELECTION_MULTIPLE)
box.pack_start(sw, padding=5)