Merge "Fix actual size calculation for storage fallback logic" into stable/2024.2
This commit is contained in:
commit
ffeadb2282
@ -492,7 +492,7 @@ def converted_size(path, estimate=False):
|
|||||||
if not estimate:
|
if not estimate:
|
||||||
return data.virtual_size
|
return data.virtual_size
|
||||||
growth_factor = CONF.raw_image_growth_factor
|
growth_factor = CONF.raw_image_growth_factor
|
||||||
return int(min(data.disk_size * growth_factor, data.virtual_size))
|
return int(min(data.actual_size * growth_factor, data.virtual_size))
|
||||||
|
|
||||||
|
|
||||||
def get_image_properties(context, image_href, properties="all"):
|
def get_image_properties(context, image_href, properties="all"):
|
||||||
|
@ -373,7 +373,7 @@ class IronicImagesTestCase(base.TestCase):
|
|||||||
autospec=True)
|
autospec=True)
|
||||||
def test_converted_size_estimate_default(self, image_info_mock):
|
def test_converted_size_estimate_default(self, image_info_mock):
|
||||||
info = self.FakeImgInfo()
|
info = self.FakeImgInfo()
|
||||||
info.disk_size = 2
|
info.actual_size = 2
|
||||||
info.virtual_size = 10 ** 10
|
info.virtual_size = 10 ** 10
|
||||||
image_info_mock.return_value = info
|
image_info_mock.return_value = info
|
||||||
size = images.converted_size('path', estimate=True)
|
size = images.converted_size('path', estimate=True)
|
||||||
@ -385,7 +385,7 @@ class IronicImagesTestCase(base.TestCase):
|
|||||||
def test_converted_size_estimate_custom(self, image_info_mock):
|
def test_converted_size_estimate_custom(self, image_info_mock):
|
||||||
CONF.set_override('raw_image_growth_factor', 3)
|
CONF.set_override('raw_image_growth_factor', 3)
|
||||||
info = self.FakeImgInfo()
|
info = self.FakeImgInfo()
|
||||||
info.disk_size = 2
|
info.actual_size = 2
|
||||||
info.virtual_size = 10 ** 10
|
info.virtual_size = 10 ** 10
|
||||||
image_info_mock.return_value = info
|
image_info_mock.return_value = info
|
||||||
size = images.converted_size('path', estimate=True)
|
size = images.converted_size('path', estimate=True)
|
||||||
@ -397,7 +397,7 @@ class IronicImagesTestCase(base.TestCase):
|
|||||||
def test_converted_size_estimate_raw_smaller(self, image_info_mock):
|
def test_converted_size_estimate_raw_smaller(self, image_info_mock):
|
||||||
CONF.set_override('raw_image_growth_factor', 3)
|
CONF.set_override('raw_image_growth_factor', 3)
|
||||||
info = self.FakeImgInfo()
|
info = self.FakeImgInfo()
|
||||||
info.disk_size = 2
|
info.actual_size = 2
|
||||||
info.virtual_size = 5
|
info.virtual_size = 5
|
||||||
image_info_mock.return_value = info
|
image_info_mock.return_value = info
|
||||||
size = images.converted_size('path', estimate=True)
|
size = images.converted_size('path', estimate=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user