CN111090491A - Method and device for recovering task state of virtual machine and electronic equipment - Google Patents
Method and device for recovering task state of virtual machine and electronic equipment Download PDFInfo
- Publication number
- CN111090491A CN111090491A CN201910595536.5A CN201910595536A CN111090491A CN 111090491 A CN111090491 A CN 111090491A CN 201910595536 A CN201910595536 A CN 201910595536A CN 111090491 A CN111090491 A CN 111090491A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- target virtual
- task state
- host
- machine
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, 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)
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the application provides a method and a device for recovering a task state of a virtual machine and electronic equipment, wherein when the task state of a target virtual machine is abnormal, whether the task state of the target virtual machine is abnormal due to migration is judged; when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine; determining a host machine where a target virtual machine marked in the management information is located; and when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into a source host machine, cleaning the bottom environment of the destination host machine and modifying the task state of the target virtual machine. The task state of the virtual machine is automatically recovered when the task state of the virtual machine is abnormal, and the workload of managers is reduced.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for recovering a task state of a virtual machine, and an electronic device.
Background
With the continuous development of computer technology, online service technology is gradually prevalent, and the cloud platform can provide diversified online services for users. The cloud platform generates a plurality of virtual machines through a virtualization technology, so that online services are provided for users through the virtual machines. The running environment of each virtual machine can be isolated through software so as to improve the safety of user data.
When the state operation is performed on the virtual machine in the cloud platform, a task state is given to the virtual machine, such as "migration in progress", "snapshot in progress", and the like. When the virtual machine is in a certain task state, the cloud platform does not perform other state operations on the virtual machine by default. In the related art, when the task state of a virtual machine is abnormal, a manager needs to manually restore the state of the virtual machine. However, the state of the virtual machine is recovered manually, which increases the workload of the manager.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for recovering a task state of a virtual machine, and an electronic device, so as to implement automatic state recovery of the virtual machine when an exception occurs in the task state of the virtual machine, thereby reducing a workload of a manager. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a method for recovering a task state of a virtual machine, where the method includes:
when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration;
when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine;
determining a host machine where the target virtual machine marked in the management information is located;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into the source host machine, cleaning the bottom environment of the destination host machine and modifying the task state of the target virtual machine;
when the host machine where the target virtual machine marked in the management information is located is the destination end host machine and the target virtual machine is detected in the destination end host machine, cleaning the bottom environment of the source end host machine and modifying the task state of the target virtual machine.
Optionally, after determining whether the task state of the target virtual machine is abnormal due to the migration, the method further includes:
when the task state of the target virtual machine is not abnormal due to migration, judging whether the target virtual machine is detected in a target host machine, wherein the target host machine is the host machine where the target virtual machine marked in the management information is located;
if the target virtual machine is detected in the target host machine, modifying the task state of the target virtual machine;
and if the target virtual machine is not detected in the target host machine, reestablishing the target virtual machine and modifying the task state of the target virtual machine.
Optionally, after determining the host where the target virtual machine marked in the management information is located, the method further includes:
and modifying the task state of the target virtual machine when the host machine where the target virtual machine marked in the management information is located is the source host machine.
Optionally, when the task state of the target virtual machine is abnormal, determining whether the task state of the target virtual machine is abnormal due to migration includes:
when the task state of a target virtual machine is abnormal, judging whether a mirror image of the target virtual machine exists or not;
and when the mirror image of the target virtual machine exists, judging whether the task state of the target virtual machine is abnormal due to migration.
Optionally, the method further includes:
and monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset duration threshold.
In a second aspect, an embodiment of the present application provides an apparatus for recovering a task state of a virtual machine, where the apparatus includes:
the abnormal judgment module is used for judging whether the task state of the target virtual machine is abnormal due to migration or not when the task state of the target virtual machine is abnormal;
the host determination module is used for determining a source host and a destination host of the target virtual machine when the task state of the target virtual machine is abnormal due to migration;
the record query module is used for determining a host machine where the target virtual machine marked in the management information is located;
a first state modification module, configured to modify the host in the management information where the target virtual machine is located into the source host, clean a bottom environment of the destination host, and modify a task state of the target virtual machine, when the host in the management information where the target virtual machine is located is the destination host and the target virtual machine is not detected in the destination host;
and the second state modification module is used for cleaning the bottom environment of the source end host and modifying the task state of the target virtual machine when the host machine where the target virtual machine marked in the management information is located is the target end host and the target virtual machine is detected in the target end host.
Optionally, the apparatus further comprises:
a virtual machine detection module, configured to determine whether the target virtual machine is detected in a target host machine when a task state of the target virtual machine is not abnormal due to migration, where the target host machine is a host machine in which the target virtual machine marked in the management information is located;
a third state modification module, configured to modify a task state of the target virtual machine if the target virtual machine is detected in the target host;
and the fourth state modification module is used for reestablishing the target virtual machine and modifying the task state of the target virtual machine if the target virtual machine is not detected in the target host machine.
Optionally, the apparatus further comprises:
and a fifth state modification module, configured to modify a task state of the target virtual machine when the host machine in which the target virtual machine is located, which is marked in the management information, is the source host machine.
Optionally, the abnormality determining module is specifically configured to:
when the task state of a target virtual machine is abnormal, judging whether a mirror image of the target virtual machine exists or not;
and when the mirror image of the target virtual machine exists, judging whether the task state of the target virtual machine is abnormal due to migration.
Optionally, the apparatus further comprises:
and the abnormity monitoring module is used for monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset duration threshold.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the method for recovering a task state of a virtual machine according to any one of the first aspect described above when executing a program stored in the memory.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the method for recovering a task state of a virtual machine according to any one of the above first aspects is implemented.
According to the method, the device and the electronic equipment for recovering the task state of the virtual machine, when the task state of the target virtual machine is abnormal, whether the task state of the target virtual machine is abnormal due to migration is judged; when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine; determining a host machine where a target virtual machine marked in the management information is located; when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into a source host machine, cleaning the bottom environment of the destination host machine and modifying the task state of the target virtual machine; and when the host machine where the target virtual machine marked in the management information is located is the destination end host machine and the target virtual machine is detected in the destination end host machine, cleaning the bottom environment of the source end host machine and modifying the task state of the target virtual machine. The task state of the virtual machine is automatically recovered when the task state of the virtual machine is abnormal, and the workload of managers is reduced. Of course, not all of the above advantages need be achieved in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a method for recovering a task state of a virtual machine according to an embodiment of the present application;
fig. 2 is another schematic diagram of a method for recovering a task state of a virtual machine according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a device for recovering a task state of a virtual machine according to an embodiment of the present disclosure
Fig. 4 is a schematic diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
First, terms of art in the embodiments of the present application are explained:
host/node: a physical server running a virtual machine.
The virtual machine task state: the operation on the virtual machine in the cloud platform can endow the virtual machine with a task state, such as 'migration in process', 'backup in process', and the like. When the virtual machine is in a certain task state, other operations on the virtual machine can not be performed through the cloud platform.
And (3) thermal migration: the running virtual machine is migrated from one node to another node for running, and the user service in the migration is not interrupted.
Cold migration: the virtual machine is migrated from one node to another node, and shutdown is performed in the migration process.
A source end host: and (4) the node where the virtual machine is located before migration.
A destination host: a node to which the virtual machine is to be migrated.
In order to reduce the workload of a manager, and achieve that an exception occurs in a task state of a virtual machine, and automatically perform state recovery on the virtual machine, an embodiment of the present application provides a method for recovering the task state of the virtual machine, which is shown in fig. 1, and the method includes:
s101, when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration.
The method for recovering the task state of the virtual machine can be realized through a cloud platform, and particularly can be realized through a server in the cloud platform.
The target virtual machine can be any virtual machine in the cloud platform, the cloud platform can monitor the task state of each virtual machine in the cloud platform, and the task state of the virtual machine is abnormal and can be an error. In a possible implementation manner, before S101, the method for recovering a task state of a virtual machine according to the embodiment of the present application further includes: and monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset time threshold.
In the process of executing the task by the virtual machine, if an error occurs, the task state of the virtual machine is set to be an error. The preset time threshold may be set according to actual conditions, for example, set to 10 minutes, 20 minutes, or 1 hour. And when the duration of the virtual machines in the same task state is greater than a preset duration threshold, judging that the task state of the virtual machine is abnormal.
The virtual machine state tasks can be divided into two types, one type is abnormal caused by migration, and the migration comprises cold migration, hot migration, size adjustment and the like; one type is non-migration-induced exceptions, such as making snapshots, etc. Because migration involves two nodes, cleanup of the environment is required at recovery time. This is because if the environment cleaning is not performed, the use of the virtual machine thereafter becomes abnormal.
And when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration. Management information of the virtual machine in database management can be acquired, so that the reason of the abnormal state of the virtual machine can be determined, wherein the management information of the virtual machine can include information such as a task before the abnormal state of the task of the virtual machine, whether the virtual machine is migrated, a source end host and a destination end host. For example, it may be determined whether or not a migration task is executed or performed on the target virtual machine, and when the migration task is executed or performed on the target virtual machine, it may be determined that an abnormality occurs in the task state of the target virtual machine due to migration.
Optionally, when the task state of the target virtual machine is abnormal, determining whether the task state of the target virtual machine is abnormal due to migration includes:
step A, when the task state of the target virtual machine is abnormal, judging whether the mirror image of the target virtual machine exists or not.
When the task state of the target virtual machine is abnormal, inquiring the mirror image warehouse, judging whether the mirror image of the target virtual machine exists or not, and when the mirror image of the target virtual machine does not exist, the target virtual machine cannot be recovered, so that the task state recovery operation aiming at the target virtual machine is abandoned.
And step B, judging whether the task state of the target virtual machine is abnormal due to migration or not when the mirror image of the target virtual machine exists.
S102, when the task state of the target virtual machine is abnormal due to migration, determining a source host and a destination host of the target virtual machine.
When the task state abnormality of the target virtual machine is caused by migration, it is described that the source host and the destination host of the target virtual machine are recorded in the management information managed by the database, and the source host and the destination host of the target virtual machine can be determined from the management information managed by the database.
And S103, determining the host machine where the target virtual machine marked in the management information is located.
And judging whether the host machine where the target virtual machine marked in the management information is located is a destination end host machine or a source end host machine.
And S104, when the host machine in which the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine in which the target virtual machine is located in the management information into the source host machine, cleaning the bottom environment of the destination host machine and modifying the task state of the target virtual machine.
The method comprises the steps of cleaning a bottom layer environment of a destination host, mainly cleaning a network of the destination host, cleaning configuration information of a network port of a target virtual machine in the destination host, and the like. Thereby reducing the situation of virtual machine network errors. The task state of the target virtual machine is modified, and the task state of the target virtual machine can be reset, namely modified to be null, so that other operations of the subsequent target virtual machine are facilitated. This is because, in general, if the task state of the target virtual machine is not "none", the user cannot perform other operations on the target virtual machine.
And S105, when the host in which the target virtual machine marked in the management information is located is the destination host and the target virtual machine is detected in the destination host, cleaning a bottom environment of the source host and modifying a task state of the target virtual machine.
The method for clearing the bottom environment of the source end host mainly comprises the steps of clearing the network of the source end host, clearing the configuration information of the network port of the target virtual machine in the source end host and the like. And resetting the task state of the target virtual machine.
In a possible implementation manner, after determining the host where the target virtual machine marked in the management information is located, the method further includes:
and modifying the task state of the target virtual machine when the host machine where the target virtual machine marked in the management information is located is the source host machine.
In the embodiment of the application, the task state of the virtual machine is automatically recovered when the task state of the virtual machine is abnormal, and the workload of managers is reduced.
In one possible implementation manner, after determining whether the task state of the target virtual machine is abnormal due to migration, the method further includes:
step one, when the task state of the target virtual machine is not abnormal due to migration, judging whether the target virtual machine is detected in a target host machine, wherein the target host machine is the host machine where the target virtual machine marked in the management information is located.
And step two, if the target virtual machine is detected in the target host machine, modifying the task state of the target virtual machine.
The task state of the target virtual machine is modified, and the task state of the target virtual machine can be reset, namely modified to be null, so that other operations of the subsequent target virtual machine are facilitated.
And step three, if the target virtual machine is not detected in the target host machine, reestablishing the target virtual machine, and modifying the task state of the target virtual machine.
And when the target virtual machine is not detected in the target host machine, regenerating the target virtual machine by using the mirror image or snapshot of the target virtual machine and the like, and modifying the task state of the target virtual machine.
Specifically, the method for recovering the task state of the virtual machine according to the embodiment of the present application may be as shown in fig. 2, and includes:
step one, judging whether a mirror image of a target virtual machine exists or not.
And when the task state of the target virtual machine is detected to be abnormal, judging whether the mirror image of the target virtual machine exists or not, if so, executing the step two, and if not, finishing the operation.
And step two, judging whether the task state of the target virtual machine is abnormal due to migration, executing step three if the task state of the target virtual machine is abnormal due to migration, and executing step eight if the task state of the target virtual machine is not abnormal due to migration.
And step three, determining a source end host and a destination end host of the target virtual machine.
And step four, judging whether the host machine where the target virtual machine marked in the management information is located is a destination end host machine or a source end host machine, executing step five when the host machine is the destination end host machine, and executing step ten when the host machine is the source end host machine.
And step five, judging whether a target virtual machine is detected in the target host machine, executing the step six when the target virtual machine is detected, and executing the step seven when the target virtual machine is not detected, wherein the target host machine is the host machine where the target virtual machine marked in the management information is located.
And step six, cleaning the environment of the source end host.
And step ten is executed after the step six is executed.
And step seven, cleaning the environment of the destination host.
And executing a step ten after the step seven is executed.
Step eight, judging whether a target virtual machine is detected on the target host machine, if so, executing the step nine, otherwise, executing the step ten.
And step nine, regenerating and starting the target virtual machine on the target host machine.
And step ten, modifying the task state of the virtual machine.
In the embodiment of the application, the task state of the virtual machine is automatically recovered when the task state of the virtual machine is abnormal, and the workload of managers is reduced.
An embodiment of the present application further provides a device for recovering a task state exception of a virtual machine, including:
the cloud platform monitoring module is used for monitoring the task states of all the virtual machines; and when the state of the virtual machine is found to be wrong or a certain task is not completed within a preset time threshold, automatically issuing a recovery command to the virtual machine state recovery module.
The virtual machine state recovery module is used for making different recovery strategies according to the task state mark, the original node of the virtual machine, the current node and other elements; after receiving a recovery command, determining the virtual machine state error reason, the occurrence scene and the task stage by acquiring the information of the target virtual machine in the database management, and matching the information with the recovery strategy in the module, thereby realizing the virtual machine state recovery and simultaneously completing the cleaning of the failed task environment.
The embodiment of the application solves the problem that the virtual machine task state is abnormal and cannot be operated again due to the instability of the cloud platform, and the maintenance cost is reduced through automatic recovery in a monitoring mode.
An embodiment of the present application further provides a device for recovering a task state of a virtual machine, referring to fig. 3, where the device includes:
an exception determining module 301, configured to determine, when a task state of a target virtual machine is abnormal, whether the task state of the target virtual machine is abnormal due to migration;
a host determining module 302, configured to determine a source host and a destination host of the target virtual machine when a task state of the target virtual machine is abnormal due to migration;
a record query module 303, configured to determine a host in which the target virtual machine marked in the management information is located;
a first state modification module 304, configured to modify the host in the management information where the target virtual machine is located into the source host, clean a bottom environment of the destination host, and modify a task state of the target virtual machine, when the host in the management information where the target virtual machine is located is the destination host and the target virtual machine is not detected in the destination host;
a second state modification module 305, configured to, when the host in which the target virtual machine marked in the management information is located is the destination host and the target virtual machine is detected in the destination host, clean a bottom environment of the source host and modify a task state of the target virtual machine.
Optionally, the apparatus for recovering the task state of the virtual machine in the embodiment of the present application further includes:
a virtual machine detection module, configured to determine whether the target virtual machine is detected in a target host machine when a task state of the target virtual machine is not abnormal due to migration, where the target host machine is a host machine in which the target virtual machine marked in the management information is located;
a third state modification module, configured to modify a task state of the target virtual machine if the target virtual machine is detected in the target host;
and a fourth state modification module, configured to reestablish the target virtual machine and modify a task state of the target virtual machine if the target virtual machine is not detected in the target host.
Optionally, the apparatus for recovering the task state of the virtual machine in the embodiment of the present application further includes:
and a fifth state modification module, configured to modify a task state of the target virtual machine when the host in which the target virtual machine marked in the management information is located is the source host.
Optionally, the abnormality determining module 301 is specifically configured to:
when the task state of a target virtual machine is abnormal, judging whether a mirror image of the target virtual machine exists or not;
and when the mirror image of the target virtual machine exists, judging whether the task state of the target virtual machine is abnormal due to migration.
Optionally, the apparatus for recovering the task state of the virtual machine in the embodiment of the present application further includes:
and the abnormity monitoring module is used for monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset time threshold.
An embodiment of the present application further provides an electronic device, including: a processor and a memory;
the memory is used for storing computer programs;
when the processor is used for executing the computer program stored in the memory, the following steps are realized:
when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration;
when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine;
determining a host machine where the target virtual machine marked in the management information is located;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into the source host machine, cleaning the bottom environment of the destination host machine, and modifying the task state of the target virtual machine;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is detected in the destination host machine, cleaning a bottom environment of the source host machine and modifying a task state of the target virtual machine.
Optionally, referring to fig. 4, the electronic device according to the embodiment of the present application further includes a communication interface 402 and a communication bus 404, where the processor 401, the communication interface 402, and the memory 403 complete communication with each other through the communication bus 404.
Optionally, when the processor is configured to execute the computer program stored in the memory, the processor may further implement a method for recovering a task state of any virtual machine.
The communication bus mentioned in the electronic device may be a PCI (Peripheral component interconnect) bus, an EISA (Extended Industry standard architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a RAM (Random Access Memory) or an NVM (Non-Volatile Memory), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the following steps:
when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration;
when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine;
determining a host machine where the target virtual machine marked in the management information is located;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into the source host machine, cleaning the bottom environment of the destination host machine, and modifying the task state of the target virtual machine;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is detected in the destination host machine, cleaning a bottom environment of the source host machine and modifying a task state of the target virtual machine.
Optionally, when being executed by a processor, the computer program can further implement a method for recovering a task state of any of the virtual machines.
It should be noted that, in this document, the technical features in the various alternatives can be combined to form the scheme as long as the technical features are not contradictory, and the scheme is within the scope of the disclosure of the present application. Relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the embodiments of the apparatus, the electronic device, and the storage medium, since they are substantially similar to the method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims (12)
1. A method for recovering a task state of a virtual machine is characterized by comprising the following steps:
when the task state of the target virtual machine is abnormal, judging whether the task state of the target virtual machine is abnormal due to migration;
when the task state of the target virtual machine is abnormal due to migration, determining a source end host and a destination end host of the target virtual machine;
determining a host machine where the target virtual machine marked in the management information is located;
when the host machine where the target virtual machine marked in the management information is located is the destination host machine and the target virtual machine is not detected in the destination host machine, modifying the host machine where the target virtual machine is located in the management information into the source host machine, cleaning the bottom environment of the destination host machine and modifying the task state of the target virtual machine;
when the host machine where the target virtual machine marked in the management information is located is the destination end host machine and the target virtual machine is detected in the destination end host machine, cleaning the bottom environment of the source end host machine and modifying the task state of the target virtual machine.
2. The method according to claim 1, wherein after the determining whether the task state of the target virtual machine is abnormal due to migration, the method further comprises:
when the task state of the target virtual machine is not abnormal due to migration, judging whether the target virtual machine is detected in a target host machine, wherein the target host machine is the host machine where the target virtual machine marked in the management information is located;
if the target virtual machine is detected in the target host machine, modifying the task state of the target virtual machine;
and if the target virtual machine is not detected in the target host machine, reestablishing the target virtual machine and modifying the task state of the target virtual machine.
3. The method according to claim 1, wherein after determining the host machine in which the target virtual machine marked in the management information is located, the method further comprises:
and modifying the task state of the target virtual machine when the host machine where the target virtual machine marked in the management information is located is the source host machine.
4. The method according to claim 1, wherein the determining whether the task state of the target virtual machine is abnormal due to migration when the task state of the target virtual machine is abnormal includes:
when the task state of a target virtual machine is abnormal, judging whether a mirror image of the target virtual machine exists or not;
and when the mirror image of the target virtual machine exists, judging whether the task state of the target virtual machine is abnormal due to migration.
5. The method according to any one of claims 1-4, further comprising:
and monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset duration threshold.
6. An apparatus for restoring a task state of a virtual machine, the apparatus comprising:
the abnormal judgment module is used for judging whether the task state of the target virtual machine is abnormal due to migration or not when the task state of the target virtual machine is abnormal;
the host determination module is used for determining a source host and a destination host of the target virtual machine when the task state of the target virtual machine is abnormal due to migration;
the record query module is used for determining a host machine where the target virtual machine marked in the management information is located;
a first state modification module, configured to modify the host in the management information where the target virtual machine is located into the source host, clean a bottom environment of the destination host, and modify a task state of the target virtual machine, when the host in the management information where the target virtual machine is located is the destination host and the target virtual machine is not detected in the destination host;
and the second state modification module is used for cleaning the bottom environment of the source end host and modifying the task state of the target virtual machine when the host machine where the target virtual machine marked in the management information is located is the target end host and the target virtual machine is detected in the target end host.
7. The apparatus of claim 6, further comprising:
a virtual machine detection module, configured to determine whether the target virtual machine is detected in a target host machine when a task state of the target virtual machine is not abnormal due to migration, where the target host machine is a host machine in which the target virtual machine marked in the management information is located;
a third state modification module, configured to modify a task state of the target virtual machine if the target virtual machine is detected in the target host;
and the fourth state modification module is used for reestablishing the target virtual machine and modifying the task state of the target virtual machine if the target virtual machine is not detected in the target host machine.
8. The apparatus of claim 6, further comprising:
and a fifth state modification module, configured to modify a task state of the target virtual machine when the host machine in which the target virtual machine is located, which is marked in the management information, is the source host machine.
9. The apparatus according to claim 6, wherein the abnormality determining module is specifically configured to:
when the task state of a target virtual machine is abnormal, judging whether a mirror image of the target virtual machine exists or not;
and when the mirror image of the target virtual machine exists, judging whether the task state of the target virtual machine is abnormal due to migration.
10. The apparatus of any of claims 6-9, further comprising:
and the abnormity monitoring module is used for monitoring the task state of the target virtual machine, and judging that the task state of the target virtual machine is abnormal when the task state of the target virtual machine is wrong or the duration of the same task state is greater than a preset duration threshold.
11. An electronic device comprising a processor and a memory;
the memory is used for storing a computer program;
the processor is configured to implement the method for restoring a task state of a virtual machine according to any one of claims 1 to 5 when executing the program stored in the memory.
12. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements the method for restoring a task state of a virtual machine according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910595536.5A CN111090491B (en) | 2019-07-03 | 2019-07-03 | Virtual machine task state recovery method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910595536.5A CN111090491B (en) | 2019-07-03 | 2019-07-03 | Virtual machine task state recovery method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111090491A true CN111090491A (en) | 2020-05-01 |
CN111090491B CN111090491B (en) | 2023-10-10 |
Family
ID=70393360
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910595536.5A Active CN111090491B (en) | 2019-07-03 | 2019-07-03 | Virtual machine task state recovery method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111090491B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113296889A (en) * | 2021-05-06 | 2021-08-24 | 曙光信息产业股份有限公司 | Task management method, device, system, computer equipment and storage medium |
Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103577245A (en) * | 2013-10-29 | 2014-02-12 | 中国科学院计算技术研究所 | Lightweight class virtual machine migration method |
CN103729280A (en) * | 2013-12-23 | 2014-04-16 | 国云科技股份有限公司 | High availability mechanism for virtual machine |
CN103885830A (en) * | 2014-04-16 | 2014-06-25 | 中国科学院软件研究所 | Data processing method used in cross-data-center live migration process of virtual machine |
CN104113574A (en) * | 2013-04-19 | 2014-10-22 | 中国科学院计算技术研究所 | Safe transfer method and system of wide area network trusted virtual machine |
US9317314B2 (en) * | 2010-06-29 | 2016-04-19 | Microsoft Techology Licensing, Llc | Techniques for migrating a virtual machine using shared storage |
WO2017008584A1 (en) * | 2015-07-15 | 2017-01-19 | 中兴通讯股份有限公司 | Virtual machine starting method and device, and management node |
CN106708603A (en) * | 2016-12-28 | 2017-05-24 | 平安科技(深圳)有限公司 | Virtual machine quick recovery method and device |
CN107196803A (en) * | 2017-05-31 | 2017-09-22 | 中国人民解放军信息工程大学 | The dynamic generation and maintaining method of isomery cloud main frame |
CN107797878A (en) * | 2016-09-06 | 2018-03-13 | 阿里巴巴集团控股有限公司 | Live migration of virtual machine processing method and system |
US10007533B2 (en) * | 2012-08-22 | 2018-06-26 | V3 Systems Holdings, Inc. | Virtual machine migration |
CN108763405A (en) * | 2018-05-22 | 2018-11-06 | 深信服网络科技(深圳)有限公司 | Service data migration method, device and system and readable storage medium |
CN109086118A (en) * | 2018-07-25 | 2018-12-25 | 浪潮(北京)电子信息产业有限公司 | VTPM virtual machine migration method, device and equipment based on KVM |
CN109213570A (en) * | 2018-08-28 | 2019-01-15 | 郑州云海信息技术有限公司 | A kind of virtual machine migration method, device, equipment and readable storage medium storing program for executing |
US20190034298A1 (en) * | 2017-07-31 | 2019-01-31 | Vmware, Inc. | Automatic selection of networks when recovering a virtual machine |
-
2019
- 2019-07-03 CN CN201910595536.5A patent/CN111090491B/en active Active
Patent Citations (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9317314B2 (en) * | 2010-06-29 | 2016-04-19 | Microsoft Techology Licensing, Llc | Techniques for migrating a virtual machine using shared storage |
US10007533B2 (en) * | 2012-08-22 | 2018-06-26 | V3 Systems Holdings, Inc. | Virtual machine migration |
CN104113574A (en) * | 2013-04-19 | 2014-10-22 | 中国科学院计算技术研究所 | Safe transfer method and system of wide area network trusted virtual machine |
CN103577245A (en) * | 2013-10-29 | 2014-02-12 | 中国科学院计算技术研究所 | Lightweight class virtual machine migration method |
CN103729280A (en) * | 2013-12-23 | 2014-04-16 | 国云科技股份有限公司 | High availability mechanism for virtual machine |
CN103885830A (en) * | 2014-04-16 | 2014-06-25 | 中国科学院软件研究所 | Data processing method used in cross-data-center live migration process of virtual machine |
WO2017008584A1 (en) * | 2015-07-15 | 2017-01-19 | 中兴通讯股份有限公司 | Virtual machine starting method and device, and management node |
CN107797878A (en) * | 2016-09-06 | 2018-03-13 | 阿里巴巴集团控股有限公司 | Live migration of virtual machine processing method and system |
CN106708603A (en) * | 2016-12-28 | 2017-05-24 | 平安科技(深圳)有限公司 | Virtual machine quick recovery method and device |
CN107196803A (en) * | 2017-05-31 | 2017-09-22 | 中国人民解放军信息工程大学 | The dynamic generation and maintaining method of isomery cloud main frame |
US20190034298A1 (en) * | 2017-07-31 | 2019-01-31 | Vmware, Inc. | Automatic selection of networks when recovering a virtual machine |
CN108763405A (en) * | 2018-05-22 | 2018-11-06 | 深信服网络科技(深圳)有限公司 | Service data migration method, device and system and readable storage medium |
CN109086118A (en) * | 2018-07-25 | 2018-12-25 | 浪潮(北京)电子信息产业有限公司 | VTPM virtual machine migration method, device and equipment based on KVM |
CN109213570A (en) * | 2018-08-28 | 2019-01-15 | 郑州云海信息技术有限公司 | A kind of virtual machine migration method, device, equipment and readable storage medium storing program for executing |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113296889A (en) * | 2021-05-06 | 2021-08-24 | 曙光信息产业股份有限公司 | Task management method, device, system, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111090491B (en) | 2023-10-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP5075736B2 (en) | System failure recovery method and system for virtual server | |
CN109815049B (en) | Node downtime recovery method and device, electronic equipment and storage medium | |
US11030052B2 (en) | Data protection using checkpoint restart for cluster shared resources | |
US8910172B2 (en) | Application resource switchover systems and methods | |
CN102810073B (en) | Background real-time monitoring processing method for data | |
JP6447258B2 (en) | Management program, management method, and management apparatus | |
CN109992452B (en) | Fault processing method and device | |
JP6411696B1 (en) | Version control system and version control method | |
CN112199240A (en) | Method for switching nodes during node failure and related equipment | |
CN114443332A (en) | Storage pool detection method and device, electronic equipment and storage medium | |
JPWO2017168484A1 (en) | Management computer and performance deterioration sign detection method | |
CN107203451B (en) | Method and apparatus for handling failures in a storage system | |
CN111090491B (en) | Virtual machine task state recovery method and device and electronic equipment | |
US20200233674A1 (en) | Automatically configuring boot order in recovery operations | |
US20100085871A1 (en) | Resource leak recovery in a multi-node computer system | |
CN113986450A (en) | Virtual machine backup method and device | |
CN109725916B (en) | Topology updating system and method for stream processing | |
US10754753B1 (en) | Performance of virtual machine instances using machine recognition of screenshot images | |
CN111130856A (en) | Server configuration method, system, equipment and computer readable storage medium | |
CN110968456B (en) | Method and device for processing fault disk in distributed storage system | |
CN111488124A (en) | Data updating method and device, electronic equipment and storage medium | |
US8203937B2 (en) | Global detection of resource leaks in a multi-node computer system | |
JP5466740B2 (en) | System failure recovery method and system for virtual server | |
CN113778763B (en) | Intelligent switching method and system for three-way interface service faults | |
US20230088318A1 (en) | Remotely healing crashed processes |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |