Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Red Hat Install (http://www.linux-archive.org/red-hat-install/)
-   -   Fix lots of buggy behavior in the partition dialog. (http://www.linux-archive.org/red-hat-install/263700-fix-lots-buggy-behavior-partition-dialog.html)

David Lehman 03-15-2009 07:57 PM

Fix lots of buggy behavior in the partition dialog.
 
Re-editing new partitions was generating a new request instead of
modifying the original request.

We were also trying to pass in a format to the ActionDestroyFormat
constructor, which is wrong -- they all take a device argument.

Lastly, the conditional for showing the "new" filesystem options
was wrong, which was causing both it and the "preexist" fs options
to get added to the dialog on new request re-edits.
---
iw/partition_dialog_gui.py | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 53d26f0..c379671 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -159,15 +159,18 @@ class PartitionEditor:
if disk.name == drive:
disks.append(disk)

- # TODO: when will we set bootable?
- request = self.storage.newPartition(size=size,
- grow=grow,
- maxsize=maxsize,
- primary=primary,
- parents=disks)
+ if self.isNew:
+ request = self.storage.newPartition(size=size,
+ grow=grow,
+ maxsize=maxsize,
+ primary=primary,
+ parents=disks)
+ else:
+ request = self.origrequest

format = fmt_class(mountpoint=mountpoint)
- if self.lukscb and self.lukscb.get_active():
+ if self.lukscb and self.lukscb.get_active() and
+ request.format.type != "luks":
luksformat = format
format = getFormat("luks",
passphrase=self.storage.encryptionPassphrase)
@@ -179,13 +182,21 @@ class PartitionEditor:
# destroy the luks format and the mapped device
luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
if luksdev:
- actions.append(ActionDestroyFormat(luksdev.format) )
+ actions.append(ActionDestroyFormat(luksdev))
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
- actions.append(ActionDestroyFormat(self.origreques t))
+ actions.append(ActionDestroyFormat(request))
+
+ if self.isNew:
+ # we're all set, so create the actions
+ actions.append(ActionCreateDevice(request))
+ else:
+ request.req_size = size
+ request.req_grow = grow
+ request.req_max_size = maxsize
+ request.req_primary = primary
+ request.req_disks = disks

- # we're all set, so create the actions
- actions.append(ActionCreateDevice(request))
actions.append(ActionCreateFormat(request, format))
if luksdev:
actions.append(ActionCreateDevice(luksdev))
@@ -286,7 +297,7 @@ class PartitionEditor:
row = row + 1

# Partition Type
- if not self.origrequest.format.exists:
+ if not self.origrequest.exists:
lbl = createAlignedLabel(_("File System _Type:"))
maintable.attach(lbl, 0, 1, row, row + 1)

--
1.6.0.6

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

Hans de Goede 03-16-2009 08:04 AM

Fix lots of buggy behavior in the partition dialog.
 
Looks good,

Regards,

Hans

David Lehman wrote:

Re-editing new partitions was generating a new request instead of
modifying the original request.

We were also trying to pass in a format to the ActionDestroyFormat
constructor, which is wrong -- they all take a device argument.

Lastly, the conditional for showing the "new" filesystem options
was wrong, which was causing both it and the "preexist" fs options
to get added to the dialog on new request re-edits.
---
iw/partition_dialog_gui.py | 35 +++++++++++++++++++++++------------
1 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 53d26f0..c379671 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -159,15 +159,18 @@ class PartitionEditor:
if disk.name == drive:
disks.append(disk)

- # TODO: when will we set bootable?

- request = self.storage.newPartition(size=size,
- grow=grow,
- maxsize=maxsize,
- primary=primary,
- parents=disks)
+ if self.isNew:
+ request = self.storage.newPartition(size=size,
+ grow=grow,
+ maxsize=maxsize,
+ primary=primary,
+ parents=disks)
+ else:
+ request = self.origrequest

format = fmt_class(mountpoint=mountpoint)

- if self.lukscb and self.lukscb.get_active():
+ if self.lukscb and self.lukscb.get_active() and
+ request.format.type != "luks":
luksformat = format
format = getFormat("luks",
passphrase=self.storage.encryptionPassphrase)
@@ -179,13 +182,21 @@ class PartitionEditor:
# destroy the luks format and the mapped device
luksdev = self.storage.devicetree.getChildren(self.origreque st)[0]
if luksdev:
- actions.append(ActionDestroyFormat(luksdev.format) )
+ actions.append(ActionDestroyFormat(luksdev))
actions.append(ActionDestroyDevice(luksdev))
luksdev = None
- actions.append(ActionDestroyFormat(self.origreques t))
+ actions.append(ActionDestroyFormat(request))
+
+ if self.isNew:
+ # we're all set, so create the actions
+ actions.append(ActionCreateDevice(request))
+ else:
+ request.req_size = size
+ request.req_grow = grow
+ request.req_max_size = maxsize
+ request.req_primary = primary
+ request.req_disks = disks

- # we're all set, so create the actions

- actions.append(ActionCreateDevice(request))
actions.append(ActionCreateFormat(request, format))
if luksdev:
actions.append(ActionCreateDevice(luksdev))
@@ -286,7 +297,7 @@ class PartitionEditor:
row = row + 1

# Partition Type

- if not self.origrequest.format.exists:
+ if not self.origrequest.exists:
lbl = createAlignedLabel(_("File System _Type:"))
maintable.attach(lbl, 0, 1, row, row + 1)



_______________________________________________
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 04:59 PM.

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