CN103838593B - Method and system for recovering virtual machine, controller, server and host - Google Patents

Method and system for recovering virtual machine, controller, server and host Download PDF

Info

Publication number
CN103838593B
CN103838593B CN201210479165.2A CN201210479165A CN103838593B CN 103838593 B CN103838593 B CN 103838593B CN 201210479165 A CN201210479165 A CN 201210479165A CN 103838593 B CN103838593 B CN 103838593B
Authority
CN
China
Prior art keywords
virtual machine
server
host
controller
migration instruction
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
CN201210479165.2A
Other languages
Chinese (zh)
Other versions
CN103838593A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201210479165.2A priority Critical patent/CN103838593B/en
Priority to PCT/CN2013/074295 priority patent/WO2014079194A1/en
Publication of CN103838593A publication Critical patent/CN103838593A/en
Application granted granted Critical
Publication of CN103838593B publication Critical patent/CN103838593B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a method and a system for recovering a virtual machine, a controller, a server and a host, wherein the method comprises the following steps: the method comprises the steps that a server receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to a host computer once; the server pre-copies the memory data of the mirror image of the virtual machine to the host computer once according to the first migration instruction, and recovers the virtual machine at the host computer. Through the mode, the method and the device can effectively improve the starting time of the virtual machine.

Description

