def resize_quota_delta(context, new_flavor, old_flavor, sense, compare):
 def _quota_delta(resource):
  return (sense * (new_flavor[resource] - old_flavor[resource]))
 deltas = {}
 if ((compare * _quota_delta('vcpus')) > 0):
  deltas['cores'] = _quota_delta('vcpus')
 if ((compare * _quota_delta('memory_mb')) > 0):
  deltas['ram'] = _quota_delta('memory_mb')
 return deltas

def resize_quota_delta ( context , new_flavor , old_flavor , sense , compare ) : def _quota_delta ( resource ) : return ( sense * ( new_flavor [ resource ] - old_flavor [ resource ] ) ) deltas = { } if ( ( compare * _quota_delta ( 'vcpus' ) ) > 0 ) : deltas [ 'cores' ] = _quota_delta ( 'vcpus' ) if ( ( compare * _quota_delta ( 'memory_mb' ) ) > 0 ) : deltas [ 'ram' ] = _quota_delta ( 'memory_mb' ) return deltas
calculate any quota adjustment required at a particular point in the resize cycle .