Re: [PATCH 01/30] Edit LVM LV when user has a LV selected.

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Comments inline.

On Wed, 16 Sep 2009, Joel Granados Moreno wrote:

* iw/lvm_dialog_gui.py (run, convertToActions): New function.  Need to
have a separate function so we can run it from the editLVMLogicalVolume
function in iw/partition_gui.py.  We call new function from run.
* iw/partition_gui.py (editCB): Call the new editLVMLogicalVolume
function.
(editLVMLogicalVolume):  New function.  Serves the same purpose as
editLVMVolumeGroup but for Logical Volumes.
(deleteCB): All actions are created when we delete a selected LV.  We do
need to make sure that we delete the deleted LV from the VG that
---
iw/lvm_dialog_gui.py |    4 ++++
iw/partition_gui.py  |   34 ++++++++++++++++++++++++++++++++--
2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/iw/lvm_dialog_gui.py b/iw/lvm_dialog_gui.py
index e226650..8a32a8f 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -945,7 +945,9 @@ class VolumeGroupEditor:

	    # everything ok
	    break
+        return self.convertToActions()

+    def convertToActions(self):
        # here we have to figure out what all was done and convert it to
        # devices and actions
        #
@@ -956,6 +958,8 @@ class VolumeGroupEditor:
        log.debug("finished editing vg")
        log.debug("pvs: %s" % [p.name for p in self.pvs])
        log.debug("luks: %s" % self.luks.keys())
+        volname = self.volnameEntry.get_text().strip()
+        pesize = int(self.peCombo.get_active_value()) / 1024.0

Should we wrap this in some input validation try/except statements?  If
someone manages to enter 'steak' for the self.peCombo value, we could have
problems.

        for lv in self.lvs.itervalues():
            log.debug("lv %s" % lv)
            _luks = self.luks.get(lv['name'])
diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 5ebee3a..b16bd4b 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -709,7 +709,7 @@ class PartitionWindow(InstallWindow):
		    else:
			self.tree[iter]['Mount Point'] = ""
		    self.tree[iter]['Size (MB)'] = "%Ld" % lv.size
-		    self.tree[iter]['PyObject'] = vg
+		    self.tree[iter]['PyObject'] = lv

                    if lv.format.type == "luks" and not lv.format.exists:
                        # we're creating the LUKS header
@@ -995,6 +995,8 @@ class PartitionWindow(InstallWindow):
                justRedraw = False
            else:
                justRedraw = True
+                if device.type == "lvmlv" and device in device.vg.lvs:
+                    device.vg._removeLogVol(device)

            self.refresh(justRedraw=justRedraw)

@@ -1077,7 +1079,7 @@ class PartitionWindow(InstallWindow):
        elif device.type == "lvmvg":
            self.editLVMVolumeGroup(device)
        elif device.type == "lvmlv":
-            self.editLVMVolumeGroup(device)
+            self.editLVMLogicalVolume(device)
        elif isinstance(device, storage.devices.PartitionDevice):
            self.editPartition(device)

@@ -1171,6 +1173,34 @@ class PartitionWindow(InstallWindow):

	vgeditor.destroy()

+    def editLVMLogicalVolume (self, device):
+        vgeditor = lvm_dialog_gui.VolumeGroupEditor(self.anaconda,
+                                                    self.intf,
+                                                    self.parent,
+                                                    device.vg,
+                                                    isNew = 0)
+        while 1:

Style/cosmetic:  isNew could be a boolean and the while statement could say
'while True'.

+            lv = vgeditor.lvs[device.lvname]
+            vgeditor.editLogicalVolume(lv)
+            actions = vgeditor.convertToActions();
+
+            for action in actions:
+                # FIXME: handle exceptions
+                self.storage.devicetree.registerAction(action)
+
+            if self.refresh(justRedraw=True):
+                actions.reverse()
+                for action in actions:
+                    self.storage.devicetree.cancelAction(action)
+
+                if self.refresh():
+                    raise RuntimeError, ("Returning partitions to state "
+                                         "prior to edit failed")
+                continue
+            else:
+                break
+
+        vgeditor.destroy()

    def makeLvmCB(self, widget):
        if not getFormat("lvmpv").supported or not lvm.has_lvm():


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqy9HwACgkQ5hsjjIy1VkkohACffZA1aTwNtPS+a7y80QK0b957
rWkAn3olRVEg18sXl1HVJz5v1uBrP4+B
=WXrm
-----END PGP SIGNATURE-----

_______________________________________________
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