It should be "not to rest". "until he had qualified" is used because qualification happened before resting, and both are now in the past. It is the past version of "until he has qualified".
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.