The content of the invention
It is right efficiently to realize the invention provides a kind of method for realizing virtual machine (vm) migration, device and group systemVirtual machine (vm) migration simultaneously ensures the reliability service of group system.
Based on above mentioned problem, a kind of method for realizing virtual machine (vm) migration provided in an embodiment of the present invention is comprised the following steps:
The virtual machine migrated according to needed for source physical host determines, and obtain one or more virtual machines of required migrationConfiguration information, the configuration information according to the virtual machine determines virtual machine (vm) migration sequentially;
Multiple physical host resource using informations of current operation in analysis group system, by multiple physical hosts according to moneySource use information priority carries out physical host sequence;
Sorted since virtual machine (vm) migration order most preceding virtual machine, according to virtual machine (vm) migration order, sequentially heldRow multiple virtual machine (vm) migrations to target physical main frame operation, until all of virtual machine (vm) migration operate all terminate;MigratingCheng Zhong, selects the most preceding physical host of physical host collating sequence as target physical main frame, until presently described target physicalThe memory source of main frame can not meet the virutal machine memory for being currently needed for migrating and take resource or reach default horizontal redundancy barDuring part, the next physical host in selection physical host collating sequence is used as new target physical main frame.
It is preferred that as a kind of embodiment, before the determination needs the virtual machine and migration order of migration, also wrappingInclude following steps:
Heartbeat detection, the multiple physics masters run in detection group system are periodically done by IP according to the default time cycleThe running status of machine, and determine the source physical host for breaking down.
It is preferred that used as a kind of embodiment, the configuration information according to virtual machine determines virtual machine (vm) migration sequentiallySpecifically include following steps:
According to the configuration information of the virtual machine for obtaining, migration set in advance is determined whether sequentially, if, it is determined that it is emptyThe migration of plan machine order for migration set in advance sequentially;If not, it is determined that virtual machine (vm) migration order is virtual in configuration informationMachine creation time is sequentially;
The configuration information of the virtual machine includes:The size information of virutal machine memory, multiple virtual machine creating time sequencingsInformation or migration order information set in advance.
It is preferred that used as a kind of embodiment, the physical host resource using information is surplus including present physical main frameRemaining internal memory and present physical host CPU utilization rate.
Further, it is described that physical host row is carried out according to resource using information priority as a kind of embodimentSequence specifically includes following steps:
According to the size of present physical main frame free memory, descending sort is carried out;
If the magnitude difference of present physical host memory adjacent in sequence is less than default memory threshold after arrangement,According to CPU usage size, ascending order arrangement is carried out to the adjacent physical host and the physical host sequence is finally determined;
Wherein, the default memory threshold is 128M.
It is preferred that used as a kind of embodiment, the default horizontal redundancy condition is:After performing virtual machine (vm) migration20% of the free memory of target physical main frame less than the total internal memory of physical host;
The free memory size of the target physical main frame after the virtual machine (vm) migration is equal to present physical main frame free memorySize subtracts the size of the virutal machine memory for moving to the physical host.
Further, as a kind of embodiment, after the migration operation of execution multiple virtual machines, also including withLower step:
Multiple virtual machine (vm) migrations simultaneously change multiple virtual to the original running status of virtual machine after target physical main frame, is recoveredThe configuration information that machine physical host affiliated respectively changes by virtual machine (vm) migration operation.
Correspondingly, present invention also offers the device for realizing virtual machine (vm) migration, the device bag for realizing virtual machine (vm) migrationVirtual machine order module, physical host order module and migration process module are included, wherein:
The virtual machine order module, the virtual machine migrated needed for for being determined according to source physical host, and obtain requiredThe configuration information of one or more virtual machines of migration, the configuration information according to the virtual machine determines virtual machine (vm) migration sequentially;
The physical host order module, the multiple physical host resources for analyzing current operation in group system are usedMultiple physical hosts are carried out physical host sequence by information according to resource using information priority;
The migration process module, for being sorted most preceding virtual machine since virtual machine (vm) migration order, according toSequentially, order performs multiple virtual machine (vm) migrations to the operation of target physical main frame to virtual machine (vm) migration, until all of virtual machine is movedOperation is moved all to terminate;In transition process, the most preceding physical host of physical host collating sequence is selected as target physical main frame,Until presently described target physical main frame memory source can not meet be currently needed for migration virutal machine memory take resource orWhen reaching default horizontal redundancy condition, the next physical host in selection physical host collating sequence is used as new objectReason main frame.
It is preferred that used as a kind of embodiment, the device for realizing virtual machine (vm) migration also includes heart beat detection module,Wherein:
The heart beat detection module, for periodically doing heartbeat detection by IP according to the default time cycle, detects clusterThe running status of the multiple physical hosts run in system, and determine the source physical host for breaking down.
Further, as a kind of embodiment, the virtual machine order module includes judging submodule, wherein:
The judging submodule, for the configuration information according to the virtual machine for obtaining, determines whether set in advance movingShifting sequentially, if, it is determined that virtual machine (vm) migration order for migration set in advance sequentially;If not, it is determined that virtual machine (vm) migration is suitableSequence is the virtual machine creating time sequencing in configuration information;
The configuration information of the virtual machine includes:The size information of virutal machine memory, multiple virtual machine creating time sequencingsInformation or migration order information set in advance.
Further, as a kind of embodiment, the physical host order module includes physical host sequence submoduleBlock, wherein:
The physical host sorting sub-module, for the size according to present physical main frame free memory, carries out descending rowSequence;
If the magnitude difference of present physical host memory adjacent in sequence is less than default memory threshold after arrangement,According to CPU usage size, ascending order arrangement is carried out to the adjacent physical host and the physical host sequence is finally determined;
Wherein, the default memory threshold is 128M.
It is preferred that used as a kind of embodiment, the device for realizing virtual machine (vm) migration also includes recovery module, itsIn:
The recovery module, for after multiple virtual machine (vm) migrations to target physical main frame, recovering the original fortune of virtual machineRow state simultaneously changes the configuration information that multiple virtual machines physical host affiliated respectively changes by virtual machine (vm) migration operation.
Correspondingly, it is described including group system multiple physical host, each institute present invention also offers a kind of group systemStating can be provided with one or more virtual machines on physical host, the group system also includes above-mentioned virtual machine (vm) migration device;
The virtual machine (vm) migration device is used to, when source physical host breaks down, the virtual machine on the physical host of source be movedMove to target physical main frame.
Beneficial effects of the present invention include:
A kind of method for realizing virtual machine (vm) migration, device and group system that the present invention is provided, wherein method include:TrueAfter determining the virtual machine of source physical host and required migration, virtual machine (vm) migration is determined sequentially, and analyze and currently run in group systemMultiple physical host resource using informations, multiple physical hosts are carried out into physical host row according to resource using information prioritySequence;Sorted since virtual machine (vm) migration order most preceding virtual machine, according to virtual machine (vm) migration order, order performs multiple virtualMachine moves to the operation of target physical main frame, until the operation of all of virtual machine (vm) migration all terminates.The realization that the present invention is provided is emptyMethod, device and the group system that plan machine is migrated ensure virtual machine in group system on the premise of virtual machine (vm) migration reliabilityThe high efficiency and security of mirror image.
Specific embodiment
With reference to Figure of description, to the embodiment of the present invention in the methods, devices and systems for realizing virtual machine (vm) migrationSpecific embodiment illustrate.
A kind of method for realizing virtual machine (vm) migration provided in an embodiment of the present invention, the money for migrating virtual machine as neededSource occupancy situation, virtual machine is migrated under same cluster on most suitable physical host.
Fig. 1 is the method flow diagram for realizing virtual machine (vm) migration of the embodiment of the present invention.As shown in figure 1, the present embodiment is madeMethod includes following several steps:
Step S100, the virtual machine migrated according to needed for source physical host determines, and obtain one or many of required migrationThe configuration information of individual virtual machine, the configuration information according to the virtual machine determines virtual machine (vm) migration sequentially;
Multiple physical host resource using informations of current operation in step S200, analysis group system, by multiple physicsMain frame carries out physical host sequence according to resource using information priority;
Step S300, sort most preceding virtual machine since virtual machine (vm) migration order, it is suitable according to virtual machine (vm) migrationSequence, order performs multiple virtual machine (vm) migrations to the operation of target physical main frame, until the operation of all of virtual machine (vm) migration all terminates;In transition process, the most preceding physical host of physical host collating sequence is selected as target physical main frame, until presently describedThe memory source of target physical main frame can not meet the virutal machine memory for being currently needed for migrating and take resource or reach default waterDuring flat redundancy condition, the next physical host in selection physical host collating sequence is used as new target physical main frame.
In the specific implementation, above steps can be by realizing that the method for virtual machine (vm) migration, device are come for the embodiment of the present inventionComplete.Above steps is described in detail below:
It is preferred that as a kind of embodiment, before the step S100, also comprising the following steps:
Heartbeat detection, the multiple physics masters run in detection group system are periodically done by IP according to the default time cycleThe running status of machine, and determine the source physical host for breaking down.
In above-mentioned steps, heartbeat detection is done by IP, physical host periodically sends mutually inspection by heartbeat pathThe test bag of survey, if certain physical host breaks down in the multiple physical hosts for now being run in group system(Such as:FirmlyDisk, internal memory, CPU, mainboard, I/O plates and power failure), then now this physical host will not produce response(It is i.e. continuous to loseSet the detection bag of number), so then judge that this physical host breaks down, at this moment can then determine the source thing for breaking downReason main frame.
It is preferred that used as a kind of embodiment, in the step S100, the determination virtual machine (vm) migration order is specificComprise the following steps:
According to the configuration information of the virtual machine for obtaining, migration set in advance is determined whether sequentially, if, it is determined that it is emptyThe migration of plan machine order for migration set in advance sequentially;If not, it is determined that virtual machine (vm) migration order is virtual in configuration informationMachine creation time is sequentially;
The configuration information of the virtual machine includes:The size information of virutal machine memory, multiple virtual machine creating time sequencingsInformation or migration order information set in advance.
In the present invention is implemented, it is determined that after the source physical host for breaking down, which has on inquiry faulty physical main frameA little virtual machines, clearly which one or more virtual machine are to be migrated on other most suitable target physical main frames;
User can be analyzed according to the configuration information of virtual machine and learn, migration order information condition is set with userIt is lower, it is necessary to migration set in advance sequentially;Under conditions of without setting migration order, according to the virtual machine creating time(VirtuallyThe configuration information of machine)Order as virtual machine migration sequentially, wherein, virtual machine (vm) migration order for virtual machine creating whenBetween order from front to back order arrange.
It is preferred that used as a kind of embodiment, the physical host resource using information is surplus including present physical main frameRemaining internal memory and present physical host CPU utilization rate.
Further, it is described preferential according to resource using information in the step S200 as a kind of embodimentLevel carries out physical host sequence and specifically includes:
According to the size of present physical main frame free memory, descending sort is carried out;
If the magnitude difference of present physical host memory adjacent in sequence is less than default memory threshold after arrangement,According to CPU usage size, ascending order arrangement is carried out to the adjacent physical host and the physical host sequence is finally determined;
Wherein, the default memory threshold is 128M.
In above-mentioned steps, physics host resource use information is analyzed, determine the reception resources of virtual machine of physical host(MirrorPicture)Priority, perform physical host sequence, inquiry obtains the resource of the physical host of normal operation under cluster, present physicalHost CPU utilization rate, present physical main frame free memory size, first by present physical main frame free memory size as sequenceStandard, is ranked up from big to small, if memory size is more or less the same(In difference 128M), the small physical host of CPU usageRanking is preceding.
It is preferred that used as a kind of embodiment, the default horizontal redundancy condition is:After performing virtual machine (vm) migration20% of the free memory of target physical main frame less than the total internal memory of physical host;
The free memory size of the target physical main frame after the virtual machine (vm) migration is equal to present physical main frame free memorySize subtracts the size of the virutal machine memory for moving to the physical host.
Further, as a kind of embodiment, also include after the migration operation of execution multiple virtual machines withLower step:
Multiple virtual machine (vm) migrations simultaneously change multiple virtual to the original running status of virtual machine after target physical main frame, is recoveredThe configuration information that machine physical host affiliated respectively changes by virtual machine (vm) migration operation.
In above-mentioned steps S300, for example, first by the most preceding First that sorted in virtual machine (vm) migration orderVirtual machine correspondence is migrated to the most preceding target physical main frame of physical host collating sequence, is terminated in the operation of First virtual machine (vm) migrationAfterwards, if free memory of the now most preceding target physical main frame after First virtual machine (vm) migration is less than the total internal memory of the physical host20% condition when(Reach default horizontal redundancy condition)Or the memory source of most preceding target physical main frame can not meetThe virutal machine memory for being currently needed for migration takes resource, and the next physical host in selection physical host collating sequence is used as newTarget physical main frame;Continue second virtual machine (vm) migration in virtual machine (vm) migration order to new target physical main frame, thisSample repetitive sequence performs the migration operation of multiple virtual machines until the migration of all of virtual machine all terminates.
Obviously, First virtual machine target physical main frame is to arrange most preceding physical host, after the migration of this physical hostThe free memory size of target physical main frame is the memory size before the migration of this physical host(Present physical host memory it is bigIt is small)Subtract the virutal machine memory size for moving to the physical host;After First virtual machine (vm) migration, if this physical hostInternal memory meets second virutal machine memory and takes resource(While not up to default horizontal redundancy condition), then this physical hostIt is second target physical main frame of virtual machine to continue, after this physical host free memory is less than total internal memory 20%, migrationGoal displacement is next physical host, and each migration target physical main frame of virtual machine is determined by this rule;
In order to the method for realizing virtual machine (vm) migration provided in an embodiment of the present invention is better described, for an example for realityThe step of virtual machine is illustrated on realizing sequence and virtual machine (vm) migration.For example:
Following physical host and virtual machine are installed in a group system:
So, physical host sequence is carried out according to resource using information priority, the order after physical host sequence is:ThingReason main frame 3, physical host 1, physical host 2.
Virtual machine is ordered as:VM1、VM2、VM3.
First, VM1 is performed and migrated to the operation of target physical main frame 3, the free memory value of target physical main frame after migrationThe memory value for subtracting VM1 equal to the physical host free memory value before migration is i.e.:6G-2G=4G;
Second step, whether the free memory value of target physical main frame 3 meets second virutal machine memory after judging to migrate(2G is saved as in VM2)Take resource(While not up to default horizontal redundancy condition), it is clear that target physical main frame 3 using asThe target physical main frame of VM2;After VM2 migrations, the free memory of target physical main frame machine 3 is:4G-2G=2G;Can not now expireThe 3rd virutal machine memory of foot(3G is saved as in VM3)Take resource;
3rd step, according to physical host clooating sequence, the next physical host in selection physical host collating sequence is madeIt is new target physical main frame(Physical host 1), continue the 3rd virtual machine (vm) migration in virtual machine (vm) migration order to newTarget physical main frame, the free memory of target physical main frame 1 where VM3 after so migrating is:5G-2G=3G.
Subsequent migration and perform virtual machine recovering step with step S100 ~ step S300 in the embodiment of the present invention it is similar itPlace, it is no longer repeated.
The embodiment of the present invention can as needed migrate the occupation condition of virtual machine, reach and be migrated to virtual machinePurpose under same cluster on most suitable physical host, and ensure the high-caliber reliability of group system and security.
It will be understood by those skilled in the art that the resource of physical host involved in the embodiment of the present invention is standardChange(Physical host involved by the embodiment of the present invention is x86 servers), telescopic and dynamic change at any time, it should haveThe redundancy of some levels is to ensure high-caliber availability, but it is important that this redundancy is allowed for application demandIncrease and easily extend;Need the use resource of the physical host of normal operation under computing cluster, including present physical main frameCUP, the memory source of present physical main frame;Calculate the resources of virtual machine capacity of all migrations;Successively according to resources of virtual machineCapacity distributes most suitable migration target physical main frame in the cluster.
Based on same inventive concept, the embodiment of the present invention additionally provides a kind of device for realizing virtual machine (vm) migration, due to thisThe principle of device solve problem is similar to a kind of foregoing method for realizing virtual machine (vm) migration, therefore the implementation of the device may refer toThe implementation of preceding method, repeats part and repeats no more.
Correspondingly, present invention also offers the device for realizing virtual machine (vm) migration, the device 1 for realizing virtual machine (vm) migration is wrappedVirtual machine order module 10, physical host order module 20 and migration process module 30 are included, as shown in Fig. 2 wherein:
The virtual machine order module 10, the virtual machine migrated needed for for being determined according to source physical host, and obtain instituteThe configuration information of one or more virtual machines that need to be migrated, the configuration information according to the virtual machine determines that virtual machine (vm) migration is suitableSequence;
The physical host order module 20, the multiple physical host resources for analyzing current operation in group system makeWith information, multiple physical hosts are carried out into physical host sequence according to resource using information priority;
The migration process module 30, for being sorted most preceding virtual machine since virtual machine (vm) migration order, pressesAccording to virtual machine (vm) migration order, order performs multiple virtual machine (vm) migrations to the operation of target physical main frame, until all of virtual machineMigration operation all terminates;In transition process, the most preceding physical host of selection physical host collating sequence is used as target physical masterMachine, until the memory source of presently described target physical main frame can not meet the virutal machine memory occupancy resource for being currently needed for migrationOr when reaching default horizontal redundancy condition, the next physical host in selection physical host collating sequence is used as new targetPhysical host.
It is preferred that used as a kind of embodiment, the device 1 for realizing virtual machine (vm) migration also includes heart beat detection module40, wherein:
The heart beat detection module 40, for periodically doing heartbeat detection, detection collection by IP according to the default time cycleThe running status of the multiple physical hosts run in group's system, and determine the source physical host for breaking down.
Further, as a kind of embodiment, the virtual machine order module includes judging submodule, wherein:
The judging submodule, for the configuration information according to the virtual machine for obtaining, determines whether set in advance movingShifting sequentially, if, it is determined that virtual machine (vm) migration order for migration set in advance sequentially;If not, it is determined that virtual machine (vm) migration is suitableSequence is the virtual machine creating time sequencing in configuration information;
The configuration information of the virtual machine includes:The size information of virutal machine memory, multiple virtual machine creating time sequencingsInformation or migration order information set in advance.
Further, as a kind of embodiment, the physical host order module includes physical host sequence submoduleBlock, wherein:
The physical host sorting sub-module, for the size according to present physical main frame free memory, carries out descending rowSequence;
If the magnitude difference of present physical host memory adjacent in sequence is less than default memory threshold after arrangement,According to CPU usage size, ascending order arrangement is carried out to the adjacent physical host and the physical host sequence is finally determined;
Wherein, the default memory threshold is 128M.
It is preferred that used as a kind of embodiment, the device 1 for realizing virtual machine (vm) migration also includes recovery module 50,Wherein:
The recovery module 50, for after multiple virtual machine (vm) migrations to target physical main frame, recovering virtual machine originalRunning status simultaneously changes the configuration information that multiple virtual machines physical host affiliated respectively changes by virtual machine (vm) migration operation.
Correspondingly, it is described including group system multiple physical host, each institute present invention also offers a kind of group systemStating can be provided with one or more virtual machines on physical host, the group system also includes above-mentioned virtual machine (vm) migration device;
The virtual machine (vm) migration device is used to, when source physical host breaks down, the virtual machine on the physical host of source be movedMove to target physical main frame.
A kind of method for realizing virtual machine (vm) migration provided in an embodiment of the present invention, device and group system, wherein method bagInclude:It is determined that after source physical host and the virtual machine of required migration, determine virtual machine (vm) migration sequentially, and analyze group system and be taken inMultiple physical hosts are carried out physics by multiple physical host resource using informations of preceding operation according to resource using information priorityMain frame sorts;Sorted since virtual machine (vm) migration order most preceding virtual machine, according to virtual machine (vm) migration order, order performs manyIndividual virtual machine (vm) migration to target physical main frame operation, until all of virtual machine (vm) migration operation all terminate.The embodiment of the present inventionWhat is provided realizes method, device and the group system of virtual machine (vm) migration on the premise of virtual machine (vm) migration reliability, ensures clusterThe high efficiency and security of virtual machine image in system.
Embodiment described above only expresses several embodiments of the invention, and its description is more specific and detailed, but simultaneouslyTherefore the limitation to the scope of the claims of the present invention can not be interpreted as.It should be pointed out that for one of ordinary skill in the artFor, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the inventionShield scope.Therefore, the protection domain of patent of the present invention should be determined by the appended claims.