Method and system for recovering virtual machine, controller, server and host
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and a system for recovering a virtual machine, a controller, a server, and a host.
Background
A virtual machine refers to a complete computer system with complete hardware system functionality, which is emulated by software, running in a completely isolated environment. After entering the operating system of the virtual machine, all operations are performed in the brand-new independent virtual system, running software can be independently installed, data is stored, the independent desktop is owned, and no influence is generated on the real system. One or more virtual machines can be virtualized on one physical computer.
The virtual machine is started in three ways, which are: starting a CD-ROM, starting a hard disk and starting a network. The optical drive starting means that the virtual machine is started from the optical drive. Network boot is intended to mean that the virtual machine is not booted at the hosted host's local hard disk, but rather from a network-shared hard disk. Hard disk startup refers to the virtual machine starting from the host's hard disk.
The optical drive is mainly suitable for the installation scene of the operating system of the empty virtual machine, but is slow in starting, not suitable for popularization and not suitable for large-scale scene use. The network startup requires that the application scenarios of all virtual machines started by using the shared hard disk are necessarily consistent, so that the application scenarios of the virtual machines are limited, the startup time is influenced by the network condition, the startup process is unstable, and the popularization and the application are not facilitated. The hard disk starting is a common starting mode of the virtual machine, is the simplest and most direct mode, and is slow in starting time. As mentioned above, the starting speed is too slow when the virtual machine is restored in the prior art, which greatly affects the popularization and application of the virtual machine.
Disclosure of Invention
The technical problem mainly solved by the embodiment of the invention is to provide a method for recovering a virtual machine, a controller, a server and a host, which can improve the starting time of the virtual machine.
In a first aspect, a method for restoring a virtual machine is provided, which includes the following steps: the controller receives a starting notice for starting the virtual machine; the controller inquires whether the server has the mirror image of the virtual machine or not, and if the server has the mirror image of the virtual machine, the controller respectively sends a first migration instruction to the server and the host, wherein the first migration instruction is used for indicating the server to pre-copy the memory data of the mirror image of the virtual machine to the host once.
In a first possible implementation manner of the first aspect, the receiving, by the controller, a start notification for starting the virtual machine specifically includes: the controller receives a virtual machine restart notification sent by the server; or the controller receives special state notification of the virtual machine sent by the host, wherein the special state comprises a virtual machine starting state or a virtual machine downtime state.
With reference to the implementation manner of the first aspect, in a second possible implementation manner of the first aspect, before the receiving, by the controller, a start notification for starting the virtual machine, the method further includes: the controller respectively sends a second migration instruction to the server and the host of the virtual machine, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server once, so that the server generates the mirror image of the virtual machine.
With reference to the implementation manner of the first aspect, in a third possible implementation manner of the first aspect, before the step of sending, by the controller, the second migration instruction to the server and the hosted host of the virtual machine, the method further includes: the controller receives a first backup instruction of a backup virtual machine from the server and generates a second migration instruction according to the first backup instruction.
In a second aspect, a method for restoring a virtual machine is provided, which includes the following steps: the method comprises the steps that a server receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to a host computer once; the server pre-copies the memory data of the mirror image of the virtual machine to the host computer once according to the first migration instruction, so that the host computer recovers the virtual machine.
In a first possible implementation manner of the second aspect, the receiving, by the server, the first migration instruction from the controller specifically includes: the server receives a first message from the virtual machine, wherein the first message is used for indicating the virtual machine to restart; the server sends a virtual machine restart notification to the controller according to the first message, and sends a destroy instruction for destroying the virtual machine to the host; the server receives a first migration instruction sent by the controller according to a restart notification of the virtual machine.
With reference to the implementation manner of the second aspect, in a second possible implementation manner of the second aspect, before the step of receiving, by the server, the first migration instruction from the controller, the method further includes: the server receives a second migration instruction from the controller, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server once; the server receives the memory data from the virtual machine and generates an image of the virtual machine.
With reference to the second possible implementation manner of the second aspect, in a third possible implementation manner of the second aspect, before the step of the server receiving the second migration instruction from the controller, the method further includes:
the server receives a connection request from the virtual machine and establishes connection with the virtual machine; the server acquires the IP address and the computer name of the virtual machine; the server inquires whether a mirror image of the virtual machine exists according to the IP address of the virtual machine and the name of the computer; if the server does not have the mirror image of the virtual machine, the server sends a first backup instruction for backing up the virtual machine to the controller; the step of the server receiving the second migration instruction from the controller includes: the server receives a second migration instruction sent by the controller according to the first backup instruction.
With reference to the second possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the step of the server receiving the second migration instruction from the controller includes: the server receives a second migration instruction triggered by a triggering module of the controller.
With reference to the implementation manner of the second aspect, in a fifth possible implementation manner of the second aspect, before the step of receiving, by the server, the first migration instruction from the controller, the method further includes: the server receives a second backup instruction from the backup virtual machine sent by the virtual machine; the server sends a third migration instruction to the host according to the second backup instruction; and the server receives the memory data of the virtual machine transmitted by the host according to the third migration instruction and generates the mirror image of the virtual machine.
In a third aspect, a method for restoring a virtual machine is provided, which includes the following steps: the method comprises the steps that a host computer receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating a server to pre-copy memory data of a mirror image of a virtual machine to the host computer once; and the host receives the memory data of the mirror image of the virtual machine according to the first migration instruction, and recovers the virtual machine on the host.
In a first possible implementation manner of the third aspect, before the step of receiving, by the host, the first migration instruction from the controller, the method further includes: the method comprises the steps that a host machine detects special states of a virtual machine, wherein the special states comprise a virtual machine starting state or a virtual machine downtime state; when detecting the special state of the virtual machine, the host sends a special state notification of the virtual machine to the controller; the method for receiving the first migration instruction from the controller by the host specifically includes: the host receives a first migration instruction sent by the controller according to the special state notification of the virtual machine.
With reference to the implementation manner of the third aspect, in a second possible implementation manner of the third aspect, before the step of receiving, by the host, the first migration instruction from the controller, the method further includes: the host receives a second migration instruction from the controller, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server at a time; and the host suspends the virtual machine according to the second migration instruction or the third migration instruction, pre-copies the memory data of the virtual machine to the server once, and generates the mirror image of the virtual machine on the server.
With reference to the implementation manner of the third aspect, in a third possible implementation manner of the third aspect, before the step of receiving, by the host, the first migration instruction from the controller, the method further includes: the host computer receives a third migration instruction from the server, wherein the third migration instruction is used for instructing the host computer to pre-copy the memory data of the virtual machine to the server once, and generates a mirror image of the virtual machine on the server; and the host suspends the virtual machine according to the third migration instruction and pre-copies the memory data of the virtual machine to the server once so that the server generates the mirror image of the virtual machine.
In a fourth aspect, a controller is provided, comprising: the first receiving module is used for receiving a starting notice for starting the virtual machine; the query module is used for querying whether the server has the mirror image of the virtual machine; the first sending module is used for sending a first migration instruction to the server and the host respectively after the query module queries the mirror image of the virtual machine, wherein the first migration instruction is used for indicating the server to pre-copy the memory data of the mirror image of the virtual machine to the host once.
In a first possible implementation manner of the fourth aspect, the first receiving module is specifically configured to: receiving a virtual machine restart notification sent by a server; or receiving special state notifications of the virtual machines sent by the host, wherein the special states comprise the starting state and the downtime state of the virtual machines.
With reference to the implementation manner of the fourth aspect, in a second possible implementation manner of the fourth aspect, the controller further includes: and the second sending module is used for sending a second migration instruction to the host and the server respectively, wherein the second migration instruction is used for indicating the host to pre-copy the memory data of the virtual machine to the server once, so that the server generates the mirror image of the virtual machine.
With reference to the second possible implementation manner of the fourth aspect, in a third possible implementation manner of the fourth aspect, the controller further includes: the second receiving module is used for receiving a first backup instruction of the backup virtual machine from the server; and the generating module is used for generating a second migration instruction according to the first backup instruction.
With reference to the second possible implementation manner of the fourth aspect, in a fourth possible implementation manner of the fourth aspect, the controller includes: and the trigger generation module is used for triggering the second migration instruction.
In a fifth aspect, a server is provided, including: the first receiving module is used for receiving a first migration instruction from the controller, wherein the first migration instruction is used for instructing the server to pre-copy the memory data of the mirror image of the virtual machine to the host computer once; and the pre-copying module is used for pre-copying the memory data of the mirror image of the virtual machine to the host computer once according to the first migration instruction so as to restore the virtual machine on the host computer.
In a first possible implementation manner of the fifth aspect, the server further includes: the second receiving module is used for receiving a first message from the virtual machine, wherein the first message is used for indicating the virtual machine to restart; the first sending module is used for sending a virtual machine restart notification to the controller according to the first message and sending a destroying instruction for destroying the virtual machine to the host; the first receiving module is specifically: a first migration instruction sent by the controller according to the virtual machine restart notification is received.
With reference to the implementation manner of the fifth aspect, in a second possible implementation manner of the fifth aspect, the server further includes: the third receiving module is used for receiving a second migration instruction from the controller; and the first receiving and generating module is used for receiving the memory data of the virtual machine from the host according to the second migration instruction and generating the mirror image of the virtual machine.
With reference to the second implementation manner of the fifth aspect, in a third possible implementation manner of the fifth aspect, the server further includes: the receiving and establishing module is used for receiving a connection request from the virtual machine and establishing connection with the virtual machine; the acquisition module is used for acquiring the IP address and the computer name of the virtual machine; the query module is used for querying whether the mirror image of the virtual machine exists or not according to the IP address and the computer name; and the second sending module is used for sending a first backup instruction for backing up the virtual machine to the controller when the mirror image of the virtual machine is not inquired by the inquiry module. The third receiving module is specifically configured to receive a second migration instruction sent by the controller according to the first backup instruction.
With reference to the second implementation manner of the fifth aspect, in a fourth implementation manner of the fifth aspect, the third receiving module is specifically configured to: and receiving a second migration instruction triggered by a triggering module of the controller.
With reference to the implementation manner of the fifth aspect, in a fifth possible implementation manner of the fifth aspect, the server includes: the fourth receiving module is used for receiving a second backup instruction sent by the virtual machine for backing up the virtual machine; the third sending module is used for sending a third migration instruction to the host of the virtual machine according to the second backup instruction; and the second receiving and generating module is used for receiving the memory data of the virtual machine transmitted by the host according to the third migration instruction and generating the mirror image of the virtual machine.
In a sixth aspect, there is provided a hosted host, comprising: the first receiving module is used for receiving a first migration instruction from the controller, wherein the first migration instruction is used for indicating the server to pre-copy the memory data of the mirror image of the virtual machine to the host computer once; and the receiving and recovering module is used for receiving the memory data of the mirror image of the virtual machine transmitted by the server according to the first migration instruction and recovering the virtual machine on the host.
In a first possible implementation manner of the sixth aspect, the host further includes: the detection module is used for detecting special states of the virtual machine, wherein the special states comprise a starting state and a downtime state of the virtual machine; the first sending module is used for sending a special state notification of the virtual machine to the controller when the detection module detects the special state of the virtual machine; the first receiving module is specifically configured to receive a first migration instruction sent by the controller according to the special state notification of the virtual machine.
With reference to the implementation manner of the sixth aspect, in a second possible implementation manner of the sixth aspect, the host further includes: the second receiving module is used for receiving a second migration instruction from the controller, wherein the second migration instruction is used for instructing the host computer to pre-copy the memory data of the virtual machine to the server once; and the pre-copying module is used for suspending the virtual machine and pre-copying the memory data of the virtual machine to the server once.
With reference to the implementation manner of the sixth aspect, in a third possible implementation manner of the sixth aspect, the host further includes: the third receiving module is used for receiving a third migration instruction of the server, wherein the third migration instruction is used for indicating the host to pre-copy the memory data of the virtual machine to the server once; and the pre-copying module is used for suspending the virtual machine according to the third migration instruction and pre-copying the memory data of the virtual machine to the server once.
In a seventh aspect, an embodiment of the present invention further provides a virtual machine recovery system, including any one of the controllers described in the fourth aspect, any one of the servers described in the fifth aspect, and the hosted host described in any one of the sixth aspects.
The beneficial effects of the embodiment of the invention are as follows: the method comprises the steps of pre-copying memory data of the virtual machine to a server once in advance in a memory migration mode, and generating a mirror image of the virtual machine on the server; when the virtual machine is restarted or started after shutdown or crashes, memory data of the mirror image of the virtual machine on the server is pre-copied to the host computer once, and the host computer mounts the hard disk for the virtual machine, so that the virtual machine is recovered, and the virtual machine can carry a starting item. The virtual machine does not need to go through the generation process of generating the virtual machine on the host machine and the self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. The memory data of the virtual machine is generally small, the time from the server to the host computer for single pre-copying is extremely short, and the starting time of the virtual machine is not influenced.
Drawings
FIG. 1 is a flow chart of a first embodiment of a method of restoring a virtual machine of the present invention;
FIG. 2 is a flow chart of a second embodiment of a method of restoring virtual machines of the present invention;
FIG. 3 is a flow diagram of a third embodiment of a method of restoring virtual machines of the present invention;
FIG. 4 is a flow chart of a fourth embodiment of a method of restoring virtual machines of the present invention;
FIG. 5 is a flowchart illustrating sub-steps of a server receiving a first migration instruction according to a fourth embodiment of the present invention;
FIG. 6 is a flow chart of a fifth embodiment of the method of the present invention for restoring virtual machines;
FIG. 7 is a flow chart of a sixth embodiment of the method of the present invention for restoring virtual machines;
FIG. 8 is a schematic structural diagram of a first embodiment of the controller of the present invention;
FIG. 9 is a schematic structural diagram of a second embodiment of the controller of the present invention;
FIG. 10 is a schematic block diagram of a first embodiment of a server according to the present invention;
FIG. 11 is a schematic block diagram of a second embodiment of a server according to the present invention;
FIG. 12 is a schematic block diagram of a first embodiment of a hosted host of the present invention;
FIG. 13 is a schematic block diagram of a second embodiment of the hosted host of the present invention;
FIG. 14 is a block diagram of an embodiment of a system for restoring virtual machines according to the present invention;
FIG. 15 is a flowchart of an initial start of a virtual machine in a system embodiment of the present invention to restore virtual machines;
FIG. 16 is a flowchart illustrating the internal operation backup of a virtual machine according to an embodiment of the present invention;
FIG. 17 is a flowchart of a virtual machine initiating an internal reboot in a system embodiment of the invention recovering a virtual machine;
FIG. 18 is a flowchart illustrating the startup of a virtual machine in an embodiment of the system for restoring a virtual machine.
Detailed Description
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for restoring a virtual machine according to a first embodiment of the present invention. As shown, the method comprises:
step S101: the controller receives a starting notice for starting the virtual machine;
the controller is a node that manages all virtual machines under a cluster, and the controller is connected to all hosted hosts under the cluster. A virtual machine is a virtualized computer system hosted on a hosted host. The host is a computer in the physical sense. One host can be divided into a plurality of virtual machines. The host can sense the actions of shutdown, startup and the like of the upper virtual machine hosted on the host. When the boarder host senses the starting state and the downtime state of the virtual machine, the starting state and the downtime state of the virtual machine are used as the special state of the virtual machine, and the special state notification of the virtual machine is sent to the controller. Therefore, step S101 may specifically be: the controller receives special state notifications of the virtual machines sent by the host, wherein the special states comprise starting states and downtime states of the virtual machines.
The server acts as a shadow node for the virtual machine and maintains a server-client relationship with the clients of all virtual machines under the cluster. The client serves as a program inside the virtual machine, senses the behavior of the virtual machine through the system interface, and sends the sensed behavior information of the virtual machine to the server. Since the client is a program inside the virtual machine, the client will perceive the behavior of the virtual machine one step earlier than the hosted host. And the server sends the acquired behavior information of the virtual machine to the controller. Therefore, step S101 may be embodied as: the controller receives a virtual machine restart notification sent from the server.
Step S102: the controller inquires whether the server has the mirror image of the virtual machine, and if the server has the mirror image of the virtual machine, the step S103 is carried out;
step S103: the method comprises the steps that a controller sends first migration instructions to a server and a host respectively, wherein the first migration instructions are used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to the host once;
the mirror of a virtual machine is a copy of the virtual machine on the server and the server is running the mirror of the virtual machine, in short, the server is running the same virtual machine as the virtual machine running on the hosted host. Of course, the server may also perform memory compression on the image of the virtual machine to form a compressed image.
The single pre-copy is to copy the memory data of the virtual machine hosted by the host to the server at one time (including dirty data in the memory). After the server receives the memory data of the virtual machine, the virtual machine is generated in the server. The controller can also send a mounting instruction to the host computer, so that the host computer is a virtual machine to mount the hard disk.
In the embodiment of the invention, after the controller receives the starting notice of the virtual machine, the controller instructs the server to pre-copy the memory data of the mirror image of the virtual machine to the host computer for a single time, and the virtual machine is recovered. The virtual machine is started without undergoing a generation process of generating the virtual machine at the host machine and a self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 2, fig. 2 is a flowchart illustrating a method for restoring a virtual machine according to a second embodiment of the present invention. As shown, it includes:
step S201: the controller receives a first backup instruction of a backup virtual machine from the server and generates a second migration instruction according to the first backup instruction;
a virtual machine is a virtualized computer system hosted on a hosted host. The server is a shadow node of the virtual machines in the cluster. The server can be a separately deployed physical server, or can be a virtualized deployed virtual server, for example: the server function is provided by a virtual machine form. Wherein the server is at the same level as the controller, the server maintains a connection with all virtual machines in the cluster, and the server is able to obtain the IP addresses and computer names of the virtual machines. Further, the server inquires whether a mirror image of the virtual machine exists locally according to the IP address and the computer name, and if the mirror image of the virtual machine does not exist locally, after receiving information of completion of starting the virtual machine, which is sent by the client, a first backup instruction for backing up the virtual machine is sent to the controller.
The controller is used for managing all virtual machines under the cluster, is connected with the host of the virtual machines, and senses the behaviors of the virtual machines by receiving the information of the host, such as: startup, shutdown, etc. of the virtual machine. In the embodiment of the present invention, a triggering module may also be set in the controller, and the triggering module triggers the second migration instruction, where a triggering point of the triggering module may be set according to an actual situation, for example: restart or power-on automatic synchronization, manual synchronization, application modified synchronization, timing synchronization, and the like. And triggering a second migration instruction when the controller senses that the behavior of the virtual machine meets the trigger point, such as: and after the application is modified and synchronized, the controller senses that the application program is added or reduced to the virtual machine, and then the controller triggers a second migration instruction. Therefore, step S201 may also be: and a triggering module of the controller triggers and generates a second migration instruction.
Step S202: the controller respectively sends a second migration instruction to the host computer and the server of the virtual machine, wherein the second migration instruction is used for instructing the host computer to pre-copy the memory data of the virtual machine to the server once so as to generate the mirror image of the virtual machine at the server.
The host is a physical host running a virtual machine. One hosted host may run multiple virtual machines. The single pre-copy is to directly suspend the virtual machine of the hosted host, copy the memory data (including dirty data) of the virtual machine on the hosted host to the server at one time, and generate the mirror image of the virtual machine on the server. Mirroring of a virtual machine refers to a virtual machine that runs on the same server as a virtual machine that runs on a hosted host. Of course, the server may also perform memory compression on the image of the virtual machine to form a compressed image.
Step S203: the controller receives a starting notice for starting the virtual machine;
the hosted host is able to perceive all behavior of the virtual machine hosted at the hosted host and send the perceived information to the controller. When the host senses the start and the downtime of the virtual machine, the start state and the downtime state of the virtual machine are used as the special state of the virtual machine, and the special state notification is sent to the controller. It should be noted that: after the host detects that the virtual machine is down, the host forcibly closes the down virtual machine except for sending a special state notice to the controller. Step S203 may specifically be: the controller receives special state notifications of the virtual machines sent by the host, wherein the special states comprise a virtual machine starting state and a virtual machine downtime state.
And when the virtual machine needs to be restarted but is not restarted, the client side senses that the virtual machine needs to be restarted through the system interface. The client perceives the restart behavior of the virtual machine one step earlier than the hosted host. If so, the quick starting process of the virtual machine is immediately carried out, so that the starting of the virtual machine does not need to be carried out after the shutdown time of the virtual machine, and the starting time of the virtual machine is further prolonged. And the client sends the perceived information of the restarting behavior of the virtual machine to the server. The server sends a virtual machine restart notification to the controller. Therefore, step S203 may be embodied as: the controller receives a virtual machine restart notification sent from the server.
Step S204: the controller inquires whether the server has the mirror image of the virtual machine, and if the server has the mirror image of the virtual machine, the step S205 is executed;
step S205: the method comprises the steps that a controller sends first migration instructions to a server and a host respectively, wherein the first migration instructions are used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to the host once;
the server pre-copies the memory data of the mirror image of the virtual machine to the host computer once, and the virtual machine is recovered on the host computer. The controller can also send a mounting instruction to the host computer, so that the host computer mounts the hard disk for the virtual machine. After the host mounts the hard disk for the virtual machine, the virtual machine has the complete function of the virtual machine. The hard disk mounted on the host computer as a virtual machine can be a hard disk carried by the host computer itself or a hard disk shared by a network.
In the embodiment of the invention, the controller instructs the server to pre-copy the memory data of the mirror image of the virtual machine to the host where the virtual machine is located once, and the virtual machine is recovered on the host. The virtual machine is started without undergoing a generation process of generating the virtual machine at the host machine and a self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for restoring a virtual machine according to a third embodiment of the present invention. As shown, the method comprises:
step S301: the method comprises the steps that a server receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to a host computer once;
a node with both controller and server at the management level. The controller is connected with all the host machines under the cluster, and the server and the clients of all the virtual machines under the cluster keep the relationship of the server clients.
The image of a virtual machine is a copy of the virtual machine running on the server. The server may also compress memory data of the image of the virtual machine to form a compressed image. If the mirror image of the virtual machine on the server is a compressed mirror image, the compressed mirror image needs to be decompressed before the memory data of the mirror image of the virtual machine is pre-copied to the host computer for a single time.
Step S302: the server pre-copies the memory data of the mirror image of the virtual machine to the host computer for a single time according to the first migration instruction so as to recover the virtual machine at the host computer.
The pre-copy-once is used to mean directly suspending the virtual machine on the server and copying the memory data (including dirty data) of the virtual machine on the server to the host at one time. After the memory data of the mirror image of the virtual machine is pre-copied to the host computer once, the virtual machine is directly recovered from the host computer.
In the embodiment of the invention, the memory data of the mirror image of the virtual machine on the server is pre-copied to the host computer once, and the virtual machine is directly recovered on the host computer, so that the virtual machine is started without undergoing the generation process of generating the virtual machine on the host computer and the self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 4, fig. 4 is a flowchart illustrating a method for restoring a virtual machine according to a fourth embodiment of the present invention. As shown, the method comprises:
step S401: the server receives a connection request from the virtual machine and establishes connection with the virtual machine;
the server is used as a shadow node of the virtual machine, the virtual machine can be migrated to the server, and a mirror image of the virtual machine is operated on the server. The server maintains a connection with all virtual machines under the cluster. .
Step S402: the server acquires the IP address and the computer name of the virtual machine;
the IP address and the computer name constitute a unique identification of the virtual machine. The different virtual machines can be identified by IP address and computer name.
Step S403: the server inquires whether a mirror image of the virtual machine exists according to the IP address and the name of the computer, and if not, the step S404 is carried out;
the image of the virtual machine is the same virtual machine as the virtual machine running on the hosted host, except that the image of the virtual machine runs on the server as a copy of the virtual machine running on the hosted host.
Step S404: the server sends a first backup instruction of the backup virtual machine to the controller;
the controller is used for managing all virtual machines under the cluster, and the controller is connected with all host machines under the cluster. And after receiving the first backup instruction, the controller respectively sends a second migration instruction to the server and the host where the virtual machine is located.
Step S405: the server receives a second migration instruction sent by the controller according to the first backup instruction, wherein the second migration instruction is used for indicating the host to pre-copy the memory data of the virtual machine to the server once;
and after receiving the second migration instruction, the host pre-copies the memory data of the virtual machine to the server once.
Optionally, a trigger module may be set on the controller, and the trigger module is mainly used for backing up the virtual machine. When the controller monitors that the state of the virtual machine under the cluster reaches a trigger point of the trigger module, the trigger module triggers the second migration instruction, where the trigger point may be set according to an actual situation, for example: automatic synchronization during restarting or startup, manual synchronization, synchronization after application modification, timing automatic synchronization and the like. And triggering a second migration instruction when the controller senses that the behavior of the virtual machine meets the trigger point. Step S406: the server receives a second migration instruction triggered by a trigger module of the controller, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server once.
Optionally, the virtual machine sends a second backup instruction for backing up the virtual machine to the server. In the embodiment of the present invention, a backup button may be set on the virtual machine, and the virtual machine sends the second backup instruction to the server by clicking the backup button, and of course, the virtual machine may also be triggered to send the second backup instruction to the server in other manners, for example: voice commands, and the like.
Step S407: the server receives a second backup instruction from the backup virtual machine sent by the virtual machine;
step S408: the server sends a second migration instruction to the host according to the second backup instruction, wherein the second migration instruction is used for indicating the host to pre-copy the memory data of the virtual machine to the server once;
step S409: the server receives memory data of the virtual machine from the host computer and generates a mirror image of the virtual machine;
after the server receives the memory data of the virtual machine from the host, the virtual machine is generated on the server, and the virtual machine is used as an image of the virtual machine running on the host. And, the mirror image of the virtual machine may not mount a hard disk.
Step S410: the method comprises the steps that a server receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating the server to pre-copy memory data of a mirror image of a virtual machine to a host computer once;
the controller may learn about the startup behavior of the virtual machine by receiving information from the hosted host. The controller inquires whether the server has the mirror image of the virtual machine, and if the mirror image of the virtual machine exists, the controller respectively sends a first migration instruction to the host computer and the server.
Furthermore, if the virtual machine performs a reboot operation, the virtual machine can further sense its own behavior earlier than the hosted host. And the virtual machine sends a message of restarting the virtual machine to the server, the server sends a virtual machine restart notification to the controller, and the controller sends the first migration instruction to the hosted host and the server of the virtual machine according to the virtual machine restart notification, so the step S410 may further include:
substep S4101: the server receives a first message from the virtual machine, wherein the first message is used for indicating the virtual machine to restart;
substep S4102: the server sends a virtual machine restart notification to the controller according to the first message, and sends a destroy instruction for destroying the virtual machine to a host of the virtual machine;
compared with the traditional method for closing the virtual machine, the method has shorter time for closing the virtual machine, and can further shorten the starting time of the virtual machine. And the host destroys the virtual machine through the destroying instruction, and recovers the process of the virtual machine by receiving the memory data of the virtual machine from the server, which does not belong to the traditional restarting process of the virtual machine, so that the host does not sense the restarting behavior of the virtual machine, and the host does not send the restarting notice of the virtual machine to the controller.
Substep S4103: the server receives a first migration instruction sent by the controller according to the virtual machine restart notification.
Step S411: the server pre-copies the memory data of the mirror image of the virtual machine to the host computer for a single time according to the first migration instruction so as to recover the virtual machine at the host computer.
In the embodiment of the invention, the memory data of the virtual machine on the server is pre-copied to the host computer once, and the virtual machine is directly recovered on the host computer, so that the virtual machine does not need to go through the recovery process of recovering the virtual machine on the host computer and the self starting process of the virtual machine, and the starting time of the virtual machine is effectively improved. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 6, fig. 6 is a flowchart illustrating a method for restoring a virtual machine according to a fifth embodiment of the present invention. As shown, the method comprises:
step S501: the method comprises the steps that a host computer receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating a server to pre-copy memory data of a mirror image of a virtual machine to the host computer once;
the controller is a node that manages all virtual machines under the cluster. The hosted host is a physical host on which virtual machines must run. The single pre-copy is used to refer to copying all memory data of the virtual machine on the server to the host at one time.
Step S502: the host receives the memory data of the mirror image of the virtual machine according to the first migration instruction and recovers the virtual machine;
further, the host can also receive a mounting instruction from the controller and mount the hard disk for the virtual machine according to the mounting instruction. The hard disk may be a hard disk of the host itself or a shared hard disk on a network.
In the embodiment of the invention, the memory data of the mirror image of the virtual machine from the server is received by the host computer, and the virtual machine is directly recovered on the host computer, so that the virtual machine is not required to be started in the generation process of generating the virtual machine in the host computer and the self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 7, fig. 7 is a flowchart illustrating a method for restoring a virtual machine according to a sixth embodiment of the present invention. As shown, the method comprises:
step S601: the host receives a second migration instruction from the controller, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server at a time;
the host is a physical host for generating a virtual machine, and the host is connected with the controller. Alternatively, the second migration instruction may be sent by the controller. And a triggering module of the controller triggers the second migration instruction, or the controller receives the first backup instruction from the server to generate the second migration instruction.
The server is at the same level as the controller and is connected to all virtual machines under the cluster. Optionally, after receiving the second backup instruction from the backup virtual machine of the virtual machine, the server may directly send the third migration instruction to the host. Step S601 may be further embodied as: and the host receives a third migration instruction from the server, wherein the third migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server at a time, and generates the mirror image of the virtual machine on the server. .
Step S602: the host suspends the virtual machine according to the second migration instruction, and pre-copies the memory data of the virtual machine to the server once, so that the server generates a mirror image of the virtual machine;
the single pre-copy refers to copying memory data (including dirty data) of the virtual machine hosted by the host to the server at one time. After the memory data of the virtual machine is pre-copied to the server once, a virtual machine is generated on the server, wherein the virtual machine is an image of a virtual machine running on the host machine.
Step S603: the method comprises the steps that a host computer receives a first migration instruction from a controller, wherein the first migration instruction is used for indicating a server to pre-copy memory data of a mirror image of a virtual machine to the host computer once;
the mirror of the virtual machine is the virtual machine running on the server and is the same as the virtual machine running on the hosted host, in short, the mirror is a copy of the virtual machine running on the hosted host.
Step S604: the method comprises the steps that a host machine detects a special state of a virtual machine, wherein the special state comprises a starting state or a downtime state of the virtual machine;
the virtual machine is hosted on the host machine, and the host machine can sense all behaviors of the virtual machine.
Step S605: when detecting the special state of the virtual machine, the host sends a special state notification of the virtual machine to the controller;
further, when the hosted host detects the downtime state of the virtual machine, the hosted host directly shuts down the virtual machine that has been crashed, in addition to sending the virtual machine downtime notification to the controller.
Step S606: the host computer receives a first migration instruction sent by the controller according to the special state notice of the virtual machine;
optionally, the first migration instruction may also be an instruction sent by the controller receiving the information of the server. Step S604 and step S605 may not exist, and step S606 may specifically be: the host receives a first migration instruction from the controller.
Step S607: the host receives the memory data of the mirror image of the virtual machine according to the first migration instruction and recovers the virtual machine;
after the host computer receives the memory data of the mirror image of the virtual machine, a virtual machine is generated in the host computer immediately, and the virtual machine is in a starting state. Unlike conventional approaches, it is necessary to first generate a virtual machine on the hosted host and then start the virtual machine.
The host can also receive a mounting instruction from the controller and mount the hard disk for the virtual machine according to the mounting instruction. The hard disk may be a hard disk of the host itself or a shared hard disk on a network.
In the embodiment of the invention, the memory data of the virtual machine of the host computer is firstly pre-copied to the server once, and the mirror image of the virtual machine is formed on the server. When the virtual machine is started or restarted, the virtual machine is quickly recovered on the host machine from the server by single pre-copying to the host machine. Compared with the traditional method, the virtual machine in the embodiment of the invention is started without undergoing a recovery process of recovering the virtual machine at the host and a self starting process of the virtual machine, so that the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
The invention further provides controller embodiments. As shown in fig. 8, the controller 70 includes a first receiving module 701, a querying module 702, and a first transmitting module 703. The first reception block 701 receives a start notification to start a virtual machine. Where the virtual machine runs on the hosted host 72, the hosted host 72 is able to perceive all the behavior of the virtual machine. When a virtual machine is about to start or is down, the hosted host 72 takes the start state and the down state of the virtual machine as special states and sends special state notifications to the controller 70. Therefore, the first receiving module 701 may be further embodied as: special status notifications are received from the hosted host 72, the special status including the startup status and the downtime status of the virtual machines. Connection of the server 71 to the virtual machine. When the virtual machine is to be restarted, the virtual machine sends a virtual machine restarting message to the server, and the server sends a virtual machine re-notification to the controller after receiving the virtual machine restarting message. Therefore, the first receiving module 701 may be further embodied as: receives a virtual machine restart notification sent from the server 71.
The query module 702 queries whether an image of a virtual machine exists on a server. The image of a virtual machine is a copy of the virtual machine running on the server. The first sending module 703 sends a first migration instruction to the server 71 and the host 72 respectively after the querying module 702 queries that the mirror image of the virtual machine exists, where the first migration instruction is used to instruct the server 71 to pre-copy the memory data of the mirror image of the virtual machine to the host 72 at a single time. After the memory data of the mirror image of the virtual machine is copied to the host 72, the virtual machine is directly recovered at the host 72. A single pre-copy refers to copying all memory data of a virtual machine on a server to a hosted host at one time. The controller 70 further comprises a second receiving module 704, a generating module 705, a trigger generating module 706 and a second sending module 707. When the virtual machine is started, the virtual machine establishes a connection with the server 71, and the server 71 acquires the IP address and the computer name of the virtual machine. The server 71 queries whether the mirror image of the virtual machine exists locally, and if not, after receiving a message from the virtual machine that the start is complete, sends a first backup instruction for backing up the virtual machine to the central controller 71. The second receiving module 704 receives a first backup instruction of a backup virtual machine from a server. The generating module 705 generates a second migration instruction according to the first backup instruction. Alternatively, the trigger generation module 706 triggers the second migration instruction according to the trigger point of the controller 70. The trigger points may be set as: automatic synchronization for restart or startup, manual synchronization, synchronization after application modification, timing synchronization, and the like. The second sending module 707 sends a second migration instruction to the hosted host 72 and the server 71, respectively, where the second migration instruction is used to instruct the hosted host 72 to pre-copy the memory data of the virtual machine to the server 71 at a single time, and generate the mirror image of the virtual machine in the server 71. The controller 70 may further include a third sending module 708, configured to send a mount instruction to the hosted host 72, so that the hosted host mounts the hard disk for the virtual machine.
In the embodiment of the present invention, after the first receiving module 701 receives the start notification of the virtual machine and the querying module 702 queries that the server 71 has the mirror image of the virtual machine, the first sending module 703 sends the first migration instruction to the server 71 and the guest host, respectively, to instruct the server 71 to pre-copy the memory data of the mirror image of the virtual machine to the guest host where the virtual machine is located at a single time. The virtual machine is started without undergoing a generation process of generating the virtual machine at the host machine and a self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a controller according to a second embodiment of the present invention. As shown, set controller node 75 includes a processor 750 and a memory 751.
Processor 750 is configured to receive a start notification to start a virtual machine; inquiring whether the server 76 has the mirror image of the virtual machine, if the server 76 has the mirror image of the virtual machine, sending a first migration instruction to the server 76 and the host 77 respectively, wherein the first migration instruction is used for instructing the server 76 to pre-copy the memory data of the mirror image of the virtual machine to the host 77 at a single time.
The above processing procedure executed by the processor 750 is usually controlled by a program, which is stored in the memory 751, and when the above operation is required, the program is called into the processor 750 and controlled by the processor 750. Of course, the above processing procedure may also be performed by hardware. The processor 750 may further send a mount instruction to the hosted host 77 after completing sending the first migration instruction, where the mount instruction is used to instruct the hosted host 77 to mount a hard disk for the virtual machine.
The invention also provides a server implementation mode. As shown in fig. 10, the server 80 includes a first receiving module 801 and a pre-copy module 802;
the first receiving module 801 receives a first migration instruction from the controller 81, where the first migration instruction is used to instruct the server 80 to pre-copy the memory data of the image of the virtual machine to the host 82 at a time. The controller 81 is configured to manage all virtual machines in the cluster. When the controller 81 senses that the virtual machine 83 is started and inquires that the server 80 has an image of the virtual machine 83, a first migration instruction is sent to the server 80. If the virtual machine 83 needs to be restarted in the middle of running, the virtual machine 83 sends a restart message of the virtual machine to the server 80. Accordingly, the server 80 further includes: a second receiving module 803 and a first sending unit 804.
Second receiving module 803 receives a first message from virtual machine 83, the first message being used to instruct virtual machine 83 to restart. The first sending module 803 sends a virtual machine restart notification to the controller 81 according to the first message, and sends a destroy instruction for destroying the virtual machine 83 to the hosted host 82 of the virtual machine 83. The hosted host 82 shuts down the virtual machine 83 by destroying the instruction faster and in less time than the conventional way of shutting down the virtual machine 83. The first receiving module 801 specifically includes: a first migration instruction sent by the controller 81 according to the virtual machine restart notification is received. The pre-copy module 802 pre-copies the memory data of the image of the virtual machine 83 to the host 82 at a time according to the first migration instruction, so as to recover the virtual machine 83 at the host.
The server 80 further comprises a receiving establishing module 805, an obtaining module 806, a querying module 807, a second sending module 808, a third receiving module 809, a first receiving generating module 810, a fourth receiving module 811, a third sending module 812 and a second receiving generating module 813.
Receiving establishing module 805 is configured to receive a connection request from virtual machine 83, and establish a connection with virtual machine 83. The obtaining module 804 is configured to obtain the IP address and the computer name of the virtual machine 83. The query module 806 queries whether an image of the virtual machine 83 exists based on the IP address and the computer name. If the server 80 has the image of the virtual machine 83, the second sending module 808 sends a first backup instruction for backing up the virtual machine 83 to the controller 81. The third receiving module 809 receives the second migration instruction transmitted by the controller 81 according to the first backup instruction. The controller 81 may also set a triggering module, and the triggering module triggers sending of the second migration instruction to the server 80. The third receiving module 809 may be further embodied as: a second migration instruction triggered by the triggering module of the controller 81 is received. The first receiving and generating module 810 receives the memory data from the virtual machine 83 on the host 82 according to the second migration instruction, and generates an image of the virtual machine 83.
Optionally, virtual machine 83 may also send a backup message to server 80 to backup virtual machine 83. The fourth receiving module 811 receives the second backup instruction of the backup virtual machine 83 transmitted from the virtual machine 83. The third sending module 812 sends a third migration instruction to the hosted host 82 of the virtual machine 83 according to the second backup instruction, where the third migration instruction is used to instruct the hosted host 82 to pre-copy the memory data of the virtual machine to the server 80 at a time. The second reception generation module 813 receives the memory data from the virtual machine 83 transmitted by the host 82 according to the third migration instruction, and generates an image of the virtual machine 83.
In the embodiment of the present invention, after the first receiving module 801 receives the first migration instruction, the pre-copy module 802 pre-copies the memory data of the mirror image of the virtual machine 83 on the server 80 to the host computer once according to the first migration instruction, and directly restores the virtual machine on the host computer, so that the virtual machine does not need to be started through the restoration process of generating the virtual machine on the host computer and the self-starting process of the virtual machine, and the starting time of the virtual machine is effectively increased. And the memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and the starting time of the virtual machine is not influenced.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a server according to a second embodiment of the present invention. As shown, server 85 includes a processor 850 and memory 851.
The processor 850 is configured to receive a first migration instruction from the controller 86, where the first migration instruction is used to instruct the server 85 to pre-copy the memory data of the image of the virtual machine to the host 87 in a single time; according to the first migration instruction, the memory data of the mirror image of the virtual machine is pre-copied to the host 87 for a single time, and the virtual machine is recovered at the host.
The above-described processing performed by the processor 851 is normally controlled by a single program, and the program is stored in the memory 852, and when the above-described operation is necessary, the program is called into the processor 851 and controlled by the processor 851. Of course, the above processing procedure may also be performed by hardware.
It should be noted that: the server and the controller may be combined together to form a control service node. The control service node integrates the functions of the server and the controller. The control service node firstly indicates the host to pre-copy the memory data of the virtual machine to the control service node once, and generates the mirror image of the virtual machine at the control service node. When the virtual machine is started or restarted, the control service node pre-copies the memory data of the mirror image of the virtual machine to the host computer once, directly recovers the virtual machine from the host computer, and further indicates the host computer to mount a hard disk for the virtual machine, so that the quick start of the virtual machine is completed.
The invention also provides a host boarder implementation mode. As shown in fig. 12, the hosted host 90 includes a first receiving module 901 and a receiving recovery module 902.
The first receiving module 901 receives a first migration instruction from the controller 91, where the first migration instruction is used to instruct the server 92 to pre-copy the memory data of the image of the virtual machine to the host 90 in a single time. The receiving and restoring module 902 receives the memory data of the image of the virtual machine transmitted from the server 92 according to the first migration instruction, and restores the virtual machine at the host 90.
The hosted host 90 further includes a detection module 903, a sending module 904, a second receiving module 905, a third receiving module 906, and a pre-copy module 907. The detection module 903 detects special states of the virtual machine, where the special states include a virtual machine startup state and a virtual machine shutdown state. The sending module 904 sends a special state notification of the virtual machine to the controller 91 when the detection module 903 detects the special state of the virtual machine. The first receiving module 901 may further be embodied as: a first migration instruction sent by the controller 91 according to the special state of the virtual machine is received.
The second receiving module 905 receives a second migration instruction from the controller, where the second migration instruction is used to instruct the hosted host to pre-copy the memory data of the virtual machine to the server at a time. Alternatively, the virtual machine directly sends a second backup instruction for backing up the virtual machine to the server 92, and the server 92 sends a second migration instruction to the hosted host according to the second backup instruction. The third receiving module 906 receives a third migration instruction of the server 92, where the third migration instruction is used to instruct the host 90 to pre-copy the memory data of the virtual machine to the server 92 at a time. The pre-copy module 907 is configured to suspend the virtual machine according to the second migration instruction or the third migration instruction, and pre-copy the memory data of the virtual machine to the server 92 in a single time. The host in this embodiment of the present invention may further include a fourth receiving module 908 and a mount module 909, where the fourth receiving module 908 receives a mount instruction from the controller 91 after the virtual machine is recovered, and the mount module 909 mounts the hard disk for the virtual machine according to the mount instruction.
In the embodiment of the present invention, the receiving and recovering module 902 receives the memory data of the mirror image of the virtual machine transmitted from the server 92, and directly recovers the virtual machine on the host computer 90. The virtual machine is started without undergoing a generation process of recovering the virtual machine from the host and a self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged. The memory data of the virtual machine is small, the time from the server to the host computer is extremely short, and similarly, the time for the host computer to mount the hard disk for the virtual machine is also extremely short, so that the starting time of the virtual machine is not influenced.
Referring to fig. 13, fig. 13 is a schematic structural diagram of a host according to a second embodiment of the present invention. As shown, the hosted host 95 includes a processor 950 and a memory 951.
The processor 950 is configured to receive a first migration instruction from the controller 97, where the first migration instruction is used to instruct the server 96 to pre-copy the memory data of the image of the virtual machine to the host 95 in a single time; receiving memory data of the mirror image of the virtual machine according to the first migration instruction, and restoring the virtual machine on the host computer 95; and is also operable to receive mount instructions from the controller 97 after the virtual machine is restored; and mounting the hard disk for the virtual machine according to the mounting instruction, and finishing the starting of the virtual machine.
The above processing procedure executed by the processor 950 is usually controlled by a program, the program is stored in the memory 950, and when the above operation is required, the program is called into the processor 950 and controlled by the processor 950. Of course, the above processing procedure may also be performed by hardware.
In order to provide the reader with a better understanding of the present invention, the following describes the present invention from a system perspective. Referring to fig. 14, fig. 14 is a block diagram of a system for restoring a virtual machine according to an embodiment of the present invention. The system 1 for restoring virtual machines includes a controller 2, a server 3, and a hosted host 4. The controller 2 is any one of the above controllers, the server 3 is any one of the above servers, and the host 4 is any one of the above hosts. Further, there may be a plurality of host machines 4. The virtual machine runs on the hosted host 4.
Further, referring to fig. 15, fig. 15 is a flowchart illustrating initial starting of a virtual machine according to the system embodiment of the present invention for restoring a virtual machine.
Step S10: the virtual machine is started for the first time, and the server does not have a mirror image of the virtual machine;
step S11: broadcasting a data packet by a client;
step S12: the server monitors the data packet of the client, establishes connection with the client and obtains information such as IP (Internet protocol) and computer name of the virtual machine;
step S13: a hook program on the client hooks keyboard and mouse information to form a queue and stores the queue in a system memory;
step S14: the client refreshes the number of the processes of the virtual machine to form a first variable, and delays for 1 s;
step S15: the client refreshes the number of the processes of the virtual machine to form a second variable, the first variable and the second variable are compared, if the first variable is not equal to the second variable, the delay is continued, and if the first variable is equal to the second variable, the process is ended;
step S16: when the first variable is equal to the second variable, the virtual machine is started completely, and the client sends a message to the server, wherein the message is used for indicating that the virtual machine is started completely;
step S17: the server applies for a backup virtual machine from the controller;
step S18: the controller sends a memory data single pre-copy command of the virtual machine to the host;
step S19: the controller sends a memory data single pre-copy command of the virtual machine to the server;
step S20: the host pre-copies the memory data of the virtual machine once to the server;
step S21: the server compresses the memory data of the virtual machine to form a compressed mirror image;
step S22: the controller updates state information of the mirror image of the virtual machine and indicates that the mirror image of the virtual machine exists;
step S23: the server sends a message of completing the processing to the client;
step S24: and releasing the hook message by the client, and using the hook message by the client normally.
Referring to fig. 16, fig. 16 is a flowchart illustrating a backup process of the internal operation of the virtual machine according to the embodiment of the present invention;
step S110, clicking a backup virtual machine;
s111, the virtual machine applies for a backup virtual machine to a server;
step S112: the host suspends the virtual machine;
step S113: the host pre-copies the memory data of the virtual machine to the server in a single time.
Referring to fig. 17, fig. 17 is a flowchart illustrating a virtual machine initiating an internal reboot according to an embodiment of the system for restoring a virtual machine;
step S120: restarting the interior of the virtual machine;
step S121: the client calls a system interface to sense the behavior;
step S122: the client sends a message to the server;
step S123: the server inquires the mirror image of the existing virtual machine;
step S124: the server sends a message to the host computer and closes the virtual machine;
step S125: the server calls a virtual machine migration interface;
step S126: the server pre-copies the memory data of the virtual machine to the host computer once;
step S128: the host computer is a virtual machine mounted hard disk.
Referring to fig. 18, fig. 18 is a flowchart illustrating virtual machine startup according to an embodiment of the system for restoring a virtual machine of the present invention;
step S130: the controller senses the start of the virtual machine;
step S131: the controller inquires that the mirror image of the virtual machine exists in the memory of the server;
step S132: the method comprises the steps that a controller server sends a memory data single-time pre-copy command of a virtual machine;
step S133: the controller host computer sends a memory data single pre-copy command of the virtual machine;
step S134: the server decompresses the mirror image of the virtual machine;
step S135: the server pre-copies the decompressed memory data of the virtual machine to the host computer once;
step S136: the host computer is a virtual machine mounted hard disk.
The memory data of the mirror image of the virtual machine on the server is pre-copied to the host computer once, and the virtual machine is directly recovered on the host computer, so that the virtual machine does not need to go through the generation process of generating the virtual machine on the host computer and the self starting process of the virtual machine, and the starting time of the virtual machine is effectively prolonged.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes performed by the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (5)

