The invention discloses a migrating method and device for a
virtual machine, and partly solves the problem that the switch timing between a precopy and a post-copy in a
live migration hybrid-copy method is hard to determine. In some of the applicable embodiment of the invention, the
virtual machine migration method comprises the steps as follows: firstly,
copying the memory data of a target
virtual machine to be migrated on a source physical host to a target physical host in a circulatory iteration manner by adopting a precopy method; secondly, after each round of iteration copy is ended, calculating the changing rate of a
dirty page, wherein the changing rate of the
dirty page represents the rate of the number changing of the remaining
internal memory dirty page in a current round of iteration copy relative to the remaining
internal memory dirty page in a previous round of iteration copy; thirdly, judging whether the dirty page changing rate is within a dirty page changing rate threshold range or not; fourthly, counting the frequency that the dirty page changing rate is within the dirty page changing rate threshold range and judging whether the frequency is larger than or equal to the threshold value; finally, if the frequency is larger than or equal to the threshold value, adopting the post-copy method for migrating the target virtual
machine to the target physical host.