Make proliantutils return 1 size less than actual disk size

Return disk size 1 less than the actual disk size. This prevents
the deploy to fail from Nova when root_gb is same as local_gb
in Ironic. When the disk size is used as root_device hints,
then it should be given as the actual size i.e.
ironic (node.properties['local_gb'] + 1) else deploy via
root device hint will fail.

Closes bug: 1492921
Change-Id: Ifbad87c08307bc12118dd8b01ad0114cf9ff7583
This commit is contained in:
Nisha Agarwal
2015-09-09 03:11:06 -07:00
parent 57a40be4a1
commit bd582e7400
2 changed files with 12 additions and 3 deletions

View File

@@ -847,6 +847,15 @@ class RIBCLOperations(operations.IloOperations):
local_gb = int(local_bytes / (1024 * 1024 * 1024))
if minimum >= local_gb or minimum == 0:
minimum = local_gb
# Return disk size 1 less than the actual disk size. This prevents
# the deploy to fail from Nova when root_gb is same as local_gb
# in Ironic. When the disk size is used as root_device hints,
# then it should be given as the actual size i.e.
# ironic (node.properties['local_gb'] + 1) else root device
# hint will fail.
if minimum:
minimum = minimum - 1
return minimum
def get_value_as_list(self, dictionary, key):

View File

@@ -513,14 +513,14 @@ class IloRibclTestCase(unittest.TestCase):
json_data = json.loads(data)
local_gb = self.ilo._parse_storage_embedded_health(json_data)
self.assertTrue(type(local_gb), int)
self.assertEqual("99", str(local_gb))
self.assertEqual("98", str(local_gb))
def test__parse_storage_embedded_health_controller_list(self):
data = constants.GET_EMBEDDED_HEALTH_OUTPUT_LIST_STORAGE
json_data = json.loads(data)
local_gb = self.ilo._parse_storage_embedded_health(json_data)
self.assertTrue(type(local_gb), int)
self.assertEqual("99", str(local_gb))
self.assertEqual("98", str(local_gb))
def test__parse_storage_embedded_health_no_logical_drive(self):
data = constants.GET_EMBEDDED_HEALTH_OUTPUT_NO_LOGICAL_DRIVE
@@ -579,7 +579,7 @@ class IloRibclTestCase(unittest.TestCase):
'properties': {
'memory_mb': 32768,
'cpu_arch': 'x86_64',
'local_gb': 99,
'local_gb': 98,
'cpus': 2}
}
properties = self.ilo.get_essential_properties()