CN103036947B - Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM - Google Patents

Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM Download PDF

Info

Publication number
CN103036947B
CN103036947B CN201210477637.0A CN201210477637A CN103036947B CN 103036947 B CN103036947 B CN 103036947B CN 201210477637 A CN201210477637 A CN 201210477637A CN 103036947 B CN103036947 B CN 103036947B
Authority
CN
China
Prior art keywords
virtual machine
information
target virtual
uncertainty event
source virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210477637.0A
Other languages
Chinese (zh)
Other versions
CN103036947A (en
Inventor
李建欣
司守钰
胡春明
崔磊
黄玉梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beihang University
Original Assignee
Beihang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beihang University filed Critical Beihang University
Priority to CN201210477637.0A priority Critical patent/CN103036947B/en
Publication of CN103036947A publication Critical patent/CN103036947A/en
Application granted granted Critical
Publication of CN103036947B publication Critical patent/CN103036947B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention provides a virtual machine transferring method based on the kernel-based virtual machine (KVM) and a virtual machine transferring system based on the KVM. The virtual machine transferring method based on the KVM includes the following steps: a source virtual machine synchronizes the information of a central processing unit (CPU) register and an internal memory to a target virtual machine and then records the information of occurred uncertain incidents; the source virtual machine transmits the information of the uncertain incidents to the target virtual machine according to a first transmission order, wherein the information of the uncertain incidents is not transmitted to the target virtual machine before the first transmission order; the target virtual machine carries out a reset operation on the information of the uncertain incidents of the source virtual machine, the transmission operation and the reset operation are carried out in an iteration mode, when the number of the transmitted information of the uncertain incidents is smaller than or equal to the preset number value, the source virtual machine is stopped, the uncertain incidents which are not transmitted before are transmitted, the target virtual machine carries out the reset operation, and therefore the transferring of the virtual machine is completed. According to the virtual machine transferring method based on the KVM and the virtual machine transferring system based on the KVM, the uncertain incidents are recorded and reset, the internal memory iteration copying method in the prior art is replaced, the transmitted data amount is largely reduced, and the iteration transmission time in the transferring process is shortened.

Description

Based on virtual machine migration method and the system of KVM
Technical field
The present invention relates to the communications field, particularly relate to a kind of virtual machine migration method based on KVM and system.
Background technology
Based on KVM(Kernel-based Virtual Machine) virtual machine application study extensive, virtual machine (vm) migration refers to, to the virtual machine in a physical machine be operated in, by certain technological means, make it continue to run the technology of getting up in another physical machine.Virtual machine migration technology is divided into two classes: off-line migration and online migration.Off-line migration refers to when closing virtual machine, and the synchronous driving of virtual machine on other machine, is then started virtual machine by use file transfer software on corresponding machine.Online migration refers to and preserves complete for the running status of whole virtual machine, can return to fast on original hardware platform or even different hardware platforms simultaneously.After recovery, virtual machine is smoothness run still, and user can not perceive any difference, because this method can keep the continuity of business, so become study hotspot gradually.
Prior art is usually by the moving method of pre-copy internal memory, this moving method copies by iteration the page revised on last stage to complete, although actualizing technology is simple, require lower to application scenarios, but under internal memory writes intensive scene, especially, when the speed writing the page is greater than transfer rate, need the data volume of transmission large, the iteration delivery time in transition process is longer.
Summary of the invention
The object of the invention is to provide a kind of virtual machine migration method based on KVM and system, transmits data volume, reduce the iteration delivery time in transition process in order to reduce.
The invention provides a kind of virtual machine migration method based on KVM, comprising:
The CPU register of described source virtual machine and memory information are synchronized to target virtual machine by source virtual machine, and record the information of the uncertainty event of generation after described CPU register and memory information are synchronized to described target virtual machine;
Described source virtual machine receives the first move instruction that described target virtual machine sends, and according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine;
Described target virtual machine receives the information of the uncertainty event that described source virtual machine transmits, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result is for being greater than, then the information of received uncertainty event is reset, to upgrade system mode current on described target virtual machine, and resend described first move instruction to described source virtual machine, described first move instruction receiving the transmission of described target virtual machine is continued to make described source virtual machine, iteration carries out uncertainty event record, transmission and playback procedure,
If judged result is for being less than or equal to, then described target virtual machine indicates described source virtual machine out of service and sends the second move instruction to described source virtual machine, to indicate described source virtual machine, the information not being sent to the uncertainty event of described target virtual machine before receiving described second move instruction is sent to described target virtual machine; The information of described target virtual machine to the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, and to upgrade system mode current on described target virtual machine, then replaces described source virtual machine and brings into operation.
Present invention also offers a kind of virtual machine (vm) migration system based on KVM, comprising: source virtual machine and target virtual machine;
Described source virtual machine is used for, and the CPU register of described source virtual machine and memory information are synchronized to described target virtual machine, and records the information of the uncertainty event of generation after described CPU register and memory information are synchronized to described target virtual machine; Receive the first move instruction that described target virtual machine sends, according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine; Receive the second move instruction that described target virtual machine sends, according to described second move instruction, the information of the uncertainty event that described source virtual machine does not transmit is sent to described target virtual machine, and stops the operation of described source virtual machine;
Described target virtual machine is used for, receive the synchronous CPU register of described source virtual machine and memory information, the first move instruction is sent to described source virtual machine, receive the information of the uncertainty event that described source virtual machine transmits according to described first move instruction, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result is for being greater than, then the information of received uncertainty event is reset, to upgrade system mode current on described target virtual machine, and resend described first move instruction to described source virtual machine, continue to make described source virtual machine to receive described first move instruction, according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine, if judged result is for being less than or equal to, then described target virtual machine indicates described source virtual machine out of service and sends the second move instruction to described source virtual machine, to indicate described source virtual machine, the information not being sent to the uncertainty event of described target virtual machine before receiving described second move instruction is sent to described target virtual machine, the information of described target virtual machine to the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, and to upgrade system mode current on described target virtual machine, then replaces described source virtual machine and brings into operation.
Virtual machine migration method based on KVM provided by the invention and system; by target virtual machine, replay operations is carried out to the information of the uncertainty event of source virtual machine; and when the number of the information when the uncertainty event transmitted is less than or equal to predetermined number threshold value; source virtual machine is shut down; the information of the uncertainty event do not transmitted before is transmitted, thus completes the migration of virtual machine.The virtual machine migration method based on KVM that technical solution of the present invention provides and system, the information of uncertain time being carried out transmitting and resetting replaces internal memory iteration copy method of the prior art can reduce transmission data volume greatly, reduces the iteration delivery time in transition process.
Accompanying drawing explanation
The schematic flow sheet of the virtual machine migration method based on KVM that Fig. 1 provides for one embodiment of the invention;
The structural representation of the virtual machine (vm) migration system based on KVM that Fig. 2 provides for further embodiment of this invention.
Embodiment
The schematic flow sheet of the virtual machine migration method based on KVM that Fig. 1 provides for one embodiment of the invention, as shown in Figure 1, present embodiments provide a kind of virtual machine migration method based on KVM, along with the development of cloud computing is with deep, Intel Virtualization Technology as one of main support technology obtains the extensive concern of industrial circle and academia, virtually a physical machine can be made to run multiple virtual machine instance, improve the utilance of the parts such as CPU, there is the characteristic that packaging effects, isolation etc. are outstanding.The method comprises:
Step 11: the CPU register of source virtual machine and memory information are synchronized to target virtual machine by source virtual machine, and the information of the uncertainty event of generation is recorded after CPU register and memory information are synchronized to target virtual machine.Source virtual machine and target virtual machine initialization migration scene, start transition process, the CPU register of source virtual machine and memory information are synchronized to target virtual machine by source virtual machine, target virtual machine preserves CPU register and the memory information of source virtual machine, source virtual machine continues to run, and starts the information recording the uncertainty event occurred.
Step 12: the first move instruction that source virtual machine receiving target virtual machine sends, is sent to target virtual machine according to the first move instruction by the information of the uncertainty event not being sent to target virtual machine before receiving the first move instruction.After the first move instruction that source virtual machine receiving target virtual machine sends, record virtual machine uncertainty event is transmitted through the network to target virtual machine.First move instruction is that target virtual machine sends after synchronously completing CPU register and memory information, object is that target virtual machine is after synchronously completing CPU register and memory information, continues the uncertainty event occurred at source virtual machine to reset at destination virtual pusher side.
Step 13: target virtual machine receives the information of the uncertainty event that source virtual machine transmits, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result performs step 14 for being greater than, if judged result is for being less than or equal to, then perform step 15.
Step 14: the information of received uncertainty event is reset, to upgrade system mode current on target virtual machine, and resend the first move instruction to source virtual machine, with the first move instruction making source virtual machine continue the transmission of receiving target virtual machine, according to the first move instruction, the information of the uncertainty event not being sent to target virtual machine before receiving the first move instruction is sent to target virtual machine.The information of the uncertainty event that source virtual machine occurs goes on record, and is sent to target virtual machine by network, and target virtual machine carries out playback work, completes the 1st playback.In the transmission and reproduction process process of the 1st uncertain time, new uncertainty event can be produced again, need to carry out the 2nd iterative process, in the 2nd iterative process transmission and reproduction process be the uncertainty event produced in the 1st iterative process.The rest may be inferred, and (n+1)th time iterative process needs transmission and processes the uncertainty event produced in n-th iterative process.Execution of step 14 needs again to turn execution step 12.
Step 15: if judged result is for being less than or equal to, then target virtual machine indicates source virtual machine out of service and sends the second move instruction to source virtual machine, to indicate source virtual machine, the information of the uncertainty event not being sent to target virtual machine before receiving the second move instruction is sent to target virtual machine.After having carried out several times iteration copy procedure, along with the minimizing of the amount of information of the uncertainty event of record, when the number of the information of uncertainty event is less than or equal to predetermined number threshold value, stop the operation of source virtual machine, and indicate source virtual machine (i.e. the second transfer instruction) that the information of the uncertainty event that source virtual machine does not transmit all is sent to target virtual machine.The information of the uncertainty event not yet transmitted all is sent to target virtual machine according to the instruction of target virtual machine by source virtual machine, and continues to perform step 16.
Step 16: the information of target virtual machine to the uncertainty event that source virtual machine transmits according to the second move instruction is reset, to upgrade system mode current on target virtual machine, then replaces source virtual machine and brings into operation.At source virtual machine operation-stopping stage, after the information playback of the uncertainty event do not transmitted before completes by target virtual machine, target virtual machine sends migration to source virtual machine and completes information, and target virtual machine replaces source virtual machine and brings into operation, and completes whole virtual machine (vm) migration process.
Wherein, use in the process that to be uncertainty event copy in iteration of the first move instruction described in the present embodiment, the second move instruction is the operation in order to expiry notification source virtual machine, and carries out transmission and the playback procedure of last part uncertainty event.
The virtual machine migration method based on KVM that the present embodiment provides; by target virtual machine, replay operations is carried out to the information of the uncertainty event of source virtual machine; and when the number of the information when the uncertainty event transmitted is less than or equal to predetermined number threshold value; source virtual machine is shut down; the information of the uncertainty event do not transmitted before is transmitted, thus completes the migration of virtual machine.The virtual machine migration method based on KVM that the present embodiment technical scheme provides, the information of uncertain time being carried out transmitting and resetting replaces internal memory iteration copy method of the prior art can reduce transmission data volume greatly, reduces the iteration delivery time in transition process.
The present embodiment mainly uses record reproducing technology in virtual machine (vm) migration process, and the core concept of record reproducing technology is recorded the implementation of program, and other times, other equipment carry out the execution again of indifference.The method of record reproducing can be divided into following a few class: for the recording and reproducing system of application program, needs the amount of information of record minimum, lightweight the most; The record reproducing technology of oriented manipulation system, need the whole uncertainty events recording whole system, the feature of record contains much information, and the most comprehensively, but performance cost is larger; Along with the development of Intel Virtualization Technology, the object of record reproducing turns to virtual machine, by virtual machine monitor layer, can obtain the uncertainty event of whole dummy machine system, ensure that the data volume recorded is unlikely to excessive, be a kind of outstanding playback of recorded method of comprehensive comparison simultaneously.
Record reproducing technology not only can be used for Intrusion analysis and software debugging aspect, by recording the implementation of source virtual machine, and carrying out indifference playback at target virtual machine, becoming a kind of new method realizing the online shift function of virtual machine.Record reproducing technology is introduced real-time migration of virtual machine field, adopt the uncertain information that the influential system order produced in record virtual machine implementation performs, by carrying out the method for determining to reset at target virtual machine, target virtual machine is made automatically to generate the identical system mode with source virtual machine.Said method replaces the legacy migration method of memory copying, can meet the requirement that virtual machine moves online on space consuming and time loss, the downtime that shortening virtual machine moves online and gross migration time.
Preferred as technique scheme, source is virtual the CPU register of source virtual machine and memory information are synchronized to target virtual machine before comprise:
Source virtual machine receives migration instruction;
Source virtual machine sends migration request according to migration instruction to target virtual machine;
Target virtual machine judges whether to meet transition condition according to migration request, if met, remigration confirmation is to source virtual machine;
The CPU register of source virtual machine and memory information are synchronized to target virtual machine and comprise by source virtual machine:
The CPU register of source virtual machine and memory information, according to migration confirmation, are synchronized to target virtual machine by source virtual machine.
Above-mentioned migration instruction can send for user, also can be source virtual machine due to certain network state or equipment state change so that trigger the migration instruction generated, but be not limited to above-mentioned enumerating.Migration instruction in the present embodiment sends for user, after the migration instruction that source virtual machine reception user sends, source virtual machine sends migration request to target virtual machine, and require that target virtual machine judges whether to meet transition condition, after target virtual machine resource judgment completes, judged result is sent to source virtual machine, source virtual machine is according to the difference of result, selection starts migration or moves unsuccessfully, concrete, if met, remigration confirmation to source virtual machine, if do not met, then move failure, do not carry out virtual machine (vm) migration operation.
Preferred as technique scheme, the method that the present embodiment provides also comprises: in step 16, the information of target virtual machine to the uncertainty event that source virtual machine transmits according to the second move instruction is reset, and comprises after upgrading CPU register current on target virtual machine and memory information:
Target virtual machine sends migration to source virtual machine and completes information.
The virtual machine migration method based on KVM that the present embodiment provides, transition process comprises 3 stages:
In the preparatory stage that migration starts, the Socket setting up two ends connects, and source virtual machine inquiry target virtual machine resource service condition, judges whether migration can be carried out.
In the process of iteration copy, the information of the uncertainty event of source virtual machine record is sent to target virtual machine, resets for target virtual machine.Meanwhile, target virtual machine is according to playback progress situation, and notification source virtual machine carries out next iteration copy or suspends transmission data.
Shut down the copy stage, target virtual machine receives the instruction of having reset, and disconnects and communicating with the Socket of source virtual machine, represent that whole transition process completes.
Preferred as technique scheme, the information of the uncertainty event that record occurs comprises:
If the operating system of source virtual machine is withdrawn into root mode, then judging whether uncertainty event occurs, if judged result is for occurring, then judging the type of uncertainty event:
If judge that uncertainty event is time uncertainty event, then record time point information and the interrupt type of uncertainty event generation.Time uncertainty event is: in virtual machine, and time uncertainty event refers in twice running, the event that time of origin is different, and this kind of event is generally initiated by monitor of virtual machine, and such as uncertainty event comprises the time, and tick interrupt and/or I/O interrupt.Time point provides accurate positional information for playback uncertain time, is one of most important information, so must at the time point information of record stage recording events generation accurately.In order to accurately describe the position of event in running, time point must have dullness, unique, reusable feature.Traditional clock time is easily subject to the interference of external environment, can not use as precise time point, the time point that choice for use needs the register performing number of times to form by performance counter, instruction pointer and mark prefix instruction herein " tlv triple " occurs as uncertainty event.
In virtual machine, time uncertainty event only includes tick interrupt and I/O interrupts.For tick interrupt, virtual machine kernel module in charge safeguards clock source, regularly injects tick interrupt to target virtual machine, before tick interrupt injects, interruption injection function in kernel, inserts time point and obtains function, can obtain the correct time point that tick interrupt is injected into.
I/O is interrupted, needs to carry out interruption at virtual machine kernel and intercept and capture.KVM virtual machine is divided into two parts: the one of virtual machine kernel module and User space process QEMU(simulator, provides the functions such as user interactions for KVM), wherein the major function of QEMU is the external equipments such as responsible simulating keyboard, network interface card, and communicates with kernel.When there is I/O operation, the peripheral hardware of QEMU simulation by triggered interrupts, and passes through IOCTLI/O control command, by interrupt notification kernel, kernel intercepts and captures this interruption, is transmitted by virtual interrupt controller, eventually through interruption injection function, this interruption is injected in target virtual machine.Similar with tick interrupt, before this hardware interrupts is injected, insert time point and obtain function, the correct time point that I/O interrupts being injected into can be obtained.
If judge that uncertainty event is data uncertainty event, then record time point information and the data message of the generation of uncertainty event.Data uncertainty event is: in target virtual machine twice running, even if time of origin is identical, and the event that the data result obtained also may be different, such as data uncertainty event comprises programmable I/O and memory-mapped I/O.
For data uncertainty event, need to record its data message and time point information.Data uncertainty event in virtual machine mainly refers to that I/O operates the uncertain result returned, and comprises the input operation of the external equipments such as keyboard, mouse and network interface card.
Programmable I/O(PIO) and/or memory-mapped I/O (MMIO) I/O operation is mainly divided into two classes:.The equipment simulating of virtual machine is all completed by QEMU, be responsible for preparing data by QEMU, kernel is responsible for injecting to virtual machine interrupting, so for the uncertainty event of I/O type, particularly MMIO, need to record the information such as time point at kernel, notice QEMU carries out the intercepting and capturing of data, and event is supplemented complete after stored in journal file.
After having recorded, system normal process exits reason, and final system enters non-root mode to be continued to run.
Preferred as technique scheme, the information of the uncertainty event that target virtual machine is right is carried out playback and is comprised:
If uncertainty event is time uncertainty event, the time point information that target virtual machine occurs according to uncertainty event and interrupt type, inject target virtual machine by uncertainty event;
If uncertainty event is data uncertainty event, the time point information of the generation of uncertainty event and data message add in the region of memory on target virtual machine by target virtual machine.
Core for the playback of the information of uncertainty event is: according to the information of the uncertainty event received, and resets to the information of uncertainty event, ensures the complete errorless reproduction of system mode.
First, playback instructions is sent by QEMU, the all external interrupt of interior nuclear screening of notification target virtual machine, to prevent the new uncertainty event interference playback procedure produced, then the kernel initialization CPU of target virtual machine is arranged, the mainly registration work of kernel notification chain, after completing initial work, kernel carries out coupling work according to the time point information obtained, then classify according to different events, playback work is jointly completed by kernel and QEMU, if record the information of multiple uncertainty event, then again obtain the information of uncertainty event, carry out next round playback, if do not remain the information of uncertainty event, then reset, the no longer controlled execution of target virtual machine.
In order to be inserted in the command sequence of target virtual machine by event exactly, the most important condition when time point mates completely, to stop target virtual machine running, under target virtual machine is withdrawn into root mode.
Time point matching algorithm is as follows: suppose that the uncertainty event that current process completes is A, next uncertainty event is B, B.BC represents that the branch instruction number that B event is corresponding, B.EIP represent the value of the EIP register that B event is corresponding, and B.ECX represents the value of the ECX register that B event is corresponding.
First the branch instruction number difference between twice uncertainty event A, B is calculated, identical with the target virtual machine operational effect of recording process owing to resetting, so from after event A performs secondary branch, can the branch instruction number of match event B.Then, target virtual machine continues to run, until the value of current EIP register equals B.EIP.Finally, when the value that target virtual machine continues to move to current ECX register equals event B.ECX, time point coupling terminates.
Concrete:
1) branch instruction number matches method
Because performance counter operates in target virtual machine, in normal course of operation, accurately cannot learn the numerical value of counter, the exact matching of branch instruction number cannot be carried out.
But, performance counter be one 40 without sign register, when the value of register exceedes the greatest measure that can record, will register spilling be there is, P6 architecture is that performance counter overflows the special interruption of event definition one, and permission system processes spilling event.The die notification chain(necrology chain of utility counter overflow and linux kernel herein) mechanism carries out branch instruction number matches.
2) EIP register mapping method
The matching process of EIP is relatively simple, the mode arranging breakpoint that make use of the use of software debugging field herein realizes, employ the DR0-Dr7 debug registers in operating system, the linear address of store breakpoint is responsible for by DR0-DR3 register wherein, the value of the EIP namely in this process, DR7 register is debug control registers, be responsible for controlling each register whether can use, breakpoint length etc., after corresponding positions in DR7 register is arranged, target virtual machine can continue to run, once the value of EIP register equals the value set in DR register, destination virtual chance produces due to exception and exits (VMExit) operation, now start the matching process of ECX.
3) ECX register mapping method
If after EIP has mated, the value of ECX is not equal to event B.ECX, the value of ECX register is needed to be set to ECX=ECX-B.ECX, then the mode operational objective virtual machine of single step run is adopted, until the value of ECX register is decremented to 0, this illustrates that rep prefix instruction has just in time run B.ECX time, and so far case point coupling terminates completely, namely have found the correct time point of insertion event.After uncertainty event has been inserted, need the value of ECX to be set to B.ECX, can ensure that the follow-up repetitive process of rep prefix instruction can continue execution and go down like this.
Time uncertainty event playback method: the playback for time uncertainty event is relatively simple, only need after time point has mated, be injected into target virtual machine, what unique needs were distinguished is different interrupt number differences of interrupting correspondence, only need in virtual machine kernel, by the vector number interrupted, interrupt the VM_ENTER_INTR_INFO_FIELD of information write VMCS (Virtual Machine Control Structure) such as significance bit, when target virtual machine is withdrawn into root mode, automatically the content in this region can be read, thus acquisition needs interrupting information to be processed, and the interrupt processing function of invocation target VME operating system processes.
Data uncertainty event playback method: the playback method more complicated of data uncertainty event, for the data of PIO mode, the data of record are needed to only include single character, in playback procedure, by I/O interrupt playback, target virtual machine process I/O is interrupted, trigger I/O operation, this operation is intercepted and captured by the kernel of target virtual machine, and the character we being stored in advance QEMU reads target virtual machine region of memory, completes the playback procedure of standard I/O operation.What MMIO mode read is multibyte data, so need to carry out digital independent control by the byte number recorded, its operation principle and PIO are substantially identical, do not do superfluous stating at this.
The structural representation of the virtual machine (vm) migration system based on KVM that Fig. 2 provides for further embodiment of this invention, as shown in Figure 2, present embodiments provides a kind of virtual machine (vm) migration system based on KVM, comprising: source virtual machine 21 and target virtual machine 22;
Source virtual machine 21 for, the CPU register of source virtual machine 21 and memory information are synchronized to target virtual machine 22, and the information of uncertainty event that record occurs after CPU register and memory information are synchronized to target virtual machine 22; The first move instruction that receiving target virtual machine 22 sends, is sent to target virtual machine 22 according to the first move instruction by the information of the uncertainty event not being sent to target virtual machine 22 before receiving the first move instruction; The second move instruction that receiving target virtual machine 22 sends, is sent to target virtual machine according to the second move instruction by the information of the uncertainty event that source virtual machine 21 does not transmit;
Target virtual machine 22 for, receive the synchronous CPU register of source virtual machine 21 and memory information, the first move instruction is sent to source virtual machine 21, receive the uncertainty event that source virtual machine 21 transmits according to the first move instruction, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result is for being greater than, then the information of received uncertainty event is reset, to upgrade CPU register current on target virtual machine 22 and memory information, and resend the first move instruction to source virtual machine 21, with the first move instruction making source virtual machine 21 continue receiving target virtual machine 22 transmission, iteration carries out uncertainty event record, transmission and playback, if judged result is for being less than or equal to, then indicate source virtual machine 21 out of service and send the second move instruction to source virtual machine 21, to indicate source virtual machine 21, the information of the uncertainty event not being sent to target virtual machine 22 before receiving the second move instruction is sent to target virtual machine 22, the information of the uncertainty event that target virtual machine 22 pairs of source virtual machines 21 transmit according to the second move instruction is reset, to upgrade system mode current on target virtual machine 22, then replace source virtual machine 21 and bring into operation.
The virtual machine (vm) migration system based on KVM that the present embodiment provides; comprise source virtual machine and target virtual machine; by target virtual machine, replay operations is carried out to the information of the uncertainty event of source virtual machine; and when the number of the information when the uncertainty event transmitted is less than or equal to predetermined number threshold value; source virtual machine is shut down; the information of the uncertainty event do not transmitted before is transmitted, thus completes the migration of virtual machine.The virtual machine migration method based on KVM that the present embodiment technical scheme provides and system, the information of uncertain time being carried out transmitting and resetting replaces internal memory iteration copy method of the prior art can reduce transmission data volume greatly, reduces the iteration delivery time in transition process.Concrete online migration flow process is identical with the virtual machine migration method based on KVM in above-described embodiment, and idiographic flow, see the virtual machine migration method flow process based on KVM of above-described embodiment, does not repeat them here.
Preferred as technique scheme, virtual machine 21 also for, before the CPU register of source virtual machine 21 and memory information are synchronized to target virtual machine 22, receive migration instruction; Migration request is sent to target virtual machine 22 according to migration instruction, and the migration confirmation that receiving target virtual machine 22 returns according to migration request;
Target virtual machine 22 also for, receiving the migration request that source virtual machine 21 sends, judging whether to meet transition condition according to migration request, and when judged result is for meeting to source virtual machine 21 remigration confirmation;
Source virtual machine 21 is specifically for according to migration confirmation, and just the CPU register of source virtual machine 21 and memory information are synchronized to target virtual machine 22.
Preferred as technique scheme, target virtual machine 22 also for, the information of the uncertainty event that source virtual machine 21 transmits according to the second move instruction is reset, after upgrading system mode current on target virtual machine 22, sends migration to source virtual machine 21 and complete information.
Preferred as technique scheme, the information that source virtual machine 21 records the uncertainty event occurred comprises:
If source virtual machine 21 is withdrawn into root mode specifically for the operating system of source virtual machine 21, judging whether uncertainty event occurs, if judged result is for occurring, then judging the type of uncertainty event:
If judge that uncertainty event is time uncertainty event, then record time point information and the interrupt type of uncertainty event generation; If judge that uncertainty event is data uncertainty event, then record time point information and the data message of the generation of uncertainty event.
One of ordinary skill in the art will appreciate that: all or part of step realizing above-mentioned each embodiment of the method can have been come by the hardware that program command is relevant.Aforesaid program can be stored in a computer read/write memory medium.This program, when performing, performs the step comprising above-mentioned each embodiment of the method; And aforesaid storage medium comprises: ROM, RAM, magnetic disc or CD etc. various can be program code stored medium.
Last it is noted that above each embodiment is only in order to illustrate technical scheme of the present invention, be not intended to limit; Although with reference to foregoing embodiments to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein some or all of technical characteristic; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the scope of various embodiments of the present invention technical scheme.

