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

Simple addition for striping in fedora 6



Relevant to Bug # 134638.
Simple, very limited addition to allow striped Logical Volumes. Can't choose the number of stripes nor the size of the stripes yet. Working on it.
The diffs are attached.
Regards.
Joel

--- fsset.py-JG	2007-02-15 20:23:09.000000000 +0100
+++ fsset.py	2006-09-27 23:16:56.000000000 +0200
@@ -2279,7 +2279,7 @@
 
 class LogicalVolumeDevice(Device):
     # note that size is in megabytes!
-    def __init__(self, vgname, size, lvname, vg, existing = 0, striped=0 ):
+    def __init__(self, vgname, size, lvname, vg, existing = 0):
         Device.__init__(self)
         self.vgname = vgname
         self.size = size
@@ -2288,7 +2288,6 @@
         self.isSetup = existing
         self.doLabel = None
         self.vg = vg
-        self.striped = striped
 
         # these are attributes we might want to expose.  or maybe not.
         # self.chunksize
@@ -2297,14 +2296,8 @@
         # self.extents
         # self.readaheadsectors
 
-    def setStriped(self, value):
-        self.striped = value
-
-    def isStriped(self):
-        return self.striped
- 
     def setupDevice(self, chroot="/", devPrefix='/tmp', vgdevice = None):
-        if not self.isSetup and not self.isStriped():
+        if not self.isSetup:
             lvm.writeForceConf()
             rc = iutil.execWithRedirect("lvm",
                                         ["lvcreate", "-L",
@@ -2320,26 +2313,7 @@
             self.isSetup = 1
 
             if vgdevice and vgdevice.isNetdev(): self.setAsNetdev()
-        elif not self.isSetup:
-            lvm.writeForceConf()
-            numDevices = len(self.vg.dev.physicalVolumes)
-            rc = iutil.execWithRedirect("lvm",
-                                        ["lvcreate", 
-                                        "-i%d" % (numDevices,),
-                                        "-I4", # The default size of the strips for now
-                                        "-L", "%dM" % (self.size,),
-                                         "-n", self.name, "-An",
-                                         self.vgname],
-                                        stdout = "/tmp/lvmout",
-                                        stderr = "/tmp/lvmout",
-                                        searchPath = 1)
-            if rc:
-                raise SystemError, "Striped lvcreate failed for %s" %(self.name,)
-            lvm.unlinkConf()
-            self.isSetup = 1
 
-            if vgdevice and vgdevice.isNetdev(): self.setAsNetdev()
- 
         return "/dev/%s" % (self.getDevice(),)
 
     def getDevice(self, asBoot = 0):
--- lvm_dialog_gui.py-JG	2007-02-15 19:36:54.000000000 +0100
+++ lvm_dialog_gui.py	2006-07-21 20:51:56.000000000 +0200
@@ -364,15 +364,6 @@
 	(model, iter) = selection.get_selected()
 	return iter
 
-    def toggleStripButton(self, button, args):
-        # When the strip button is toggled we must modify Entry
-        # We use `not` because we recive the state of the button after its toggled
-        entry, totalSize = args
-        if not button.get_active():
-            entry.set_editable(True)
-        else:
-            entry.set_text("%s" % (totalSize,))
-            entry.set_editable(False)
 
     def editLogicalVolume(self, logrequest, isNew = 0):
 	if isNew:
@@ -462,48 +453,6 @@
         row += 1
 
         if not logrequest or not logrequest.getPreExisting():
-            stripCombo = gtk.CheckButton(label="Striped", use_underline=True)
-            stripCombo.connect("toggled", self.toggleStripButton , (sizeEntry,logrequest.getActualSize(self.partitions, self.diskset) ) )
-            pesize = int(self.peCombo.get_active_value())
-            (tspace, uspace, fspace) = self.computeSpaceValues(usepe=pesize)
-            NSPV = len(self.getSelectedPhysicalVolumes(self.lvmlist.get_model())) # Number os Selected Physical Volumes
-            if  NSPV < 2:
-                # Not enough available lvm partitions
-                stripCombo.set_active(False)
-                stripCombo.set_sensitive(False)
-                sizeEntry.set_editable(True)
-            elif len(self.logvolreqs) == 0:
-                # There are no previous requests.
-                stripCombo.set_active(False)
-                stripCombo.set_sensitive(True)
-                sizeEntry.set_editable(True)
-            elif len(self.logvolreqs) == 1 and fspace != 0:
-                # It is adding a new logvol and one already exists
-               stripCombo.set_active(False)
-               stripCombo.set_sensitive(False)
-               sizeEntry.set_editable(True)
-               logrequest.setStriped(False)
-            elif len(self.logvolreqs) == 1 and fspace == 0:
-               # We can have a striped or non striped volume
-               # Just set the value to that of the logrequest.
-               stripCombo.set_active(logrequest.isStriped())
-               sizeEntry.set_editable(not logrequest.isStriped())
-            elif len(self.logvolreqs) > 1 :
-                # We got more than 1 logvol
-                stripCombo.set_active(False)
-                stripCombo.set_sensitive(False) # Non editable
-                sizeEntry.set_editable(True)
-            else:
-                # Negative logvols.  raise error
-                pass
-            maintable.attach(lbl, 0, 1, row, row+1)
-            maintable.attach(stripCombo, 1,2,row, row+1)
-            row += 1
-        else:
-            stripCombo = gtk.CheckButton(label="Striped")
-            stripCombo.set_active(False)
-
-        if not logrequest or not logrequest.getPreExisting():
             pesize = int(self.peCombo.get_active_value())
             (tspace, uspace, fspace) = self.computeSpaceValues(usepe=pesize)
             maxlv = min(lvm.getMaxLVSize(pesize), fspace)
@@ -727,17 +676,6 @@
 					  "or make the logical volume(s) smaller.") % (neededSpaceMB, availSpaceMB), custom_icon="error")
 		del tmplogreqs
 		continue
