|
|
94d765 |
From dc964f10d24499ea7fc90fd896a8b50c9c5e2d74 Mon Sep 17 00:00:00 2001
|
|
|
94d765 |
From: "Samantha N. Bueno" <sbueno+anaconda@redhat.com>
|
|
|
94d765 |
Date: Wed, 8 Jun 2016 13:47:40 -0400
|
|
|
94d765 |
Subject: [PATCH] Round down to nearest MiB value when writing ks parittion
|
|
|
94d765 |
info.
|
|
|
94d765 |
|
|
|
94d765 |
On s390x in particular, some partition alignment issue is causing fractional
|
|
|
94d765 |
sizes to be reported. Pykickstart doesn't take anything except int values for
|
|
|
94d765 |
partition info, hence the call to roundToNearest.
|
|
|
94d765 |
|
|
|
94d765 |
This change only affects the data that is written to ks.cfg.
|
|
|
94d765 |
|
|
|
94d765 |
Resolves: rhbz#1850670
|
|
|
94d765 |
---
|
|
|
94d765 |
blivet/devices/partition.py | 9 ++++++---
|
|
|
94d765 |
1 file changed, 6 insertions(+), 3 deletions(-)
|
|
|
94d765 |
|
|
|
94d765 |
diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
|
|
|
94d765 |
index 0c56a6e7..76048aed 100644
|
|
|
94d765 |
--- a/blivet/devices/partition.py
|
|
|
94d765 |
+++ b/blivet/devices/partition.py
|
|
|
94d765 |
@@ -35,7 +35,7 @@
|
|
|
94d765 |
from ..storage_log import log_method_call
|
|
|
94d765 |
from .. import udev
|
|
|
94d765 |
from ..formats import DeviceFormat, get_format
|
|
|
94d765 |
-from ..size import Size, MiB
|
|
|
94d765 |
+from ..size import Size, MiB, ROUND_DOWN
|
|
|
94d765 |
|
|
|
94d765 |
import logging
|
|
|
94d765 |
log = logging.getLogger("blivet")
|
|
|
94d765 |
@@ -967,7 +967,8 @@ def populate_ksdata(self, data):
|
|
|
94d765 |
data.resize = (self.exists and self.target_size and
|
|
|
94d765 |
self.target_size != self.current_size)
|
|
|
94d765 |
if not self.exists:
|
|
|
94d765 |
- data.size = self.req_base_size.convert_to(MiB)
|
|
|
94d765 |
+ # round this to nearest MiB before doing anything else
|
|
|
94d765 |
+ data.size = self.req_base_size.round_to_nearest(MiB, rounding=ROUND_DOWN).convert_to(spec=MiB)
|
|
|
94d765 |
data.grow = self.req_grow
|
|
|
94d765 |
if self.req_grow:
|
|
|
94d765 |
data.max_size_mb = self.req_max_size.convert_to(MiB)
|
|
|
94d765 |
@@ -980,4 +981,6 @@ def populate_ksdata(self, data):
|
|
|
94d765 |
data.on_part = self.name # by-id
|
|
|
94d765 |
|
|
|
94d765 |
if data.resize:
|
|
|
94d765 |
- data.size = self.size.convert_to(MiB)
|
|
|
94d765 |
+ # on s390x in particular, fractional sizes are reported, which
|
|
|
94d765 |
+ # cause issues when writing to ks.cfg
|
|
|
94d765 |
+ data.size = self.size.round_to_nearest(MiB, rounding=ROUND_DOWN).convert_to(spec=MiB)
|