#NEWLINE# def check_image_size( task ) : #NEWLINE# #INDENT# 'Check if the requested image is larger than the root partition size.\n\n    :param task: a TaskManager instance containing the node to act on.\n    :raises: InstanceDeployFailure if size of the image is greater than root\n        partition.\n    ' #NEWLINE# i_info = deploy_utils . parse_instance_info ( task . node ) #NEWLINE# image_path = _get_image_file_path ( task . node . uuid ) #NEWLINE# image_mb = disk_utils . get_image_mb ( image_path ) #NEWLINE# root_mb = ( 1024 * int ( i_info [ 'root_gb' ] ) ) #NEWLINE# if ( image_mb > root_mb ) : #NEWLINE# #INDENT# msg = ( _ ( 'Root partition is too small for requested image. Image virtual size: %(image_mb)d MB, Root size: %(root_mb)d MB' ) % { #NEWLINE# #INDENT# 'image_mb' : task , #NEWLINE# 'root_mb' : root_mb , #NEWLINE# #UNINDENT# } ) #NEWLINE# raise exception . InstanceDeployFailure ( msg )