CN103036947A - 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
CN103036947A
CN103036947A CN2012104776370A CN201210477637A CN103036947A CN 103036947 A CN103036947 A CN 103036947A CN 2012104776370 A CN2012104776370 A CN 2012104776370A CN 201210477637 A CN201210477637 A CN 201210477637A CN 103036947 A CN103036947 A CN 103036947A
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.)
Granted
Application number
CN2012104776370A
Other languages
Chinese (zh)
Other versions
CN103036947B (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

Images

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

Virtual machine migration method and system based on KVM
Technical field
The present invention relates to the communications field, relate in particular to a kind of virtual machine migration method based on KVM and system.
Background technology
Based on KVM(Kernel-based Virtual Machine) the virtual machine application study extensive, virtual machine (vm) migration refers to, with operating in a virtual machine on the physical machine, by certain technological means, make it continue the technology that operation is got up in another physical machine.It is two classes that the virtual machine (vm) migration technology is divided into: off-line migration and online migration.Off-line migration refers in the situation that close virtual machine, use file transfer software with the synchronous driving of virtual machine to other machine, then start virtual machine at corresponding machine.Online migration refers to complete the preserving of running status with whole virtual machine, can return to fast on original hardware platform or even the different hardware platforms simultaneously.After the recovery, virtual machine is smoothness run still, and the user can not perceive any difference, because this method can keep professional continuity, so become gradually study hotspot.
Prior art is the moving method by the pre-copy internal memory usually, this moving method is to finish by the page that the iteration copy was revised on last stage, although the realization technology is simple, require lower to application scenarios, but write under the intensive scene at internal memory, especially when the speed of writing the page during greater than transfer rate, need the data volume that transmits large, the iteration delivery time in the 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 in order to reduce, and reduces the iteration delivery time in the transition process.
The invention provides a kind of virtual machine migration method based on KVM, comprising:
Source virtual machine is synchronized to the target virtual machine with CPU register and the memory information of described source virtual machine, and the information of the uncertainty event that record occurs 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 the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the first move instruction is sent to described target virtual machine;
Described target virtual machine receives the information of the uncertainty event of described source virtual machine transmission, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result be greater than, then the information of received uncertainty event is reset, to upgrade current system mode on the described target virtual machine, and resend described the first move instruction to described source virtual machine, so that described source virtual machine continues to receive described the first move instruction that described target virtual machine sends, iteration is carried out the 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 send the second move instruction to described source virtual machine, is sent to described target virtual machine with the information of indicating described source virtual machine will not to be sent to the uncertainty event of described target virtual machine before receiving described the second move instruction; Described target virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission to described source virtual machine, to upgrade current system mode on the described target virtual machine, then replaces described source virtual machine and brings into operation.
The present invention also provides 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 CPU register and the memory information of described source virtual machine is synchronized to described target virtual machine, and the information of the uncertainty event that record occurs 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, the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the first move instruction is sent to described target virtual machine; Receive the second move instruction that described target virtual machine sends, according to described the second move instruction the information of the uncertainty event that do not transmit on the described source virtual machine is sent to described target virtual machine, and stops the operation of described source virtual machine;
Described target virtual machine is used for, receive described source virtual machine synchronous CPU register and memory information, send the first move instruction to described source virtual machine, receive described source virtual machine according to the information of the uncertainty event of described the first move instruction transmission, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result be greater than, then the information of received uncertainty event is reset, to upgrade current system mode on the described target virtual machine, and resend described the first move instruction to described source virtual machine, so that described source virtual machine continues to receive described the first move instruction, the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the 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 send the second move instruction to described source virtual machine, is sent to described target virtual machine with the information of indicating described source virtual machine will not to be sent to the uncertainty event of described target virtual machine before receiving described the second move instruction; Described target virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission to described source virtual machine, to upgrade current system mode on the described target virtual machine, then replaces described source virtual machine and brings into operation.
Virtual machine migration method and system based on KVM provided by the invention; by the target virtual machine information of the uncertainty event of source virtual machine is carried out replay operations; and when the number of the information of the uncertainty event that transmits during less than or equal to default number threshold value; source virtual machine is shut down; the information of the uncertainty event that do not transmit is before transmitted, thereby finish the migration of virtual machine.Virtual machine migration method and system based on KVM that technical solution of the present invention provides, the information of uncertain time transmitted and reset replace internal memory iteration copy method of the prior art can reduce greatly the transmission data volume, reduce the iteration delivery time in the transition process.
Description of drawings
The schematic flow sheet based on the virtual machine migration method of KVM that Fig. 1 provides for one embodiment of the invention;
The structural representation based on the virtual machine (vm) migration system of KVM that Fig. 2 provides for further embodiment of this invention.
Embodiment
The schematic flow sheet based on the virtual machine migration method of KVM that Fig. 1 provides for one embodiment of the invention, as shown in Figure 1, the present embodiment provides a kind of virtual machine migration method based on KVM, along with the development of cloud computing and deeply, obtained the extensive concern of industrial circle and academia as the Intel Virtualization Technology of one of main support technology, virtually can make a physical machine move a plurality of virtual machine instance, improve the utilance of the parts such as CPU, have the outstanding characteristics such as encapsulation property, isolation.The method comprises:
Step 11: source virtual machine is synchronized to the target virtual machine with CPU register and the memory information of source virtual machine, and the information of the uncertainty event that record occurs after CPU register and memory information are synchronized to the target virtual machine.Source virtual machine and target virtual machine initialization migration scene, start transition process, source virtual machine is synchronized to the target virtual machine with CPU register and the memory information of source virtual machine, the target virtual machine is preserved CPU register and the memory information of source virtual machine, source virtual machine continues operation, and begins to record the information of the uncertainty event that occurs.
Step 12: the first move instruction that source virtual machine receiving target virtual machine sends, the information that will not be sent to the uncertainty event of target virtual machine according to the first move instruction before receiving the first move instruction is sent to the target virtual machine.After the first move instruction that source virtual machine receiving target virtual machine sends, will record the virtual machine uncertainty event and be transmitted through the network to the target virtual machine.To be the target virtual machine send after CPU register and memory information are finished synchronously in the first move instruction, purpose is the target virtual machine after CPU register and memory information are finished synchronously, and continuation will be reset at the virtual pusher side of target in the uncertainty event that source virtual machine occurs.
Step 13: the information of the uncertainty event that target virtual machine reception sources virtual machine transmits, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result is greater than execution in step 14, if judged result is for being less than or equal to, then execution in step 15.
Step 14: the information to received uncertainty event is reset, with current system mode on the fresh target virtual machine more, and resend the first move instruction to source virtual machine, so that source virtual machine continues the first move instruction that the receiving target virtual machine sends, the information that will not be sent to the uncertainty event of target virtual machine according to the first move instruction before receiving the first move instruction is sent to the target virtual machine.The information of the uncertainty event that source virtual machine occurs goes on record, and is sent to the target virtual machine by network, and the target virtual machine carries out playback work, finishes the 1st playback.In the transmission and playback processing procedure of the 1st uncertain time, can produce new uncertainty event again, need to carry out iterative process the 2nd time, transmission and resetting is processed in the 2nd iterative process is the uncertainty event that produces in the 1st iterative process.The rest may be inferred, and the uncertainty event that produces in the n time iterative process need to be transmitted and process to the n+1 time iterative process.Execution of step 14 need to turn execution in step 12 again.
Step 15: if judged result is for being less than or equal to, then target virtual machine indication source virtual machine is out of service and send the second move instruction to source virtual machine, and the information that will not be sent to the uncertainty event of target virtual machine with the indication source virtual machine before receiving the second move instruction is sent to the target virtual machine.After having carried out several times iteration copy procedure, the minimizing of amount of information along with the uncertainty event of record, when the number of the information of uncertainty event is less than or equal to default number threshold value, stop the operation of source virtual machine, and indication source virtual machine (i.e. the second transfer instruction) with on the source virtual machine not the information of uncertainty event of transmission all be sent to the target virtual machine.Source virtual machine all is sent to the target virtual machine according to the information of the uncertainty event that the indication of target virtual machine will not yet transmit, and continues execution in step 16.
Step 16: the target virtual machine is reset to the information of the uncertainty event that source virtual machine transmits according to the second move instruction, with current system mode on the fresh target virtual machine more, then replaces source virtual machine and brings into operation.At the source virtual machine operation-stopping stage, after the information playback of the uncertainty event that the target virtual machine will transmit is not before finished, the target virtual machine sends migration to source virtual machine and finishes information, and the target virtual machine replaces source virtual machine and brings into operation, and finishes whole virtual machine (vm) migration process.
Wherein, the first move instruction described in the present embodiment is that uncertainty event is used in the process of iteration copy, and the second move instruction is the operation for the 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 the target virtual machine information of the uncertainty event of source virtual machine is carried out replay operations; and when the number of the information of the uncertainty event that transmits during less than or equal to default number threshold value; source virtual machine is shut down; the information of the uncertainty event that do not transmit is before transmitted, thereby finish 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 transmitted and reset replace internal memory iteration copy method of the prior art can reduce greatly the transmission data volume, reduce the iteration delivery time in the transition process.
The present embodiment mainly uses the record reproducing technology in the virtual machine (vm) migration process, and the core concept of record reproducing technology is that the program implementation process record is got off, and carries out the again execution of indifference at other times, other equipment.The method of record reproducing can be divided into following a few class: for the recording and reproducing system of application program, need the amount of information of record minimum, the most lightweight; The record reproducing technology of oriented manipulation system, whole uncertainty events of needs record whole system, the characteristics of record are to contain much information, and are the most comprehensive, but performance cost is larger; Development along with Intel Virtualization Technology, the object of record reproducing turns to virtual machine, by in virtual machine monitor layer, can obtain the uncertainty event of whole dummy machine system, the data volume that guarantees simultaneously record is unlikely to excessive, is the outstanding playback of recorded method of a kind of comprehensive comparison.
The record reproducing technology not only can be used for Intrusion analysis and software debugging aspect, by the implementation of record source virtual machine, and carries out indifference at the target virtual machine and resets, and becomes a kind of new method that realizes the online shift function of virtual machine.The record reproducing technology is introduced virtual machine real-time migration field, adopt the uncertain information that systematic order is carried out that affects that produces in the record virtual machine implementation, by the method for determining at the target virtual machine to reset, the target virtual machine is generated and the identical system mode of source virtual machine automatically.Said method replaces the legacy migration method of memory copying, can satisfy the online requirement of moving of virtual machine at space consuming and time loss, shortens downtime and the gross migration time of the online migration of virtual machine.
Preferred as technique scheme, virtual CPU register and the memory information with source virtual machine in source comprises before being synchronized to the target virtual machine:
Source virtual machine receives the migration instruction;
Source virtual machine sends migration request according to the migration instruction to the target virtual machine;
The target virtual machine judges whether to satisfy transition condition according to migration request, and if satisfied the remigration confirmation to source virtual machine;
Source virtual machine is synchronized to the target virtual machine with the CPU register of source virtual machine and memory information and comprises:
Source virtual machine is synchronized to the target virtual machine according to the migration confirmation with CPU register and the memory information of source virtual machine.
Above-mentioned migration instruction can be sent for the user, also can be source virtual machine because the change of certain network state or equipment state and then trigger the migration instruction that generates, but be not limited to above-mentioned enumerating.Migration instruction in the present embodiment is sent as example with the user, after the migration instruction that source virtual machine reception user sends, source virtual machine sends migration request to the target virtual machine, and require the target virtual machine to judge whether to satisfy transition condition, after the judgement of target resources of virtual machine is finished, send judged result to source virtual machine, source virtual machine is according to result's difference, selection begins migration or moves unsuccessfully, concrete, and if satisfied the remigration confirmation to source virtual machine, if do not satisfy, then move unsuccessfully, do not carry out the virtual machine (vm) migration operation.
Preferred as technique scheme, the method that the present embodiment provides also comprises: the information of the uncertainty event that the target virtual machine transmits according to the second move instruction source virtual machine in the step 16 is reset, to comprise after CPU register current on the fresh target virtual machine more and the memory information:
The target virtual machine sends migration to source virtual machine and finishes information.
The virtual machine migration method based on KVM that the present embodiment provides, transition process comprise 3 stages:
In the preparatory stage of migration beginning, the Socket that sets up two ends connects, and source virtual machine inquiry target resources of virtual machine operating position 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 the target virtual machine, resets for the target virtual machine.Simultaneously, the target virtual machine is according to playback progress situation, and the notification source virtual machine carries out the next iteration copy or suspends the transmission of data.
Shut down the copy stage, the target virtual machine receives the instruction of resetting and finishing, and disconnects and communicating by letter with the Socket of source virtual machine, represents that whole transition process finishes.
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 judge whether to occur uncertainty event, if judged result is generation, then judge the type of uncertainty event:
Be the time uncertainty event if judge uncertainty event, then record time point information and interrupt type that uncertainty event occurs.The time uncertainty event is: in virtual machine, the time uncertainty event refers to that in twice running, the event that time of origin is different, this class event are generally initiated by monitor of virtual machine, and for example uncertainty event comprises the time, and clock interrupts and/or I/O interrupts.Time point is one of most important information for the playback uncertain time provides accurate positional information, so must be at the time point information of accurately recording events generation of record stage.For the accurate position of description event in running, time point must have dullness, unique, reusable characteristics.Traditional clock time easily is subject to the interference of external environment, can not use as precise time point the time point that " tlv triple " that the register that this paper choice for use do as one likes can counter, instruction pointer and the instruction of sign prefix need to be carried out number of times consists of occurs as uncertainty event.
In virtual machine, the time uncertainty event includes only the clock interruption and I/O interrupts.For clock interrupted, the virtual machine kernel module was responsible for safeguarding clock source, regularly injected clock to the target virtual machine and interrupted, before clock interrupts injecting, interruption injection function in kernel inserts time point and obtains function, can obtain the correct time point that the clock interruption is injected into.
Interrupt for I/O, need to interrupt intercepting and capturing at the virtual machine kernel.The KVM virtual machine is divided into two parts: virtual machine kernel module and user's attitude process QEMU(simulator a kind of provides the functions such as user interactions for KVM), wherein the major function of QEMU is to be responsible for the external equipments such as simulating keyboard, network interface card, and communicates with kernel.When the I/O operation occurs, the peripheral hardware of QEMU simulation will trigger interruption, and by the IOCTLI/O control command, with the interrupt notification kernel, kernel is intercepted and captured this interruption, transmits by virtual interrupt control unit, final by interrupting injection function, this interruption is injected in the target virtual machine.Similar with the clock interruption, before this hardware interrupts is injected, insert time point and obtain function, can obtain the correct time point that the I/O interruption is injected into.
Be the data uncertainty event if judge uncertainty event, then record time point information and the data message of the generation of uncertainty event.The data uncertainty event is: in twice running of target virtual machine, even time of origin is identical, and the event that the data result that obtains also may be different, for example the data uncertainty event comprises programmable I/O and memory-mapped I/O.
For the data uncertainty event, need its data message of record and time dot information.Data uncertainty event in the virtual machine mainly refers to the uncertain result that the I/O operation is returned, and comprises the input operation of the external equipments such as keyboard, mouse and network interface card.
I/O operation mainly is divided into two classes: programmable I/O(PIO) and/or memory-mapped I/O (MMIO).The equipment simulating of virtual machine is all finished by QEMU, be responsible for preparing data by QEMU, kernel is responsible for injecting interruption to virtual machine, so uncertainty event for the I/O type, MMIO particularly, need to record at kernel the information such as time point, notice QEMU carries out the intercepting and capturing of data, and deposits journal file in after event is additional complete.
After record was finished, system's normal process withdrawed from reason, and final system enters non-root mode and continues operation.
Preferred as technique scheme, the information of the uncertainty event that the target virtual machine is right is reset and is comprised:
If uncertainty event is the time uncertainty event, the target virtual machine injects the target virtual machine according to time point information and interrupt type that uncertainty event occurs with uncertainty event;
If uncertainty event is the data uncertainty event, the target virtual machine adds the time point information of the generation of uncertainty event and data message in the region of memory on the target virtual machine to.
Core for the playback of the information of uncertainty event is: according to the information of the uncertainty event that receives, the information of uncertainty event is reset, guarantee the complete errorless reproduction of system mode.
At first, send playback instructions by QEMU, all external interrupt of interior nuclear screening of notification target virtual machine, disturb playback procedure to prevent the new uncertainty event that produces, then the kernel initialization CPU of target virtual machine arranges, mainly be the registration work of kernel notification chain, finish after the initial work, kernel carries out coupling work according to the time point information that obtains, then according to different event classification, jointly finish playback work by kernel and QEMU, if record the information of a plurality of uncertainty events, then again obtain the information of uncertainty event, carrying out next round resets, if do not remain the information of uncertainty event, then reset and finish the no longer controlled execution of target virtual machine.
In order can exactly event to be inserted in the command sequence of target virtual machine, the most important condition is to stop the operation of target virtual machine when time point mates fully, and the target virtual machine is withdrawn under the root mode.
The time point matching algorithm is as follows: suppose that current uncertainty event of finishing dealing with is A, next uncertainty event is B, B.BC represents the branch instruction number that the B event is corresponding, and B.EIP represents the value of the EIP register that the B event is corresponding, and B.ECX represents the value of the ECX register that the B event is corresponding.
At first calculate the branch instruction number difference between uncertainty event A, the B twice because reset and the target virtual machine operational effect of recording process identical, so after event A carries out inferior branch, branch instruction number that can match event B.Then, the target virtual machine continues operation, until the value of current EIP register equals B.EIP.At last, when the value that continues to move to current ECX register when the target virtual machine equaled event B.ECX, the time point coupling finished.
Concrete:
1) branch instruction number matching process
Because performance counter operates in the target virtual machine, can't accurately learn the numerical value of counter in the normal course of operation, can't carry out the exact matching of branch instruction number.
But, performance counter be one 40 without sign register, when the value of register surpassed the greatest measure that can record, register spilling will occur, the P6 architecture is the performance counter special interruption of having overflowed event definition, and the permission system processes the event of overflowing.The die notification chain(necrology chain of this paper utility counter overflow and linux kernel) mechanism is carried out branch instruction number coupling.
2) EIP register mapping method
The matching process of EIP is relatively simple, the mode that breakpoint is set that this paper has utilized the software debugging field to use realizes, used the DR0 in the operating system-Dr7 debug registers, DR0 wherein-DR3 register is responsible for the linear address of store breakpoint, it is the value of the EIP in this process, the DR7 register is the debugging control register, whether availablely be responsible for each register of control, breakpoint length etc., after corresponding positions in the DR7 register arranged, the target virtual machine can continue operation, in case the value of EIP register equals the value set in the DR register, the target virtual machine can owing to unusually producing and withdraw from (VMExit) and operate, begin the matching process of ECX at this moment.
3) ECX register mapping method
If after the EIP coupling is finished, the value of ECX is not equal to event B.ECX, value that need to the ECX register is set to ECX=ECX-B.ECX, then adopt the mode operational objective virtual machine of single step run, until the value of ECX register is decremented to 0, the instruction of this explanation rep prefix has just in time moved B.ECX time, and so far the case point coupling finishes fully, has namely found the correct time point of the event of inserting.After uncertainty event was inserted and to be finished, value that need to ECX was set to B.ECX, can guarantee that so the follow-up repetitive process of rep prefix instruction can continue to carry out.
Time uncertainty event playback method: the playback for the time uncertainty event is relatively simple, only need to be after the time point coupling be finished, being injected into the target virtual machine gets final product, it is unique that what need to distinguish is that different to interrupt corresponding interrupt number different, only need to be in the virtual machine kernel, with the vector that interrupts number, the information such as interruption significance bit write the VM_ENTER_INTR_INFO_FIELD of VMCS (Virtual Machine Control Structure), when the target virtual machine is withdrawn into root mode, can automatically read this regional content, thereby obtaining needs interrupting information to be processed, and the interruption of invocation target VME operating system processing function is processed.
Data uncertainty event playback method: the playback method more complicated of data uncertainty event, data for the PIO mode, need the data of record to include only single character, in playback procedure, by the I/O interrupt playback, so that processing I/O, the target virtual machine interrupts, trigger the I/O operation, this operation is intercepted and captured by the kernel of target virtual machine, and the character that we is stored in advance QEMU reads target virutal machine memory zone, finishes the playback procedure of standard I/O operation.What the MMIO mode read is multibyte data, reads control so need to carry out data by the byte number of recording, and its operation principle and PIO are basic identical, do not do superfluous stating at this.
The structural representation based on the virtual machine (vm) migration system of KVM that Fig. 2 provides for further embodiment of this invention, as shown in Figure 2, the present embodiment 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 is used for, and CPU register and the memory information of source virtual machine 21 is synchronized to target virtual machine 22, and the information of the 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, the information that will not be sent to the uncertainty event of target virtual machine 22 according to the first move instruction before receiving the first move instruction is sent to target virtual machine 22; The second move instruction that receiving target virtual machine 22 sends is sent to the target virtual machine according to the second move instruction with the information of the uncertainty event that do not transmit on the source virtual machine 21;
Target virtual machine 22 is used for, CPU register and memory information that reception sources virtual machine 21 is synchronous, send the first move instruction to source virtual machine 21, the uncertainty event that reception sources virtual machine 21 transmits according to the first move instruction, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result be greater than, then the information of received uncertainty event is reset, with current CPU register and memory information on the fresh target virtual machine 22 more, and resend the first move instruction to source virtual machine 21, so that source virtual machine 21 continues the first move instruction that receiving target virtual machine 22 sends, iteration is carried out the 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, the information that will not be sent to the uncertainty event of target virtual machine 22 with indication source virtual machine 21 before receiving the second move instruction is sent to target virtual machine 22,22 pairs of source virtual machines 21 of target virtual machine are reset according to the information of the uncertainty event that the second move instruction transmits, with current system mode on the fresh target virtual machine 22 more, 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 the target virtual machine information of the uncertainty event of source virtual machine is carried out replay operations; and when the number of the information of the uncertainty event that transmits during less than or equal to default number threshold value; source virtual machine is shut down; the information of the uncertainty event that do not transmit is before transmitted, thereby finish the migration of virtual machine.Virtual machine migration method and system based on KVM that the present embodiment technical scheme provides, the information of uncertain time transmitted and reset replace internal memory iteration copy method of the prior art can reduce greatly the transmission data volume, reduce the iteration delivery time in the 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 does not repeat them here referring to the virtual machine migration method flow process based on KVM of above-described embodiment.
Preferred as technique scheme, virtual machine 21 also is used for, and receives the migration instruction before the CPU register of source virtual machine 21 and memory information are synchronized to target virtual machine 22; Send migration request according to the migration instruction to target virtual machine 22, and the migration confirmation returned according to migration request of receiving target virtual machine 22;
Target virtual machine 22 also is used for, and the migration request that reception sources virtual machine 21 sends judges whether to satisfy transition condition according to migration request, and judged result when satisfying to source virtual machine 21 remigration confirmations;
Source virtual machine 21 specifically is used for according to the 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 is used for, the information of the uncertainty event that source virtual machine 21 is transmitted according to the second move instruction is reset, and after system mode current on the fresh target virtual machine 22 more, sends migration to source virtual machine 21 and finishes information.
Preferred as technique scheme, the information of the uncertainty event that source virtual machine 21 records occur comprises:
If the source virtual machine 21 concrete operating systems that are used for source virtual machine 21 are withdrawn into root mode, judge whether to occur uncertainty event, if judged result is generation, then judge the type of uncertainty event:
Be the time uncertainty event if judge uncertainty event, then record time point information and interrupt type that uncertainty event occurs; Be the data uncertainty event if judge 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 that realizes above-mentioned each embodiment of the method can be finished by the relevant hardware of program command.Aforesaid program can be stored in the computer read/write memory medium.This program is carried out the step that comprises above-mentioned each embodiment of the method when carrying out; And aforesaid storage medium comprises: the various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above each embodiment is not intended to limit only in order to technical scheme of the present invention to be described; Although with reference to aforementioned each embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment puts down in writing, and perhaps some or all of technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the scope of various embodiments of the present invention technical scheme.

