Merge "Properly set ephemeral size in agent drivers"

This commit is contained in:
Jenkins 2016-06-22 18:53:26 +00:00 committed by Gerrit Code Review
commit d0382c9c71
4 changed files with 19 additions and 9 deletions

View File

@ -1123,7 +1123,9 @@ def parse_instance_info(node):
" in node's instance_info")
check_for_missing_params(i_info, error_msg)
i_info['swap_mb'] = int(info.get('swap_mb', 0))
# NOTE(vdrok): We're casting disk layout parameters to int only after
# ensuring that it is possible
i_info['swap_mb'] = info.get('swap_mb', 0)
i_info['ephemeral_gb'] = info.get('ephemeral_gb', 0)
err_msg_invalid = _("Cannot validate parameter for driver deploy. "
"Invalid parameter %(param)s. Reason: %(reason)s")
@ -1136,10 +1138,12 @@ def parse_instance_info(node):
{'param': param,
'reason': reason})
i_info['root_mb'] = 1024 * int(info.get('root_gb'))
i_info['root_mb'] = 1024 * int(i_info['root_gb'])
i_info['swap_mb'] = int(i_info['swap_mb'])
i_info['ephemeral_mb'] = 1024 * int(i_info['ephemeral_gb'])
if iwdi:
if int(i_info['swap_mb']) > 0 or int(i_info['ephemeral_gb']) > 0:
if i_info['swap_mb'] > 0 or i_info['ephemeral_mb'] > 0:
err_msg_invalid = _("Cannot deploy whole disk image with "
"swap or ephemeral size set")
raise exception.InvalidParameterValue(err_msg_invalid)

View File

@ -207,9 +207,9 @@ def get_deploy_info(node, address, iqn, port=None, lun='1'):
is_whole_disk_image = node.driver_internal_info['is_whole_disk_image']
if not is_whole_disk_image:
params.update({'root_mb': 1024 * int(i_info['root_gb']),
'swap_mb': int(i_info['swap_mb']),
'ephemeral_mb': 1024 * int(i_info['ephemeral_gb']),
params.update({'root_mb': i_info['root_mb'],
'swap_mb': i_info['swap_mb'],
'ephemeral_mb': i_info['ephemeral_mb'],
'preserve_ephemeral': i_info['preserve_ephemeral'],
'boot_option': deploy_utils.get_boot_option(node),
'boot_mode': _get_boot_mode(node)})

View File

@ -2125,6 +2125,7 @@ class InstanceInfoTestCase(db_base.DbTestCase):
def test_parse_instance_info_valid_ephemeral_gb(self):
ephemeral_gb = 10
ephemeral_mb = 1024 * ephemeral_gb
ephemeral_fmt = 'test-fmt'
info = dict(INST_INFO_DICT)
info['ephemeral_gb'] = ephemeral_gb
@ -2134,7 +2135,7 @@ class InstanceInfoTestCase(db_base.DbTestCase):
driver_internal_info=DRV_INTERNAL_INFO_DICT,
)
data = utils.parse_instance_info(node)
self.assertEqual(ephemeral_gb, data['ephemeral_gb'])
self.assertEqual(ephemeral_mb, data['ephemeral_mb'])
self.assertEqual(ephemeral_fmt, data['ephemeral_format'])
def test_parse_instance_info_unicode_swap_mb(self):
@ -2308,9 +2309,9 @@ class InstanceInfoTestCase(db_base.DbTestCase):
)
instance_info = utils.parse_instance_info(node)
self.assertIsNotNone(instance_info['image_source'])
self.assertIsNotNone(instance_info['root_gb'])
self.assertIsNotNone(instance_info['root_mb'])
self.assertEqual(0, instance_info['swap_mb'])
self.assertEqual(0, instance_info['ephemeral_gb'])
self.assertEqual(0, instance_info['ephemeral_mb'])
self.assertIsNone(instance_info['configdrive'])
def test_parse_instance_info_whole_disk_image_missing_root(self):

View File

@ -0,0 +1,5 @@
---
fixes:
- Fixed a bug where the ironic python agent ramdisk was not creating an
ephemeral partition because the ephemeral partition size was not being
passed correctly to the agent.