storage/v2: report aligned min size value
This commit is contained in:
parent
4d2d6455bf
commit
69b765efd5
|
@ -707,10 +707,12 @@ class Partition(_Formattable):
|
||||||
fs_data = self._m._probe_data.get('filesystem', {}).get(self._path())
|
fs_data = self._m._probe_data.get('filesystem', {}).get(self._path())
|
||||||
if fs_data is None:
|
if fs_data is None:
|
||||||
return -1
|
return -1
|
||||||
val = fs_data.get('ESTIMATED_MIN_SIZE')
|
val = fs_data.get('ESTIMATED_MIN_SIZE', -1)
|
||||||
if val == 0:
|
if val == 0:
|
||||||
return self.device.alignment_data().part_align
|
return self.device.alignment_data().part_align
|
||||||
return val
|
if val == -1:
|
||||||
|
return -1
|
||||||
|
return align_up(val, self.device.alignment_data().part_align)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ok_for_raid(self):
|
def ok_for_raid(self):
|
||||||
|
|
|
@ -936,14 +936,13 @@ class TestPartitionTableEditing(TestAPI):
|
||||||
|
|
||||||
@timeout()
|
@timeout()
|
||||||
async def test_est_min_size(self):
|
async def test_est_min_size(self):
|
||||||
# load config, edit size, use that for server
|
|
||||||
cfg = self.machineConfig('examples/win10-along-ubuntu.json')
|
cfg = self.machineConfig('examples/win10-along-ubuntu.json')
|
||||||
with cfg.edit() as data:
|
with cfg.edit() as data:
|
||||||
fs = data['storage']['filesystem']
|
fs = data['storage']['filesystem']
|
||||||
fs['/dev/sda1']['ESTIMATED_MIN_SIZE'] = 0
|
fs['/dev/sda1']['ESTIMATED_MIN_SIZE'] = 0
|
||||||
# data file has no sda2 in filesystem
|
# data file has no sda2 in filesystem
|
||||||
fs['/dev/sda3']['ESTIMATED_MIN_SIZE'] = -1
|
fs['/dev/sda3']['ESTIMATED_MIN_SIZE'] = -1
|
||||||
fs['/dev/sda4']['ESTIMATED_MIN_SIZE'] = 1 << 30
|
fs['/dev/sda4']['ESTIMATED_MIN_SIZE'] = (1 << 20) + 1
|
||||||
|
|
||||||
extra = ['--storage-version', '2']
|
extra = ['--storage-version', '2']
|
||||||
async with start_server(cfg, extra_args=extra) as inst:
|
async with start_server(cfg, extra_args=extra) as inst:
|
||||||
|
@ -952,7 +951,7 @@ class TestPartitionTableEditing(TestAPI):
|
||||||
[p1, _, p3, p4, _] = sda['partitions']
|
[p1, _, p3, p4, _] = sda['partitions']
|
||||||
self.assertEqual(1 << 20, p1['estimated_min_size'])
|
self.assertEqual(1 << 20, p1['estimated_min_size'])
|
||||||
self.assertEqual(-1, p3['estimated_min_size'])
|
self.assertEqual(-1, p3['estimated_min_size'])
|
||||||
self.assertEqual(1 << 30, p4['estimated_min_size'])
|
self.assertEqual(2 << 20, p4['estimated_min_size'])
|
||||||
|
|
||||||
|
|
||||||
class TestGap(TestAPI):
|
class TestGap(TestAPI):
|
||||||
|
|
Loading…
Reference in New Issue