Claims (8)

1. based on a virtual machine migration method of KVM, it is characterized in that, comprising:
The CPU register of described source virtual machine and memory information are synchronized to target virtual machine by source virtual machine, and record the information of the uncertainty event of generation after described CPU register and memory information are synchronized to described target virtual machine;
Described source virtual machine receives the first move instruction that described target virtual machine sends, and according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine;
Described target virtual machine receives the information of the uncertainty event that described source virtual machine transmits, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result is for being greater than, then the information of received uncertainty event is reset, to upgrade the system mode of described target virtual machine, and resend described first move instruction to described source virtual machine, described first move instruction receiving the transmission of described target virtual machine is continued to make described source virtual machine, according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine,
If judged result is for being less than or equal to, then described target virtual machine indicates described source virtual machine out of service and sends the second move instruction to described source virtual machine, to indicate described source virtual machine, the information not being sent to the uncertainty event of described target virtual machine before receiving described second move instruction is sent to described target virtual machine; The information of described target virtual machine to the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, and to upgrade the system mode of described target virtual machine, then replaces described source virtual machine and brings into operation;
Described source virtual machine comprises before the CPU register of described source virtual machine and memory information are synchronized to target virtual machine:
Described source virtual machine receives migration instruction;
Described source virtual machine sends migration request according to described migration instruction to described target virtual machine;
Described target virtual machine judges whether to meet transition condition according to described migration request, if met, remigration confirmation is to described source virtual machine;
The CPU register of described source virtual machine and memory information are synchronized to target virtual machine and comprise by described source virtual machine:
The CPU register of described source virtual machine and memory information, according to described migration confirmation, are synchronized to described target virtual machine by described source virtual machine.
2. the virtual machine migration method based on KVM according to claim 1, it is characterized in that, the information of described target virtual machine to the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, and comprises after upgrading system mode current on described target virtual machine:
Described target virtual machine sends migration to described source virtual machine and completes information.
3. the virtual machine migration method based on KVM according to claim 1, is characterized in that, the information of the uncertainty event that described source virtual machine record occurs comprises:
If the operating system of described source virtual machine is withdrawn into root mode, then judging whether uncertainty event occurs, if judged result is for occurring, then judging the type of described uncertainty event:
If judge that described uncertainty event is time uncertainty event, then record time point information and the interrupt type of described uncertainty event generation;
If judge that described uncertainty event is data uncertainty event, then record time point information and the data message of described uncertainty event generation.
4. the virtual machine migration method based on KVM according to claim 3, is characterized in that, described time uncertainty event comprises time interruption and/or I/O interrupts;
Described data uncertainty event comprises programmable I/O and memory-mapped I/O.
5. the virtual machine migration method based on KVM according to claim 3, is characterized in that, described target virtual machine carries out playback to the information of described uncertainty event and comprises:
If described uncertainty event is time uncertainty event, the time point information that described target virtual machine occurs according to described uncertainty event and interrupt type, inject described target virtual machine by described uncertainty event;
If described uncertainty event is data uncertainty event, the time point information of the generation of described uncertainty event and data message add in the region of memory on described target virtual machine by described target virtual machine.
6. based on a virtual machine (vm) migration system of KVM, it is characterized in that, comprising: source virtual machine and target virtual machine;
Described source virtual machine is used for, and the CPU register of described source virtual machine and memory information are synchronized to described target virtual machine, and records the information of the uncertainty event of generation after described CPU register and memory information are synchronized to described target virtual machine; Receive the first move instruction that described target virtual machine sends, according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine; Receive the second move instruction that described target virtual machine sends, according to described second move instruction, the information of the uncertainty event that described source virtual machine does not transmit is sent to described target virtual machine;
Described target virtual machine is used for, receive the synchronous CPU register of described source virtual machine and memory information, the first move instruction is sent to described source virtual machine, receive the information of the uncertainty event that described source virtual machine transmits according to described first move instruction, and whether the number of information of uncertainty event received by judging is greater than predetermined number threshold value, if judged result is for being greater than, then the information of received uncertainty event is reset, to upgrade the system mode on described target virtual machine, and resend described first move instruction to described source virtual machine, continue to make described source virtual machine to receive described first move instruction, according to described first move instruction, the information not being sent to the uncertainty event of described target virtual machine before receiving described first move instruction is sent to described target virtual machine, if judged result is for being less than or equal to, then described target virtual machine indicates described source virtual machine out of service and sends the second move instruction to described source virtual machine, to indicate described source virtual machine, the information not being sent to the uncertainty event of described target virtual machine before receiving described second move instruction is sent to described target virtual machine, the information of described target virtual machine to the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, and to upgrade system mode current on described target virtual machine, then replaces described source virtual machine and brings into operation,
Described source virtual machine also for, described the CPU register of source virtual machine and memory information be synchronized to described target virtual machine before receive migration instruction; Send migration request according to described migration instruction to described target virtual machine, and receive the migration confirmation that described target virtual machine returns according to described migration request;
Described target virtual machine also for, receiving the described migration request that described source virtual machine sends, judging whether to meet transition condition according to described migration request, and when judged result is for meeting to described source virtual machine remigration confirmation;
The CPU register of source virtual machine and memory information, specifically for according to described migration confirmation, are synchronized to described target virtual machine by described by described source virtual machine.
7. the virtual machine (vm) migration system based on KVM according to claim 6, it is characterized in that, described target virtual machine also for, the information of the uncertainty event that described source virtual machine transmits according to described second move instruction is reset, after upgrading system mode current on described target virtual machine, send migration to described source virtual machine and complete information.
8. the virtual machine (vm) migration system based on KVM according to claim 6, is characterized in that, the information of the uncertainty event that described source virtual machine record occurs comprises:
If described source virtual machine is withdrawn into root mode specifically for the operating system of described source virtual machine, judge whether uncertainty event occurs, if judged result is for occurring, then judge the type of described uncertainty event, if judge that described uncertainty event is time uncertainty event, then record time point information and the interrupt type of described uncertainty event generation; If judge that described uncertainty event is data uncertainty event, then record time point information and the data message of the generation of described uncertainty event.
CN201210477637.0A 2012-11-21 2012-11-21 Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM Active CN103036947B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210477637.0A CN103036947B (en) 2012-11-21 2012-11-21 Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210477637.0A CN103036947B (en) 2012-11-21 2012-11-21 Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM

Publications (2)

Publication Number Publication Date
CN103036947A CN103036947A (en) 2013-04-10
CN103036947B true CN103036947B (en) 2015-05-20

Family

ID=48023419

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210477637.0A Active CN103036947B (en) 2012-11-21 2012-11-21 Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM

Country Status (1)

Country Link
CN (1) CN103036947B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853598B (en) * 2014-02-21 2017-03-01 北京神舟航天软件技术有限公司 Realize embedded type virtual machine strong when virtual timer response method
CN106201564B (en) 2015-05-07 2019-08-23 阿里巴巴集团控股有限公司 Device and method of the online upgrading based on kernel virtual machine module
WO2018176393A1 (en) * 2017-03-31 2018-10-04 Intel Corporation Techniques for virtual machine transfer and resource management
CN109522088A (en) * 2018-09-30 2019-03-26 华为技术有限公司 A kind of virtual machine migration method and device
CN110941476B (en) * 2019-11-14 2023-01-24 济南浪潮数据技术有限公司 Control method, control device and control equipment for virtual machine live migration
CN114968469A (en) * 2021-02-23 2022-08-30 澜起电子科技(昆山)有限公司 Method and device for live migration of virtual machine

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191440B2 (en) * 2001-08-15 2007-03-13 Intel Corporation Tracking operating system process and thread execution and virtual machine execution in hardware or in a virtual machine monitor
CN102073556A (en) * 2010-12-08 2011-05-25 北京航空航天大学 Hot backup and restoration method, equipment and system for virtual machine

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191440B2 (en) * 2001-08-15 2007-03-13 Intel Corporation Tracking operating system process and thread execution and virtual machine execution in hardware or in a virtual machine monitor
CN102073556A (en) * 2010-12-08 2011-05-25 北京航空航天大学 Hot backup and restoration method, equipment and system for virtual machine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于内存混合复制方式的虚拟机在线迁移机制;陈阳等;《计算机学报》;20111231;第34卷(第12期);第1-3节 *

Also Published As

Publication number Publication date
CN103036947A (en) 2013-04-10

Similar Documents

Publication Publication Date Title
CN103036947B (en) Virtual machine transferring method based on kernel-based virtual machine (KVM) and virtual machine transferring method based on KVM
CN102597958B (en) Symmetric live migration of virtual machines
TWI410864B (en) Controlling instruction execution in a processing environment
CN104965757A (en) Virtual machine live migration method, virtual machine migration management apparatus, and virtual machine live migration system
US10360322B2 (en) Simulation of virtual processors
US20150331689A1 (en) Virtualized software build system
CN102073556B (en) Hot backup and restoration method, equipment and system for virtual machine
US10095611B1 (en) Methodology for unit test and regression framework
EP3311272B1 (en) A method of live migration
CN102799465B (en) Virtual interrupt management method and device of distributed virtual system
CN102880482A (en) System and technical method of automatically updating software in host batch control virtual machine
CN111679889B (en) Conversion migration method and system of virtual machine
CN103559087A (en) Interrupt realization method between virtual processors, relevant device and system
CN111026510A (en) Cross-storage thermal migration method for virtual machine in cloud environment
CN106598698B (en) Accelerate the method and system of virtual machine batch starting based on migration pattern
JP2023545818A (en) Chip system, virtual interrupt handling method and corresponding device
KR20200139083A (en) Systems and methods for simulated device testing using a memory-based communication protocol
CN105760218A (en) Online migration method and device for virtual machine
CN110516447A (en) A kind of method and apparatus of identification terminal simulator
CN112328365A (en) Virtual machine migration method, device, equipment and storage medium
CN105453033A (en) Program testing service
CN112764981B (en) Cooperative testing system and method
EP2672388B1 (en) Multi-processor parallel simulation method, system and scheduler
EP3316518A1 (en) Method and device for upgrading virtual network element, and computer storage medium
CN106033368B (en) A kind of method of multi-core virtual machine Deterministic Replay

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant