By using dynamic output feedback consensus protocols, consensus analysis, and design, problems for swarm systems with external disturbances and time-varying delays are dealt with. First, two subspaces, namely, a consensus subspace and a complement consensus subspace, are defined. Based on the state projection onto the two subspaces, L2-consensus and L2-consensualization problems are introduced. Then, a necessary and sufficient condition for consensus is presented and an explicit expression of the consensus function is given. Especially, it is shown that the time-varying delay does not influence the consensus function. Finally, in terms of linear matrix inequalities, sufficient conditions for L2-consensus and L2-consensualization are presented, respectively, which possess less calculation complexity, since they are independent of the number of agents, and numerical simulations are shown to demonstrate theoretical results.