CN109697109B - Method, system, device and storage medium for distinguishing and identifying conflict virtual machines - Google Patents

Method, system, device and storage medium for distinguishing and identifying conflict virtual machines Download PDF

Info

Publication number
CN109697109B
CN109697109B CN201811612151.7A CN201811612151A CN109697109B CN 109697109 B CN109697109 B CN 109697109B CN 201811612151 A CN201811612151 A CN 201811612151A CN 109697109 B CN109697109 B CN 109697109B
Authority
CN
China
Prior art keywords
virtual machine
identification
identifier
conflict
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811612151.7A
Other languages
Chinese (zh)
Other versions
CN109697109A (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.)
Sangfor Technologies Co Ltd
Original Assignee
Sangfor 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 Sangfor Technologies Co Ltd filed Critical Sangfor Technologies Co Ltd
Priority to CN201811612151.7A priority Critical patent/CN109697109B/en
Publication of CN109697109A publication Critical patent/CN109697109A/en
Application granted granted Critical
Publication of CN109697109B publication Critical patent/CN109697109B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application discloses a method for distinguishing and identifying conflict virtual machines, which is characterized in that each virtual machine is identified by simultaneously using a first identification and a second identification which are obtained in different modes. The application also discloses a system, a device and a computer readable storage medium for distinguishing and identifying the conflict virtual machines.

Description

Method, system, device and storage medium for distinguishing and identifying conflict virtual machines
Technical Field
The present application relates to the field of virtual machine identification technology, and in particular, to a method, system, device, and computer readable storage medium for distinguishing and identifying conflicting virtual machines.
Background
The basic unit for identifying the terminal is usually a physical terminal, and since each physical terminal has globally unique hardware (such as a CPU, a hard disk, a MAC network card, etc.), the hardware has unique hardware feature codes, so that each physical terminal can be distinguished based on the globally unique hardware feature codes, and the problem of identification conflict cannot occur, because the hardware cannot change itself.
At present, the virtualization technology is large, one physical terminal with enough performance is virtualized into a plurality of virtual terminals, so that the purchase quantity of expensive physical terminals can be reduced, parameters of the virtual machine can be configured automatically, and the production and life are greatly facilitated.
Because the hardware information forming the virtual machine is virtual instead of the physical hardware with the unique hardware feature code, and the virtual hardware forming the virtual machine can be added, deleted and modified according to different requirements, the virtual machine cannot be distinguished in a manner of distinguishing different physical terminals based on the unique hardware feature code in the prior art on the basis of being incapable of having the unique hardware information.
Therefore, how to better distinguish each virtual machine in the virtual machine service cluster and reduce the occurrence probability of the recognition conflict phenomenon as much as possible is a problem to be solved by the skilled person.
Disclosure of Invention
The application aims to provide a method for distinguishing and identifying conflict virtual machines, which is characterized in that each virtual machine is identified by simultaneously using a first identification and a second identification which are obtained in different modes.
It is another object of the present application to provide a system, apparatus and computer readable storage medium for distinguishing conflicting virtual machines.
To achieve the above object, the present application provides a method for distinguishing and identifying conflicting virtual machines, the method comprising:
generating a corresponding first identifier for each virtual machine by using a random algorithm;
respectively calculating to obtain a second identification of each virtual machine according to virtual hardware information forming the virtual machine;
and meanwhile, distinguishing and identifying the conflict virtual machine by utilizing the first identification and the second identification of the virtual machine.
Optionally, generating the corresponding first identifier for each virtual machine by using a random algorithm includes:
randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value, and taking each character string as a first identifier of the corresponding virtual machine.
Optionally, the calculating to obtain the second identifier of each virtual machine according to the virtual hardware information forming the virtual machine includes:
and respectively calculating the abstracts of the MAC addresses of each virtual machine by utilizing a hash algorithm, and taking each abstracts as a second identifier of the corresponding virtual machine.
Optionally, identifying the conflicting virtual machine by using the first identifier and the second identifier of the virtual machine simultaneously includes:
respectively acquiring a first identifier of each virtual machine, and judging whether the same first identifier exists or not;
if the same first identification exists, marking each virtual machine with the same first identification as an identification conflict virtual machine, respectively acquiring a second identification of each identification conflict virtual machine, and judging whether the same second identification exists or not;
if the same second identifier does not exist, marking each identification conflict virtual machine as a class I identification conflict virtual machine, and generating a new first identifier for each class I identification conflict virtual machine by utilizing the random algorithm again;
if the same second identifier exists, marking each identification conflict virtual machine with the same second identifier as a II-type identification conflict virtual machine, modifying virtual hardware information forming each II-type identification conflict virtual machine to obtain the I-type identification conflict virtual machine, and generating a new first identifier for each I-type identification conflict virtual machine by reusing the random algorithm.
Optionally, modifying virtual hardware information forming each of the class II identification conflict virtual machines to obtain the class I identification conflict virtual machine, including:
when the second identification is calculated based on the MAC address of each virtual machine, selecting new MAC addresses with target number from a preset MAC address pool; the target number is the number of the II-type identification conflict virtual machines, and all MAC addresses in the MAC address pool are different from each other;
and respectively replacing the original MAC addresses of the class II identification conflict virtual machines with the new MAC addresses to obtain the class I identification conflict virtual machines.
Optionally, the method further comprises:
and establishing a corresponding relation between the first identifier and the second identifier of the same virtual machine, and constructing a virtual machine identification information base by utilizing the corresponding relation.
In order to achieve the above object, the present application further provides a system for distinguishing and identifying conflicting virtual machines, the system comprising:
the first identifier generation unit is used for generating corresponding first identifiers for each virtual machine by utilizing a random algorithm;
the second identifier generating unit is used for respectively calculating and obtaining a second identifier of each virtual machine according to virtual hardware information forming the virtual machine;
and the conflict identification unit is used for identifying the conflict virtual machine by utilizing the first identification and the second identification of the virtual machine at the same time.
Optionally, the first identifier generating unit includes:
the time variable character string generation subunit is used for randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value respectively, and taking each character string as a first identifier of the corresponding virtual machine.
Optionally, the second identifier generating unit includes:
and the digest calculation subunit is used for respectively calculating digests of the MAC addresses of the virtual machines by utilizing a hash algorithm, and taking each digest as a second identifier of the corresponding virtual machine.
Optionally, the identifying conflict distinguishing unit includes:
the first identifier acquisition and same judgment subunit is used for respectively acquiring the first identifier of each virtual machine and judging whether the same first identifier exists or not;
the same first identifier presence processing subunit is used for marking each virtual machine with the same first identifier as an identification conflict virtual machine when the same first identifier exists, respectively acquiring a second identifier of each identification conflict virtual machine, and judging whether the same second identifier exists or not;
the class I identification conflict processing subunit is used for marking each identification conflict virtual machine as a class I identification conflict virtual machine when the same second identifier does not exist, and generating a new first identifier for each class I identification conflict virtual machine by reusing the random algorithm;
and the class II identification conflict processing subunit is used for marking all the identification conflict virtual machines with the same second identification as class II identification conflict virtual machines when the same second identification exists, modifying virtual hardware information forming all the class II identification conflict virtual machines to obtain class I identification conflict virtual machines, and generating a new first identification for each class I identification conflict virtual machine by reusing the random algorithm.
Optionally, the class II identification conflict handling subunit includes:
the new MAC address selecting module is used for selecting new MAC addresses with target number from a preset MAC address pool when the second identification is calculated based on the MAC address of each virtual machine; the target number is the number of the II-type conflict identification virtual machines, and all MAC addresses stored in the MAC address pool are different from each other;
and the MAC address replacement module is used for replacing the original MAC address of the class II identification conflict virtual machine by using each new MAC address respectively to obtain the class I identification conflict virtual machine.
Optionally, the system further comprises:
the virtual machine identification information base establishing unit is used for establishing a corresponding relation between the first identifier and the second identifier of the same virtual machine and establishing a virtual machine identification information base by utilizing the corresponding relation.
In order to achieve the above object, the present application further provides an apparatus for distinguishing and identifying conflicting virtual machines, where the apparatus includes:
a memory for storing a computer program;
a processor for implementing the steps of the method of distinguishing conflicting virtual machines as described above when executing said computer program.
To achieve the above object, the present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of distinguishing conflicting virtual machines as described above.
Obviously, according to the method for distinguishing and identifying the conflict virtual machines, each virtual machine is identified by simultaneously using the first identification and the second identification which are obtained in different modes, and compared with the method for identifying the virtual machines by only using one mode, the method provided by the application can further clearly identify the generation reason of the conflict virtual machines through the newly added identification, so that the problem of conflict identification is solved in a targeted manner, the probability of generating the conflict virtual machines is reduced as much as possible, and the management difficulty of a virtual machine cluster is reduced. The application also provides a system, a device and a computer readable storage medium for distinguishing and identifying conflict virtual machines, which have the beneficial effects and are not repeated herein.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a method for distinguishing and identifying conflicting virtual machines according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for distinguishing conflicting virtual machines according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for distinguishing between different types of conflicting virtual machines by using a first identifier and a second identifier in a method for distinguishing between conflicting virtual machines according to an embodiment of the present application;
fig. 4 is a block diagram of a system for distinguishing and identifying conflicting virtual machines according to an embodiment of the present application.
Detailed Description
The core of the application is to provide a method, a system, a device and a computer readable storage medium for distinguishing and identifying conflict virtual machines, wherein each virtual machine is identified by simultaneously using a first identification and a second identification which are obtained in different modes.
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Example 1
Referring to fig. 1, fig. 1 is a flowchart of a method for distinguishing and identifying conflicting virtual machines according to an embodiment of the present application, which specifically includes the following steps:
s101: generating a corresponding first identifier for each virtual machine by using a random algorithm;
this step aims at exploiting the randomness of the random algorithm to generate some random numbers and using these random numbers as the first identification of each virtual machine.
In order to enable the random number serving as the first identifier to have better capability of distinguishing different virtual machines, the random number can be generated based on variable quantities, such as time when each virtual machine is created, entropy value of a system and the like, basic parameters for generating the random number can be generated by a certain type of variable quantity based on a certain random algorithm, the basic parameters can be finally generated by a certain type of variable quantity based on a certain random algorithm according to different rule combinations, and repetition probability of the generated random number is obviously reduced along with the increase of basic parameter types and the length of bit numbers.
It should be noted that, the first identifier generated for each virtual machine is embedded in the file system of each virtual machine, that is, when the first identifier of each virtual machine needs to be obtained, the first identifier needs to be found from a preset directory under the file system of each virtual machine.
It should be further noted that, most of the first identifiers given to each virtual machine are generated by using a random algorithm when the corresponding virtual machine is first created, and then the first identifiers embedded in the file system, such as virtual machine migration and virtual machine cloning, will not be modified by each operation performed on the virtual machine, so when only the first identifiers are used to distinguish between different virtual machines, the cloned virtual machine will have the same first identifier as the original virtual machine, and at this time, for the management end, multiple virtual machines with the same identification identifier will appear, and such virtual machines are called as identification conflict virtual machines, and will affect the subsequent service allocation and management for the target virtual machine.
S102: respectively calculating to obtain a second identification of each virtual machine according to virtual hardware information forming the virtual machine;
the step aims at providing an identification mark related to virtual hardware information forming each virtual machine, namely a second mark which is uniquely calculated according to the virtual hardware information forming the virtual machine and is used for representing the virtual hardware information corresponding to the virtual machine. The virtual hardware information of the virtual machine includes the identification codes of virtual hardware such as a disk, the MAC address of the network card, the device code of the input/output device, etc., some virtual hardware can be adopted by multiple virtual machines at the same time and cannot cause identification conflict, some virtual hardware must be ensured to work normally on the basis of being different from the similar hardware of other virtual machines, and if the virtual hardware is the same, the identification conflict, such as the MAC address of the network card, can be caused. Two virtual machines with the same MAC address are available, only one virtual machine can be in an online state, and the other virtual machine can not be online due to parameter conflict, so that in order to clearly identify whether the conflict virtual machine is the identification conflict caused by the situation, the application also introduces a second identifier generated by the mode as another type of identifier for describing the virtual machine constitution.
In order to make the second identifier generated in this step have better distinguishing capability, the second identifier may be calculated based on the MAC address of the virtual machine alone, or may be supplemented with some other virtual hardware information, such as a drive letter of a disk, a device code of an input/output device, and the like, on the basis of including the MAC address. Meanwhile, the second identifier may be calculated by a common hash algorithm, for example, MD5 calculates the feature value, or may be calculated uniquely from the selected virtual hardware information in the same or similar manner.
S103: and meanwhile, distinguishing and identifying the conflict virtual machine by utilizing the first identification and the second identification of the virtual machine.
On the basis of S101 and S102, this step aims to distinguish between identifying conflicting virtual machines by using the first identifier and the second identifier of the virtual machine at the same time, where identifying conflicting virtual machines refers to virtual machines that have the same identifying identifier but are not unique. As mentioned above, if the first identifier or the second identifier is used as the unique identifier of the virtual machine, the virtual machine with conflict will be identified due to some common operations performed on the virtual machine (such as migration of the virtual machine and cloning of the virtual machine), and the conflict virtual machine cannot be well distinguished for what reason, so the present application utilizes two types of identifiers generated in different manners to identify the conflict virtual machine together, at the same time, the first identifier will be used as the identifier for mainly distinguishing different virtual machines, and the second identifier will be used when the virtual machines cannot be distinguished by the first identifier.
It should be noted that, in the process of migrating the virtual machine a from the original X host to the Y host, the second identifier of the virtual machine a will change because different virtual machine hardware information is used to form the virtual machine, but since only the information of one virtual machine changes at this time, another virtual machine having the same first identifier will not be generated, and no identification conflict will be generated, and only the latest second identifier needs to be used to replace the old second identifier in the database recording the identifiers of the virtual machines.
After the virtual machine a performs the virtual machine cloning operation, a virtual machine a 'which is identical to the virtual machine a will be obtained, that is, the virtual machine a' will have the same first identifier as the virtual machine a, because the first identifier is embedded in the file system of the virtual machine a, and the cloning process is actually a copy of the virtual machine image, so that the cloned virtual machine will not be reassigned with a new first identifier, and two virtual machines a and a 'which use the same first identifier will also occur, at this time, an identification conflict will occur, because the two virtual machines appear to be identical at the management end, and if there is a task which needs to be performed by the virtual machine a, the task will be issued to the virtual machine a and the virtual machine a' simultaneously due to the same first identifier.
Meanwhile, due to uncontrollability of operators, whether the cloned virtual machine A' modifies virtual hardware information cannot be confirmed so as to be different from the virtual machine A in the construction level of the virtual machine, and two conditions can be generated accordingly: firstly, the virtual hardware information of the virtual machine A 'is not modified, and at the moment, the virtual machine A and the virtual machine A' have the same first identification and the same second identification; and secondly, modifying the hardware information of the virtual machine A ', wherein the virtual machine A and the virtual machine A' only have the same first identification, and the second identifications are different. Therefore, whether each virtual machine with the same first identifier also has the same second identifier can be utilized to judge the reason of the identification conflict virtual machine, and corresponding measures are taken to solve the problem of the identification conflict, so that the influence of the identification conflict on the virtual machine cluster is eliminated, and the management difficulty is reduced.
Further, in order to determine the number and parameters of virtual machines owned by the current virtual machine cluster so as to perform task issuing and management, the first identifier and the second identifier of the same virtual machine can be stored in a database in groups so as to be used as a virtual machine identification information base, when the virtual machine migration operation occurs, the execution of the migration operation can be confirmed by comparing old parameters in the virtual machine identification base, and the old parameters can be replaced by new parameters in time; if there is a newly added virtual machine (for example, a cloned virtual machine obtained by performing a virtual machine cloning operation), the identification pair of the newly added virtual machine may be added to the virtual machine identification information base.
Based on the above technical scheme, the first identifier and the second identifier generated in two different modes are provided for each virtual machine, and when the virtual machines with the same first identifier cannot be accurately distinguished through the first identifier, the second identifier describing the virtual machine on the other hand can accurately locate the generation reason of the identification conflict, so that the accurate distinction is performed under the condition of definitely generating the reason, the probability of generating the identification conflict virtual machine can be reduced as much as possible, and the management difficulty of the virtual machine cluster is reduced.
Example two
Referring to fig. 2, fig. 2 is a flowchart of another method for distinguishing and identifying conflicting virtual machines according to an embodiment of the present application, in this embodiment, on the basis of the first embodiment, a feasible and preferred lower level scheme is provided for S101 through S201, a feasible and preferred lower level scheme is provided for S202 through S202, and it should be noted that the schemes provided for S201 and S202 do not have an execution sequence dependency relationship, so that these two schemes may be formed into separate embodiments based on the first embodiment respectively, or may be combined as in the first embodiment to obtain an embodiment including two preferred schemes at the same time, and specifically, whether combination is required or not may be flexibly selected according to the actual situation, and this embodiment exists only as one preferred embodiment provided, and includes the following steps:
s201: randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value, and taking each character string as a first identifier of the corresponding virtual machine;
specifically, the method comprises the following three specific implementation modes:
(1) Randomly selecting a character string with a preset length from the time when each virtual machine is created, and taking the character string as a first identifier of the corresponding virtual machine;
(2) Randomly selecting a character string with a preset length from the system entropy value when each virtual machine is created, and taking the character string as a first identifier of the corresponding virtual machine;
(3) And randomly selecting character strings with preset lengths from the time when each virtual machine is created and the entropy value of the system, and taking the combination of the two character strings as a first identifier of the corresponding virtual machine.
S202: respectively calculating abstracts of the MAC addresses of each virtual machine by utilizing a hash algorithm, and taking each abstract as a second identifier of the corresponding virtual machine;
the method comprises the steps of adopting an MAC address of a virtual machine as virtual hardware information of the virtual machine, calculating a digest of the MAC address by utilizing a hash algorithm, and taking the digest uniquely corresponding to the MAC address as a second identifier of the virtual machine.
S203: and meanwhile, distinguishing and identifying the conflict virtual machine by utilizing the first identification and the second identification of the virtual machine.
Compared with the first embodiment, the embodiment provides a specific way how to generate the first mark and the second mark, and the method is simple and easy to implement and has high distinguishing degree.
Example III
Referring to fig. 3, fig. 3 is a flowchart of a method for distinguishing between conflicting virtual machines according to an embodiment of the present application, wherein the method includes the following steps for distinguishing between conflicting virtual machines according to a first identifier and a second identifier, and based on the above embodiments, for S103 or S203, a specific method is provided for distinguishing between conflicting virtual machines according to the first identifier and the second identifier, which includes the following steps:
s301: respectively acquiring a first identifier of each virtual machine;
s302: judging whether the same first mark exists or not;
s303: marking all virtual machines with the same first identification as identification conflict virtual machines, and respectively acquiring second identifications of all the identification conflict virtual machines;
the step is based on the fact that the same first identifier exists in the judgment result of S302, that is, at least two virtual machines have the same first identifier, and this case violates the rule that each virtual machine should have different identification identifiers, so that identification conflict can occur, if all virtual machines with the same first identifier are marked as identification conflict virtual machines, but identification conflict caused by which reason cannot be distinguished only by the first identifier can not be distinguished, in order to enable the virtual machine cluster to stably operate, judgment is assisted by the second identifier.
In addition, if the determination result in S302 indicates that the same first identifier does not exist, it is indicated that each virtual machine has a first identifier that is different from each other, and then tasks may be directly allocated or managed for the corresponding virtual machine by using the first identifiers that are different from each other.
S304: judging whether the same second mark exists or not;
on the basis of S303, this step aims at judging whether the same second identifier exists in each of the identification conflict virtual machines, so as to explicitly generate the reason for identifying the conflict virtual machine according to whether the same second identifier exists in the second identifier.
S305: marking each identification conflict virtual machine as a I-type identification conflict virtual machine
The step is based on the fact that the second identifiers of the virtual machines with the identification conflict are not the same as the second identifiers in the step S304, that is, the second identifiers of the virtual machines with the identification conflict are different from each other, and according to the description of the reason for the identification conflict in the step S103, the virtual hardware information of the cloned virtual machines is modified after the virtual machine cloning operation is executed, that is, the virtual machines with the identification conflict have the same first identifiers but different second identifiers, and the virtual machines with the identification conflict are marked as the virtual machines with the identification conflict of the type I.
In order to distinguish between the class I identifying conflicting virtual machines, the processing step of S308 will be used to make them have mutually different first identifiers, i.e. they can be identified as different virtual machines by the different first identifiers, so as to respectively play the role of each virtual machine.
S306: marking all the identification conflict virtual machines with the same second identification as II-type identification conflict virtual machines;
the step is based on the fact that the same second identifier exists as the result of the judgment in S304, and according to the description of the possible situations in S103, the method should belong to the situation that the virtual hardware information of the cloned virtual machine is not modified after the virtual machine cloning operation is executed, that is, some virtual machines are caused to have the same first identifier and the same second identifier. This step marks such conflicting virtual machines as class II identifying conflicting virtual machines.
S307: modifying virtual hardware information of each II-type identification conflict virtual machine to obtain I-type identification conflict virtual machines;
on the basis of S306, in order to distinguish between class II recognition conflict virtual machines, first, virtual hardware information of each class II recognition conflict virtual machine needs to be modified, so that each modified virtual machine has virtual hardware information different from each other, and becomes a class I recognition conflict virtual machine, and then the virtual machine has different first identifications through processing of S308.
When the second identifier is calculated based on the MAC address of each virtual machine, the scheme provided in this step may specifically be:
selecting a target number of new MAC addresses from a preset MAC address pool; the target number is the number of II-type identification conflict virtual machines, and all MAC addresses stored in the MAC address pool are different from each other;
and respectively replacing the original MAC addresses of the II-type identification conflict virtual machines by using the new MAC addresses to obtain the I-type identification conflict virtual machines.
S308: a new first identity is generated for each class I identity conflicting virtual machine by re-using a random algorithm.
This step is the subsequent processing step of S305 and S307, aiming at generating a new first identifier for each of the class I identification conflict virtual machines by reusing a random algorithm to distinguish the identification conflict virtual machines by the new first identifiers different from each other.
The embodiment can be based on the first embodiment or the second embodiment, by judging whether the first identifiers are the same to obtain the preliminary and general conflict virtual machine, and then definitely generating the reason of the conflict in recognition according to whether the second identifiers of the conflict virtual machines are the same, a mode of distinguishing the conflict virtual machines under different reasons is provided, a scheme capable of automatically solving the problem of the conflict in recognition is provided, and management difficulty of a virtual machine cluster is reduced.
Example IV
In order to enhance understanding and effect of the present application, based on the above embodiment, the present embodiment further provides a detailed implementation scheme based on a specific application scenario, where the scenario is specifically a virtual machine cluster for uniformly managing a plurality of virtual machines through a centralized management platform (Manager), where each virtual machine is deployed with a probe (Agent), and the centralized management platform is separately deployed on a specific virtual machine, and implements management on all virtual machines by means of data communication with probes of other virtual machines, and the operations respectively performed by the probes and the centralized management platform in each virtual machine are described below:
the probes deployed on each virtual machine are mainly responsible for generating two values uuid (i.e. first identifier) and hdid (second identifier), and sending them to the centralized management platform for subsequent judgment, and this process will be repeated from the start of the probes of the virtual machine (for example, setting the timing parameters of the periodic cycle), and is usually executed in each heartbeat connection of the probes and the centralized management platform.
The centralized management platform is responsible for detecting and judging uuid and hdid sent from the probe each time, and the judging steps are as follows:
1. if the received uuid cannot be found in the virtual machine identification information base, indicating that the virtual host corresponding to the uuid is a newly created virtual machine host, adding the uuid and hdid of the newly created virtual host to the virtual machine identification information base, and then responding the recorded information to the probe after the storage is completed;
2. if the received uuid exists in the virtual machine identification information base, then judging whether the received hdid is consistent with the hdid stored in the virtual machine identification information base, if so, determining that the virtual machine is normally identified after the uuid and hdid sent by the probe are judged according to the virtual machine identification information base;
3. if the received uuid already exists in the virtual machine identification information base and the received hdid is not consistent with the hdid stored in the virtual machine identification information base, the virtual hardware of the virtual host where the probe is located is changed, the old hdid in the virtual machine identification information base needs to be updated by using the received hdid, and the number of times of modifying hdid under the uuid is increased by 1; among the reasons for the change in virtual hardware may be: the MAC address of the virtual machine is changed due to the execution of the migration operation of the virtual machine; a new virtual machine host computer with different virtual hardware of the original virtual machine and the like generated after the cloning operation of the virtual machine is executed;
4. judging whether the number of the modification times of hdid under the uuid is larger than a preset number of times (2 for example) in unit time (5 minutes for example);
5. if the number of times of modifying hdid in the uuid is not greater than the preset number of times in unit time, it is indicated that the reason that hdid received at this time is different from hdid in the virtual machine identification information base is that virtual machine migration operation is performed by the virtual machine corresponding to the uuid, because virtual hardware of the virtual machine is changed due to the virtual machine migration operation, hdid is changed, and no operation is needed in this case, because the operation in step 3 has already achieved the purpose of replacing old hdid with new hdid;
6. if the number of the modification times of hdid in the uuid is greater than the preset number of times in unit time, it is indicated that the virtual machine identification conflict phenomenon exists, so that a plurality of virtual machines with the same uuid but different hdid frequently modify the hdid, and the reason for generating the phenomenon is as follows: the cloned virtual machines have different hdid caused by modifying the virtual hardware, but the uuid built in the file system is not modified, so that in the process that probes of the virtual machines send the uuid and hdid to the centralized management platform, the centralized management platform frequently modifies hdid through the steps (in order to judge whether the same modification is repeatedly performed, the modification content of each time can be recorded to help the judgment), and the modification times of the virtual machines exceed the preset times.
Because the problem of the identification conflict is caused by that different virtual machines have the same uuid, the virtual machines can be identified as different virtual machines through different uuids in the subsequent process only by sending an instruction for regenerating the uuid to the probes of the virtual machines by the centralized management platform, so that the problem of the identification conflict can be solved.
Because of the complexity and cannot be illustrated by one, those skilled in the art will recognize that many examples of the basic method principles provided in accordance with the present application may exist in combination with the actual situation, and should be within the scope of the present application without performing enough inventive effort.
Example five
Referring to fig. 4, fig. 4 is a block diagram of a system for distinguishing and identifying conflicting virtual machines according to an embodiment of the present application, where the system for distinguishing and identifying conflicting virtual machines may include:
a first identifier generating unit 100, configured to generate a corresponding first identifier for each virtual machine by using a random algorithm;
a second identifier generating unit 200, configured to calculate a second identifier of each virtual machine according to virtual hardware information that forms the virtual machine;
the conflict identification unit 300 is configured to identify a conflict virtual machine by using the first identifier and the second identifier of the virtual machine at the same time.
Wherein the first identifier generating unit may include:
the time variable character string generation subunit is used for randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value respectively, and taking each character string as a first identifier of the corresponding virtual machine.
Wherein the second identification generation unit may include:
and the digest calculation subunit is used for respectively calculating digests of the MAC addresses of the virtual machines by utilizing a hash algorithm, and taking each digest as a second identifier of the corresponding virtual machine.
Wherein the identifying conflict discrimination unit may include:
the first identifier acquisition and same judgment subunit is used for respectively acquiring the first identifier of each virtual machine and judging whether the same first identifier exists or not;
the same first identifier presence processing subunit is used for marking each virtual machine with the same first identifier as a conflict identifying virtual machine when the same first identifier is present, respectively acquiring a second identifier of each conflict identifying virtual machine, and judging whether the same second identifier is present;
the class I recognition conflict processing subunit is used for marking each recognition conflict virtual machine as a class I recognition conflict virtual machine when the same second identifier does not exist, and generating a new first identifier for each class I recognition conflict virtual machine by reusing a random algorithm;
and the class II identification conflict processing subunit is used for marking all the identification conflict virtual machines with the same second identification as class II identification conflict virtual machines when the same second identification exists, modifying virtual hardware information forming all the class II identification conflict virtual machines to obtain class I identification conflict virtual machines, and generating new first identification for each class I identification conflict virtual machine by reusing a random algorithm.
Wherein the class II recognition conflict handling subunit may comprise:
the new MAC address selecting module is used for selecting new MAC addresses with target number from a preset MAC address pool when the second identification is calculated based on the MAC address of each virtual machine; the target number is the number of II-type identification conflict virtual machines, and all MAC addresses stored in the MAC address pool are different from each other;
and the MAC address replacement module is used for replacing the original MAC addresses of the II-type identification conflict virtual machines by using the new MAC addresses respectively to obtain the I-type identification conflict virtual machines.
Further, the system may further include:
the virtual machine identification information base establishing unit is used for establishing the corresponding relation between the first identifier and the second identifier of the same virtual machine and establishing the virtual machine identification information base by utilizing the corresponding relation.
Based on the above embodiment, the present application further provides an apparatus for identifying conflicting virtual machines, where the apparatus may include a memory and a processor, where the memory stores a computer program, and the processor may implement the steps provided in the above embodiment when calling the computer program in the memory. Of course, the device may also include various necessary network interfaces, power supplies, and other components, etc.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by an execution terminal or processor, performs the steps provided by the above embodiments. The storage medium may include: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In the description, each embodiment is described in a progressive manner, and each embodiment is mainly described by the differences from other embodiments, so that the same similar parts among the embodiments are mutually referred. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It will be apparent to those skilled in the art that various changes and modifications can be made to the present application without departing from the principles of the application, and such changes and modifications fall within the scope of the appended claims.
It should also be noted that in this 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. Moreover, 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 one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.

Claims (12)

1. A method of distinguishing conflicting virtual machines, the method comprising:
generating a corresponding first identifier for each virtual machine by using a random algorithm;
respectively calculating to obtain a second identification of each virtual machine according to virtual hardware information forming the virtual machine;
meanwhile, distinguishing and identifying conflict virtual machines by using a first identifier and a second identifier of the virtual machine;
the identifying conflict virtual machines by utilizing the first identification and the second identification of the virtual machines simultaneously includes:
respectively acquiring a first identifier of each virtual machine, and judging whether the same first identifier exists or not;
if the same first identification exists, marking each virtual machine with the same first identification as an identification conflict virtual machine, respectively acquiring a second identification of each identification conflict virtual machine, and judging whether the same second identification exists or not;
if the same second identifier does not exist, marking each identification conflict virtual machine as a class I identification conflict virtual machine, and generating a new first identifier for each class I identification conflict virtual machine by utilizing the random algorithm again;
if the same second identifier exists, marking each identification conflict virtual machine with the same second identifier as a II-type identification conflict virtual machine, modifying virtual hardware information forming each II-type identification conflict virtual machine to obtain the I-type identification conflict virtual machine, and generating a new first identifier for each I-type identification conflict virtual machine by reusing the random algorithm.
2. The method of claim 1, wherein generating the respective first identification for each virtual machine using a random algorithm comprises:
randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value, and taking each character string as a first identifier of the corresponding virtual machine.
3. The method of claim 1, wherein the calculating the second identifier of each virtual machine according to the virtual hardware information of the virtual machine includes:
and respectively calculating the abstracts of the MAC addresses of each virtual machine by utilizing a hash algorithm, and taking each abstracts as a second identifier of the corresponding virtual machine.
4. The method of claim 1, wherein modifying virtual hardware information comprising each of the class II recognition conflicting virtual machines to obtain the class I recognition conflicting virtual machines comprises:
when the second identification is calculated based on the MAC address of each virtual machine, selecting new MAC addresses with target number from a preset MAC address pool; the target number is the number of the II-type identification conflict virtual machines, and all MAC addresses in the MAC address pool are different from each other;
and respectively replacing the original MAC addresses of the class II identification conflict virtual machines with the new MAC addresses to obtain the class I identification conflict virtual machines.
5. The method according to any one of claims 1 to 4, further comprising:
and establishing a corresponding relation between the first identifier and the second identifier of the same virtual machine, and constructing a virtual machine identification information base by utilizing the corresponding relation.
6. A system for distinguishing conflicting virtual machines, the system comprising:
the first identifier generation unit is used for generating corresponding first identifiers for each virtual machine by utilizing a random algorithm;
the second identifier generating unit is used for respectively calculating and obtaining a second identifier of each virtual machine according to virtual hardware information forming the virtual machine;
the conflict identification unit is used for identifying the conflict virtual machine by utilizing the first identifier and the second identifier of the virtual machine at the same time;
wherein the identification conflict discrimination unit includes:
the first identifier acquisition and same judgment subunit is used for respectively acquiring the first identifier of each virtual machine and judging whether the same first identifier exists or not;
the same first identifier presence processing subunit is used for marking each virtual machine with the same first identifier as an identification conflict virtual machine when the same first identifier exists, respectively acquiring a second identifier of each identification conflict virtual machine, and judging whether the same second identifier exists or not;
the class I identification conflict processing subunit is used for marking each identification conflict virtual machine as a class I identification conflict virtual machine when the same second identifier does not exist, and generating a new first identifier for each class I identification conflict virtual machine by reusing the random algorithm;
and the class II identification conflict processing subunit is used for marking all the identification conflict virtual machines with the same second identification as class II identification conflict virtual machines when the same second identification exists, modifying virtual hardware information forming all the class II identification conflict virtual machines to obtain class I identification conflict virtual machines, and generating a new first identification for each class I identification conflict virtual machine by reusing the random algorithm.
7. The system of claim 6, wherein the first identification generation unit comprises:
the time variable character string generation subunit is used for randomly selecting character strings with preset lengths from the time when each virtual machine is created and/or the system entropy value respectively, and taking each character string as a first identifier of the corresponding virtual machine.
8. The system according to claim 6, wherein the second identification generation unit comprises:
and the digest calculation subunit is used for respectively calculating digests of the MAC addresses of the virtual machines by utilizing a hash algorithm, and taking each digest as a second identifier of the corresponding virtual machine.
9. The system of claim 6, wherein the class II identification conflict handling subunit comprises:
the new MAC address selecting module is used for selecting new MAC addresses with target number from a preset MAC address pool when the second identification is calculated based on the MAC address of each virtual machine; the target number is the number of the II-type conflict identification virtual machines, and all MAC addresses stored in the MAC address pool are different from each other;
and the MAC address replacement module is used for replacing the original MAC address of the class II identification conflict virtual machine by using each new MAC address respectively to obtain the class I identification conflict virtual machine.
10. The system according to any one of claims 6 to 9, further comprising:
the virtual machine identification information base establishing unit is used for establishing a corresponding relation between the first identifier and the second identifier of the same virtual machine and establishing a virtual machine identification information base by utilizing the corresponding relation.
11. A virtual machine identification conflict processing apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the method of distinguishing between conflicting virtual machines according to any one of claims 1 to 5 when said computer program is executed.
12. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the method of distinguishing between virtual machines according to any one of claims 1 to 5.
CN201811612151.7A 2018-12-27 2018-12-27 Method, system, device and storage medium for distinguishing and identifying conflict virtual machines Active CN109697109B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811612151.7A CN109697109B (en) 2018-12-27 2018-12-27 Method, system, device and storage medium for distinguishing and identifying conflict virtual machines

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811612151.7A CN109697109B (en) 2018-12-27 2018-12-27 Method, system, device and storage medium for distinguishing and identifying conflict virtual machines

