CN113992630B - Network resource conflict processing method, device, equipment and storage medium - Google Patents

Network resource conflict processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN113992630B
CN113992630B CN202111063814.6A CN202111063814A CN113992630B CN 113992630 B CN113992630 B CN 113992630B CN 202111063814 A CN202111063814 A CN 202111063814A CN 113992630 B CN113992630 B CN 113992630B
Authority
CN
China
Prior art keywords
virtual machine
network resource
network
target virtual
conflict
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
CN202111063814.6A
Other languages
Chinese (zh)
Other versions
CN113992630A (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.)
New H3C Big Data Technologies Co Ltd
Original Assignee
New H3C Big Data 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 New H3C Big Data Technologies Co Ltd filed Critical New H3C Big Data Technologies Co Ltd
Priority to CN202111063814.6A priority Critical patent/CN113992630B/en
Publication of CN113992630A publication Critical patent/CN113992630A/en
Application granted granted Critical
Publication of CN113992630B publication Critical patent/CN113992630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for processing network resource conflict, wherein the method comprises the following steps: querying a target virtual machine associated with network resources when determining that resource conflict occurs in allocating the network resources to the virtual machine to be currently created; judging whether the target virtual machine is deleted or not; and if the target virtual machine is deleted, releasing the network resources. In the application, under the condition that the conflict occurs to the network resource provided for the virtual machine to be created currently, whether the virtual machine is deleted is judged by inquiring the target virtual machine, and when the virtual machine is deleted, the network resource is released, so that the problem of network resource conflict can be avoided when the virtual machine is created subsequently and the same network resource as the previous residue is created for the virtual machine under the condition that the network resource residue occurs.

Description

Network resource conflict processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of cloud computing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing network resource conflicts.
Background
OpenStack is an open source cloud management platform that aims to provide software for public and private cloud construction and management, and the primary task of the platform is to simplify the cloud deployment process and bring good expansibility to the cloud deployment process. Two key components of Nova (computing module) and Neutron (network module) are responsible for creating scheduling and realizing a network of a virtual machine (also called a cloud host); the conventional process of creating the virtual machine is that after Nova receives a Post request for creating the virtual machine, the virtual machine is scheduled to a computing node (OpenStack-computer) with optimal resources, and in case of a problem of the node, nova defaults to have two rescheduling opportunities so as to ensure that the virtual machine is created smoothly. When Nova schedules a virtual machine to a computing node, the computing node sends a logic judgment message for creating network resources to a neutral, after the neutral checks that a database is not abnormal, the node returns a message for designating that the network resources are available to Nova-computer service in a cpn-xxx computing node, the Nova-computer creates the network resources, after the network resources are created successfully and the virtual machine is not rescheduled, the network resources are mounted to the virtual machine, and the process of creating the virtual machine is finished; if the Nova rescheduling process is triggered due to the problem of the computing node, the network resource is temporarily separated from the virtual machine, and the network resource is not mounted to the virtual machine until the virtual machine is smoothly issued to the designated computing node.
However, when virtual machines are created in large quantities, an extreme scenario occurs, which causes network resource residues. For example, when the utilization ratio of the virtualized cluster resources corresponding to the computing node exceeds 90%, the virtual machine scheduled to the node for the first time may be rescheduled due to insufficient resources of the computing node, and the third time of scheduling may occur because the use of resources of the whole available domain is very high, and at this time, a Post interface for creating the virtual machine may be highly likely to return to an error condition, and if an error is received, the operation of deleting the virtual machine will be executed. The normal Nova reschedules the virtual machine while it is not allowed to delete the virtual machine, but may delete the virtual machine when the Post interface returns an error. When the virtual machine is deleted, at this time, since the virtual machine is still in a rescheduling state, the network resources are not bound with the virtual machine yet, so that residues appear in the allocated network resources when the virtual machine is deleted.
In the case of network resource residues, if a virtual machine is subsequently created and the same network resource as the previous residue is created for it, the problem of network resource conflict will occur.
Disclosure of Invention
Therefore, the application aims to solve the problem of network resource conflict in the prior art when the virtual machine is subsequently created and the same network resource as the previous residual is created under the condition that the network resource remains, thereby providing a network resource conflict processing method, device, equipment and storage medium.
In one aspect of the embodiment of the present application, a method for processing network resource conflict is provided, including: querying a target virtual machine associated with network resources when determining that resource conflict occurs in allocating the network resources to the virtual machine to be currently created; judging whether the target virtual machine is deleted or not; and if the target virtual machine is deleted, releasing the network resources.
Optionally, it is determined that allocating network resources to the virtual machine currently to be created is resource conflicting by: judging whether a message for indicating that the network resources are allocated is received or not; if the message is received, the network resources provided for the virtual machine to be created currently are determined to conflict.
Optionally, the querying the target virtual machine associated with the network resource includes: acquiring the identification information of the network resource; inquiring a virtual machine identifier corresponding to the identifier information from a database, and taking a target virtual machine corresponding to the inquired virtual machine identifier as a target virtual machine associated with the network resource.
Optionally, the acquiring the identification information of the network resource includes: acquiring a subnet identifier pre-allocated to the virtual machine to be currently created; and acquiring an IP address pre-allocated for the virtual machine to be created currently, and taking the subnet identification and the IP address as the identification information.
Optionally, the determining whether the target virtual machine has been deleted includes: acquiring the virtual machine identification; inquiring an operation record of the target virtual machine from a virtual machine table based on the virtual machine identifier to determine the state of the target virtual machine, wherein all the virtual machine operation records created by history are recorded in the virtual machine table; and judging whether the state of the target virtual machine is a deleting state, wherein when an operation record for deleting the target virtual machine is recorded in the virtual machine table, the state of the target virtual machine is determined to be the deleting state.
Optionally, the releasing the network resource includes: and calling a preset application programming interface, and triggering a deleting instruction of the network resource to delete all associated information of the network resource recorded in a database.
Optionally, the method further comprises: and if the target virtual machine is not deleted, sending a message for indicating that the network resources are occupied.
In order to achieve the above object, an embodiment of the present application further provides a network resource conflict processing apparatus, including: the query module is used for querying a target virtual machine which is associated with the network resource when the resource conflict is determined to occur when the network resource is allocated to the virtual machine to be created currently; the judging module is used for judging whether the target virtual machine is deleted or not; and the releasing module is used for releasing the network resources if the target virtual machine is deleted.
To achieve the above object, an embodiment of the present application further provides a computer apparatus, including: the system comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory stores computer instructions, and the processor executes the computer instructions, so that the method is executed.
To achieve the above object, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions for causing the computer to execute the above-described method.
According to the embodiment of the application, under the condition that the conflict occurs to the network resource provided for the virtual machine to be created currently, whether the virtual machine is deleted is judged by inquiring the target virtual machine, and when the virtual machine is determined to be deleted, the network resource is released, so that the problem of network resource conflict can be avoided when the virtual machine is created subsequently and the same network resource as the previous residue is created for the virtual machine under the condition that the network resource residue occurs.
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 needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present application, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
FIG. 1 is a prior art flow chart for virtual machine creation;
fig. 2 is a flowchart of a specific example of a network resource conflict processing method in embodiment 1 of the present application;
FIG. 3 is a flow chart of virtual machine creation according to embodiment 1 of the present application;
fig. 4 is a schematic block diagram of a specific example of the network resource conflict processing apparatus in embodiment 2 of the present application;
FIG. 5 is a schematic diagram of an embodiment of a computer device of the present application.
Detailed Description
The following description of the embodiments of the present application will be made apparent and fully in view of the accompanying drawings, in which some, but not all embodiments of the application are shown. 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.
In the description of the present application, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present application. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In the description of the present application, it should be noted that, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; the two components can be directly connected or indirectly connected through an intermediate medium, or can be communicated inside the two components, or can be connected wirelessly or in a wired way. The specific meaning of the above terms in the present application will be understood in specific cases by those of ordinary skill in the art.
In addition, the technical features of the different embodiments of the present application described below may be combined with each other as long as they do not collide with each other.
Before introducing the embodiment of the application, taking OpenStack as an example, the existing process of creating the virtual machine and the flow of network resource conflict are introduced. As shown in fig. 1: receiving, by the core layer, a POST request to create a virtual machine; forwarded by the system core computing module (os-computer-core) to the computing module (Nova). The specific detailed flow is as follows:
(1) nova schedules the virtual machine to the optimal computing node cpn-xxx according to the bottom resource condition;
(2) after the CPN receives a request for creating a virtual machine, a Nova-computer process calls Nova network 2 api API, and sends a network resource logic verification message to a network module; the nova. Network. Neutral 2.Api. Update_ports_for_instance interface is then invoked to update the virtual machine related series of messages (uuid, device_own, host_id, etc.).
(3) After receiving the logical verification message for creating the network resource, the Neutron finds that the fix IP address already exists (remains) during verification, and returns an IP address { xxx } already allocated in subnet { xxxx } Neutron server returns requeset _ids: [' req- { xxxx } ] message to the Nova-computer service.
(4) The Nova-computer process of the computing node cpn-xxx sends IP address { xxx } already allocated in subnet { xx } Neutron server returns requeset _ids: [ 'req- { xx }' ] to the computing module Nova.
(5) Nova returns the message in (4) to os-computer-core. The process of creating the virtual machine is ended due to the network resource conflict.
(6) The process is that services such as Nova and Neutron interact with the database, and both Nova and Neutron need to update the state of the virtual machine to the mysql database for subsequent system call when the virtual machine is operated.
Then, in the above flow, when a network resource conflict occurs, the creation of the virtual machine is directly caused to fail. This occurs more severely when cluster resource utilization exceeds a certain threshold.
The application provides the technical scheme based on the problems existing in the existing virtual machine creation flow. See in particular the examples below.
Example 1
The embodiment of the application provides a network resource conflict processing method which can be used in a network module of a virtual machine creation platform and can also be independently realized with other functional modules of the network module. As shown in fig. 2, the method includes:
in step S201, when it is determined that a resource conflict occurs in allocating a network resource to a virtual machine to be currently created, a target virtual machine associated with the network resource is queried.
In the embodiment of the present application, for the virtual machine creation process, especially, the process before the virtual machine verifies the network resource is basically the same as that shown in fig. 1, and even the process of verifying the network resource conflict may be the same. Of course, the virtual machine creation process in the embodiment of the present application may be other identical or similar processes, and the present application is not limited thereto. The network resource conflict processing method provided by the embodiment of the application can carry out network resource conflict processing on the basis of not changing the original virtual machine creation flow, trigger conflict processing in real time, does not need timing processing or restarting services and the like, and greatly reduces the resource occupation of the creation platform.
The conflict judgment of the network resources can be judged by a network module of the virtual machine creation platform, for example, when the configuration of other network resources is carried out on the pre-allocated IP address, the IP address is found to exist, so that subsequent configuration work cannot be carried out, and the conflict is reported. Of course, the method can also be realized by other functional modules which are independent from the platform, the related information of the network resource is queried in the database by acquiring the allocated network resource from the network module, and when the network resource is queried to exist, the network resource is determined to have conflict. The network resources of the embodiment of the application can comprise resources such as network ports and the like.
In the current flow of creating virtual machines, if a network resource conflict occurs, a target virtual machine associated with the network resource is queried. In the embodiment of the application, when the network resource conflict exists, the network resource is generally used by the virtual machine which is created before, so that the target virtual machine corresponding to the network resource can be queried from the stored record, and the queried record or identification of the target virtual machine can be obtained.
Step S202, determining whether the target virtual machine has been deleted.
Step S203, if the target virtual machine has been deleted, releasing the network resource.
As an alternative embodiment, the method further comprises: and if the target virtual machine is not deleted, sending a message for indicating that the network resources are occupied.
In this embodiment of the present application, as an optional implementation manner, the releasing the network resource includes: and calling a preset Application Programming (API) interface, and triggering a deleting instruction of the network resource to delete all the associated information of the network resource recorded in the database. Specifically, a system API interface for creating a virtual machine may be invoked, which may be a command interface provided by OpenStack; transmitting a command for deleting the network resource through the API interface; and deleting all associated information of the network resources in the database according to the command. In this embodiment, the deletion command is sent through the system API interface to automatically delete all the related information of the database and the network resource, and of course, the corresponding deletion command may also be executed through the database language, which is relatively more convenient to use by the system API interface.
After the target virtual machine is queried, judging whether the target virtual machine is deleted, if so, indicating that the network resource is available, but cannot be used because the network resource is not released. Thus, for this case, the existing associated data for the network resource may be deleted from the database, freeing the network resource and applying it to the virtual machine currently being created. Specifically, the information of the virtual machine bound to the network interface can be queried through a mysql database relational table, and then the virtual machine can be cleaned by querying whether the virtual machine is deleted.
According to the embodiment of the application, under the condition that the conflict occurs to the network resource provided for the virtual machine to be created currently, whether the virtual machine is deleted is judged by inquiring the target virtual machine, and when the virtual machine is determined to be deleted, the network resource is released, so that the problem of network resource conflict can be avoided when the virtual machine is created subsequently and the same network resource as the previous residue is created for the virtual machine under the condition that the network resource residue occurs.
On the other hand, according to the network resource conflict processing method provided by the embodiment of the application, the record and the processing of the deleted virtual machine are not needed, all the needed data can be queried from the existing database of the platform, the occupation of the storage space is reduced, no additional processor and memory resources are needed, the corresponding content in the database can be queried only by regular matching, and the processor resources are rarely consumed.
As an alternative embodiment, it is determined that allocating network resources to a virtual machine currently to be created is resource conflicting by: judging whether a message for indicating that the network resources are allocated is received or not; if the message is received, the network resources provided for the virtual machine to be created currently are determined to conflict.
In the prior art, when the network module is performing network resource conflict judgment, if it is determined that the network resource conflicts, a message is returned to the Nova-computer service of the computing module, for example, when the network resource is a network port, if it is found that the fix IP address already exists (remains) during verification, an IP address { xxx } already allocated in subnet { xxxx } Neutron server returns requeset _ids: [' req- { xxxx } ] message is returned to the Nova-computer service.
In the embodiment of the application, by adding a functional module to the logic, the logic can be called a conflict resolution module. When the network resource conflict is determined, the network module sends a message for indicating that the network resource is allocated to the conflict resolution module, and when the message is received, the network resource provided for the virtual machine to be created currently is determined to have the conflict. If the target virtual machine is not deleted, a message for indicating that the network resource is occupied is sent, that is, if the conflict resolution module determines that the network resource is normally occupied, the original flow is continued, that is, the message is returned to the Nova-computer service of the computing module. Other processes are not adjusted.
In the embodiment of the application, a conflict resolution module is newly added under the condition of not changing the original virtual machine creation main flow, the creation failure reason of the virtual machine is not judged during batch creation, the virtual machine is triggered only when the network card conflicts, the subsequent flows are all inquired through the database, the creation flow is not influenced, and the resources and the performances of the platform are not consumed.
As an alternative embodiment, the querying the target virtual machine associated with the network resource includes: acquiring the identification information of the network resource; inquiring a virtual machine identifier corresponding to the identifier information from a database, and taking a target virtual machine corresponding to the inquired virtual machine identifier as a target virtual machine associated with the network resource. In this embodiment, if the network resource is a network port, the identification information may be an IP address, etc., and then the identification information is used to query the database for the associated virtual machine identification, that is, the target virtual machine associated with the network resource before the determination.
The associated target virtual machine according to the embodiment of the present application includes a virtual machine that is already bound to a network resource and a virtual machine that is in a condition that the network resource is not bound to the virtual machine due to the rescheduling, where the virtual machine is not bound to the network resource when the virtual machine does not fall to a computing node in the rescheduling process, that is, in this case, the ID of the virtual machine and the network resource are not directly bound to each other, but there may be some indirect association on the data in the database, for example, the virtual machine is associated with the creation requester, and the network resource is also associated with the creation requester, but the virtual machine is not directly bound to the network resource.
Therefore, the embodiment of the application has the following advantages compared with the mode of adopting the periodic network resource clearing mode according to the ID of the virtual machine:
1. based on the triggering of the event, namely, when the network resource conflict exists, the network resource conflict solution flow is restarted, the reason for failure in creating the virtual machine is not required to be recorded, the whole flow of creating the virtual machine by the platform is not influenced, the consumption of resources is reduced, the triggering is only carried out when the network card conflicts, and the subsequent flows are all queried through the database;
2. network resource release in the case where the deleted target virtual machine is associated with a network resource but unbound can be handled.
As an optional implementation manner, the obtaining the identification information of the network resource includes: acquiring a subnet identifier pre-allocated to the virtual machine to be currently created; and acquiring an IP address pre-allocated for the virtual machine to be created currently, and taking the subnet identification and the IP address as the identification information.
In the embodiment of the application, the network resources can comprise network cards such as a subnet and an IP, the identification information of the corresponding network resources can comprise a subnet identification and an IP address, the conflict resolution module obtains the pre-allocated subnet identification and the pre-allocated IP address when the virtual machine is created, and then the identification information is used for inquiring whether the target virtual machine exists. In the embodiment of the application, because the corresponding network resources are required to be pre-allocated in the process of creating the virtual machine, but whether the final network resources can be bound to the created virtual machine or not is also required to be judged, the subnet identification and the IP address can be pre-allocated by the network module in the process of creating the network resources, and the conflict resolution module acquires the information to inquire the corresponding target virtual machine.
Further, as an optional implementation manner, the determining whether the target virtual machine has been deleted includes: acquiring the virtual machine identification; inquiring an operation record of the target virtual machine from a virtual machine table based on the virtual machine identifier to determine the state of the target virtual machine, wherein all the virtual machine operation records created by history are recorded in the virtual machine table; and judging whether the state of the target virtual machine is a deleting state, wherein when an operation record for deleting the target virtual machine is recorded in the virtual machine table, the state of the target virtual machine is determined to be the deleting state.
In the embodiment of the application, the virtual machine table may refer to an instance table, and an operation record in the process of creating the virtual machine is recorded in the instance table, so that the operation record of the target virtual machine can be queried from the instance table, and the state of the target virtual machine (i.e. the virtual machine associated with the network resource) can be determined from the final operation record, thereby further judging whether the target virtual machine is in a deleted state. For example, after the virtual machine deletion operation is performed, the state of the virtual machine is recorded as deletion in the virtual machine table.
In the embodiment of the application, taking OpenStack as an example, the virtual machine creation flow and the network resource conflict solution in the embodiment of the application are introduced. As shown in fig. 3: receiving, by the core layer, a POST request to create a virtual machine; forwarded by the system core computing module (os-computer-core) to the computing module (Nova). The specific detailed flow is as follows:
(1) nova dispatches the virtual machine to the optimal computing node according to the bottom resource condition;
(2) after the CPN receives a request for creating a virtual machine, a Nova-computer process calls Nova network 2 api API, and sends a network resource logic verification message to a network module; the nova. Network. Neutral 2.Api. Update_ports_for_instance interface is then invoked to update the virtual machine related series of messages (uuid, device_own, host_id, etc.). In this embodiment, the network resource specifically refers to a network card port and the like.
(3) After receiving the logical verification message for creating the network resource, the Neutron finds that the fix IP address already exists (remains) during verification, and returns an IP address { xxx } already allocated in subnet { xxxx } Neutron server returns requeset _ids: [' req- { xxxx } ] message to the IP conflict-solve module, namely the IP conflict resolution module. Specifically, the judgment logic code can be added in Neutron as follows:
if“fix_IPs.query=IP address{xxx}already allocated in subnet{xxxx}Neutron server returns requeset_ids:[‘req-{xxxx}’]”
send.message(“IPConflictSolve.api”)
else
send.message(“Neutron.wsgi”)
that is, when the neutron detects an IP conflict, the message is not directly sent to the Nova-computer, but is forwarded to the IP conflict-solve module and processed by the IP conflict-solve module.
(4) After receiving the IP conflict message, the IP conflict-solution module queries the corresponding devic_id in the mysql database, namely the virtual machine uuid according to the IP+subnet ID, takes the corresponding devic_id to the virtual machine uuid, then queries whether the state of the virtual machine is deleted or not in the instance table, and if not, the IP conflict-solution module does not process the network card; if the network card is in the deleted state, the IP conflict-wave module directly deletes the network card. The logical processing flow of the IP conflict-wave module is as follows:
ip_array=fix_IPs.qury.json(“IP address”)
subnet_array=fix_IPs.qury.json(“subnet”)
port_id,// uuid of network card obtained from database
select*from neutron.ipallocations where ip_address='2.0.3.216'&&network_id='760a07a7-587f-4cfe-89b2-577ae2f954cf';
Device_id,// then re-acquire virtual machine uuid
select*from neutron.ports where id='3ee16018-f93b-431f-928e-60ffad2e2a27';
@vm_state,// confirm whether the virtual machine state is delete
select*from nova.instances where uuid='97db9448-d535-418b-8bb9-0a752404e8e3';
After @ DELETE port,// confirm virtual machine state is a deleted state, DELETE port is performed
“DELETE”/v2.0/ports/{port-uuid};
After @ RETURN msg,// confirm that the virtual machine state is not a delayed state, do not process and RETURN normal conflicts to the neutral; otherwise return an exception conflict, have been resolved
(5) As shown in the logic above, if a port is deleted, then the IP conflict-wave module returns to the Neutron exception conflict, which has been resolved; if the port is not deleted, then the IP conflict-wave module returns to the Neutron normal conflict.
(6) The Nova-computer process of the computing node cpn-xxx sends IP address { xxx } already allocated in subnet { xx } Neutron server returns requeset _ids: [ 'req- { xx }' ] to the computing module Nova.
(7) Nova returns the message in (4) to os-computer-core. The process of creating the virtual machine is ended due to the network resource conflict.
(8) The process is that services such as Nova and Neutron interact with the database, and both Nova and Neutron need to update the state of the virtual machine to the mysql database for subsequent system call when the virtual machine is operated.
According to the embodiment of the application, the network card conflict processing mechanism is introduced by extremely difficult investigation when the network card residues appear in the large cluster environment, so that the success rate of creating the virtual machine in the large cluster environment can be improved; when the virtual machine and the network resources in the environment are more, a great deal of time and labor are required for checking the residual network card problem, and a network resource conflict processing mechanism is introduced, so that the time and labor required for processing the residual network card problem are greatly reduced; for the scene of high concurrency and too high use of bottom layer resources, the problem of network card residue is very easy to occur, and because the problem is difficult to process, the usability and maintainability evaluation of a product by a client are poor, and the problem can be well avoided by introducing a network resource conflict processing mechanism, so that the usability and maintainability of the product are improved.
Example 2
The embodiment of the present application also provides a device for processing network resource conflict, which may be used to execute the method for processing network resource conflict in the foregoing embodiment 1, as shown in fig. 4, where the device includes:
a query module 401, configured to query, when it is determined that a resource conflict occurs in allocating a network resource to a virtual machine to be currently created, a target virtual machine associated with the network resource.
A determining module 402, configured to determine whether the target virtual machine has been deleted.
And the releasing module 403 is configured to release the network resource if the target virtual machine has been deleted.
The specific description refers to the above method embodiments, and will not be repeated here.
According to the embodiment of the application, under the condition that the conflict occurs to the network resource provided for the virtual machine to be created currently, whether the virtual machine is deleted is judged by inquiring the target virtual machine, and when the virtual machine is determined to be deleted, the network resource is released, so that the problem of network resource conflict can be avoided when the virtual machine is created subsequently and the same network resource as the previous residue is created for the virtual machine under the condition that the network resource residue occurs.
It should be noted that, the device provided by the present application may be provided in the IP conflict resolution module in fig. 3, or the conflict resolution module may implement the above functions. Specifically, as shown in fig. 3, the IP conflict solution module may be configured to receive a message sent by the network module to indicate that the network resource is allocated, where the message may be implemented by interaction between the network resource conflict processing device and the network module, and the network resource conflict processing device may further obtain subnet identification, IP address, and other identification information pre-allocated by the network module to the virtual machine to be created, and use the identification information to interact with the database, so as to implement operation record query of the target virtual machine associated with the network resource before to determine the state of the target virtual machine. And after the network resource conflict processing device determines the result, feeding back the result to the network module.
On the other hand, according to the network resource conflict processing method provided by the embodiment of the application, the record and the processing of the deleted virtual machine are not needed, all the needed data can be queried from the existing database of the platform, the occupation of the storage space is reduced, no additional processor and memory resources are needed, the corresponding content in the database can be queried only by regular matching, and the processor resources are rarely consumed.
Optionally, the network resource conflict processing apparatus determines that allocating network resources to the virtual machine to be currently created generates a resource conflict by: a receiving module, configured to determine whether a message indicating that the network resource has been allocated is received; and the determining module is used for determining that the network resources provided for the virtual machine to be created currently collide if the message is received.
In the embodiment of the application, a conflict resolution module is newly added under the condition of not changing the original virtual machine creation main flow, the creation failure reason of the virtual machine is not judged during batch creation, the virtual machine is triggered only when the network card conflicts, the subsequent flows are all inquired through the database, the creation flow is not influenced, and the resources and the performances of the platform are not consumed.
Optionally, the query module includes: a first obtaining unit, configured to obtain identification information of the network resource; the query unit is used for querying the virtual machine identification corresponding to the identification information from the database, and taking the target virtual machine corresponding to the queried virtual machine identification as the target virtual machine associated with the network resource.
Optionally, the acquiring unit includes: a first obtaining subunit, configured to obtain a subnet identifier pre-allocated to the virtual machine to be currently created; and the second acquisition subunit is used for acquiring the IP address pre-allocated for the virtual machine to be created currently, and taking the subnet identification and the IP address as the identification information.
Optionally, the judging module includes: the second acquisition unit is used for acquiring the virtual machine identification; the second query unit is used for querying the operation records of the target virtual machine from a virtual machine table based on the virtual machine identification so as to determine the state of the target virtual machine, wherein all the virtual machine operation records created by history are recorded in the virtual machine table; and the judging unit is used for judging whether the state of the target virtual machine is a deleting state, wherein when the operation record for deleting the target virtual machine is recorded in the virtual machine table, the state of the target virtual machine is determined to be the deleting state.
Optionally, the release module includes: the deleting unit is used for calling a preset application programming interface and triggering a deleting instruction of the network resource so as to delete all the associated information of the network resource recorded in the database.
Optionally, the apparatus further comprises: and the sending module is used for sending a message for indicating that the network resources are occupied if the target virtual machine is not deleted.
The description of the device portion may be specifically referred to the above method embodiment, and detailed description is omitted in this embodiment.
Example 3
In one embodiment of the present application, there is also provided a computer apparatus, an internal structural diagram of which may be as shown in fig. 5. The computer device includes a processor, memory, a network interface, and may also include a display screen and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external computer device through a network connection. The computer program when executed by the processor is used for realizing a network resource conflict processing method, the computer equipment can also comprise a display screen and an input device, wherein the display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen or a key, a track ball or a touch pad arranged on the shell of the computer equipment.
On the other hand, the computer device may not include a display screen and an input means, and it will be understood by those skilled in the art that the structure shown in fig. 5 is merely a block diagram of a portion of the structure related to the present application, and does not constitute a limitation of the computer device to which the present application is applied, and a specific computer device may include more or less components than those shown in the drawings, or may combine some components, or have different component arrangements.
In one embodiment, a computer device is provided that includes a memory and a processor communicatively coupled to each other, the memory having stored therein computer instructions that, upon execution, perform the steps of:
querying a target virtual machine associated with network resources when determining that resource conflict occurs in allocating the network resources to the virtual machine to be currently created;
judging whether the target virtual machine is deleted or not;
and if the target virtual machine is deleted, releasing the network resources.
In one embodiment, a readable storage medium is provided, the computer readable storage medium storing computer instructions for causing the computer to perform:
querying a target virtual machine associated with network resources when determining that resource conflict occurs in allocating the network resources to the virtual machine to be currently created;
judging whether the target virtual machine is deleted or not;
and if the target virtual machine is deleted, releasing the network resources.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.
The foregoing describes in detail preferred embodiments of the present application. It should be understood that numerous modifications and variations can be made in accordance with the concepts of the application without requiring creative effort by one of ordinary skill in the art. Therefore, all technical solutions which can be obtained by logic analysis, reasoning or limited experiments based on the prior art by the person skilled in the art according to the inventive concept shall be within the scope of protection defined by the claims.

Claims (10)

1. A method for processing network resource conflict, comprising:
querying a target virtual machine associated with network resources when determining that resource conflict occurs in allocating the network resources to the virtual machine to be currently created;
judging whether the target virtual machine is deleted or not;
and if the target virtual machine is deleted, releasing the network resources.
2. The method for processing network resource conflict according to claim 1, wherein the allocation of network resources to the virtual machine to be currently created is determined to be resource conflicting by:
judging whether a message for indicating that the network resources are allocated is received or not;
if the message is received, the network resources provided for the virtual machine to be created currently are determined to conflict.
3. The network resource conflict handling method of claim 1, wherein the querying the target virtual machine associated with the network resource comprises:
acquiring the identification information of the network resource;
inquiring a virtual machine identifier corresponding to the identifier information from a database, and taking a target virtual machine corresponding to the inquired virtual machine identifier as a target virtual machine associated with the network resource.
4. The method for processing network resource conflict as claimed in claim 3, wherein said obtaining the identification information of the network resource includes:
acquiring a subnet identifier pre-allocated to the virtual machine to be currently created;
and acquiring an IP address pre-allocated for the virtual machine to be created currently, and taking the subnet identification and the IP address as the identification information.
5. The network resource conflict handling method of claim 3, wherein the determining whether the target virtual machine has been deleted comprises:
acquiring the virtual machine identification;
inquiring an operation record of the target virtual machine from a virtual machine table based on the virtual machine identifier to determine the state of the target virtual machine, wherein the virtual machine table records a virtual machine operation record which is created historically;
and judging whether the state of the target virtual machine is a deleting state, wherein when an operation record for deleting the target virtual machine is recorded in the virtual machine table, the state of the target virtual machine is determined to be the deleting state.
6. The method for processing network resource conflict as in claim 3, wherein said releasing the network resource comprises:
and calling a preset application programming interface, and triggering a deleting instruction of the network resource to delete all associated information of the network resource recorded in a database.
7. The network resource conflict handling method of claim 2, further comprising:
and if the target virtual machine is not deleted, sending a message for indicating that the network resources are occupied.
8. A network resource conflict handling apparatus, comprising:
the query module is used for querying a target virtual machine which is associated with the network resource when the resource conflict is determined to occur when the network resource is allocated to the virtual machine to be created currently;
the judging module is used for judging whether the target virtual machine is deleted or not;
and the releasing module is used for releasing the network resources if the target virtual machine is deleted.
9. A computer device, comprising: a memory and a processor in communication with each other, the memory having stored therein computer instructions, the processor executing the computer instructions to perform the method of any of claims 1-7.
10. A computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-7.
CN202111063814.6A 2021-09-10 2021-09-10 Network resource conflict processing method, device, equipment and storage medium Active CN113992630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111063814.6A CN113992630B (en) 2021-09-10 2021-09-10 Network resource conflict processing method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111063814.6A CN113992630B (en) 2021-09-10 2021-09-10 Network resource conflict processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113992630A CN113992630A (en) 2022-01-28
CN113992630B true CN113992630B (en) 2023-08-22

Family

ID=79735658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111063814.6A Active CN113992630B (en) 2021-09-10 2021-09-10 Network resource conflict processing method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113992630B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115373824B (en) * 2022-10-24 2023-02-03 恒生电子股份有限公司 Conflict detection method, device, computing equipment and computer readable storage medium
CN115941388B (en) * 2022-11-10 2024-06-14 浪潮思科网络科技有限公司 Method, device, equipment and medium for issuing virtual private network

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102710814A (en) * 2012-06-21 2012-10-03 奇智软件(北京)有限公司 Method and device for controlling Internet protocol (IP) address of virtual machine
CN102932252A (en) * 2012-11-21 2013-02-13 杭州华三通信技术有限公司 Method and device for flow recovery of virtual router redundancy protocol backup group
CN109743417A (en) * 2019-03-25 2019-05-10 山东浪潮云信息技术有限公司 A method of for the virtual machine automatic IP address allocation on ESXI host
CN111831393A (en) * 2020-06-30 2020-10-27 新华三大数据技术有限公司 Method for managing virtual machine, server and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9104463B2 (en) * 2012-11-07 2015-08-11 International Business Machines Corporation Automated and optimal deactivation of service to enable effective resource reusability

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102710814A (en) * 2012-06-21 2012-10-03 奇智软件(北京)有限公司 Method and device for controlling Internet protocol (IP) address of virtual machine
CN102932252A (en) * 2012-11-21 2013-02-13 杭州华三通信技术有限公司 Method and device for flow recovery of virtual router redundancy protocol backup group
CN109743417A (en) * 2019-03-25 2019-05-10 山东浪潮云信息技术有限公司 A method of for the virtual machine automatic IP address allocation on ESXI host
CN111831393A (en) * 2020-06-30 2020-10-27 新华三大数据技术有限公司 Method for managing virtual machine, server and storage medium

Also Published As

Publication number Publication date
CN113992630A (en) 2022-01-28

Similar Documents

Publication Publication Date Title
CN113992630B (en) Network resource conflict processing method, device, equipment and storage medium
US20190034460A1 (en) Co-locating Microservice Persistence Containers within Tenant-Specific Database
CN108717379B (en) Electronic device, distributed task scheduling method and storage medium
CN110532025B (en) Data processing method, device and equipment based on micro-service architecture and storage medium
CN108446172B (en) Data calling method and device, computer equipment and storage medium
US20160041923A1 (en) Inter-Manycore Communications Method and System
US20200174818A1 (en) Virtual machine management
CN108874549B (en) Resource multiplexing method, device, terminal and computer readable storage medium
CN112068968B (en) Service access method and device for dual-system terminal
US11301284B2 (en) Method for managing VNF instantiation and device
CN111343236A (en) Method, device and communication system for communication between server and client
CN113157411B (en) Celery-based reliable configurable task system and device
EP3879875A1 (en) Resource change method and device, apparatus, and storage medium
CN114005225B (en) Storage method and device of intelligent cabinet and pickup method and device of intelligent cabinet
CN111225007B (en) Database connection method, device and system
CN111126604A (en) Model training method, device, server and storage medium
CN113032125A (en) Job scheduling method, device, computer system and computer-readable storage medium
US8725887B2 (en) License management system and function providing device
US11915036B2 (en) Method, system, and device for modifying internal configuration of virtual machine
WO2020253045A1 (en) Configured supplementary processing method and device for data of which forwarding has abnormality, and readable storage medium
CN113946427A (en) Task processing method, processor and storage medium for multi-operating system
CN111699479A (en) Log processing method, log processing device and computer-readable storage medium
EP3661140A1 (en) Method for applying for common service resource, related device, and system
CN108241616B (en) Message pushing method and device
CN113064732A (en) Distributed system and management method thereof

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