Interconnection between gain spectrum and cavity mode in a quantum-dot vertical-cavity laser