Publications (2)

Publication Number Publication Date
CN109697109A CN109697109A (en) 2019-04-30
CN109697109B true CN109697109B (en) 2023-09-05

Family

ID=66232873

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811612151.7A Active CN109697109B (en) 2018-12-27 2018-12-27 Method, system, device and storage medium for distinguishing and identifying conflict virtual machines

Country Status (1)

Country Link
CN (1) CN109697109B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110602268B (en) * 2019-09-23 2023-02-10 杭州海兴电力科技股份有限公司 Tunnel port allocation method and device, electronic equipment and storage medium
CN110932845B (en) 2019-12-31 2021-12-03 山东英信计算机技术有限公司 Agent terminal registration method, system and related device
CN111277590B (en) * 2020-01-19 2022-06-21 深信服科技股份有限公司 Device information screening method, firewall device, network device and storage medium
CN111343296B (en) * 2020-02-26 2022-09-30 深信服科技股份有限公司 Virtualized application communication method, device, server and storage medium
CN111404893B (en) * 2020-03-06 2021-12-21 深信服科技股份有限公司 Host classification method, device, equipment and computer storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101976317A (en) * 2010-11-05 2011-02-16 北京世纪互联工程技术服务有限公司 Virtual machine image safety method in private cloud computing application
CN102402466A (en) * 2011-08-10 2012-04-04 华为技术有限公司 Method and system for resolving multilateral conflicts of virtualization platform
US8448165B1 (en) * 2009-09-15 2013-05-21 Symantec Corporation System and method for logging operations of virtual machines
CN104144182A (en) * 2013-05-08 2014-11-12 西安邮电大学 Virtual machine identification method and device
CN105162897A (en) * 2015-09-16 2015-12-16 浪潮集团有限公司 System and method for allocating IP address for virtual machine and network virtual machine
CN107807840A (en) * 2016-09-09 2018-03-16 阿里巴巴集团控股有限公司 A kind of equipment direction connection method and device applied to virtual machine network

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2697956B1 (en) * 2011-04-15 2019-10-30 Unify GmbH & Co. KG Method for generating addresses in a computer network
US9740518B2 (en) * 2012-09-12 2017-08-22 Nxp Usa, Inc. Conflict detection circuit for resolving access conflict to peripheral device by multiple virtual machines
CN106462457A (en) * 2014-02-07 2017-02-22 瑞典爱立信有限公司 Virtualized application cluster
US9882873B2 (en) * 2015-11-29 2018-01-30 Red Hat Israel, Ltd. MAC address allocation for virtual machines

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8448165B1 (en) * 2009-09-15 2013-05-21 Symantec Corporation System and method for logging operations of virtual machines
CN101976317A (en) * 2010-11-05 2011-02-16 北京世纪互联工程技术服务有限公司 Virtual machine image safety method in private cloud computing application
CN102402466A (en) * 2011-08-10 2012-04-04 华为技术有限公司 Method and system for resolving multilateral conflicts of virtualization platform
CN104144182A (en) * 2013-05-08 2014-11-12 西安邮电大学 Virtual machine identification method and device
CN105162897A (en) * 2015-09-16 2015-12-16 浪潮集团有限公司 System and method for allocating IP address for virtual machine and network virtual machine
CN107807840A (en) * 2016-09-09 2018-03-16 阿里巴巴集团控股有限公司 A kind of equipment direction connection method and device applied to virtual machine network

