[PATCH] Fix creation of fs options for preexisting encrypted devices.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Previously we just passed in the device on which we would be
creating the filesystem, but that doesn't make it easy to know
if we initially plan to format the device or if the device is
encrypted.
---
 iw/lvm_dialog_gui.py           |    6 ++++--
 iw/partition_dialog_gui.py     |    2 +-
 iw/partition_ui_helpers_gui.py |   32 ++++++++++++++++++--------------
 iw/raid_dialog_gui.py          |    6 ++++--
 4 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index 6aa5ef3..5e205a5 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -393,9 +393,11 @@ class VolumeGroupEditor:
         row = 0
 
         if lv.format.type == "luks":
-            usedev = self.findLUKSDev(lv)
+            luksdev = self.findLUKSDev(lv)
+            usedev = luksdev
             format = usedev.format
         elif lv:
+            luksdev = None
             usedev = lv
             format = lv.format
 
@@ -471,7 +473,7 @@ class VolumeGroupEditor:
 
 	self.fsoptionsDict = {}
 	if lv.exists:
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(usedev, maintable, row, mountCombo, self.storage, ignorefs = ["software RAID", "physical volume (LVM)", "vfat"])
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(lv, maintable, row, mountCombo, self.storage, ignorefs = ["software RAID", "physical volume (LVM)", "vfat"], luksdev=luksdev)
 
         # checkbutton for encryption using dm-crypt/LUKS
         if not lv.exists:
diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index c379671..8021616 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -366,7 +366,7 @@ class PartitionEditor:
 	self.fsoptionsDict = {}
         if self.origrequest.exists and \
            not self.storage.isProtected(self.origrequest):
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(usereq, maintable, row, self.mountCombo, self.storage)
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.storage, luksdev=luksdev)
 
         # size options
         if not self.origrequest.exists:
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index b8cae4a..5cd75c2 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -308,36 +308,40 @@ def noformatCB(widget, data):
        resizesb      - spinbutton with resize target
 """
 def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
-                                  partitions, ignorefs=[]):
+                                  partitions, ignorefs=[], luksdev=None):
     rc = {}
 
-    ofstype = origrequest.format
+    if luksdev:
+        origfs = luksdev.format
+    else:
+        origfs = origrequest.format
+
     formatcb = gtk.CheckButton(label=_("_Format as:"))
     maintable.attach(formatcb, 0, 1, row, row + 1)
-    formatcb.set_active(istruefalse(not origrequest.format.exists))
+    formatcb.set_active(istruefalse(not origfs.exists))
     rc["formatcb"] = formatcb
 
-    fstypeCombo = createFSTypeMenu(ofstype, fstypechangeCB,
+    fstypeCombo = createFSTypeMenu(origfs, fstypechangeCB,
                                    mountCombo, ignorefs=ignorefs)
     fstypeCombo.set_sensitive(formatcb.get_active())
     maintable.attach(fstypeCombo, 1, 2, row, row + 1)
     row += 1
     rc["fstypeCombo"] = fstypeCombo
 
-    if not formatcb.get_active() and not origrequest.format.migrate:
-	mountCombo.set_data("prevmountable", origrequest.format.mountable)
+    if not formatcb.get_active() and not origfs.migrate:
+	mountCombo.set_data("prevmountable", origfs.mountable)
 
     # this gets added to the table a bit later on
     lukscb = gtk.CheckButton(_("_Encrypt"))
 
-    if origrequest.format.migratable:
+    if origfs.migratable:
 	migratecb = gtk.CheckButton(label=_("Mi_grate filesystem to:"))
-        migratecb.set_active(istruefalse(origrequest.format.migrate))
+        migratecb.set_active(istruefalse(origfs.migrate))
 
-	migtypes = [origrequest.format.migrationTarget]
+	migtypes = [origfs.migrationTarget]
 
 	maintable.attach(migratecb, 0, 1, row, row + 1)
-	migfstypeCombo = createFSTypeMenu(ofstype,
+	migfstypeCombo = createFSTypeMenu(origfs,
                                           None, None,
                                           availablefstypes = migtypes)
 	migfstypeCombo.set_sensitive(migratecb.get_active())
@@ -346,14 +350,14 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
         rc["migratecb"] = migratecb
         rc["migfstypeCombo"] = migfstypeCombo
 	migratecb.connect("toggled", formatMigrateOptionCB,
-                          (migfstypeCombo, mountCombo, ofstype, None,
+                          (migfstypeCombo, mountCombo, origfs, None,
                            fstypeCombo, formatcb))
     else:
 	migratecb = None
 	migfstypeCombo = None
 
     formatcb.connect("toggled", formatMigrateOptionCB,
-                    (fstypeCombo, mountCombo, ofstype, lukscb,
+                    (fstypeCombo, mountCombo, origfs, lukscb,
                      migfstypeCombo, migratecb))
 
     if origrequest.resizable:
@@ -369,7 +373,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
 
         reqlower = origrequest.minSize
         requpper = origrequest.maxSize
-        if origrequest.format.exists:
+        if origfs.exists:
             lower = reqlower
         else:
             lower = 1
@@ -387,7 +391,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
 
         formatcb.connect("toggled", formatOptionResizeCB, resizesb)
 
-    if origrequest.format.type == "luks":
+    if luksdev:
         lukscb.set_active(1)
         lukscb.set_data("encrypted", 1)
     else:
diff --git a/iw/raid_dialog_gui.py b/iw/raid_dialog_gui.py
index 099a9c9..3ae2f6e 100644
--- a/iw/raid_dialog_gui.py
+++ b/iw/raid_dialog_gui.py
@@ -332,9 +332,11 @@ class RaidEditor:
         self.lukscb.set_data("formatstate", 1)
 
         if origrequest.format.type == "luks":
-            usedev = self.storage.devicetree.getChildren(origrequest)[0]
+            luksdev = self.storage.devicetree.getChildren(origrequest)[0]
+            usedev = luksdev
             format = usedev.format
         else:
+            luksdev = None
             usedev = origrequest
             format = origrequest.format
 
@@ -474,7 +476,7 @@ class RaidEditor:
             maintable.attach(self.lukscb, 0, 2, row, row + 1)
             row = row + 1
 	else:
-	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(usedev, maintable, row, self.mountCombo, self.storage)
+	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(origrequest, maintable, row, self.mountCombo, self.storage, luksdev=luksdev)
 
 	# put main table into dialog
 	dialog.vbox.pack_start(maintable)
-- 
1.6.0.6

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux