In cloud computing, organizations can form the cooperation to share the available resource to reduce the cost. This is referred to as the multi-organization cloud computing environment. In this paper, we address the issues of virtual machine management and cooperation formation in such an environment. First, for the cooperative organizations, the optimization problem is formulated and solved for the optimal virtual machine allocation so that the total cost is minimized. Then, the cost management based on cooperative game theory is applied to obtain the fair share of the cost. Second, the cooperation formation among organizations is analyzed using the network game. With the dynamic cooperation formation, the stable cooperation structure is obtained. Both cooperative virtual machine management and cooperation formation are intertwined, in which the proposed optimization and game models can be used to obtain the solution of the rational organizations to minimize their own costs.