Global simulation of the magnetosphere with a long tail: the formation and ejection of plasmoids.