def resize(mountpoint, size):
 if (size == 'max'):
  if (not salt.utils.fsutils._is_device(mountpoint)):
   raise CommandExecutionError('Mountpoint "{0}" should be a valid device'.format(mountpoint))
  if (not salt.utils.fsutils._get_mounts('btrfs').get(mountpoint)):
   raise CommandExecutionError('Device "{0}" should be mounted'.format(mountpoint))
 elif ((len(size) < 3) or (size[0] not in '-+') or (size[(-1)] not in 'kKmMgGtTpPeE') or re.sub('\\d', '', size[1:][:(-1)])):
  raise CommandExecutionError('Unknown size: "{0}". Expected: [+/-]<newsize>[kKmMgGtTpPeE]|max'.format(size))
 out = __salt__['cmd.run_all']('btrfs filesystem resize {0} {1}'.format(size, mountpoint))
 salt.utils.fsutils._verify_run(out)
 ret = {'log': out['stdout']}
 ret.update(__salt__['btrfs.info'](mountpoint))
 return ret

def resize ( mountpoint , size ) : if ( size == 'max' ) : if ( not salt . utils . fsutils . _is_device ( mountpoint ) ) : raise CommandExecutionError ( 'Mountpoint "{0}" should be a valid device' . format ( mountpoint ) ) if ( not salt . utils . fsutils . _get_mounts ( 'btrfs' ) . get ( mountpoint ) ) : raise CommandExecutionError ( 'Device "{0}" should be mounted' . format ( mountpoint ) ) elif ( ( len ( size ) < 3 ) or ( size [ 0 ] not in '-+' ) or ( size [ ( - 1 ) ] not in 'kKmMgGtTpPeE' ) or re . sub ( '\\d' , '' , size [ 1 : ] [ : ( - 1 ) ] ) ) : raise CommandExecutionError ( 'Unknown size: "{0}". Expected: [+/-]<newsize>[kKmMgGtTpPeE]|max' . format ( size ) ) out = __salt__ [ 'cmd.run_all' ] ( 'btrfs filesystem resize {0} {1}' . format ( size , mountpoint ) ) salt . utils . fsutils . _verify_run ( out ) ret = { 'log' : out [ 'stdout' ] } ret . update ( __salt__ [ 'btrfs.info' ] ( mountpoint ) ) return ret
resize a given image file maintaining the aspect ratio .