-            if stripCombo.get_active():
-                # We check that there is at least two physical volumes.
-                if len(self.getSelectedPhysicalVolumes(self.lvmlist.get_model())) < 2:
-                    self.initf.messageWindow(_("Invalid Device Count"),
-                            _("To used the lvm striped functionality you "
-                              "must have more than one physical volume "
-                              "defined for the Volume Group."), custom_icon="error" )
-                request.setStriped(1)
-            else:
-                request.setStriped(0)
-
 
 	    # everything ok
 	    break
--- partRequests.py-JG	2007-02-15 20:06:12.000000000 +0100
+++ partRequests.py	2006-08-18 16:26:38.000000000 +0200
@@ -812,7 +812,7 @@
     def __init__(self, fstype, format = None, mountpoint = None,
                  size = None, volgroup = None, lvname = None,
                  preexist = 0, percent = None, grow=0, maxSizeMB=0,
-		 bytesPerInode = 4096, fslabel = None, striped=0):
+		 bytesPerInode = 4096, fslabel = None):
         """Create a new VolumeGroupRequestSpec object.
 
         fstype is the fsset filesystem type.
@@ -827,7 +827,6 @@
 	maxSizeMB is max size to grow to.
 	bytesPerInode is the size of the inodes on the partition.
         fslabel is the label of the filesystem on the logical volume.
-        striped - If the requested logical volume is striped or not.      
         """
 
         # if it's preexisting, the original fstype should be set
@@ -854,7 +853,6 @@
         self.grow = grow
         self.maxSizeMB = maxSizeMB
         self.startSize = size
-        self.striped = striped
 	
         if not percent and not size and not preexist:
             raise RuntimeError, "Error with Volume Group:Logical Volume %s:%s - Logical Volume must specify either percentage of vgsize or size" % (volgroup, lvname)
@@ -877,13 +875,12 @@
         str = ("LV Request -- mountpoint: %(mount)s  uniqueID: %(id)s\n"
                "  type: %(fstype)s  format: %(format)s  badblocks: %(bb)s\n"
                "  size: %(size)s  lvname: %(lvname)s  volgroup: %(vgid)s\n"
-               "  bytesPerInode: %(bytesPerInode)s  options: '%(fsopts)s'\n"
-               "  striped: %(striped) " %
+               "  bytesPerInode: %(bytesPerInode)s  options: '%(fsopts)s'" %
                {"mount": self.mountpoint, "id": self.uniqueID,
                 "fstype": fsname, "format": self.format, "bb": self.badblocks,
                 "lvname": self.logicalVolumeName, "vgid": self.volumeGroup,
 		"size": size, "bytesPerInode": self.bytesPerInode,
-                "fsopts": self.fsopts, "striped": self.striped})
+                "fsopts": self.fsopts})
         return str
     
     def getDevice(self, partitions):
@@ -893,8 +890,7 @@
         self.dev = fsset.LogicalVolumeDevice(vgname, self.size,
                                              self.logicalVolumeName,
                                              vg = vg,
-                                             existing = self.preexist,
-                                             striped = self.striped)
+                                             existing = self.preexist)
         return self.dev
 
     def getActualSize(self, partitions, diskset):
@@ -929,9 +925,3 @@
                      "group's physical extent size.")
 
         return RequestSpec.sanityCheckRequest(self, partitions, skipMntPtExistCheck)
-
-    def setStriped(self, value):
-        self.striped = value
-
-    def isStriped(self):
-        return self.striped

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