pxe_base.py (ironic-17.0.2) | : | pxe_base.py (ironic-17.0.3) | ||
---|---|---|---|---|
skipping to change at line 401 | skipping to change at line 401 | |||
ramdisk and instance on the node. If invalid, raises an | ramdisk and instance on the node. If invalid, raises an | |||
exception; otherwise returns None. | exception; otherwise returns None. | |||
:param task: a task from TaskManager. | :param task: a task from TaskManager. | |||
:returns: None | :returns: None | |||
:raises: InvalidParameterValue, if some parameters are invalid. | :raises: InvalidParameterValue, if some parameters are invalid. | |||
:raises: MissingParameterValue, if some required parameters are | :raises: MissingParameterValue, if some required parameters are | |||
missing. | missing. | |||
""" | """ | |||
self._validate_common(task) | self._validate_common(task) | |||
node = task.node | ||||
# NOTE(TheJulia): If we're not writing an image, we can skip | # NOTE(TheJulia): If we're not writing an image, we can skip | |||
# the remainder of this method. | # the remainder of this method. | |||
if (not task.driver.storage.should_write_image(task)): | # NOTE(dtantsur): if we're are writing an image with local boot | |||
# the boot interface does not care about image parameters and | ||||
# must not validate them. | ||||
boot_option = deploy_utils.get_boot_option(node) | ||||
if (not task.driver.storage.should_write_image(task) | ||||
or boot_option == 'local'): | ||||
return | return | |||
node = task.node | ||||
d_info = deploy_utils.get_image_instance_info(node) | d_info = deploy_utils.get_image_instance_info(node) | |||
if (node.driver_internal_info.get('is_whole_disk_image') | if node.driver_internal_info.get('is_whole_disk_image'): | |||
or deploy_utils.get_boot_option(node) == 'local'): | ||||
props = [] | props = [] | |||
elif d_info.get('boot_iso'): | elif d_info.get('boot_iso'): | |||
props = ['boot_iso'] | props = ['boot_iso'] | |||
elif service_utils.is_glance_image(d_info['image_source']): | elif service_utils.is_glance_image(d_info['image_source']): | |||
props = ['kernel_id', 'ramdisk_id'] | props = ['kernel_id', 'ramdisk_id'] | |||
if deploy_utils.get_boot_option(node) == 'kickstart': | if boot_option == 'kickstart': | |||
props.append('squashfs_id') | props.append('squashfs_id') | |||
else: | else: | |||
props = ['kernel', 'ramdisk'] | props = ['kernel', 'ramdisk'] | |||
deploy_utils.validate_image_properties(task.context, d_info, props) | deploy_utils.validate_image_properties(task.context, d_info, props) | |||
@METRICS.timer('PXEBaseMixin.validate_rescue') | @METRICS.timer('PXEBaseMixin.validate_rescue') | |||
def validate_rescue(self, task): | def validate_rescue(self, task): | |||
"""Validate that the node has required properties for rescue. | """Validate that the node has required properties for rescue. | |||
:param task: a TaskManager instance with the node being checked | :param task: a TaskManager instance with the node being checked | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 9 lines changed or added |