Claims (10)

1. the virtual machine migration method based on KVM is characterized in that, comprising:
Source virtual machine is synchronized to the target virtual machine with CPU register and the memory information of described source virtual machine, and the information of the uncertainty event that record occurs 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 the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the first move instruction is sent to described target virtual machine;
Described target virtual machine receives the information of the uncertainty event of described source virtual machine transmission, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result be greater than, then the information of received uncertainty event is reset, to upgrade the system mode of described target virtual machine, and resend described the first move instruction to described source virtual machine, so that described source virtual machine continues to receive described the first move instruction that described target virtual machine sends, the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the 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 send the second move instruction to described source virtual machine, is sent to described target virtual machine with the information of indicating described source virtual machine will not to be sent to the uncertainty event of described target virtual machine before receiving described the second move instruction; Described target virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission to described source virtual machine, to upgrade the system mode of described target virtual machine, then replaces described source virtual machine and brings into operation.
2. the virtual machine migration method based on KVM according to claim 1 is characterized in that, described source virtual machine comprises before the CPU register of described source virtual machine and memory information are synchronized to the target virtual machine:
Described source virtual machine receives the 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 satisfy transition condition according to described migration request, and if satisfied the remigration confirmation to described source virtual machine;
Described source virtual machine is synchronized to the target virtual machine with the CPU register of described source virtual machine and memory information and comprises:
Described source virtual machine is according to described migration confirmation, and CPU register and the memory information of described source virtual machine is synchronized to described target virtual machine.
3. the virtual machine migration method based on KVM according to claim 1 and 2, it is characterized in that, described target virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission to described source virtual machine, comprises after upgrading system mode current on the described target virtual machine:
Described target virtual machine sends migration to described source virtual machine and finishes information.
4. the virtual machine migration method based on KVM according to claim 1 and 2 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 judge whether to occur uncertainty event, if judged result is generation, then judge the type of described uncertainty event:
Be the time uncertainty event if judge described uncertainty event, then record time point information and interrupt type that described uncertainty event occurs;
Be the data uncertainty event if judge described uncertainty event, then record time point information and data message that described uncertainty event occurs.
5. the virtual machine migration method based on KVM according to claim 4 is characterized in that, described time uncertainty event comprises that the time interrupts and/or I/O interrupts;
Described data uncertainty event comprises programmable I/O and memory-mapped I/O.
6. the virtual machine migration method based on KVM according to claim 4 is characterized in that, described target virtual machine is reset to the information of described uncertainty event and comprised:
If described uncertainty event is the time uncertainty event, described target virtual machine injects described target virtual machine according to time point information and interrupt type that described uncertainty event occurs with described uncertainty event;
If described uncertainty event is the data uncertainty event, described target virtual machine adds the time point information of the generation of described uncertainty event and data message in the region of memory on the described target virtual machine to.
7. the virtual machine (vm) migration system based on KVM is characterized in that, comprising: source virtual machine and target virtual machine;
Described source virtual machine is used for, and CPU register and the memory information of described source virtual machine is synchronized to described target virtual machine, and the information of the uncertainty event that record occurs 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, the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the first move instruction is sent to described target virtual machine; Receive the second move instruction that described target virtual machine sends, according to described the second move instruction the information of the uncertainty event that do not transmit on the described source virtual machine is sent to described target virtual machine;
Described target virtual machine is used for, receive described source virtual machine synchronous CPU register and memory information, send the first move instruction to described source virtual machine, receive described source virtual machine according to the information of the uncertainty event of described the first move instruction transmission, and whether the number of information of judging received uncertainty event is greater than default number threshold value, if judged result be greater than, then the information of received uncertainty event is reset, to upgrade the system mode on the described target virtual machine, and resend described the first move instruction to described source virtual machine, so that described source virtual machine continues to receive described the first move instruction, the information that will not be sent to the uncertainty event of described target virtual machine according to described the first move instruction before receiving described the 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 send the second move instruction to described source virtual machine, is sent to described target virtual machine with the information of indicating described source virtual machine will not to be sent to the uncertainty event of described target virtual machine before receiving described the second move instruction; Described target virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission to described source virtual machine, to upgrade current system mode on the described target virtual machine, then replaces described source virtual machine and brings into operation.
8. the virtual machine (vm) migration system based on KVM according to claim 7 is characterized in that,
Described source virtual machine also is used for, and receives the migration instruction before described CPU register with source virtual machine and memory information are synchronized to described target virtual machine; 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 is used for, and receives the described migration request that described source virtual machine sends, and judges whether to satisfy transition condition according to described migration request, and judged result when satisfying to described source virtual machine remigration confirmation;
Described source virtual machine specifically is used for according to described migration confirmation, and described CPU register with source virtual machine and memory information are synchronized to described target virtual machine.
9. according to claim 7 or 8 described virtual machine (vm) migration systems based on KVM, it is characterized in that, described target virtual machine also is used for, described source virtual machine is reset according to the information of the uncertainty event of described the second move instruction transmission, to upgrade after the system mode current on the described target virtual machine, send migration to described source virtual machine and finish information.
10. according to claim 7 or 8 described virtual machine (vm) migration systems based on KVM, it is characterized in that, the information of the uncertainty event that described source virtual machine record occurs comprises:
If specifically being used for the operating system of described source virtual machine, described source virtual machine is withdrawn into root mode, judge whether to occur uncertainty event, if judged result is for occuring, then judge the type of described uncertainty event, be the time uncertainty event if judge described uncertainty event, then record time point information and interrupt type that described uncertainty event occurs; Be the data uncertainty event if judge described 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 true CN103036947A (en) 2013-04-10
CN103036947B 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)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN103853598B (en) * 2014-02-21 2017-03-01 北京神舟航天软件技术有限公司 Realize embedded type virtual machine strong when virtual timer response method
WO2018177309A1 (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
CN110941476A (en) * 2019-11-14 2020-03-31 济南浪潮数据技术有限公司 Control method, control device and control equipment for virtual machine live migration
WO2022178988A1 (en) * 2021-02-23 2022-09-01 澜起电子科技(昆山)有限公司 Method and apparatus 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
陈阳等: "基于内存混合复制方式的虚拟机在线迁移机制", 《计算机学报》 *

Cited By (10)

* 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
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN106201564B (en) * 2015-05-07 2019-08-23 阿里巴巴集团控股有限公司 Device and method of the online upgrading based on kernel virtual machine module
US10565000B2 (en) 2015-05-07 2020-02-18 Alibaba Group Holding Limited Method and apparatus for online upgrade of kernel-based virtual machine module
WO2018177309A1 (en) * 2017-03-31 2018-10-04 Intel Corporation Techniques for virtual machine transfer and resource management
US11556363B2 (en) 2017-03-31 2023-01-17 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
CN110941476A (en) * 2019-11-14 2020-03-31 济南浪潮数据技术有限公司 Control method, control device and control equipment for virtual machine live migration
CN110941476B (en) * 2019-11-14 2023-01-24 济南浪潮数据技术有限公司 Control method, control device and control equipment for virtual machine live migration
WO2022178988A1 (en) * 2021-02-23 2022-09-01 澜起电子科技(昆山)有限公司 Method and apparatus for live migration of virtual machine

Also Published As

Publication number Publication date
CN103036947B (en) 2015-05-20

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
CN102207886B (en) Virtual machine high-speed simulation is assisted
CN102597958B (en) Symmetric live migration of virtual machines
EP0300516B1 (en) Digital data processing system
CN101211289B (en) Recovery action management system and method
CN104965757A (en) Virtual machine live migration method, virtual machine migration management apparatus, and virtual machine live migration system
US20070239965A1 (en) Inter-partition communication
CN108268501A (en) Method for processing business and device in a kind of online data transition process
CN103793258A (en) Hypervisor-based server duplication system and method
JP6987340B2 (en) Database data change request processing method and equipment
EP3311272B1 (en) A method of live migration
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
CN102880482A (en) System and technical method of automatically updating software in host batch control virtual machine
EP4220394A1 (en) Chip system, method for processing virtual interrupt, and corresponding device
CN111679889B (en) Conversion migration method and system of virtual machine
CN105760218A (en) Online migration method and device for virtual machine
CN105528179A (en) System and method of transfer of control between memory locations
JP2022513382A (en) Methods, devices and computer storage media for achieving function jumps
CN104407820A (en) Solid state disk storage system based data processing method, device and system
KR920003044B1 (en) Control system for guest execution of virtual computer system
CN112764981A (en) Cooperative test system and method
US9038077B1 (en) Data transfer protection in a multi-tasking modeling environment
CN106033368B (en) A kind of method of multi-core virtual machine Deterministic Replay
CN114138424B (en) Virtual machine memory snapshot generation method and device and electronic equipment

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