1. A method of restoring a virtual machine, comprising:
the server receives a connection request from the virtual machine and establishes connection with the virtual machine;
the server acquires the IP address and the computer name of the virtual machine;
the server inquires whether a mirror image of the virtual machine exists according to the IP address and the computer name of the virtual machine;
if the server does not have the mirror image of the virtual machine, the server sends a first backup instruction for backing up the virtual machine to a controller;
the server receives a second migration instruction sent by the controller according to the first backup instruction, wherein the second migration instruction is used for instructing the host to pre-copy the memory data of the virtual machine to the server at a time;
the server receives memory data from the virtual machine and generates a mirror image of the virtual machine;
the server receives a first migration instruction from the controller, wherein the first migration instruction is used for instructing the server to pre-copy memory data of the mirror image of the virtual machine to a host computer at a time;
the server pre-copies the memory data of the mirror image of the virtual machine to the host computer once according to a first migration instruction, so that the host computer recovers the virtual machine;
the receiving, by the server, a first migration instruction from the controller specifically includes:
the server receives a first message from the virtual machine, wherein the first message is used for indicating the virtual machine to restart;
the server sends a restart notification of the virtual machine to the controller according to the first message, and sends a destroy instruction for destroying the virtual machine to the host;
the server receives a first migration instruction sent by the controller according to a restart notification of the virtual machine.
2. The method of claim 1, wherein the step of the server receiving the first migration instruction from the controller is preceded by the step of:
the server receives a second backup instruction for backing up the virtual machine sent by the virtual machine;
the server sends a third migration instruction to the host according to the second backup instruction;
and the server receives the memory data of the virtual machine transmitted by the host according to the third migration instruction, and generates the mirror image of the virtual machine in the server.
3. A server, characterized in that the server comprises:
the receiving and establishing module is used for receiving a connection request from a virtual machine and establishing connection with the virtual machine;
the acquisition module is used for acquiring the IP address and the computer name of the virtual machine;
the query module is used for querying whether the mirror image of the virtual machine exists or not according to the IP address and the computer name;
the second sending module is used for sending a first backup instruction for backing up the virtual machine to the controller when the mirror image of the virtual machine is not inquired by the inquiry module;
a third receiving module, configured to receive a second migration instruction sent by the controller according to the first backup instruction;
the first receiving and generating module is used for receiving the memory data of the virtual machine from the host according to the second migration instruction and generating a mirror image of the virtual machine;
a second receiving module, configured to receive a first message from the virtual machine, where the first message is used to instruct the virtual machine to restart;
the first sending module is used for sending a virtual machine restart notification to the controller according to the first message and sending a destroy instruction for destroying the virtual machine to the host;
a first receiving module, configured to receive a first migration instruction sent by the controller according to the virtual machine restart notification, where the first migration instruction is used to instruct the server to pre-copy memory data of a mirror image of a virtual machine to a hosted host at a single time;
and the pre-copy module is used for pre-copying the memory data of the mirror image of the virtual machine to the host computer once according to the first migration instruction so that the host computer recovers the virtual machine.
4. The server of claim 3, further comprising:
a fourth receiving module, configured to receive a second backup instruction for backing up the virtual machine, where the second backup instruction is sent by the virtual machine;
a third sending module, configured to send a third migration instruction to the hosted host of the virtual machine according to the second backup instruction;
and the second receiving and generating module is configured to receive the memory data of the virtual machine transmitted by the host according to the third migration instruction, and generate a mirror image of the virtual machine.
5. A system for restoring a virtual machine, comprising: the server and hosted host of any of claims 3 to 4.
CN201210479165.2A 2012-11-22 2012-11-22 Method and system for recovering virtual machine, controller, server and host Active CN103838593B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201210479165.2A CN103838593B (en) 2012-11-22 2012-11-22 Method and system for recovering virtual machine, controller, server and host
PCT/CN2013/074295 WO2014079194A1 (en) 2012-11-22 2013-04-17 Method and system for restoring virtual machine, and controller, server and guest host

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210479165.2A CN103838593B (en) 2012-11-22 2012-11-22 Method and system for recovering virtual machine, controller, server and host

