Disclosure of Invention
The application aims to provide a virtual machine availability detection method, a virtual machine availability detection system, a computer readable storage medium and a server, which can realize high availability of important service virtual machines in a super-fusion virtual machine.
In order to solve the above technical problem, the present application provides a method for detecting availability of a virtual machine, which has the following specific technical scheme:
receiving a high availability alarm sent by a server BMC;
judging whether the high-availability alarm is a service network port alarm or not;
and if so, triggering a high availability alarm of the virtual machine.
Optionally, after triggering the high availability alarm of the virtual machine, the method further includes:
the virtual machine is migrated to a health server in a hot mode, and the virtual machine is restarted on the health server.
Optionally, the determining whether the high available alarm is a service network port alarm includes:
and judging whether the MAC address of the service network port is consistent with the MAC address of the alarm network port.
Optionally, if the high availability alarm is a service network port alarm, before triggering the high availability alarm of the virtual machine, the method further includes:
judging whether the service network port corresponding to the service network port alarm has a physical fault or is in a disconnection state;
and if so, executing a step of triggering a high availability alarm of the virtual machine.
Optionally, if a physical fault exists in a service port corresponding to the service port alarm or the service port is in a disconnection state, before triggering the high availability alarm of the virtual machine, the method further includes:
judging whether the server to which the service network port belongs is in a maintenance mode;
if yes, triggering a high-availability alarm of the virtual machine after the server finishes the maintenance mode;
and if not, executing the step of triggering the high availability alarm of the virtual machine.
Optionally, before receiving the high availability alarm sent by the server BMC, the method further includes:
judging whether the virtual machine starts a high-availability function or not;
if yes, judging whether the virtual machine starts a service network port detection function or not;
and if the virtual machine does not start the service network port detection function, starting the service network port detection function.
The present application further provides a system for detecting availability of a virtual machine, including:
the alarm receiving module is used for receiving a high-availability alarm sent by the server BMC;
the judging module is used for judging whether the high-availability alarm is a service network port alarm or not;
and the high availability triggering module is used for triggering the high availability alarm of the virtual machine when the judgment result of the judging module is yes.
Optionally, the method further includes:
and the migration module is used for carrying out hot migration on the virtual machine to a health server and restarting the virtual machine on the health server.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method as set forth above.
The present application further provides a server comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described above when calling the computer program in the memory.
The application provides a virtual machine availability detection method, which comprises the following steps: receiving a high availability alarm sent by a server BMC; judging whether the high-availability alarm is a service network port alarm or not; and if so, triggering a high availability alarm of the virtual machine.
According to the method and the system, the BMC is used for detecting the virtual machine, when the high-availability alarm sent by the BMC is received, whether the high-availability alarm is a service network port alarm is judged, if yes, the fact that the service network port is possibly abnormal due to physical damage or connection interruption and the like is indicated, the high-availability alarm of the virtual machine is triggered in time, the state of the virtual machine is correctly displayed by the super-fusion management platform, and the fact that management and normal application of the virtual machine are affected due to the fault of the service network port of the virtual machine is avoided. Through the state detection mechanism for the service network port, the high availability of the important service virtual machine can be ensured in a refined manner, and the operation and maintenance pressure and the operation and maintenance cost of the server and the virtual machine are reduced.
The present application further provides a system for detecting availability of a virtual machine, a computer-readable storage medium, and a server, which have the above beneficial effects, and are not described herein again.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, 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 some embodiments of the present application, but not all 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.
Referring to fig. 1, fig. 1 is a flowchart of a method for detecting availability of a virtual machine according to an embodiment of the present application, where the method includes:
s101: receiving a high availability alarm sent by a server BMC;
this step is intended to receive a high availability alarm from a BMC (Baseboard management Controller), and the BMC management system of the server may be used to collect the state and changes of each hardware of the server. When the network port fails or the network connection state changes, the BMC management system may detect the corresponding change.
How the super-convergence Management platform receives the high-availability alarm sent by the BMC is not specifically limited, and SNMP (Simple Network Management Protocol) or other similar protocols may be adopted to directly and automatically send the alarm information of the BMC Management system to the super-convergence Management platform for virtual machine Management. In addition, in order to determine that the warning information of the BMC can be transmitted to the super-convergence management platform in time, the management IP of the super-convergence management platform and the BMC management port of the server can be in the same network segment. Once the alarm is generated, the BMC uploads the alarm information to the hyper-converged management platform.
In addition, the present embodiment also does not specifically limit the alarm content included in the high-availability alarm, and may be freely set by a person skilled in the art through the BMC. Preferably, the high available alarm may include alarm content, alarm type, alarm address, etc., and the alarm address may be a physical address or a network address, including an IP address, a MAC address, a port number, etc.
S102: judging whether the high-availability alarm is a service network port alarm or not; if yes, entering S103;
since only high-availability triggers for the server, the management portal and the storage portal exist at present, this step aims to implement detection of the service portal, i.e., to determine whether the service portal of the virtual machine is faulty, such as connection interruption, physical damage to the portal, etc., and if so, directly perform S103.
The determination of whether the high-availability alarm is a service port alarm is not specifically limited, and the category determination of the high-availability alarm can be realized by determining whether the MAC address of the service port is consistent with the MAC address of the alarm port. If the high-availability alarm contains the MAC addresses of the network ports, the MAC addresses in the alarm information can be compared with the MAC addresses of all currently managed service network ports one by one to determine whether the alarm is a service network port alarm. Since IP addresses may be spoofed or replaced, the accuracy is higher by detecting MAC addresses than by detecting IP addresses.
S103: triggering a high availability alert for the virtual machine.
Once the high-availability alarm is determined to be a service network port alarm, the high-availability alarm of the virtual machine can be directly triggered, and high-availability protection of the virtual machine is realized.
As a preferred execution mode of this step, if the high availability alarm is a service port alarm, before triggering the high availability alarm of the virtual machine, it may be further determined whether a service port corresponding to the service port alarm has a physical fault or is in a disconnection state, and if so, this step is executed. After detecting the high-availability alarm provided by the BMC and judging the corresponding service network port fault, the service network port is detected to ensure that the service network port has the fault, avoid the high-availability alarm misinformation of the service network port caused by the BMC false alarm, and improve the effectiveness and accuracy of high-availability protection.
It is easy to understand that, in this embodiment, the default virtual machine starts the high-availability function, and at the same time, the function of detecting the state of the service port needs to be started, and the service port detection function needs to specify a specific port. If only the high-availability function is started, but the service network port detection function is not started, the virtual machine will not automatically have the HA function after the service network port fails. For a data center with a very severe network environment, if the network port detection function is started, the data center may frequently start to be highly available. It is thus proposed that data centers with very harsh network environments turn this function off. Therefore, before executing the embodiment, the determination process of whether the virtual machine starts the high availability function and the service gateway detection function may be executed respectively:
s201: judging whether the virtual machine starts a high-availability function or not; if yes, entering S202;
s202: judging whether the virtual machine starts a service network port detection function or not;
s203: and if the virtual machine does not start the service network port detection function, starting the service network port detection function.
The embodiment of the application detects the virtual machine by using the BMC, judges whether the high-availability alarm is a service network port alarm or not when receiving the high-availability alarm sent by the BMC, if so, indicates that the service network port is possibly abnormal due to physical damage or connection interruption and the like, and triggers the high-availability alarm of the virtual machine in time, so that the state of the virtual machine is correctly displayed by the super-fusion management platform, and the management and normal application of the virtual machine are prevented from being influenced by the service network port fault of the virtual machine. Through the state detection mechanism for the service network port, the high availability of the important service virtual machine can be ensured in a refined manner, and the operation and maintenance pressure and the operation and maintenance cost of the server and the virtual machine are reduced.
Based on the above embodiment, as a preferred embodiment, after the high availability alarm of the virtual machine is triggered, the virtual machine may be further migrated to the health server, and the virtual machine is restarted on the health server. The health server refers to a server which does not send out a high availability alarm, and in order to ensure that the service virtual machine is not affected by the service gateway abnormality, the virtual machine can be migrated to the health server and operated. Meanwhile, in order to reduce the influence of the migration process on the service, hot migration can be adopted during migration.
Based on the foregoing embodiment, as a preferred embodiment, if a service port corresponding to a service port alarm has a physical fault or is in a disconnection state, before performing S102 to trigger a high availability alarm of a virtual machine, the following determination process may be further included:
judging whether a server to which a service network port belongs is in a maintenance mode;
if yes, triggering a high availability alarm of the virtual machine after the server finishes the maintenance mode;
and if not, executing the step of triggering the high availability alarm of the virtual machine.
The embodiment aims to avoid the situation that the server triggers the high availability alarm in the maintenance mode, and once the server triggers the high availability alarm in the maintenance mode, the server is not beneficial to maintenance and effective high availability protection is difficult to realize.
In the following, an availability detection system of a virtual machine provided in an embodiment of the present application is introduced, and the availability detection system described below and the availability detection method of a virtual machine described above may be referred to correspondingly.
Referring to fig. 2, the present application further provides a system for detecting availability of a virtual machine, including:
thealarm receiving module 100 is used for receiving a high-availability alarm sent by the server BMC;
a judgingmodule 200, configured to judge whether the high availability alarm is a service network port alarm;
and a highavailability triggering module 300, configured to trigger a high availability alarm of the virtual machine when the determination result of the determining module is yes.
Based on the above embodiment, as a preferred embodiment, the usability detection system further includes:
and the migration module is used for carrying out hot migration on the virtual machine to a health server and restarting the virtual machine on the health server.
Based on the foregoing embodiment, as a preferred embodiment, the determiningmodule 200 is specifically a module for determining whether the MAC address of the service port and the MAC address of the alarm port are consistent.
Based on the foregoing embodiment, as a preferred embodiment, if the determination result of the determiningmodule 200 is yes, the method further includes:
the second judgment module is used for judging whether a service network port corresponding to the service network port alarm has a physical fault or is in a disconnection state before triggering the high-availability alarm of the virtual machine; if so, enter the highavailable trigger module 300.
The present application also provides a computer readable storage medium having stored thereon a computer program which, when executed, may implement the steps provided by the above-described embodiments. The storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The application also provides a server, which may include a memory and a processor, where the memory stores a computer program, and the processor may implement the steps provided by the foregoing embodiments when calling the computer program in the memory. Of course, the server may also include various network interfaces, power supplies, and the like.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system provided by the embodiment, the description is relatively simple because the system corresponds to the method provided by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are 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.