Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 183341 Details for
Bug 239727
LVM2 mirror support in anaconda (configuration and root volume)
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Same functionality, different way of coding
Mirroring.patch (text/plain), 13.01 KB, created by
Joel Andres Granados
on 2007-08-31 13:37:42 UTC
(
hide
)
Description:
Same functionality, different way of coding
Filename:
MIME Type:
Creator:
Joel Andres Granados
Created:
2007-08-31 13:37:42 UTC
Size:
13.01 KB
patch
obsolete
>Index: fsset.py >=================================================================== >RCS file: /usr/local/CVS/anaconda/fsset.py,v >retrieving revision 1.334 >diff -u -r1.334 fsset.py >--- fsset.py 17 Aug 2007 14:20:44 -0000 1.334 >+++ fsset.py 31 Aug 2007 13:17:17 -0000 >@@ -1505,7 +1505,17 @@ > vgs[entry.device.name] = entry.device > > # then set up the logical volumes >+ nonLVMirrors = [] > for entry in self.entries: >+ #We should do the mirrored stuff first :) >+ if isinstance(entry.device, MirroredLogicalVolumeDevice): >+ vg = None >+ if vgs.has_key(entry.device.vgname): >+ vg = vgs[entry.device.vgname] >+ entry.device.setupDevice(chroot, vgdevice = vg) >+ else: >+ nonLVMirrors.append(entry) >+ for nonMirrors in nonLVMirrors: > if isinstance(entry.device, LogicalVolumeDevice): > vg = None > if vgs.has_key(entry.device.vgname): >@@ -2194,6 +2204,28 @@ > return > > >+class MirroredLogicalVolumeDevice(LogicalVolumeDevice): >+ def __init__(self, vgname, size, lvname, vg, existing = 0, mirrors = 0, devs = [], corelog = True): >+ """ >+ mirrors - The number of mirrors. >+ devs - Specific devices to use for mirrors. >+ corelog - Wether to use corelog or not. >+ """ >+ LogicalVolumeDevice.__init__(self,vgname, size, lvname, vg, existing=existing) >+ self.mirrors = mirrors #If mirrors is set to 0 mirroring is ignored. >+ self.devs = devs >+ self.corelog = corelog >+ >+ def setupDevice(self, chroot="/", devPrefix='/tmp', vgdevice = None): >+ if not self.isSetup: >+ lvm.mirroredlvcreate(self.name, self.vgname, self.size, mirrors=self.mirrors, corelog=self.corelog, devs=self.devs) >+ self.isSetup = 1 >+ >+ if vgdevice and vgdevice.isNetdev(): >+ self.setAsNetdev() >+ >+ return "/dev/%s" % (self.getDevice(),) >+ > class PartitionDevice(Device): > def __init__(self, partition): > Device.__init__(self) >Index: kickstart.py >=================================================================== >RCS file: /usr/local/CVS/anaconda/kickstart.py,v >retrieving revision 1.386 >diff -u -r1.386 kickstart.py >--- kickstart.py 27 Aug 2007 20:15:55 -0000 1.386 >+++ kickstart.py 31 Aug 2007 13:17:17 -0000 >@@ -217,9 +217,9 @@ > self.handler.id.instClass.setLanguage(self.handler.id, self.lang) > self.handler.skipSteps.append("language") > >-class LogVol(commands.logvol.FC4_LogVol): >+class LogVol(commands.logvol.F8_LogVol): > def parse(self, args): >- commands.logvol.FC4_LogVol.parse(self, args) >+ commands.logvol.F8_LogVol.parse(self, args) > > lvd = self.lvList[-1] > >@@ -264,7 +264,46 @@ > elif (lvd.percent <= 0 or lvd.percent > 100) and not lvd.preexist: > raise KickstartValueError, formatErrorMsg(self.lineno, msg="Percentage must be between 0 and 100") > >- request = partRequests.LogicalVolumeRequestSpec(filesystem, >+ if lvd.mirrors > 0:# sanity checks for the mirror stuff. >+ if lvd.devs == []: >+ raise KickstartValueError, formatErrorMsg(self.lineno, \ >+ msg="When specifying a mirrored logical volume you must provide a list of devices.") >+ # For now we will ask the user to use only the minimum number of devices. >+ if lvd.corelog and len(lvd.devs) != lvd.mirrors+1: >+ raise KickstartValueError, formatErrorMsg(self.lineno, \ >+ msg="When mirroring with corelog the number of devices must be equal to the number of mirrors plus one. (devs=mirrors+1)") >+ if not lvd.corelog and len(lvd.devs) != lvd.mirrors+2: >+ raise KickstartValueError, formatErrorMsg(self.lineno, \ >+ msg="When mirroring without corelog the number of devices must be equal to the number of mirrors plus two. (devs=mirrors+2)") >+ #The calculations based on percentages will not apply to mirrored logical volumes for now. >+ if lvd.percent: >+ raise KickstartValueError, formatErrorMsg(self.lineno, \ >+ msg="When creating a logical volume use the --size option instead of the --percent.") >+ # get the unique ids of each of the physical volumes >+ pvs=[] >+ for pv in lvd.devs: >+ if pv not in self.handler.ksPVMapping.keys(): >+ raise KickstartValueError, formatErrorMsg(self.lineno, \ >+ msg="Tried to use undefined partition %s in Volume Group specification" % pv) >+ pvs.append(self.handler.ksPVMapping[pv]) >+ >+ request = partRequests.MirroredLogicalVolumeRequestSpec(filesystem, >+ format = lvd.format, >+ mountpoint = lvd.mountpoint, >+ size = lvd.size, >+ percent = lvd.percent, >+ volgroup = vgid, >+ lvname = lvd.name, >+ grow = lvd.grow, >+ maxSizeMB = lvd.maxSizeMB, >+ preexist = lvd.preexist, >+ bytesPerInode = lvd.bytesPerInode, >+ mirrors = lvd.mirrors, >+ corelog = lvd.corelog, >+ devs = pvs) >+ >+ else: >+ request = partRequests.LogicalVolumeRequestSpec(filesystem, > format = lvd.format, > mountpoint = lvd.mountpoint, > size = lvd.size, >@@ -695,7 +734,7 @@ > "poweroff": Reboot, > "raid": Raid, > "reboot": Reboot, >- "repo": commands.repo.F8_Repo, >+ "repo": commands.repo.FC6_Repo, > "rootpw": RootPw, > "selinux": SELinux, > "services": commands.services.FC6_Services, >Index: lvm.py >=================================================================== >RCS file: /usr/local/CVS/anaconda/lvm.py,v >retrieving revision 1.48 >diff -u -r1.48 lvm.py >--- lvm.py 21 May 2007 14:30:19 -0000 1.48 >+++ lvm.py 31 Aug 2007 13:17:17 -0000 >@@ -179,6 +179,31 @@ > raise LVCreateError(vgname, lvname, size) > unlinkConf() > >+def mirroredlvcreate(lvname, vgname, size, mirrors=0, corelog=True, devs=[]): >+ """Creates mirrored logical volume. >+ lvname - name of logical volume to create. >+ vgname - name of volume group lv will be in. >+ size - size of lv, in megabytes. >+ mirrors - the amount of mirrors to create >+ devs - a list of string representing valid devices of the form "/dev/deviceName >+ corelog - whether or not to use corelog. >+ """ >+ global lvmDevicePresent >+ if flags.test or lvmDevicePresent == 0: >+ return >+ writeForceConf() >+ vgscan() >+ >+ args = ["lvcreate", "-v", "-L", "%dM" %(size,), "-m", "%s"%mirrors]+\ >+ (corelog and ["--corelog"] or [])+["-n", lvname, "-An", vgname] >+ try: >+ rc = lvmExec(*args) >+ except: >+ rc = 1 >+ if rc: >+ raise LVCreateError(vgname, lvname, size) >+ unlinkConf() >+ > def lvremove(lvname, vgname): > """Removes a logical volume. > >Index: partRequests.py >=================================================================== >RCS file: /usr/local/CVS/anaconda/partRequests.py,v >retrieving revision 1.74 >diff -u -r1.74 partRequests.py >--- partRequests.py 3 Aug 2007 19:32:24 -0000 1.74 >+++ partRequests.py 31 Aug 2007 13:17:17 -0000 >@@ -930,3 +930,84 @@ > "group's physical extent size.") > > return RequestSpec.sanityCheckRequest(self, partitions, skipMntPtExistCheck) >+ >+class MirroredLogicalVolumeRequestSpec(LogicalVolumeRequestSpec): >+ 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, mirrors=1, corelog=True, devs=[]): >+ """ >+ mirrors - This is the total amount of mirrors. Not counting the main device. >+ corelog - If corelog was chosen or not. >+ devs - The list of devices that hold the mirrors and the main device >+ >+ The lvm2 cml does not make the relation of each device with each logical volume, we are not >+ going to handle that relation either. >+ """ >+ self.mirrors = mirrors >+ self.corelog = corelog >+ self.devs = devs >+ #This is the size of each side. All sides have the same size. >+ self.mirroredSize = size >+ self.mirroredRequestSize = size >+ #This is what the rest of the code has to consider as size. >+ #This is done so other lvs can be installed with the mirrored lv. >+ #FIXME: We don't consider the space that the log ocupies, it might be a problem! >+ #Be aware that the requestSize will also be the "totalSize". >+ #self.totalMirroredLVSize = self.mirroredSize * (self.mirrors + 1) >+ >+ LogicalVolumeRequestSpec.__init__(self, fstype, format=format, mountpoint=mountpoint, >+ size=self.mirroredSize * (self.mirrors + 1), volgroup=volgroup, lvname=lvname, preexist=preexist, >+ percent=percent, grow=grow, maxSizeMB=maxSizeMB, bytesPerInode=bytesPerInode, fslabel=fslabel) >+ >+ self.requestSize = self.mirroredSize >+ >+ def __str__(self): >+ devices = "" >+ for dev in self.devs: >+ devices = "%s,%s"%(devices, dev) >+ devices = devices.strip(",") >+ str = (" %(lvstr)s \n" >+ " mirrors: %(mirrors) devices: %(devices)s corelog: %(corelog)s" % >+ { "lvstr": LogicalVolumeRequestSpec.__str__(self), "mirrors":self.mirrors, >+ "devices":devices, "corelog":self.corelog}) >+ return str >+ >+ def setSize(self, size): >+ # We will not allow size change for now. >+ raise RuntimeError, "The size of the mirrored lv was going to be changed. This is not possible for now." >+ >+ >+ def getDevice(self, partitions): >+ """Return a device which can be solidified.""" >+ devices = [] >+ for dev in self.devs: >+ devices.append("/dev/%s"%partitions.getRequestByID(dev).device) >+ vg = partitions.getRequestByID(self.volumeGroup) >+ vgname = vg.volumeGroupName >+ self.dev = fsset.MirroredLogicalVolumeDevice(vgname, self.mirroredSize, >+ self.logicalVolumeName, >+ vg = vg, >+ existing = self.preexist, >+ mirrors=self.mirrors, >+ corelog=self.corelog, >+ devs=devices) >+ return self.dev >+ >+ def sanityCheckMirroredRequest(self, partitions, diskset): >+ peSize = partitions.getRequestByID(self.volumeGroup).pesize >+ #We mainly check that the size stuff is ok. >+ for dev in self.devs: >+ devReq = partitions.getRequestByID(dev) >+ actualSize = devReq.getActualSize(partitions, diskset) >+ if devReq.grow and actualSize < self.mirroredSize: >+ # After the devices grew, it was still insuficient space to hold the lv. >+ return _("After growing one of the Physical Volumes it was still insuficient " >+ "to hold %s Mirrored Logical Volume." % self.logicalVolumeName) >+ if not devReq.grow and devReq.requestSize < self.mirroredRequestSize: >+ # Must be a mistake in the ksfile >+ return _("All Physical Volumes must be greater than or equal to the size of " >+ "the mirrored Logical Volume that will contain them.") >+ if not devReq.grow and lvm.clampPVSize(actualSize,peSize) < self.mirroredSize and devReq.requestSize >= actualSize: >+ #This basically means that the actual size of the pv was rounded up. >+ #Change the self.mirroredSize and continue >+ self.mirroredSize = lvm.clampPVSize(actualSize,peSize) >Index: partitions.py >=================================================================== >RCS file: /usr/local/CVS/anaconda/partitions.py,v >retrieving revision 1.108 >diff -u -r1.108 partitions.py >--- partitions.py 23 Aug 2007 14:58:15 -0000 1.108 >+++ partitions.py 31 Aug 2007 13:17:17 -0000 >@@ -957,6 +957,10 @@ > rc = request.sanityCheckRaid(self) > if rc: > errors.append(rc) >+ if isinstance(request, partRequests.MirroredLogicalVolumeRequestSpec): >+ rc = request.sanityCheckMirroredRequest(self, diskset) >+ if rc: >+ errors.append(rc) > if not hasattr(request,'drive'): > continue > for x in request.drive or []:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 239727
:
174121
|
174161
|
174181
|
175081
|
175101
|
183321
| 183341