Irreversibility and metastability in spin-glasses. I. Ising model