Also Published As

Publication number Publication date
CN109697109A (en) 2019-04-30

Similar Documents

Publication Publication Date Title
CN109697109B (en) Method, system, device and storage medium for distinguishing and identifying conflict virtual machines
CN110830234B (en) User traffic distribution method and device
CN110018996B (en) Snapshot rollback method and related device of distributed storage system
CN104408118B (en) The creation method and device of database
CN105812175B (en) Resource management method and resource management equipment
CN111813788A (en) Information query method and device and information synchronization method and device
CN109995816B (en) Information importing method and device based on cloud computing platform and communication equipment
CN107656796B (en) Virtual machine cold migration method, system and equipment
JP2016099857A (en) Fraudulent program handling system and fraudulent program handling method
CN108769118B (en) Method and device for selecting master nodes in distributed system
CN115599437B (en) Software version processing method and device, electronic equipment and storage medium
CN111414528B (en) Method and device for determining equipment identification, storage medium and electronic equipment
CN113010897A (en) Cloud computing security management method and system
CN112631994A (en) Data migration method and system
CN109359093A (en) A kind of rule file update method and system
CN111324368B (en) Data sharing method and server
CN114610516A (en) Application program repairing method and device, computer equipment and storage medium
CN111464395A (en) Method and device for creating block chain and readable storage medium
CN107666495B (en) Disaster recovery method and terminal for application
CN113407403B (en) Cloud host management method and device, computer equipment and storage medium
CN114742600B (en) Content analysis method based on industrial internet and computer storage medium
CN111399903B (en) Server connection method, device and related equipment
JP2019204373A (en) Apparatus for and method of supporting creation of program using visual programming tool
CN113872978B (en) DNS hijacking monitoring method and device and electronic equipment
CN115080269A (en) Preheating method, electronic device and storage medium

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