Just a few smaller/simpler patches someone might want to git am while I am gone. Or not. Either way.
--- blivet/devicelibs/mdraid.py | 26 +++++++++++++++++++++++++- blivet/devices.py | 26 ++------------------------ 2 files changed, 27 insertions(+), 25 deletions(-)
diff --git a/blivet/devicelibs/mdraid.py b/blivet/devicelibs/mdraid.py index fee83f1..1fc5d46 100644 --- a/blivet/devicelibs/mdraid.py +++ b/blivet/devicelibs/mdraid.py @@ -134,6 +134,30 @@ def get_raid_max_spares(raidlevel, nummembers):
raise MDRaidError("invalid raid level %d" % raidlevel)
+def get_raid_superblock_size(size, version=None): + """ mdadm has different amounts of space reserved for its use depending + on the metadata type and size of the array. + + 0.9 use 2.0 MB + 1.0 use 2.0 MB + 1.1 or 1.2 use the formula lifted from mdadm/super1.c to calculate it + based on the array size. + """ + # mdadm 3.2.4 made a major change in the amount of space used for 1.1 and 1.2 + # in order to reserve space for reshaping. See commit 508a7f16 in the + # upstream mdadm repository. + headroom = MD_SUPERBLOCK_SIZE + if version is None or version in ["default", "1.1", "1.2"]: + # MDADM: We try to leave 0.1% at the start for reshape + # MDADM: operations, but limit this to 128Meg (0.1% of 10Gig) + # MDADM: which is plenty for efficient reshapes + # NOTE: In the mdadm code this is in 512b sectors. Converted to use MB + headroom = 128 + while headroom << 10 > size: + headroom >>= 1 + log.info("Using %sMB superBlockSize" % (headroom)) + return headroom + def get_member_space(size, disks, level=None): space = 0 # size of *each* member device
@@ -164,7 +188,7 @@ def get_member_space(size, disks, level=None): # capacity space = size / (disks / 2.0)
- space += MD_SUPERBLOCK_SIZE + space += get_raid_superblock_size(size)
return space * disks
diff --git a/blivet/devices.py b/blivet/devices.py index f091378..afce027 100644 --- a/blivet/devices.py +++ b/blivet/devices.py @@ -2734,30 +2734,8 @@ class MDRaidArrayDevice(StorageDevice):
@property def superBlockSize(self): - """ mdadm has different amounts of space reserved for its use depending - on the metadata type and size of the array. - - 0.9 use 2.0 MB - 1.0 use 2.0 MB - 1.1 or 1.2 use the formula lifted from mdadm/super1.c to calculate it - based on the array size. - """ - # mdadm 3.2.4 made a major change in the amount of space used for 1.1 and 1.2 - # in order to reserve space for reshaping. See commit 508a7f16 in the - # upstream mdadm repository. - if self.metadataVersion not in ["default", "1.1", "1.2"]: - headroom = 2.0 - else: - array_size = self.rawArraySize - # MDADM: We try to leave 0.1% at the start for reshape - # MDADM: operations, but limit this to 128Meg (0.1% of 10Gig) - # MDADM: which is plenty for efficient reshapes - # NOTE: In the mdadm code this is in 512b sectors. Converted to use MB - headroom = 128 - while headroom << 10 > array_size: - headroom >>= 1 - log.info("Using %sMB superBlockSize" % (headroom)) - return headroom + return mdraid.get_raid_superblock_size(self.rawArraySize, + version=self.metadataVersion)
@property def smallestMember(self):
Prior to this fix, you'd end up with a trailing underscore in the name. --- blivet/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py index 5da572c..cdb4bec 100644 --- a/blivet/__init__.py +++ b/blivet/__init__.py @@ -1302,7 +1302,7 @@ class Blivet(object): elif swap: body = "swap"
- if prefix: + if prefix and body: body = "_" + body
template = self.safeDeviceName(prefix + body)
Getting name=None is the same as not getting a name at all. --- blivet/__init__.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py index cdb4bec..c3e7d81 100644 --- a/blivet/__init__.py +++ b/blivet/__init__.py @@ -1015,8 +1015,8 @@ class Blivet(object): None), **kwargs.pop("fmt_args", {}))
- if kwargs.has_key("name"): - name = kwargs.pop("name") + name = kwargs.pop("name", None) + if name: safe_name = self.safeDeviceName(name) if safe_name != name: log.warning("using '%s' instead of specified name '%s'" @@ -1038,8 +1038,8 @@ class Blivet(object): if pv not in self.devices: raise ValueError("pv is not in the device tree")
- if kwargs.has_key("name"): - name = kwargs.pop("name") + name = kwargs.pop("name", None) + if name: safe_name = self.safeDeviceName(name) if safe_name != name: log.warning("using '%s' instead of specified name '%s'" @@ -1066,8 +1066,8 @@ class Blivet(object): mountpoint=mountpoint, **kwargs.pop("fmt_args", {}))
- if kwargs.has_key("name"): - name = kwargs.pop("name") + name = kwargs.pop("name", None) + if name: # make sure the specified name is sensible safe_vg_name = self.safeDeviceName(vg.name) full_name = "%s-%s" % (safe_vg_name, name)
--- blivet/devices.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/blivet/devices.py b/blivet/devices.py index afce027..a18dba7 100644 --- a/blivet/devices.py +++ b/blivet/devices.py @@ -2484,6 +2484,11 @@ class LVMLogicalVolumeDevice(DMDevice): size = property(StorageDevice._getSize, _setSize)
@property + def maxSize(self): + """ The maximum size this lv can be. """ + return min(self.format.maxSize, self.size + self.vg.freeSpace) + + @property def vgSpaceUsed(self): """ Space occupied by this LV, not including snapshots. """ return (self.vg.align(self.size, roundup=True) * self.stripes
Resolves: rhbz#910506 --- blivet/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py index c3e7d81..ddc9692 100644 --- a/blivet/__init__.py +++ b/blivet/__init__.py @@ -1599,7 +1599,7 @@ class Blivet(object): if self.bootloader: pkgs.update(self.bootloader.packages)
- for device in self.fsset.devices: + for device in self.mountpoints.values() + self.swaps: # this takes care of device and filesystem packages pkgs.update(device.packages)
On Fri, 2013-03-22 at 11:48 -0500, David Lehman wrote:
Just a few smaller/simpler patches someone might want to git am while I am gone. Or not. Either way.
These all look good to me. I'll git am them on Monday unless somebody beats me.
anaconda-patches@lists.fedorahosted.org