Virtual machine migration method, device and electronic equipment
By dynamically adjusting migration strategies based on link bandwidth and utilization, the problem of migration failures during virtual machine hot migration was solved, achieving a more efficient migration success rate.
Patent Information
- Application Number
- CN202411329607.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2044-09-23
AI Technical Summary
Existing technologies cannot dynamically adapt migration strategies based on network bandwidth and bandwidth utilization during virtual machine hot migration, leading to migration failure.
By detecting link bandwidth and bandwidth utilization before migration, the migration strategy is dynamically adjusted, including disabling memory copying and active CPU frequency reduction, to adapt to changes in network status. The strategy of memory copying before migration and active CPU frequency reduction is adopted.
This improves the success rate of virtual machine migration and avoids failures caused by incompatible migration strategies.
Smart Images

Figure CN119225906B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of virtual machine technology, and in particular to virtual machine migration methods, apparatus and electronic devices. Background Technology
[0002] Because virtual machine hot migration allows virtual machines to continue operating normally and services to remain uninterrupted during the migration process, it has become a research hotspot. There are two main methods for hot migration of virtual machines: memory precopy and memory postcopy.
[0003] Currently, virtual machine hot migration is performed by default using a specified method, such as memory pre-copying. However, this default specified method is fixed and cannot cope with migration situations where network conditions change. For example, it cannot dynamically adapt the migration strategy based on network bandwidth and bandwidth utilization, which will cause the virtual machine migration to fail due to the incompatibility of the migration strategy. Summary of the Invention
[0004] In view of this, embodiments of this application provide virtual machine migration methods, apparatuses, and electronic devices to dynamically adapt migration strategies based on network bandwidth and bandwidth utilization, thereby avoiding virtual machine migration failures caused by incompatible migration strategies.
[0005] This application provides a virtual machine migration method, which is applied to a network device used to manage multiple hosts within a local area network; the method includes:
[0006] Before migrating a virtual machine from the first host to the second host, if the bandwidth allocated to the link for migrating the virtual machine from the first host to the second host is less than the set bandwidth lower limit, a first migration strategy matching the bandwidth is output to migrate the virtual machine according to the first migration strategy; the first migration strategy is used to indicate the strategy of copying after closing memory and enabling active CPU downclocking.
[0007] If the bandwidth is greater than or equal to the lower bandwidth limit, then:
[0008] When the current bandwidth utilization of the link is greater than or equal to the set bandwidth utilization limit, an indication is output, which is used to indicate that the virtual machine is prohibited from migrating from the first host to the second host;
[0009] when the bandwidth utilization is between the bandwidth utilization upper limit and a set bandwidth utilization lower limit, if the bandwidth utilization meets one of requirements of the set CPU active frequency reduction, outputting a first migration strategy matched with the bandwidth utilization, to migrate the virtual machine according to the first migration strategy; if the bandwidth utilization does not meet the set CPU active frequency reduction, outputting a second migration strategy matched with the bandwidth utilization, to migrate the virtual machine according to the second migration strategy; the second migration strategy is used to indicate a strategy of closing memory post-copy and closing CPU active frequency reduction.
[0010] The embodiment of the present application further provides a virtual machine migration device, which is applied to a network equipment, and the network equipment is used for managing a plurality of hosts in a local area network; the device comprises:
[0011] The checking module, the first executing module is used for, before the virtual machine is migrated from a current first host to a second host, if bandwidth allocated to a link through which the virtual machine is migrated from the first host to the second host is less than a set bandwidth lower limit value, outputting a first migration strategy matched with the bandwidth, to migrate the virtual machine according to the first migration strategy; the first migration strategy is used to indicate a strategy of closing memory post-copy and opening CPU active frequency reduction;
[0012] The second executing module is used for, if the bandwidth is greater than or equal to the bandwidth lower limit value, then:
[0013] When the current bandwidth utilization of the link is greater than or equal to a set bandwidth utilization upper limit, outputting an indication, and the indication is used to indicate that the virtual machine is prohibited from being migrated from the first host to the second host;
[0014] when the bandwidth utilization is between the bandwidth utilization upper limit and a set bandwidth utilization lower limit, if the bandwidth utilization meets one of requirements of the set CPU active frequency reduction, outputting a first migration strategy matched with the bandwidth utilization, to migrate the virtual machine according to the first migration strategy; if the bandwidth utilization does not meet the set CPU active frequency reduction, outputting a second migration strategy matched with the bandwidth utilization, to migrate the virtual machine according to the second migration strategy; the second migration strategy is used to indicate a strategy of closing memory post-copy and closing CPU active frequency reduction.
[0015] The embodiment of the present application further provides an electronic device, comprising a processor and a memory used for storing computer program instructions, and the computer program instructions are used for enabling the processor to execute steps of the above method when the computer program instructions are run by the processor.
[0016] The embodiment of the present application further provides a machine readable storage medium, which stores computer program instructions, and when the computer program instructions are executed, the steps of the method described above can be implemented.
[0017] From the above technical solution, it can be seen that in the embodiment, when the virtual machine is migrated, the migration is no longer performed in the default specified manner, but whether to migrate is determined according to the bandwidth allocated to the link through which the virtual machine is migrated and the bandwidth utilization, and when the migration is determined, the matching migration strategy is dynamically adapted. This method of dynamically adapting the migration strategy based on the link state can perform the migration of the virtual machine in the most appropriate manner, which effectively avoids the risks that may exist in the virtual hot migration process and improves the success rate of the virtual machine migration. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 A schematic diagram of a virtual machine migration scenario provided by the embodiment of the present application is shown in the figure.
[0019] Figure 2 A flowchart of the method provided by the embodiment of the present application is shown in the figure.
[0020] Figure 3 A flowchart of another method provided by the embodiment of the present application is shown in the figure.
[0021] Figure 4 A structural schematic diagram of the device provided by the embodiment of the present application is shown in the figure.
[0022] Figure 5 A structural schematic diagram of the electronic device provided by the embodiment of the present application is shown in the figure. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, and to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application will be further described in detail below with reference to the drawings.
[0024] In order to facilitate understanding of the present solution, before describing the present solution, the technical problems existing in the prior art will be described in detail:
[0025] The migration of the virtual machine is divided into cold migration (also known as static migration) and hot migration (also known as online migration). Among them, the cold migration needs to first shut down the virtual machine of the source host, then migrate the memory data and other configuration files of the virtual machine to the destination host for storage, and finally restart the virtual machine on the destination host.
[0026] Hot migration is a process of migrating a virtual machine from one host (source host) to another host (destination host) while the virtual machine is running normally. Since the virtual machine is still running during the migration process, the memory data of the virtual machine needs to be properly handled to ensure the normal operation of the virtual machine and the uninterrupted service. The hot migration of the virtual machine mainly includes two modes: memory pre-copy mode and memory post-copy mode.
[0027] The memory pre-copy mode refers to copying memory data and other configuration information, and then recycling the dirty pages, and the virtual machine is still running in the source host during the migration. Here, the dirty page refers to the memory data modified by the virtual machine running in the destination host in each round of copying process.
[0028] The memory post-copy mode refers to copying other configuration information in advance, copying necessary information to the destination host, and then running the virtual machine. When the destination virtual machine runs and calls the memory data that has not been transmitted from the source host, a page fault exception (the page corresponding to the page fault is a dirty page) is triggered, and then the source host copies the required memory page to the target host.
[0029] Currently, the default migration mode is used when performing hot migration of the virtual machine, such as the default pre-copy mode or the default post-copy mode. However, the default migration mode is fixed, and it cannot adapt to the migration situation of network state changes, such as the dynamic adaptation of the migration strategy based on network bandwidth and bandwidth utilization, which will cause the failure of the virtual machine migration due to the inadaptation of the migration strategy.
[0030] Therefore, in order to solve the above problems, the embodiments of the present application provide a virtual machine migration method, device and electronic equipment.
[0031] In order to facilitate the understanding of the method, before describing the method, the virtual machine migration scenario provided by the embodiments of the present application is described:
[0032] Referring to Figure 1 , Figure 1 The schematic diagram of the virtual machine migration scenario provided by the present application is shown in FIG. 1. As shown in FIG. 1, the virtual machine migration scenario provided by the present application includes a source host 101, a destination host 102, a network 103, and a virtual machine 104. Figure 1As shown, the migration scenario generally involves a first host, a second host, and a network device. Optionally, the network device can be a master platform. The network device is used to manage a plurality of hosts in a local area network, i.e., the network device manages the plurality of hosts including the first host and the second host. When a user determines that a virtual machine needs to be migrated from the first host to the second host by interacting with the network device, the network device performs the method provided in the embodiments below to cooperate with the first host and the second host to perform an appropriate migration strategy to achieve migration of the virtual machine from the first host to the second host.
[0033] The method provided in the embodiments of the present application is described below in combination with Figure 1 the virtual machine migration scenario shown in the figure:
[0034] Referring to Figure 2 , Figure 2 a flowchart of the method provided in the embodiments of the present application. As shown in the figure, the flowchart can include the following steps: Figure 2
[0035] S201, before the virtual machine is migrated from the current first host to the second host, if the bandwidth allocated to the link through which the virtual machine is migrated from the first host to the second host is less than a set bandwidth lower limit value, output a first migration strategy matched with the bandwidth to migrate the virtual machine according to the first migration strategy, and the first migration strategy is used to indicate a strategy of closing memory post-copy and starting CPU active frequency reduction.
[0036] In the embodiment, the link is obtained in many ways in specific implementation, for example, as an embodiment, a dedicated network link for virtual machine migration is searched for in at least one network link configured between the first host and the second host, if found, the dedicated network link is determined as the link. If not found, a management network link between the first host and the second host is determined as the link. Here, the management network link is a network link between the first host and the second host when the network device manages the first host and the second host.
[0037] It should be noted that the minimum requirement of the link through which the virtual machine is migrated from the first host to the second host is that the link is available, that is, the current remaining bandwidth cannot be 0. The link determined by the above method does not exist the case that the current available bandwidth is 0, which can meet this requirement.
[0038] In the embodiment, the bandwidth lower limit value is set according to specific scenarios, which can be 10 GB / s, and the embodiments of the present application do not specifically limit it.
[0039] In the embodiment, the first migration strategy refers to a strategy that requires memory pre-copy and CPU active frequency reduction when the virtual machine is migrated from the first host to the second host. Since memory post-copy requires higher link transmission requirement due to frequent userfault calling compared to memory pre-copy, when the bandwidth allocated to the link is less than the set lower limit of the bandwidth, memory post-copy needs to be closed, that is, the memory pre-copy mode is adopted.
[0040] The purpose of CPU active frequency reduction is to reduce the efficiency of the CPU of the virtual machine to adapt to the current link situation. Here, it has been determined to adopt memory pre-copy, and the purpose of starting CPU active frequency reduction is to reduce the scheduling frequency of the CPU of the virtual machine in the first host in the memory pre-copy process to reduce the generation of dirty pages and improve the migration speed.
[0041] S202, if the bandwidth is greater than or equal to the lower limit of the bandwidth, the following steps S203 to S204 are executed.
[0042] S203, when the current bandwidth utilization of the link is greater than or equal to the set upper limit of the bandwidth utilization, an output is outputted to indicate that the virtual machine is prohibited from migrating from the first host to the second host.
[0043] S204, when the bandwidth utilization is between the upper limit of the bandwidth utilization and the set lower limit of the bandwidth utilization, if the bandwidth utilization meets one of the set requirements of CPU active frequency reduction, the first migration strategy matched with the bandwidth utilization is outputted to migrate the virtual machine according to the first migration strategy; if the bandwidth utilization does not meet the set CPU active frequency reduction, the second migration strategy matched with the bandwidth utilization is outputted to migrate the virtual machine according to the second migration strategy; the second migration strategy refers to a strategy that requires closing memory post-copy and closing CPU active frequency reduction.
[0044] In the embodiment, the second migration strategy refers to a strategy that adopts memory pre-copy and does not adopt CPU active frequency reduction.
[0045] In the embodiment, there are many ways to obtain the bandwidth utilization in specific implementation, for example, as an embodiment, the bandwidth utilization is obtained by the following method: obtaining the average output traffic and the average input traffic of the interface of the local connection link of the first host within a specified checking period; the average output traffic is sent to the second host according to the IP address of the second host; the average input traffic is received from the second host according to the IP address of the second host. According to the average output traffic, the average input traffic and the bandwidth allocated to the link, the bandwidth utilization is determined.
[0046] Specifically, in one implementation, the nload tool installed on the first host is used to check the traffic parameters of the interface of the local connection link of the first host, by executing the command: nload ethx<the IP address of the second host>-a 15-m. The traffic parameters include the current traffic, average traffic, minimum traffic, maximum traffic, and total traffic of the input and output of the interface. Thus, the average output traffic and average input traffic of the interface in the specified checking period can be obtained by counting these parameters.
[0047] In one implementation, the bandwidth utilization is calculated by the following formula:
[0048] Bandwidth utilization=(average output traffic+average input traffic) / bandwidth allocated to the link.
[0049] Thus, after determining the link, the higher the average output traffic and average input traffic, the higher the bandwidth utilization, and vice versa.
[0050] In this embodiment, the upper limit of the bandwidth utilization and the lower limit of the bandwidth utilization can be set according to specific scenarios, such as the upper limit of the bandwidth utilization being 70% and the lower limit of the bandwidth utilization being 30%, and the present embodiment does not specifically limit this.
[0051] In this embodiment, the purpose of the CPU active frequency reduction is to reduce the efficiency of the CPU of the virtual machine to reduce the frequency of dirty pages or page faults to adapt to the current link situation, and thus the CPU active frequency reduction is closely related to the bandwidth utilization. As an example, the requirement of the CPU active frequency reduction is embodied by the set bandwidth utilization range, such as the requirement of the CPU active frequency reduction being that the bandwidth utilization range is greater than or equal to 50% and less than 70%. The bandwidth utilization meeting one of the set requirements of the CPU active frequency reduction means that the bandwidth utilization is between [50%, 70%).
[0052] Further, if the upper limit of the bandwidth utilization is 70% and the lower limit of the bandwidth utilization is 30%, the requirement of the CPU active frequency reduction is set to be the bandwidth utilization range [50%, 70%]. When the current bandwidth utilization is [50%, 70%), the memory post-copy needs to be closed and the CPU active frequency reduction needs to be started. When the current bandwidth utilization is [30%, 50%), the memory post-copy needs to be closed and the CPU active frequency reduction needs to be stopped.
[0053] The specific implementation of the above steps S201 to S204 will be described in more detail in the form of specific embodiments hereinafter, which will not be described here.
[0054] Thus far, the completion Figure 1 of the flowchart shown.
[0055] ByFigure 1 As can be seen from the flow, in the embodiment, when the virtual machine is migrated, instead of migrating by default in the specified manner, whether to migrate is determined according to the bandwidth allocated to the link through which the virtual machine is migrated and the bandwidth utilization, and when it is determined to migrate, a matching migration strategy is dynamically adapted. This method of dynamically adapting the migration strategy based on the link state can migrate the virtual machine in the most appropriate manner, effectively avoiding the risks that may exist in the virtual hot migration process and improving the success rate of virtual machine migration.
[0056] Further, as an embodiment, the method provided by the embodiment of the application further includes: when the bandwidth utilization is less than the lower limit of the bandwidth utilization, obtaining network delay information and packet loss information between the first host and the second host. Whether to migrate the virtual machine is determined according to the network delay information and the packet loss information. When it is determined to migrate the virtual machine, a third migration strategy matching the network delay information and the packet loss information is output, and the virtual machine is migrated according to the third migration strategy.
[0057] In the embodiment, there are many ways to obtain the network delay information and the packet loss information in specific implementation. For example, as an embodiment, the network delay information and the packet loss information are obtained by the following manner: the first host sends a plurality of test data packets to the second host through the link every set time interval. The network delay information and the packet loss information are determined according to the response of the second host to each test data packet.
[0058] Specifically, in an implementation, the ping tool set on the first host executes the instruction: ping-c<times>-s<test data packet size><IP address of the second host> to check the packet loss rate and a plurality of delay indicators of the link through which the virtual machine is migrated. The plurality of delay indicators at least include a minimum delay value, an average delay value, a maximum delay value, and a delay standard deviation.
[0059] In the embodiment, whether to migrate the virtual machine and determining the third migration strategy matching the packet loss rate and the plurality of delay indicators are implemented by the following manner:
[0060] As an embodiment, when the packet loss rate is greater than or equal to a set upper limit value of the packet loss rate, the virtual machine is not migrated. In the embodiment, when the packet loss rate is greater than or equal to the set upper limit value of the packet loss rate, the packet loss rate of the link is too large, at this time, a prompt "The packet loss rate of the link through which the virtual machine is migrated is too high, please do not migrate the virtual machine to the second host" should be given.
[0061] As an embodiment, when the packet loss rate is between the set packet loss rate upper limit value and the set packet loss rate lower limit value, the third migration strategy is the first migration strategy described above. That is, in this embodiment, when the packet loss rate is between the set packet loss rate upper limit value and the set packet loss rate lower limit value, it indicates that the link network state is insufficient to support the requirement of the memory post-copy on the link, and therefore, the virtual machine is migrated in the manner of memory pre-copy and CPU active frequency reduction.
[0062] As an embodiment, when the packet loss rate is less than the set packet loss rate lower limit value, it is divided into the following three cases:
[0063] The first case: when each delay indicator in the plurality of delay indicators is less than the set delay indicator lower limit value corresponding to the delay indicator, the third migration strategy is used to indicate the strategy of opening the memory post-copy and closing the active CPU frequency reduction.
[0064] At this time, the third migration strategy refers to the strategy of using the post-storage pre-copy and not using the CPU active frequency reduction.
[0065] The second case: when each delay indicator in the plurality of delay indicators is greater than or equal to the set delay indicator lower limit value corresponding to the delay indicator and less than the set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is used to indicate the strategy of opening the memory post-copy and opening the active CPU frequency reduction.
[0066] The third case: when there is a delay indicator in the plurality of delay indicators that is greater than or equal to the set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is the second migration strategy described above.
[0067] At this time, the second migration strategy refers to the strategy of using the memory pre-copy and not using the CPU active frequency reduction.
[0068] In this embodiment, the packet loss rate upper limit value, the packet loss rate lower limit value, and the delay indicator upper limit value and the delay indicator lower limit value corresponding to each delay indicator can be set according to specific conditions, and the embodiments of the present application are not specifically limited.
[0069] In order to more specifically describe the method provided by the present application, the following will be described in combination with Figure 3 The scheme provided by the present application is described in more detail in the manner of specific embodiments.
[0070] In this embodiment, the bandwidth lower limit value is 10 GB / s, the bandwidth utilization upper limit is 70%, the bandwidth utilization lower limit is 30%, and the requirement for CPU active frequency reduction is set to be the bandwidth utilization range of [50%, 70%),
[0071] The packet loss rate upper limit value is 5%, and the packet loss rate lower limit value is 1%,
[0072] The upper limit of the delay minimum value is 0.15 ms, and the lower limit of the delay minimum value is 0.12 ms,
[0073] The upper limit of the delay average value is 0.2 ms, and the lower limit of the delay average value is 0.15 ms,
[0074] The upper limit of the delay maximum value is 0.35 ms, and the lower limit of the delay maximum value is 0.3 ms,
[0075] The upper limit of the delay standard deviation is 0.1 ms, and the lower limit of the delay standard deviation is 0.05 ms.
[0076] The method comprises the following steps:
[0077] 1. The master control platform obtains the IP address of the second host as the migration destination through the user's selection, determines the link of the migrated virtual machine according to the IP address of the second host, and issues the IP address of the second host to the first host.
[0078] 2. After the first host obtains the second IP address, the instruction nload ethx<the IP address of the second host>-a 15 –m is executed, and the average output traffic and the average input traffic of the interface of the local connection link of the host in the specified inspection period are obtained by waiting for the command execution result, and the current bandwidth utilization is calculated through the following formula.
[0079] Bandwidth utilization = (average output traffic + average input traffic) / bandwidth allocated to the link.
[0080] In this step, the instruction nload ethx<the IP address of the second host>-a 15 –m is executed, wherein the length of the specified inspection period is 15 s.
[0081] 3. The ping tool on the first host executes the instruction: ping -c<the number of times>-s<the size of the test data packet><the IP address of the second host>, controls the first host to send multiple test data packets through the link to the second host at a set time interval, and checks the packet loss rate, the delay minimum value, the delay average value, the delay maximum value, and the delay standard deviation of the link of the migrated virtual machine according to the response of the second host to each test data packet.
[0082] In this step, the instruction ping -c<the number of times>-s<the size of the test data packet><the IP address of the second host> is executed, the number of -c parameters is 50 by default, and the size of -s parameter is 64 bytes by default, that is, 50 test data packets of 64 bytes are sent by the first host in 1 s.
[0083] 4. The master control platform determines whether to migrate and the migration strategy when migration is determined according to the bandwidth, bandwidth utilization, packet loss rate, minimum delay, average delay, maximum delay, and standard deviation of the delay of the link.
[0084] Specifically, as shown in Figure 3 the following cases are included:
[0085] (1) If the bandwidth allocated to the link through which the virtual machine migrates from the first host to the second host is less than 10 GB / s, the strategy of turning off "memory post-copy" and turning on "CPU active frequency reduction" is output.
[0086] (2) If the bandwidth is greater than or equal to 10 GB / s and the current bandwidth utilization of the link is greater than or equal to 70%, an instruction to "prohibit migration of the virtual machine from the first host to the second host" is output.
[0087] (3) If the bandwidth is greater than or equal to 10 GB / s and the current bandwidth utilization of the link is greater than or equal to 50% and less than 70%, the strategy of turning off "memory post-copy" and turning on "active CPU frequency reduction" is output.
[0088] (4) If the bandwidth is greater than or equal to 10 GB / s and the current bandwidth utilization of the link is greater than or equal to 30% and less than 50%, the strategy of turning off "memory post-copy" and turning off "active CPU frequency reduction" is output.
[0089] (5) If the bandwidth is greater than or equal to 10 GB / s and the bandwidth utilization is less than 30%, the following cases exist:
[0090] 1) If the packet loss rate is greater than or equal to 5%, an instruction to "prohibit migration of the virtual machine from the first host to the second host" is output.
[0091] 2) If the packet loss rate is greater than or equal to 1% and less than 5% (not included), the strategy of turning off "memory post-copy" and turning on "active CPU frequency reduction" is output.
[0092] 3) If the packet loss rate is less than 1% and the following conditions are all met: the minimum delay is less than or equal to 0.12 ms, the average delay is less than or equal to 0.15 ms, the maximum delay is less than or equal to 0.30 ms, and the standard deviation of the delay is less than or equal to 0.05 ms, the strategy of turning on "memory post-copy" and turning off "active CPU frequency reduction" is output.
[0093] 4) If the packet loss rate is less than 1%, and all of the following conditions are met: the minimum latency is in the range of (0.12ms-0.15ms), the average latency is in the range of (0.15ms-0.2ms), the maximum latency is in the range of (0.30ms-0.35ms), and the standard deviation of latency is in the range of (0.15ms-0.1ms), then the output will enable the strategy of "memory copy" and "active CPU downclocking".
[0094] 5) If the packet loss rate is less than 1%, and at least one of the following conditions is met: minimum latency is greater than or equal to 0.15ms, average latency is greater than or equal to 0.2ms, maximum latency is greater than or equal to 0.35ms, and standard deviation of latency is greater than or equal to 0.1ms, then output the strategy of disabling "memory copy" and "active CPU downclocking".
[0095] In this embodiment, when the main control platform issues a "prohibit virtual machine migration from the first host to the second host" message, virtual machine migration is not performed. After the main control platform outputs the corresponding migration policy, the first host and the second host migrate the virtual machine according to the migration policy, thereby realizing the migration of the virtual machine from the first host to the second host.
[0096] The methods provided in the embodiments of this application have been described above. The apparatus provided in the embodiments of this application is described below:
[0097] See Figure 4 , Figure 4 This is a structural diagram of the device provided in an embodiment of this application. Figure 4 As shown, the device is applied to a network device for managing multiple hosts within a local area network; the device includes: a first execution module 401 and a second execution module 402.
[0098] The first execution module 401 is used to output a first migration strategy that matches the bandwidth before the virtual machine is migrated from the current first host to the second host. If the bandwidth allocated to the link for the virtual machine to migrate from the first host to the second host is less than the set bandwidth lower limit, the first migration strategy is used to indicate the strategy of copying after closing memory and enabling active CPU downclocking.
[0099] The second execution module 402 is used to: if the bandwidth is greater than or equal to the lower bandwidth limit, then:
[0100] If the current bandwidth utilization of the link is greater than or equal to the set bandwidth utilization limit, an indication is output to prohibit the virtual machine from migrating from the first host to the second host.
[0101] When the bandwidth utilization is between the upper limit of the bandwidth utilization and the set lower limit of the bandwidth utilization, if the bandwidth utilization meets one of the set requirements of the CPU active frequency reduction, a first migration strategy matching the bandwidth utilization is outputted, so as to migrate the virtual machine according to the first migration strategy; if the bandwidth utilization does not meet the set CPU active frequency reduction, a second migration strategy matching the bandwidth utilization is outputted, so as to migrate the virtual machine according to the second migration strategy; the second migration strategy is used to indicate a strategy of closing the memory post-copy and closing the CPU active frequency reduction.
[0102] As an embodiment, the bandwidth utilization is obtained by the following steps:
[0103] The average output traffic and the average input traffic of the interface of the first host local connection link within a specified checking time period are obtained; the average output traffic is sent to the second host according to the IP address of the second host; the average input traffic is received from the second host according to the IP address of the second host;
[0104] The bandwidth utilization is determined according to the average output traffic, the average input traffic and the bandwidth allocated to the link.
[0105] As an embodiment, the device further comprises a third execution module, which is used to obtain network delay information and packet loss information between the first host and the second host when the bandwidth utilization is less than the lower limit of the bandwidth utilization;
[0106] It is determined whether to migrate the virtual machine according to the network delay information and the packet loss information;
[0107] When it is determined to migrate the virtual machine, a third migration strategy matching the network delay information and the packet loss information is outputted, so as to migrate the virtual machine according to the third migration strategy.
[0108] As an embodiment, the network delay information and the packet loss information between the first host and the second host are obtained by:
[0109] The first host is controlled to send a plurality of test data packets to the second host through the link every set time interval;
[0110] The network delay information and the packet loss information are determined according to the response of the second host to each test data packet.
[0111] As an embodiment, the packet loss information is embodied by a packet loss rate; wherein, when the packet loss rate is greater than or equal to a set upper limit value of the packet loss rate, the virtual machine is not migrated.
[0112] As an embodiment, the packet loss information is embodied by a packet loss rate; wherein, when the packet loss rate is between a set upper limit value of the packet loss rate and a set lower limit value of the packet loss rate, the third migration strategy is the first migration strategy.
[0113] As an embodiment, the packet loss information is embodied by a packet loss rate; the network latency information is embodied by a plurality of delay indicators; the plurality of delay indicators at least include a delay minimum value, a delay average value, a delay maximum value, and a delay standard deviation;
[0114] When the packet loss rate is less than a set packet loss rate lower limit value, then:
[0115] When each of the plurality of delay indicators is less than a set delay indicator lower limit value corresponding to the delay indicator, the third migration strategy is used to indicate a strategy of turning on memory post-copy and turning off active CPU frequency reduction;
[0116] When each of the plurality of delay indicators is greater than or equal to a set delay indicator lower limit value corresponding to the delay indicator and less than a set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is used to indicate a strategy of turning on memory post-copy and turning on active CPU frequency reduction;
[0117] When one of the plurality of delay indicators is greater than or equal to a set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is the second migration strategy.
[0118] Thus far, the Figure 4 structure of the device is described.
[0119] Referring to Figure 5 , Figure 5 the electronic device structure diagram provided by the embodiments of the present application. As shown in Figure 5 , the hardware structure can include a processor and a machine-readable storage medium, the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the method disclosed in the above examples of the present application.
[0120] Based on the same application concept as the above method, the embodiments of the present application also provide a machine-readable storage medium, the machine-readable storage medium stores a plurality of computer instructions, the computer instructions are executed by the processor to implement the method disclosed in the above examples of the present application.
[0121] As an example, the above machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, and can contain or store information such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Radom Access Memory, Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard drive), solid state disk, any type of storage disk (such as optical disk, dvd, etc.), or similar storage medium, or combination thereof.
[0122] The above merely provides an example of the present application, but is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principle of the present application should be included in the scope of claims of the present application.
Claims
1. A virtual machine migration method characterized by, The method is applied to a network device for managing a plurality of hosts in a local area network; the method comprises: Before a virtual machine is migrated from a current first host to a second host, if bandwidth allocated to a link through which the virtual machine is migrated from the first host to the second host is less than a set bandwidth lower limit value, a first migration strategy matching the bandwidth is outputted, and the virtual machine is migrated according to the first migration strategy; the first migration strategy is used to indicate a strategy of closing memory post-copy and opening CPU active frequency reduction; If the bandwidth is greater than or equal to the bandwidth lower limit value, then: When current bandwidth utilization of the link is greater than or equal to a set bandwidth utilization upper limit value, an indication is outputted, and the indication is used to indicate that the virtual machine is prohibited from being migrated from the first host to the second host; When the bandwidth utilization is between the bandwidth utilization upper limit value and a set bandwidth utilization lower limit value, if the bandwidth utilization satisfies one of set requirements of CPU active frequency reduction, the first migration strategy matching the bandwidth utilization is outputted, and the virtual machine is migrated according to the first migration strategy; if the bandwidth utilization does not satisfy the set CPU active frequency reduction, a second migration strategy matching the bandwidth utilization is outputted, and the virtual machine is migrated according to the second migration strategy; the second migration strategy is used to indicate a strategy of closing memory post-copy and closing CPU active frequency reduction.
2. The method of claim 1, wherein, The bandwidth utilization is obtained by the following steps: Average output traffic and average input traffic of an interface of the first host locally connected to the link within a specified checking time period are obtained; The average output traffic is sent to the second host according to an IP address of the second host; The average input traffic is received from the second host according to the IP address of the second host; The bandwidth utilization is determined according to the average output traffic, the average input traffic and bandwidth allocated to the link.
3. The method of claim 1, wherein, The method further comprises: When the bandwidth utilization is less than the bandwidth utilization lower limit value, network delay information and packet loss information between the first host and the second host are obtained; Whether to migrate the virtual machine is determined according to the network delay information and the packet loss information; When it is determined to migrate the virtual machine, a third migration strategy matching the network delay information and the packet loss information is outputted, and the virtual machine is migrated according to the third migration strategy.
4. The method of claim 3, wherein, The network delay information and the packet loss information are obtained by the following steps: The first host is controlled to send a plurality of test data packets to the second host through the link at a set time interval; The network delay information and the packet loss information are determined according to response of the second host to each test data packet.
5. The method of claim 3, wherein, The packet loss information is embodied by a packet loss rate; when the packet loss rate is greater than or equal to a set packet loss rate upper limit value, the virtual machine is not migrated.
6. The method of claim 3, wherein, The packet loss information is embodied by a packet loss rate; when the packet loss rate is between a set packet loss rate upper limit value and a set packet loss rate lower limit value, the third migration strategy is the first migration strategy.
7. The method of claim 3, wherein, The packet loss information is embodied by a packet loss rate; the network delay information is embodied by a plurality of delay indicators; the plurality of delay indicators at least include a delay minimum value, a delay average value, a delay maximum value, and a delay standard deviation; When the packet loss rate is less than a set packet loss rate lower limit value, then: When each of the plurality of delay indicators is less than a set delay indicator lower limit value corresponding to the delay indicator, the third migration strategy is used to indicate a strategy of opening memory post-copy and closing active CPU frequency reduction; When each of the plurality of delay indicators is greater than or equal to a set delay indicator lower limit value corresponding to the delay indicator and less than a set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is used to indicate a strategy of opening memory post-copy and opening active CPU frequency reduction; When one of the plurality of delay indicators is greater than or equal to a set delay indicator upper limit value corresponding to the delay indicator, the third migration strategy is the second migration strategy.
8. A virtual machine migration apparatus characterized by comprising: The device is applied to a network device for managing a plurality of hosts in a local area network; the device comprises: A first execution module is configured to, before a virtual machine is migrated from a current first host to a second host, if bandwidth allocated to a link through which the virtual machine is migrated from the first host to the second host is less than a set bandwidth lower limit value, output a first migration strategy matched with the bandwidth, so as to migrate the virtual machine according to the first migration strategy; the first migration strategy is used to indicate a strategy of closing memory post-copy and opening CPU active frequency reduction; A second execution module is configured to, if the bandwidth is greater than or equal to the bandwidth lower limit value, then: When current bandwidth utilization of the link is greater than or equal to a set bandwidth utilization upper limit, an indication is outputted, the indication is used to indicate that the virtual machine is prohibited from being migrated from the first host to the second host; When the bandwidth utilization is between the bandwidth utilization upper limit and a set bandwidth utilization lower limit, if the bandwidth utilization satisfies one of set requirements of CPU active frequency reduction, the first migration strategy matched with the bandwidth utilization is outputted, so as to migrate the virtual machine according to the first migration strategy; if the bandwidth utilization does not satisfy the set requirements of CPU active frequency reduction, a second migration strategy matched with the bandwidth utilization is outputted, so as to migrate the virtual machine according to the second migration strategy; the second migration strategy is used to indicate a strategy of closing memory post-copy and closing CPU active frequency reduction.
9. The apparatus of claim 8, wherein, The bandwidth utilization is obtained by the following steps: Average output traffic and average input traffic of an interface of the first host locally connected to the link within a specified checking time period are obtained; The average output traffic is sent to the second host according to an IP address of the second host; The average input traffic is received from the second host according to the IP address of the second host; The bandwidth utilization is determined according to the average output traffic, the average input traffic, and bandwidth allocated to the link.
10. The apparatus of claim 8, wherein, The apparatus further comprises a third execution module configured to obtain network delay information and packet loss information between the first host and the second host when the bandwidth utilization is less than the lower limit of the bandwidth utilization; determine whether to migrate a virtual machine according to the network delay information and the packet loss information; output a third migration strategy matching the network delay information and the packet loss information when it is determined to migrate the virtual machine, and migrate the virtual machine according to the third migration strategy.
11. The apparatus of claim 10, wherein, The obtaining of the network delay information and the packet loss information between the first host and the second host comprises: controlling the first host to send a plurality of test data packets to the second host through the link at a set time interval; determining the network delay information and the packet loss information according to responses of the second host to the test data packets.
12. The apparatus of claim 10, wherein, The packet loss information is represented by a packet loss rate; when the packet loss rate is greater than or equal to a set upper limit value of the packet loss rate, the virtual machine is not migrated.
13. The apparatus of claim 10, wherein, The packet loss information is represented by a packet loss rate; when the packet loss rate is between a set upper limit value of the packet loss rate and a set lower limit value of the packet loss rate, the third migration strategy is the first migration strategy.
14. The apparatus of claim 10, wherein, The packet loss information is represented by a packet loss rate; the network delay information is represented by a plurality of delay indicators; the plurality of delay indicators at least include a delay minimum value, a delay average value, a delay maximum value, and a delay standard deviation; when the packet loss rate is less than a set lower limit value of the packet loss rate, then: when each delay indicator in the plurality of delay indicators is less than a set lower limit value of the delay indicator, the third migration strategy is used to indicate a strategy of turning on memory post-copy and turning off active CPU frequency reduction; when each delay indicator in the plurality of delay indicators is greater than or equal to a set lower limit value of the delay indicator and less than a set upper limit value of the delay indicator, the third migration strategy is used to indicate a strategy of turning on memory post-copy and turning on active CPU frequency reduction; when there is a delay indicator in the plurality of delay indicators that is greater than or equal to a set upper limit value of the delay indicator, the third migration strategy is the second migration strategy.
15. An electronic device, comprising: comprise: a processor; and a memory having computer program instructions stored therein, the computer program instructions, when executed by the processor, causing the processor to perform the steps of the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Virtual machine live migration method and device and storage medium
CN114443211A
Thermal migration method, device and equipment and readable storage medium
CN116820673A