def create(app, gear, quota_blocks=nil, quota_files=nil)
result = nil
(1..10).each do |i|
args = Hash.new
args['--with-app-uuid'] = app.uuid
args['--with-app-name'] = app.name
args['--with-container-uuid'] = gear.uuid
args['--with-container-name'] = gear.name
args['--with-quota-blocks'] = quota_blocks if quota_blocks
args['--with-quota-files'] = quota_files if quota_files
args['--with-namespace'] = app.domain.namespace
args['--with-uid'] = gear.uid if gear.uid
mcoll_reply = execute_direct(@@C_CONTROLLER, 'app-create', args)
result = parse_result(mcoll_reply)
if result.exitcode == 129 && has_uid_or_gid?(app.gear.uid)
destroy(app, gear, true)
inc_externally_reserved_uids_size
gear.uid = reserve_uid
app.save
else
break
end
end
result
end