Publications (2)

Publication Number Publication Date
CN103838593A CN103838593A (en) 2014-06-04
CN103838593B true CN103838593B (en) 2020-04-03

Family

ID=50775464

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210479165.2A Active CN103838593B (en) 2012-11-22 2012-11-22 Method and system for recovering virtual machine, controller, server and host

Country Status (2)

Country Link
CN (1) CN103838593B (en)
WO (1) WO2014079194A1 (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10439996B2 (en) 2014-02-11 2019-10-08 Yaana Technologies, LLC Method and system for metadata analysis and collection with privacy
US10447503B2 (en) 2014-02-21 2019-10-15 Yaana Technologies, LLC Method and system for data flow management of user equipment in a tunneling packet data network
US10334037B2 (en) 2014-03-31 2019-06-25 Yaana Technologies, Inc. Peer-to-peer rendezvous system for minimizing third party visibility and method thereof
US10285038B2 (en) 2014-10-10 2019-05-07 Yaana Technologies, Inc. Method and system for discovering user equipment in a network
US10542426B2 (en) 2014-11-21 2020-01-21 Yaana Technologies, LLC System and method for transmitting a secure message over a signaling network
WO2016176661A1 (en) 2015-04-29 2016-11-03 Yaana Technologies, Inc. Scalable and iterative deep packet inspection for communications networks
EP3375155A4 (en) 2015-11-13 2019-08-14 Yaana Technologies, LLC System and method for discovering internet protocol (ip) network address and port translation bindings
CN106817238A (en) * 2015-11-30 2017-06-09 中兴通讯股份有限公司 Virtual machine repair method, virtual machine, system and business function network element
CN105718263B (en) * 2016-01-19 2018-11-13 合肥联宝信息技术有限公司 A kind of method and system for realizing distributed computer based on cloud
US20170230242A1 (en) * 2016-02-10 2017-08-10 Yaana Technologies, LLC Dynamic Elastic Shadow Service Orchestrator
CN106708603B (en) 2016-12-28 2019-04-26 平安科技(深圳)有限公司 Virtual machine quick recovery method and device
CN110196723B (en) * 2018-02-27 2023-06-27 阿里巴巴(中国)有限公司 Method, apparatus and computer readable storage medium for copying traffic data
CN108694066B (en) * 2018-05-09 2021-04-27 北京酷我科技有限公司 TableView delayed refreshing method
CN109472680A (en) * 2018-10-26 2019-03-15 中国银行股份有限公司 A kind of accounting processing method and system
CN112835739A (en) * 2019-11-22 2021-05-25 北京百度网讯科技有限公司 Downtime processing method and device
US12014186B2 (en) * 2022-03-25 2024-06-18 Sap Se Reducing downtime during operating system patching

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033755A (en) * 2009-09-30 2011-04-27 国际商业机器公司 Method and system for running virtual machine mirror image
CN102339229A (en) * 2010-07-15 2012-02-01 戴元顺 Virtualization method based on operating system layer

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102185928B (en) * 2011-06-01 2013-07-17 广州杰赛科技股份有限公司 Method for creating virtual machine in cloud computing system and cloud computing system
CN102662751B (en) * 2012-03-30 2016-05-11 浪潮电子信息产业股份有限公司 A kind of method improving based on thermophoresis dummy machine system availability

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102033755A (en) * 2009-09-30 2011-04-27 国际商业机器公司 Method and system for running virtual machine mirror image
CN102339229A (en) * 2010-07-15 2012-02-01 戴元顺 Virtualization method based on operating system layer

Also Published As

Publication number Publication date
WO2014079194A1 (en) 2014-05-30
CN103838593A (en) 2014-06-04

Similar Documents

Publication Publication Date Title
CN103838593B (en) Method and system for recovering virtual machine, controller, server and host
US10628205B2 (en) Virtual machine placement with automatic deployment error recovery
CN106911524B (en) HA implementation method and device
US9448899B2 (en) Method, apparatus and system for switching over virtual application two-node cluster in cloud environment
EP2712119B1 (en) Abnormality handling method, device and client
WO2017049828A1 (en) Method, device and system for data processing based on linux
EP3550436A1 (en) Method and apparatus for detecting and recovering fault of virtual machine
US20170031602A1 (en) Coordinated Upgrade of a Cluster Storage System
WO2011066761A1 (en) Method, apparatus, and system for online migrating from physical machine to virtual machine
WO2014039112A1 (en) System for enabling server maintenance using snapshots
JPWO2017042890A1 (en) Database system, server device, program, and information processing method
KR20180087278A (en) Method, apparatus and system for quick restoration of virtual machines
CN112380062A (en) Method and system for rapidly recovering system for multiple times based on system backup point
CN104503861A (en) Abnormality handling method and system, agency device and control device
CN110196749B (en) Virtual machine recovery method and device, storage medium and electronic device
JP4560074B2 (en) Virtual computer system and virtual computer restoration method in the same system
US10606632B2 (en) Preventing interruption during virtual machine reboot
WO2011109049A1 (en) Method and apparatus of backing-up subversion repository
JP5285045B2 (en) Failure recovery method, server and program in virtual environment
CN107168774B (en) Virtual machine migration method and system based on local storage
CN112948008A (en) Ironic based physical bare computer management method
JP6374362B2 (en) Call processing apparatus, session recovery method, and call processing server program
CN114930313A (en) System and method for managing blockchain nodes
US10776036B2 (en) System and method for efficient restore
CN115292101A (en) Metadata abnormal state recovery method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant