Re: [PATCH] master.

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

 



The delete was a little tricky.  I based my 'delete' changes on
iw/lvm_dialog_gui.py:992 (around that line).  Where the actions are
being created for the lvm stuff.  I noticed the following code:

<snip>
if lv in self.vg.lvs:
    self.vg._removeLogVol(lv)
</snip>

after the actions where created.  That snipped of code is when we
schedule the destruction of the lvs (line iw/lvm_dialog_gui.py:1011
aprox)

With this in mind I added the removal of the LV that is being deleted
from the main partitioning screen when the user hits delete.  The
actions were already properly created so the only thing left was to
remove the lv from the vg so that it did not show up in the screen at
refresh.

The previous behavior for pressing delete when having an LV selected was
to erase all the VG. (not good).

Regards.

On Thu, Jul 23, 2009 at 02:07:24PM -0500, David Lehman wrote:
> On Thu, 2009-07-23 at 18:43 +0200, Joel Granados Moreno wrote:
> > Hello list
> > 
> > When selecting the lv in the tree and hitting edit we go to the Volume
> > group.  The user has to then select the Logical Volume to continue
> > editing. Wouldn't it be better to go to the LV editing window?  This
> > patch allows this but with some strangeness:
> > 1. It goes to the LV screen directly but it "passes through" the Volume
> > group screen.  So the user will see the VolumeGroup screen behind the
> > Lobical Volume screen pop up.
> > 2. Once the user is done editing and hits OK, or Cancel, both windows
> > close.
> 
> How does the F10 installer behave? Also, any change should be cover the
> delete case as well (delete removes lv, not entire vg).
> 
> Dave
> 
> > 
> > IMO, its consistent behavior, but its still strange.  In any case I
> > think its a step in the right direction.
> > 
> > comments greatly appreciated.
> > 
> > regards.
> > 
> > Joel Andres Granados
> > Brno, Czech Republic, Red Hat.
> > 
> > _______________________________________________
> > Anaconda-devel-list mailing list
> > Anaconda-devel-list@xxxxxxxxxx
> > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.
From be2950dfcd7183f147b5bc7365a696460741d612 Mon Sep 17 00:00:00 2001
From: Joel Granados Moreno <jgranado@xxxxxxxxxx>
Date: Thu, 23 Jul 2009 15:51:24 +0200
Subject: [PATCH] Edit LVM LV when user has a LV selected.

* 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 18e140a..bdc581c 100644
--- a/iw/lvm_dialog_gui.py
+++ b/iw/lvm_dialog_gui.py
@@ -944,7 +944,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
         #
@@ -955,6 +957,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
         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 bffc5a9..847ea2c 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:
+            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():
-- 
1.6.0.6

Attachment: pgpF22fLkNjiW.pgp
Description: 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