code for stop vm - part 1.