Virtual machine online migration method, device, computer equipment and storage medium
By blocking and timing prediction of the data to be migrated by kvm virtual machines and determining the comprehensive migration sequence, the problems of low online migration efficiency and high migration risk in the existing technology are solved, and efficient and accurate virtual machine data are achieved migrate.
Patent Information
- Application Number
- CN202310885911.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-18
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2043-07-18
Smart Images

Figure CN117648155B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of virtual machines, and in particular to a method, device, computer equipment and storage medium for online migration of virtual machines. Background Art
[0002] The KVM virtual machine (Kernel-based Virtual Machine, an open source system virtualization module) runs in the Linux operating system. The essence of online migration technology is to perform online cross-machine migration between different physical machines without shutting down the virtual machine. First, a virtual machine with the same configuration is established on the target physical machine, and then various data migrations are performed, and finally a quick switch is made to the new virtual machine on the target end. Since the user's virtual machine can maintain normal operation for most of the time during the entire migration process, and the switching process is very short, it will not cause user business interruption and has almost no impact on the user's business running in the virtual machine. Therefore, the online migration technology of the KVM virtual machine is of great significance in realizing dynamic adjustment of cloud platform resources and fault handling.
[0003] However, during the online migration of the KVM virtual machine, since its central processor is in operation, the disk data and memory data are constantly changing. The use of traditional online migration methods will result in longer migration time and even possible migration failure, resulting in certain migration risks and reduced migration efficiency. Summary of the invention
[0004] In view of the defects existing in the prior art, the purpose of the present invention is to provide a virtual machine online migration method, device, computer equipment and storage medium, which can improve the online migration efficiency of KVM virtual machines.
[0005] To achieve the above objectives, the present invention provides a method for online migration of a virtual machine, which specifically includes the following steps:
[0006] Receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes first type data and second type data, and the first type data is configured with a first migration order, and the second type data is configured with a second migration order;
[0007] The first type of data is processed by block division according to a preset first block index to obtain a plurality of first data blocks and respective corresponding first index scores, and the second type of data is processed by block division according to a preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores;
[0008] Using a preset virtual machine data block migration timing prediction model, predicting the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data;
[0009] Determining a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing;
[0010] The data to be migrated is migrated to the target kvm virtual machine in the target physical machine according to the comprehensive migration order.
[0011] Based on the above technical solutions,
[0012] The first type of data is disk data, the preset first block index includes a plurality of first indexes, the first index includes one of an importance attribute of the disk data, a privacy attribute of the disk data, and a data category of the disk data, and each of the first indexes corresponds to a first index scoring rule;
[0013] The first type of data is processed into blocks according to the preset first block index to obtain a plurality of first data blocks and first index scores corresponding to the first data blocks, including:
[0014] Divide the disk data into blocks according to the first indicator to obtain a plurality of the first data blocks;
[0015] The first indicator scores corresponding to each of the first data blocks are determined according to a first indicator scoring rule corresponding to the first indicator.
[0016] Based on the above technical solutions,
[0017] The second type of data is memory data, the preset second block index includes a plurality of second indexes, the second index includes an update frequency attribute of the memory data or an access frequency attribute of the memory data, and each second index corresponds to a second index scoring rule;
[0018] The step of performing block processing on the second type of data according to the preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores includes:
[0019] Divide the memory data into blocks according to the second indicator to obtain a plurality of the second data blocks;
[0020] The second indicator scores corresponding to each of the second data blocks are determined according to the second indicator scoring rule corresponding to the second indicator.
[0021] Based on the above technical solutions,
[0022] The first migration sequence includes M first time points, one first data block corresponds to one time point, the second migration sequence includes N second time points, one second data block corresponds to one second time point, and M and N are both natural numbers greater than 1;
[0023] The method uses a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data, including:
[0024] Constructing an N*M scoring matrix according to the first indicator scores corresponding to the M first data blocks and the second indicator scores corresponding to the N second data blocks;
[0025] The N*M scoring matrix is used as the input of the preset virtual machine data block migration timing prediction model, and M first time points and N second time points output by the virtual machine data block migration timing prediction model are obtained.
[0026] On the basis of the above technical solution, the comprehensive migration order of the data to be migrated is determined according to the first migration order, the second migration order, the first migration timing and the second migration timing, and the specific steps include:
[0027] When it is determined that the first migration sequence is before the second migration sequence, sorting the M first time points in the first migration sequence to obtain a first time series;
[0028] Sorting the N second time points in the second migration time sequence to obtain a second time series;
[0029] The order in which the first time series comes first and the second time series comes later is determined as the comprehensive migration order.
[0030] On the basis of the above technical solution, the steps of migrating the data to be migrated to the target kvm virtual machine in the target physical machine according to the comprehensive migration sequence include:
[0031] Acquire a first data block corresponding to each first time point in the first time series, and acquire a second data block corresponding to each second time point in the second time series;
[0032] Constructing a first sequential queue according to the first data block, and constructing a second sequential queue according to the second data block;
[0033] Migrating the first sequential queue to a target kvm virtual machine in a target physical machine;
[0034] When receiving an indication that the migration of the first sequential queue is complete, the second sequential queue is migrated to a target KVM virtual machine in a target physical machine.
[0035] On the basis of the above technical solution, the virtual machine online migration method further includes:
[0036] Acquire training data, where the training data includes a plurality of first training indicator scores, a plurality of second training indicator scores, training operation parameters, a first training migration timing, and a second training migration timing;
[0037] Constructing a training indicator scoring matrix according to the plurality of first training indicator scores and the plurality of second training indicator scores;
[0038] Using the training indicator scoring matrix and the training operation parameters as inputs of a pre-trained machine learning model to obtain a prediction result output by the pre-trained machine learning model;
[0039] The parameters in the pre-trained machine learning model are optimized according to the prediction result, the trained first migration timing and the trained second migration timing to obtain a trained virtual machine data block migration timing prediction model.
[0040] The present invention provides a virtual machine online migration device, comprising:
[0041] A receiving module, configured to receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes first type data and second type data, and the first type data is configured with a first migration order, and the second type data is configured with a second migration order;
[0042] A block processing module is used to process the first type of data in blocks according to a preset first block index to obtain a plurality of first data blocks and respective corresponding first index scores, and to process the second type of data in blocks according to a preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores;
[0043] A prediction module, configured to use a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data;
[0044] a determination module, configured to determine a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing;
[0045] The migration module is used to migrate the data to be migrated to the target kvm virtual machine in the target physical machine according to the comprehensive migration sequence.
[0046] The present invention provides a computer device, the computer device comprising:
[0047] one or more processors;
[0048] Memory; and
[0049] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the above-mentioned virtual machine online migration method.
[0050] The present invention provides a computer-readable storage medium, on which a computer program is stored. The computer program is loaded by a processor to execute the steps in the above-mentioned virtual machine online migration method.
[0051] Compared with the prior art, the advantages of the present invention are: since the data to be migrated is divided into blocks, and the divided data is analyzed and the migration order is predicted, a fine-grained analysis of the data to be migrated in the KVM virtual machine is achieved, the accuracy of the migration order prediction is ensured, and migration is performed according to the predicted migration sequence. There is no need to modify or adjust the migration order of the data to be migrated, thereby improving the online migration efficiency of the KVM virtual machine. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1 This is a schematic diagram of a scenario of a virtual machine online migration device provided in an embodiment of the present application;
[0054] Figure 2 This is a flow chart of an embodiment of a method for online migration of a virtual machine provided in an embodiment of the present application;
[0055] Figure 3 It is a schematic diagram of the structure of an embodiment of a virtual machine online migration device provided in an embodiment of the present application;
[0056] Figure 4 It is a schematic diagram of the structure of an embodiment of a computer device provided in the embodiments of the present application. DETAILED DESCRIPTION
[0057] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0058] In the description of the present application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present application, "plurality" means two or more, unless otherwise clearly and specifically defined.
[0059] In this application, the word "exemplary" is used to mean "used as an example, illustration, or description." Any embodiment described in this application as "exemplary" is not necessarily to be construed as being preferred or advantageous over other embodiments. The following description is given to enable any technician in the field to implement and use the present application. In the following description, details are listed for the purpose of explanation. It should be understood that a person of ordinary skill in the art can recognize that the present application can be implemented without using these specific details. In other instances, well-known structures and processes will not be elaborated in detail to avoid obscuring the description of the present application with unnecessary details. Therefore, the present application is not intended to be limited to the embodiments shown, but is consistent with the widest scope consistent with the principles and features disclosed in the present application.
[0060] The embodiments of the present application provide a method, apparatus, computer device and storage medium for online migration of a virtual machine, which are described in detail below.
[0061] See also Figure 1 , Figure 1 Schematic diagram of a scenario of a virtual machine online migration device provided in an embodiment of the present application. The virtual machine online migration device may include a computer device 100, in which the virtual machine online migration device is integrated, such as Figure 1 Computer equipment in.
[0062] In the embodiment of the present application, the computer device 100 may be an independent server, or a server network or server cluster composed of servers. For example, the computer device 100 described in the embodiment of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing.
[0063] It is to be understood that the terminal used in the embodiments of the present application may be a device including both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such a device may include: a cellular or other communication device having a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The specific terminal may be a desktop terminal or a mobile terminal, and the terminal may also be one of a mobile phone, a tablet computer, a laptop computer, etc.
[0064] Those skilled in the art will understand that Figure 1 The application environment shown in the figure is only one application scenario of the present application solution and does not constitute a limitation on the application scenario of the present application solution. Other application environments may also include Figure 1 More or less computer equipment as shown in Figure 1 Only one computer device is shown in the figure. It can be understood that the virtual machine online migration device can also include one or more other services, which are not specifically limited here.
[0065] In addition, if Figure 1 As shown, the virtual machine online migration device may further include a storage module 200 for storing data.
[0066] It should be noted that Figure 1 The scenario diagram of the virtual machine online migration device shown is merely an example. The virtual machine online migration device and scenario described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the virtual machine online migration device and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is equally applicable to similar technical problems.
[0067] like Figure 2 As shown, it is a flow chart of an embodiment of a virtual machine online migration method in an embodiment of the present application. The virtual machine online migration method may include the following steps 301 to 305, which are as follows:
[0068] 301. Receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes a first type of data and a second type of data, and the first type of data is configured with a first migration order, and the second type of data is configured with a second migration order.
[0069] Among them, the online migration instruction is a call instruction for migrating target data from the source kvm virtual machine in the source physical machine to the target kvm virtual machine in the target physical machine. The target data is the data to be migrated, which is the data to be migrated in the source kvm virtual machine in the source physical machine. The data to be migrated includes two types of data, namely, first type data and second type data, such as the first type data is disk data, the second type data is memory data, and the first type data is configured with a first migration order, and the second type data is configured with a second migration order.
[0070] In this embodiment, corresponding migration sequences are respectively configured for data of different data types in the data to be migrated, which are used as the migration sequence between data types.
[0071] 302. Block-process the first type of data according to a preset first block index to obtain multiple first data blocks and their corresponding first index scores, and block-process the second type of data according to a preset second block index to obtain multiple second data blocks and their corresponding second index scores.
[0072] Among them, block processing refers to dividing the data into multiple blocks, and the block processing can be performed according to the set block index, and each block after each block is scored to quantify the importance of the data. The preset first block index is a pre-set block index for block processing of the first type of data, and is configured with a first index score. Similarly, the preset second block index is a pre-set block index for block processing of the second type of data, and is configured with a second index score. In one example, the first block index is the A index, and the A index is divided into the A1 sub-indicator and the A2 sub-indicator. The A1 sub-indicator corresponds to a first index score, and the A2 sub-indicator corresponds to a first index score.
[0073] Specifically, for the first type of data, the first type of data is divided into multiple first data blocks according to the first block index, and each first data block corresponds to a first indicator score, which realizes the block division of the first type of data and the quantification of the data after block division, and improves the fine-grained analysis of the first type of data, so that the efficiency of the analysis of the first type of data can be improved based on the first data block and the corresponding first indicator score in the future. Correspondingly, for the second type of data, the second type of data is divided into multiple second data blocks according to the second block index, and each second data block corresponds to a second indicator score, which realizes the block division of the second type of data and the quantification of the data after block division, and improves the fine-grained analysis of the second type of data, so that the efficiency of the analysis of the second type of data can be improved based on the second data block and the corresponding second indicator score in the future. It can be understood that in this embodiment, by performing block processing on the data to be migrated, the block division and scoring of the first type of data and the second type of data are realized, so that the accurate analysis of the block-divided data can be realized based on the score in the future.
[0074] In a specific implementation, the first type of data is disk data, the preset first block index includes multiple first indexes, the first index includes one of the importance attribute of disk data, the privacy attribute of disk data, and the data category of disk data, and each first index corresponds to a first index scoring rule; the block processing of the first type of data according to the preset first block index in step 302 to obtain multiple first data blocks and their corresponding first index scores may include the following steps 302A-302B, which are specifically as follows:
[0075] 302A, dividing the disk data into blocks according to the first indicator to obtain a plurality of the first data blocks;
[0076] 302B. Determine the first indicator scores corresponding to each of the first data blocks according to the first indicator scoring rule corresponding to the first indicator.
[0077] The disk data is data stored in the disk of the source physical machine, for example, the disk data may be data of multiple customers. The preset first block index includes multiple first indexes, such as importance attributes of the disk data, privacy attributes of the disk data, or data categories of the disk data.
[0078] In an example, the first indicator is the importance attribute of the disk data. The disk data can be divided into two blocks according to the importance of the disk data folder, namely important data and generally important data. The corresponding first indicator scoring rule is: important data is scored as 10 points and generally important data is scored as 6 points, that is, the important data is the first data block X1 (10 points) and the generally important data is the first data block X2 (6 points).
[0079] In another example, the first indicator is the privacy attribute of the disk data. The disk data can be divided into two blocks according to the privacy attribute of the folder of the disk data, namely private data and non-private data. The corresponding first indicator scoring rule is: private data is scored as 10 points and non-private data is scored as 4 points, that is, private data is the first data block X1 (10 points) and non-private data is the first data block X2 (4 points).
[0080] In another example, the first indicator is the data category of the disk data. The disk data can be divided into two blocks according to the data format of the disk data, namely, image data and document data. The corresponding first indicator scoring rule is: the image data score is 9 points and the document data score is 3 points, that is, the image data is the first data block X1 (9 points) and the document data is the first data block X2 (3 points).
[0081] In a specific implementation, the second type of data is memory data, the preset second block index includes multiple second indexes, the second index includes an update frequency attribute of the memory data or an access frequency attribute of the memory data, and each second index corresponds to a second index scoring rule; the block processing of the second type of data according to the preset second block index in step 302 to obtain multiple second data blocks and their corresponding second index scores may include the following steps 302C to 302D, which are specifically as follows:
[0082] 302C. Divide the memory data into blocks according to the second indicator to obtain a plurality of second data blocks;
[0083] 302D. Determine the second indicator scores corresponding to each of the second data blocks according to the second indicator scoring rule corresponding to the second indicator.
[0084] The memory data is data of the source virtual machine running on the source physical machine, for example, the memory data may be data of multiple applications. The preset second block index includes multiple second indexes, such as an update frequency attribute of the memory data or an access frequency attribute of the memory data.
[0085] In one example, the second indicator is the update frequency attribute of the memory data. The memory data can be divided into three blocks according to the historical operation data of different applications, namely, memory data with high update frequency, memory data with average update frequency, and memory data with low update frequency. The corresponding second indicator scoring rules are: memory data with high update frequency is scored as 9 points, memory data with average update frequency is scored as 5 points, and memory data with low update frequency is scored as 1 point, that is, the memory data with high update frequency is the second data block Y1 (9 points), the memory data with average update frequency is the second data block Y2 (5 points), and the memory data with low update frequency is the second data block Y3 (1 point).
[0086] In another example, the second indicator is the access frequency attribute of the memory data. The memory data can be divided into three blocks according to the access frequency of the memory data, namely, memory data with high access frequency, memory data with average access frequency, and memory data with low access frequency. The corresponding second indicator scoring rule is: the memory data with high access frequency is scored as 10 points, the memory data with average access frequency is scored as 4 points, and the memory data with low access frequency is scored as 1 point, that is, the memory data with high access frequency is the second data block Y1 (10 points), the memory data with average access frequency is the second data block Y2 (4 points), and the memory data with low access frequency is the second data block Y3 (1 point).
[0087] 303. Utilize a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their respective corresponding first indicator scores, the second data blocks and their respective corresponding second indicator scores, and obtain a first migration timing of the first type of data and a second migration timing of the second type of data.
[0088] Among them, the preset virtual machine data block migration timing prediction model refers to a machine learning model used to determine the migration order of the first data block and / or the second data block, such as a BP neural network model, a recurrent neural network model LSTM, an autoregressive model AR, a hidden Markov model HMM, etc.
[0089] The first migration timing refers to a time series containing multiple time elements. A first data block corresponds to one time element. Similarly, a second data block corresponds to one time element. The time elements constitute the second migration timing. The first migration timing is used to characterize the migration order within the first data block, and the second migration timing is used to characterize the migration order within the second data block.
[0090] Specifically, the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores are used as the input of the preset virtual machine data block migration timing prediction model, and the output of the preset virtual machine data block migration timing prediction model is used as the first migration timing of the first type of data and the second migration timing of the second type of data, thereby realizing the prediction of the migration order of each first data block and the second data block, so that the migration data can be subsequently migrated based on the predicted migration order, thereby improving the migration efficiency.
[0091] In a specific implementation, the first migration timing includes M first time points, one first data block corresponds to one time point, the second migration timing includes N second time points, one second data block corresponds to one second time point, and M and N are both natural numbers greater than 1; the step 303 uses a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, and obtains the first migration timing of the first type of data and the second migration timing of the second type of data, which may include the following steps 303A-303B, which are specifically as follows:
[0092] 303A. Construct an N*M scoring matrix according to the first indicator scores corresponding to the M first data blocks and the second indicator scores corresponding to the N second data blocks;
[0093] 303B. Use the N*M scoring matrix as input of the preset virtual machine data block migration timing prediction model, and obtain M first time points and N second time points output by the virtual machine data block migration timing prediction model.
[0094] Specifically, M first indicator scores and N second indicator scores are constructed into an N*M score matrix, and the N*M score matrix is input into a preset virtual machine data block migration timing prediction model for timing prediction. The time points of the M first data blocks and the N second data blocks are predicted, and the time points corresponding to the M first data blocks and the N second data blocks can be obtained. On this basis, the virtual machine data block migration timing prediction model is used to predict the score matrix, and the time series matrix corresponding to the score matrix can be obtained, in which the N row elements are the N first time points and the M column elements are the M second time points. It can be understood that in this embodiment, the first data block and the second data block are predicted according to the first indicator score and the second indicator score, and the migration order of each data block is predicted based on the analysis of the first data block and the second data block, which improves the accuracy of the prediction, thereby facilitating the improvement of the accuracy of the subsequent migration order, and thus improving the migration efficiency.
[0095] 304. Determine a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing.
[0096] The comprehensive migration order refers to the migration order of the data to be migrated.
[0097] Specifically, the first migration order and the second migration order can be used as the order between data types, the first migration timing can be used as the order within the first data block under the first migration order, and the second migration timing can be used as the order within the second data block under the second migration order to determine the comprehensive migration order of the data to be migrated. In this embodiment, the overall accuracy of the comprehensive migration order is improved by classifying and performing timing analysis and prediction on the data to be migrated.
[0098] In a specific implementation manner, determining the comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing in step 303 may include the following steps 304A to 304C, which are specifically as follows:
[0099] 304A. When it is determined that the first migration sequence is before the second migration sequence, sort the M first time points in the first migration sequence to obtain a first time series.
[0100] 304B. Sort the N second time points in the second migration time sequence to obtain a second time series;
[0101] 304C. Determine the order in which the first time series comes first and the second time series comes later as the comprehensive migration order.
[0102] The first time series refers to a time series in which M first time points are sorted in chronological order, and the second time series refers to a time series in which N second time points are sorted in chronological order.
[0103] Specifically, it is determined that the first migration order is before the second migration order, that is, the migration of the data to be migrated of the first data type is performed first, and each first data block in the first type of data is migrated according to the first time sequence, and after the migration of the first type of data is completed, the migration of the data to be migrated of the second type of data is performed, and each second data block in the second type of data is migrated according to the second time sequence. It can be understood that in this embodiment, the first type of data, i.e., the disk data, is migrated first, and after the migration of the disk data is completed, the memory data is migrated, and the change of the memory data will affect the data migration order. Therefore, the memory data is migrated last to ensure the accuracy of the migration, and there is no need to change the migration order, which greatly improves the efficiency of the online migration of the virtual machine.
[0104] 305. Migrate the data to be migrated to the target KVM virtual machine in the target physical machine according to the comprehensive migration order.
[0105] Specifically, the data to be migrated is migrated to the target KVM virtual machine in the target physical machine according to the comprehensive migration sequence. Since the comprehensive migration sequence has high accuracy, the modification and adjustment of the migration sequence of the data to be migrated is avoided, which greatly improves the online migration efficiency of the KVM virtual machine.
[0106] In an embodiment of the present application, by dividing the data to be migrated into blocks, analyzing the divided data and predicting the migration order, a fine-grained analysis of the data to be migrated in the KVM virtual machine is achieved, the accuracy of the migration order prediction is ensured, and migration is performed according to the predicted migration sequence. There is no need to modify or adjust the migration order of the data to be migrated, thereby improving the online migration efficiency of the KVM virtual machine.
[0107] In a specific implementation manner, migrating the data to be migrated to the target kvm virtual machine in the target physical machine according to the comprehensive migration sequence in step 305 may include the following steps 305A to 305C, which are specifically as follows:
[0108] 305A, constructing a first sequential queue according to the first data block, and constructing a second sequential queue according to the second data block;
[0109] 305B, migrating the first sequential queue to a target kvm virtual machine in a target physical machine;
[0110] 305C. Upon receiving an indication that the migration of the first sequential queue is complete, the second sequential queue is migrated to a target KVM virtual machine in a target physical machine.
[0111] Among them, the first sequential queue refers to the first data block in which the first data block is sorted in the order of the corresponding first time series. Similarly, the second sequential queue refers to the first data block in which the second data block is sorted in the order of the corresponding second time series.
[0112] Specifically, the first sequential queue is migrated to the target kvm virtual machine in the target physical machine, and when the migration of the first sequential queue is completed, the second sequential queue is migrated to the target kvm virtual machine in the target physical machine.
[0113] In a specific implementation, the virtual machine online migration method may further include the following steps 306 to 310, which are as follows:
[0114] 306. Acquire training data, where the training data includes a plurality of first training indicator scores, a plurality of second training indicator scores, training operation parameters, a first training migration timing, and a second training migration timing;
[0115] 307. Construct a training indicator scoring matrix according to the plurality of first training indicator scores and the plurality of second training indicator scores;
[0116] 308. Using the training indicator scoring matrix and the training operation parameters as inputs of a pre-trained machine learning model to obtain a prediction result output by the pre-trained machine learning model;
[0117] 309. Optimize the parameters in the pre-trained machine learning model according to the prediction result, the trained first migration timing, and the trained second migration timing to obtain a trained virtual machine data block migration timing prediction model.
[0118] Specifically, first obtain multiple first training indicator scores, multiple second training indicator scores, training operation parameters, first training migration timing, and second training migration timing, then construct a training indicator scoring matrix based on the multiple first training indicator scores and the multiple second training indicator scores, and then use the training indicator scoring matrix and the training operation parameters as inputs of the pre-trained machine learning model to obtain prediction results of the output of the pre-trained machine learning model, optimize the parameters in the pre-trained machine learning model based on the prediction results, the first training migration timing, and the second training migration timing, and obtain a trained virtual machine data block migration timing prediction model.
[0119] After completing the model training, the prediction model can be encapsulated into an interface function and deployed. When performing time series prediction, the time series can be obtained by calling the interface function.
[0120] In order to better implement the virtual machine online migration method in the embodiment of the present application, based on the virtual machine online migration method, the embodiment of the present application also provides a virtual machine online migration device, such as Figure 3 As shown, the virtual machine online migration device 400 includes:
[0121] The receiving module 401 is used to receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes a first type of data and a second type of data, and the first type of data is configured with a first migration order, and the second type of data is configured with a second migration order;
[0122] The block module 402 is used to perform block processing on the first type of data according to a preset first block index to obtain a plurality of first data blocks and respective corresponding first index scores, and to perform block processing on the second type of data according to a preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores;
[0123] The prediction module 403 is used to use a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data;
[0124] A determination module 404, configured to determine a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing;
[0125] The migration module 405 is used to migrate the data to be migrated to the target KVM virtual machine in the target physical machine according to the comprehensive migration sequence.
[0126] In the embodiment of the present application, the first type of data is disk data, the preset first block index includes multiple first indexes, the first index includes one of the importance attribute of disk data, the privacy attribute of disk data, and the data category of disk data, and each of the first indexes corresponds to a first index scoring rule; the block module 402 is specifically used for:
[0127] Divide the disk data into blocks according to the first indicator to obtain a plurality of the first data blocks;
[0128] The first indicator scores corresponding to each of the first data blocks are determined according to a first indicator scoring rule corresponding to the first indicator.
[0129] In the embodiment of the present application, the second type of data is memory data, the preset second block index includes multiple second indicators, the second indicator includes an update frequency attribute of the memory data or an access frequency attribute of the memory data, and each second indicator corresponds to a second indicator scoring rule; the block module 402 is further specifically used for:
[0130] Divide the memory data into blocks according to the second indicator to obtain a plurality of the second data blocks;
[0131] The second indicator scores corresponding to each of the second data blocks are determined according to the second indicator scoring rule corresponding to the second indicator.
[0132] In the embodiment of the present application, the first migration sequence includes M first time points, one first data block corresponds to one time point, the second migration sequence includes N second time points, one second data block corresponds to one second time point, and M and N are both natural numbers greater than 1; the prediction module 403 is specifically used to:
[0133] Constructing an N*M scoring matrix according to the first indicator scores corresponding to the M first data blocks and the second indicator scores corresponding to the N second data blocks;
[0134] The N*M scoring matrix is used as the input of the preset virtual machine data block migration timing prediction model, and M first time points and N second time points output by the virtual machine data block migration timing prediction model are obtained.
[0135] In the embodiment of the present application, the determination module 404 is specifically used for:
[0136] When it is determined that the first migration sequence is before the second migration sequence, sorting the M first time points in the first migration sequence to obtain a first time series;
[0137] Sorting the N second time points in the second migration time sequence to obtain a second time series;
[0138] The order in which the first time series comes first and the second time series comes later is determined as the comprehensive migration order.
[0139] In the embodiment of the present application, the migration module 405 is specifically used for:
[0140] Acquire a first data block corresponding to each first time point in the first time series, and acquire a second data block corresponding to each second time point in the second time series;
[0141] Constructing a first sequential queue according to the first data block, and constructing a second sequential queue according to the second data block;
[0142] Migrating the first sequential queue to a target kvm virtual machine in a target physical machine;
[0143] When receiving an indication that the migration of the first sequential queue is complete, the second sequential queue is migrated to a target KVM virtual machine in a target physical machine.
[0144] In the embodiment of the present application, the virtual machine online migration device also includes:
[0145] An acquisition module, used to acquire training data, wherein the training data includes a plurality of first training indicator scores, a plurality of second training indicator scores, training operation parameters, a first training migration timing, and a second training migration timing;
[0146] A construction module, used to construct a training indicator scoring matrix according to a plurality of the first training indicator scores and a plurality of the second training indicator scores;
[0147] A training module, used to use the training indicator scoring matrix and the training operation parameters as inputs of a pre-trained machine learning model to obtain a prediction result output by the pre-trained machine learning model;
[0148] A generation module is used for the module, which is used to optimize the parameters in the pre-trained machine learning model according to the prediction results, the trained first migration timing and the trained second migration timing to obtain the trained virtual machine data block migration timing prediction model.
[0149] The embodiment of the present application further provides a computer device, which integrates any one of the virtual machine online migration devices provided in the embodiment of the present application, and the computer device includes:
[0150] one or more processors;
[0151] Memory; and
[0152] One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the processor in the steps of the virtual machine online migration method described in any of the above-mentioned virtual machine online migration method embodiments.
[0153] The present application also provides a computer device that integrates any of the virtual machine online migration devices provided in the present application. Figure 4 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0154] The computer device may include one or more processing core processors 701, one or more computer readable storage media memories 702, a power supply 703, an input unit 704 and other components. Those skilled in the art will appreciate that Figure 4 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0155] The processor 701 is the control center of the computer device. It uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 702 and calling data stored in the memory 702, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701.
[0156] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.
[0157] The computer device also includes a power supply 703 for supplying power to various components. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 703 can also include any combination of one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, etc.
[0158] The computer device may further include an input unit 704, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0159] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 701 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 will run the application programs stored in the memory 702 to implement various functions.
[0160] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0161] To this end, an embodiment of the present application provides a computer-readable storage medium, which may include: a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the virtual machine online migration methods provided in the embodiments of the present application.
[0162] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the detailed description of other embodiments above, and will not be repeated here.
[0163] In specific implementation, the above units or structures can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same or several entities. The specific implementation of the above units or structures can refer to the previous method embodiments, which will not be repeated here.
[0164] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0165] The above is a detailed introduction to a virtual machine online migration method, device and storage medium provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A virtual machine online migration method, characterized in that: The specific steps include: Receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes first type data and second type data, and the first type data is configured with a first migration order, and the second type data is configured with a second migration order; The first type of data is processed by block division according to a preset first block index to obtain a plurality of first data blocks and respective corresponding first index scores, and the second type of data is processed by block division according to a preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores; Using a preset virtual machine data block migration timing prediction model, predicting the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data; Determining a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing; Migrating the data to be migrated to the target kvm virtual machine in the target physical machine according to the comprehensive migration order; Among them, the first migration order and the second migration order are used to determine the migration order between the first type of data and the second type of data, the first migration timing is used to determine the migration order of each first data block of the first type of data, and the second migration timing is used to determine the migration order of each second data block of the second type of data.
2. A virtual machine online migration method according to claim 1, characterized in that: The first type of data is disk data, the preset first block index includes a plurality of first indexes, the first index includes one of an importance attribute of the disk data, a privacy attribute of the disk data, and a data category of the disk data, and each of the first indexes corresponds to a first index scoring rule; The first type of data is processed in blocks according to the preset first block index to obtain a plurality of first data blocks and first index scores corresponding to the first data blocks, including: Divide the disk data into blocks according to the first index to obtain a plurality of the first data blocks; The first indicator scores corresponding to each of the first data blocks are determined according to a first indicator scoring rule corresponding to the first indicator.
3. A virtual machine online migration method as claimed in claim 2, characterized in that: The second type of data is memory data, the preset second block index includes a plurality of second indexes, the second index includes an update frequency attribute of the memory data or an access frequency attribute of the memory data, and each second index corresponds to a second index scoring rule; The step of performing block processing on the second type of data according to the preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores includes: Divide the memory data into blocks according to the second indicator to obtain a plurality of the second data blocks; The second indicator scores corresponding to each of the second data blocks are determined according to the second indicator scoring rule corresponding to the second indicator.
4. A virtual machine online migration method as claimed in claim 3, characterized in that: The first migration sequence includes M first time points, one first data block corresponds to one first time point, the second migration sequence includes N second time points, one second data block corresponds to one second time point, and M and N are both natural numbers greater than 1; The method uses a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data, including: Constructing an N*M scoring matrix according to the first indicator scores corresponding to the M first data blocks and the second indicator scores corresponding to the N second data blocks; The N*M scoring matrix is used as the input of the preset virtual machine data block migration timing prediction model, and M first time points and N second time points output by the virtual machine data block migration timing prediction model are obtained.
5. A virtual machine online migration method as claimed in claim 4, characterized in that: The step of determining the comprehensive migration order of the data to be migrated according to the first migration order, the second migration order, the first migration timing and the second migration timing comprises: When it is determined that the first migration sequence is before the second migration sequence, sorting the M first time points in the first migration sequence to obtain a first time series; Sorting the N second time points in the second migration time sequence to obtain a second time series; The order in which the first time series comes first and the second time series comes later is determined as the comprehensive migration order.
6. A virtual machine online migration method according to claim 5, characterized in that: The step of migrating the data to be migrated to the target KVM virtual machine in the target physical machine according to the comprehensive migration sequence specifically includes: Acquire a first data block corresponding to each first time point in the first time series, and acquire a second data block corresponding to each second time point in the second time series; constructing a first sequential queue according to the first data block, and constructing a second sequential queue according to the second data block; Migrating the first sequential queue to a target kvm virtual machine in a target physical machine; When receiving an indication that the migration of the first sequential queue is complete, the second sequential queue is migrated to a target KVM virtual machine in a target physical machine.
7. A virtual machine online migration method according to any one of claims 1 to 6, characterized in that: The virtual machine online migration method also includes: Acquire training data, where the training data includes a plurality of first training indicator scores, a plurality of second training indicator scores, training operation parameters, a first training migration timing, and a second training migration timing; Constructing a training indicator scoring matrix according to the plurality of first training indicator scores and the plurality of second training indicator scores; Using the training indicator scoring matrix and the training operation parameters as inputs of a pre-trained machine learning model to obtain a prediction result output by the pre-trained machine learning model; The parameters in the pre-trained machine learning model are optimized according to the prediction result, the trained first migration timing and the trained second migration timing to obtain a trained virtual machine data block migration timing prediction model.
8. A virtual machine online migration device, characterized in that: include: A receiving module, configured to receive an online migration instruction, and determine the data to be migrated of the source KVM virtual machine in the source physical machine according to the online migration instruction, wherein the data to be migrated includes first type data and second type data, and the first type data is configured with a first migration order, and the second type data is configured with a second migration order; A block processing module is used to process the first type of data in blocks according to a preset first block index to obtain a plurality of first data blocks and respective corresponding first index scores, and to process the second type of data in blocks according to a preset second block index to obtain a plurality of second data blocks and respective corresponding second index scores; A prediction module, configured to use a preset virtual machine data block migration timing prediction model to predict the migration timing of the first type of data and the second type of data according to the first data blocks and their corresponding first indicator scores, the second data blocks and their corresponding second indicator scores, to obtain a first migration timing of the first type of data and a second migration timing of the second type of data; a determination module, configured to determine a comprehensive migration order of the to-be-migrated data according to the first migration order, the second migration order, the first migration timing, and the second migration timing; A migration module, used for migrating the data to be migrated to a target kvm virtual machine in a target physical machine according to the comprehensive migration sequence; Among them, the first migration order and the second migration order are used to determine the migration order between the first type of data and the second type of data, the first migration timing is used to determine the migration order of each first data block of the first type of data, and the second migration timing is used to determine the migration order of each second data block of the second type of data.
9. A computer device, characterized in that: The computer device comprises: one or more processors; Memory; and One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the virtual machine online migration method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in the virtual machine online migration method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Virtual storage migration method and system and virtual machine monitor
CN102073462A
Virtual machine disk data transfer method and device
CN106484312A