def is_image_extendable(image):
 LOG.debug('Checking if we can extend filesystem inside %(image)s.', {'image': image})
 if ((not isinstance(image, imgmodel.LocalImage)) or (image.format != imgmodel.FORMAT_RAW)):
  fs = None
  try:
   fs = vfs.VFS.instance_for_image(image, None)
   fs.setup(mount=False)
   if (fs.get_image_fs() in SUPPORTED_FS_TO_EXTEND):
    return True
  except exception.NovaException as e:
   LOG.warning(_LW('Unable to mount image %(image)s with error %(error)s. Cannot resize.'), {'image': image, 'error': e})
  finally:
   if (fs is not None):
    fs.teardown()
  return False
 else:
  try:
   utils.execute('e2label', image.path)
  except processutils.ProcessExecutionError as e:
   LOG.debug('Unable to determine label for image %(image)s with error %(error)s. Cannot resize.', {'image': image, 'error': e})
   return False
 return True

def is_image_extendable ( image ) : LOG . debug ( 'Checking if we can extend filesystem inside %(image)s.' , { 'image' : image } ) if ( ( not isinstance ( image , imgmodel . LocalImage ) ) or ( image . format != imgmodel . FORMAT_RAW ) ) : fs = None try : fs = vfs . VFS . instance_for_image ( image , None ) fs . setup ( mount = False ) if ( fs . get_image_fs ( ) in SUPPORTED_FS_TO_EXTEND ) : return True except exception . NovaException as e : LOG . warning ( _LW ( 'Unable to mount image %(image)s with error %(error)s. Cannot resize.' ) , { 'image' : image , 'error' : e } ) finally : if ( fs is not None ) : fs . teardown ( ) return False else : try : utils . execute ( 'e2label' , image . path ) except processutils . ProcessExecutionError as e : LOG . debug ( 'Unable to determine label for image %(image)s with error %(error)s. Cannot resize.' , { 'image' : image , 'error' : e } ) return False return True
check whether we can extend the image .