A method for migrating virtual machines, comprising: Detecting, by a switch, whether a quantity of the virtual machines connected with a first virtual machine bearing server is less than a first threshold; when the quantity of the virtual machines is less than the first threshold, requesting, by the switch, a virtual machine management server to migrate the virtual machines connected with the first virtual machine bearing server to another virtual machine bearing server or other virtual machine bearing servers; wherein said detecting, by the switch, whether the quantity of the virtual machines connected with the first virtual machine bearing server is less than the first threshold comprises: detecting, by the switch, whether port traffic between the first virtual machine bearing server and the switch is less than a second threshold within a preset duration; when the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration, determining, by the switch, that the quantity of the virtual machines is less than the first threshold; and wherein said detecting, by the switch, whether the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration comprises: detecting, by the switch, an average value of the port traffic and a peak value of the port traffic; when the average value is less than the second threshold and the peak value is less than a preset multiple of the second threshold within the preset duration, determining, by the switch, that the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration. Detecting, by a switch, whether a quantity of the virtual machines connected with a first virtual machine bearing server is less than a first threshold; when the quantity of the virtual machines is less than the first threshold, requesting, by the switch, a virtual machine management server to migrate the virtual machines connected with the first virtual machine bearing server to another virtual machine bearing server or other virtual machine bearing servers; wherein said detecting, by the switch, whether the quantity of the virtual machines connected with the first virtual machine bearing server is less than the first threshold comprises: detecting, by the switch, whether port traffic between the first virtual machine bearing server and the switch is less than a second threshold within a preset duration; when the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration, determining, by the switch, that the quantity of the virtual machines is less than the first threshold; and wherein said detecting, by the switch, whether the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration comprises: detecting, by the switch, an average value of the port traffic and a peak value of the port traffic; when the average value is less than the second threshold and the peak value is less than a preset multiple of the second threshold within the preset duration, determining, by the switch, that the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration. detecting, by the switch, whether port traffic between the first virtual machine bearing server and the switch is less than a second threshold within a preset duration; when the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration, determining, by the switch, that the quantity of the virtual machines is less than the first threshold; and wherein said detecting, by the switch, whether the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration comprises: detecting, by the switch, an average value of the port traffic and a peak value of the port traffic; when the average value is less than the second threshold and the peak value is less than a preset multiple of the second threshold within the preset duration, determining, by the switch, that the port traffic between the first virtual machine bearing server and the switch is less than the second threshold within the preset duration.