Thermodynamic extension of density-functional theory. II. Finite-temperature ensemble spin-density functional theory