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