CN113992630A - Network resource conflict processing method, device, equipment and storage medium - Google Patents
Network resource conflict processing method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN113992630A CN113992630A CN202111063814.6A CN202111063814A CN113992630A CN 113992630 A CN113992630 A CN 113992630A CN 202111063814 A CN202111063814 A CN 202111063814A CN 113992630 A CN113992630 A CN 113992630A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- network resource
- target virtual
- network
- deleted
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a network resource conflict processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: when determining that resource conflict occurs when network resources are allocated to a virtual machine to be created currently, inquiring a target virtual machine associated with the network resources; judging whether the target virtual machine is deleted or not; and if the target virtual machine is deleted, releasing the network resources. The invention judges whether the target virtual machine is deleted or not by inquiring the target virtual machine under the condition that the network resources provided for the virtual machine to be created currently conflict, and releases the network resources under the condition that the target virtual machine is deleted, thereby avoiding the problem of network resource conflict when the network resources are remained and if the virtual machine is subsequently created and the same network resources remained as before are created for the virtual machine.
Description
Technical Field
The invention relates to the technical field of cloud computing, in particular to a network resource conflict processing method, device, equipment and storage medium.
Background
OpenStack is an open source cloud management platform aiming at providing 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 and scheduling virtual machines (also called cloud hosts) and implementing networks; in a conventional process of creating a virtual machine, after a Post request for creating the virtual machine is received by Nova, the virtual machine is scheduled to a computing node (OpenStack-computer) with an optimal resource, and in case of a problem of the node, the Nova defaults to have two times of 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 establishing network resources to Neutron, the Neutron checks whether the database is abnormal, the Neutron returns a message that the specified network resources are available to the Nova-computer service in the cpn-xxx computing node, the Nova-computer establishes the network resources, and after the network resources are successfully established and the virtual machine is not rescheduled, the network resources are hung to the virtual machine, and the process of establishing the virtual machine is finished; if the Nova rescheduling flow is triggered due to the problem of the computing nodes, the network resources are temporarily separated from the virtual machine, and the network resources are not mounted to the virtual machine until the virtual machine is successfully issued to the designated computing nodes.
However, when creating virtual machines in large quantities, an extreme scenario occurs, which may cause network resource residue. For example, when the utilization rate of the virtualized cluster resource corresponding to the compute node exceeds 90%, due to reasons such as insufficient compute node resources, the virtual machine scheduled to the node for the first time may be rescheduled due to insufficient resources, and because the resource usage of the entire available domain is high, the third scheduling may occur, at this time, a Post interface return error condition for creating the virtual machine may occur at a high probability, and if an error is received, the operation of deleting the virtual machine may be performed. Deletion of the virtual machine is not allowed during normal Nova rescheduling of the virtual machine, but is allowed when the Post interface returns an error. When the virtual machine is deleted, at this time, because the virtual machine is still in a rescheduling state, the network resource is not bound with the virtual machine, and the distributed network resource is left when the virtual machine is deleted.
In the case of network resource residue, if a virtual machine is subsequently created and the same network resource as the previously residual network resource is created for the virtual machine, a network resource conflict problem may occur.
Disclosure of Invention
Therefore, the present invention provides a method, an apparatus, a device, and a storage medium for processing network resource conflict, so as to solve the problem in the prior art that when a virtual machine is subsequently created and the same network resource as that previously remaining is created for the virtual machine, the network resource conflict will occur.
In one aspect of the embodiments of the present invention, a method for processing network resource conflicts is provided, including: when determining that resource conflict occurs when network resources are allocated to a virtual machine to be created currently, inquiring a target virtual machine associated with the network resources; 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 resource conflict occurs when allocating network resources to the virtual machine to be currently created by: judging whether a message for indicating that the network resource is allocated is received or not; and if the message is received, determining that the network resources provided for the virtual machine to be created currently have conflict.
Optionally, the querying a target virtual machine associated with the network resource includes: acquiring identification information of the network resource; and querying a virtual machine identifier corresponding to the identification information from a database, and taking a target virtual machine corresponding to the queried virtual machine identifier as a target virtual machine associated with the network resource.
Optionally, the obtaining the identification information of the network resource includes: acquiring subnet identifications pre-allocated to the virtual machine to be created currently; and acquiring an IP address pre-allocated to 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 identifier; querying an operation record of the target virtual machine from a virtual machine table based on the virtual machine identification to determine the state of the target virtual machine, wherein all historically created virtual machine operation records are recorded in the virtual machine table; and judging whether the state of the target virtual machine is a deletion 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 deletion state.
Optionally, the releasing the network resource includes: and 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 method further comprises: and if the target virtual machine is not deleted, sending a message for indicating that the network resource is occupied.
In order to achieve the above object, an embodiment of the present invention further provides a network resource conflict processing apparatus, including: the query module is used for querying a target virtual machine associated with the network resource when determining that the resource conflict occurs 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; and the release module is used for releasing the network resource if the target virtual machine is deleted.
In order to achieve the above object, an embodiment of the present invention further provides a computer device, including: the device comprises a memory and a processor, wherein the memory and the processor are mutually connected in a communication way, computer instructions are stored in the memory, and the processor executes the computer instructions so as to execute the method.
In order to achieve the above object, an embodiment of the present invention further provides a computer-readable storage medium storing computer instructions for causing the computer to execute the above method.
According to the embodiment of the invention, under the condition that the conflict of the network resources provided for the virtual machine to be created currently occurs, whether the target virtual machine is deleted or not is judged by inquiring the target virtual machine, and under the condition that the target virtual machine is deleted, the network resources are released, so that the problem of network resource conflict can be avoided under the condition that the network resources are remained if the virtual machine is subsequently created and the same network resources as the previous network resources remained are created for the virtual machine.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of virtual machine creation in the prior art;
fig. 2 is a flowchart of a specific example of a network resource conflict processing method in embodiment 1 of the present invention;
fig. 3 is a flowchart of virtual machine creation according to embodiment 1 of the present invention;
fig. 4 is a schematic block diagram of a specific example of a network resource conflict processing apparatus in embodiment 2 of the present invention;
FIG. 5 is a schematic block diagram of one embodiment of a computer apparatus of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the accompanying drawings, and it should be understood that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention. 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 invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; the two elements may be directly connected or indirectly connected through an intermediate medium, or may be communicated with each other inside the two elements, or may be wirelessly connected or wired connected. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
In addition, the technical features involved in the different embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
Before the embodiment of the present invention is introduced, an OpenStack is taken as an example, and a flow of network resource conflict in an existing virtual machine creation process is introduced first. As shown in fig. 1: receiving, by a 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:
nova schedules a virtual machine to an optimal computing node cpn-xxx according to the bottom resource condition;
after receiving the request for creating the virtual machine, the CPN calls Nova, network, Neutron, 2, api, allocate, for instance, to send a message for creating network resource logic verification to the Neutron (network module); the new, network, neutral, 2, api, update, port, for instance interface is called to update the series of messages (uuid, device _ owner, host _ id, etc.) associated with the virtual machine.
After receiving the message for creating the network resource logic verification, the Neutron finds that the fix IP address is already existed (remained) during verification, and returns an IP address { xxx } adaptive allocated in subnet { xxxx } Neutron server return request _ ids [' req- { xxxx } ] message to the Nova-computer service.
Fourthly, the Nova-computer process of the computing node cpn-xxx sends IP address { xxx } adaptive in subnet { xxxx } Neutron server return _ ids [' req- { xxxx } ] to the computing module Nova.
Nova returns the message in (iv) to os-computer-core. And ending the process of creating the virtual machine due to the network resource conflict.
The flow is interaction between services such as Nova and Neutron and a database, and the Nova and Neutron update the state of the virtual machine to the mysql database for subsequent system calling when the virtual machine is operated.
Then, in the above flow, when a network resource conflict occurs, the creation of the virtual machine may be directly failed. This occurs even more when cluster resource utilization exceeds a certain threshold.
The invention provides the technical scheme to be protected based on the problems in the existing virtual machine creation process. See in particular the examples below.
Example 1
The embodiment of the invention 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:
step S201, when determining that resource conflict occurs when allocating network resources to a virtual machine to be created currently, querying a target virtual machine associated with the network resources.
In the embodiment of the present invention, for the virtual machine creation process, especially, the flow before the virtual machine verifies the network resource is substantially the same as the content 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 invention may also be other same or similar processes, and the present invention is not limited thereto. The network resource conflict processing method provided by the embodiment of the invention can perform network resource conflict processing and trigger conflict processing in real time on the basis of not changing the original virtual machine creating flow, does not need timing processing or restarting service and the like, and greatly reduces the resource occupation of a creating platform.
The conflict determination of the network resource may be determined by a network module of the virtual machine creation platform, for example, when the pre-allocated IP address is configured with other network resources, it is found that the IP address already exists, which results in that subsequent configuration work cannot be performed, and a conflict is reported. Of course, the method can also be implemented by other functional modules independent from the platform after the platform is created, the allocated network resources are acquired from the network module, the related information of the network resources is inquired in the database, and when the network resources are inquired to exist, the network resources are determined to have conflicts. The network resources of the embodiment of the invention can comprise resources such as network ports and the like.
In the current process of creating the virtual machine, if a network resource conflict occurs, a target virtual machine associated with the network resource is inquired. In the embodiment of the present invention, when there is a network resource conflict, because a previously created virtual machine uses the network resource, a target virtual machine corresponding to the network resource may be queried from a stored record, where the queried record may be a related record or an identifier of the target virtual machine.
Step S202, judging whether the target virtual machine is 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 resource is occupied.
In this embodiment of the present invention, as an optional implementation manner, the releasing the network resource includes: and calling a preset Application Programming Interface (API) to trigger a deleting instruction of the network resource so as 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 called, where the API interface may be a command interface provided by OpenStack; sending a command for deleting the network resources through the API; and deleting all the 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, all the information associated with the network resource in the database can be automatically deleted, and of course, the corresponding deletion command can also be executed through the database language.
After the target virtual machine is inquired, whether the target virtual machine is deleted or not is judged, if the target virtual machine is deleted, the network resource is indicated to be an available resource, but the network resource cannot be used due to unreleased network resource. Thus, for this case, the existing associated data for the network resource may be deleted from the database, thereby freeing the network resource for application on the currently created virtual machine. Specifically, the information that the network interface has bound the virtual machine can be inquired through the mysql database relation table, and then the virtual machine can be cleaned up by inquiring whether the virtual machine is deleted.
According to the embodiment of the invention, under the condition that the conflict of the network resources provided for the virtual machine to be created currently occurs, whether the target virtual machine is deleted or not is judged by inquiring the target virtual machine, and under the condition that the target virtual machine is deleted, the network resources are released, so that the problem of network resource conflict can be avoided under the condition that the network resources are remained if the virtual machine is subsequently created and the same network resources as the previous network resources remained are created for the virtual machine.
On the other hand, the network resource conflict processing method of the embodiment of the invention does not need to record and process the deleted virtual machine, the required data can be inquired from the existing database of the platform, the occupation of the storage space is reduced, no additional processor and memory resource is needed, the corresponding content in the database can be inquired only by regular matching, and the processor resource is rarely consumed.
As an alternative embodiment, it is determined that resource conflict occurs when allocating network resources to a virtual machine to be currently created by the following steps: judging whether a message for indicating that the network resource is allocated is received or not; and if the message is received, determining that the network resources provided for the virtual machine to be created currently have conflict.
In the prior art, when a network module is performing network resource conflict judgment, if the network resource conflict is determined, a message is returned to the Nova-computer service of the computing module, for example, if the network resource is a network port, if it is verified that a fix IP address exists (remains), an IP address { xxx } adaptive in subnet { xxxx } Neutron server return _ sets [ 'req- { xxxx }' ] message is returned to the Nova-computer service.
In the embodiment of the present invention, a functional module is added to the above logic, which may be referred to as a conflict resolution module. When determining the network resource conflict, the network module sends the message for indicating that the network resource is distributed to the conflict resolution module, and when receiving the message, the network module determines that the network resource provided for the virtual machine to be created at present conflicts. If the target virtual machine is not deleted, sending a message for indicating that the network resource is occupied, namely, if the conflict resolution module judges that the network resource is normally occupied, continuing the original flow, namely, returning the message to the Nova-computer service of the computing module. Other flows are not adjusted.
In the embodiment of the invention, under the condition of not changing the original main flow of virtual machine creation, a conflict solution module is newly added, the reason for the failure of virtual machine creation cannot be judged during batch creation, the virtual machine creation is triggered only when the network cards conflict, and the subsequent flows are inquired through the database, so that the creation flow is not influenced, and the resources and the performance of the platform are not consumed.
As an optional implementation, the querying a target virtual machine associated with the network resource includes: acquiring identification information of the network resource; and querying a virtual machine identifier corresponding to the identification information from a database, and taking a target virtual machine corresponding to the queried 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, and then the identification information is used to query the associated virtual machine identification from the database, that is, to determine the previously associated target virtual machine of the network resource.
The associated target virtual machines described in the embodiments of the present invention include a virtual machine already bound to a network resource and a virtual machine in a case where a rescheduling situation occurs to cause a network resource to be unbound to the virtual machine, where the virtual machine is not bound to the network resource when the rescheduling process does not fall on a compute node, that is, in this case, a binding relationship is not directly formed between an ID of the virtual machine and the network resource, but some indirect associations on data may exist in a database, for example, the virtual machine is associated with a creation requester, the network resource is also associated with the creation requester, but the virtual machine is not directly bound to the network resource.
Therefore, compared with a mode of clearing network resources according to the ID of the virtual machine periodically, the embodiment of the invention has the following advantages:
1. triggering based on an event, namely restarting a network resource conflict solution process under the condition that the network resource conflict exists, not recording the reason of the failure of creating the virtual machine, not influencing the whole process of creating the virtual machine by a platform, reducing the consumption of resources, triggering only when network cards conflict, and inquiring the subsequent processes through a database;
2. the network resource release in the case where the deleted target virtual machine is associated with a network resource but is unbound can be handled.
As an optional implementation manner, the obtaining the identification information of the network resource includes: acquiring subnet identifications pre-allocated to the virtual machine to be created currently; and acquiring an IP address pre-allocated to 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 present invention, the network resources may include network cards such as subnets and IP, the identification information of the corresponding network resources may include subnet identifications and IP addresses, the conflict resolution module obtains the subnet identifications pre-allocated and the IP addresses pre-allocated when the virtual machine is created, and then queries whether the target virtual machine exists according to the identification information. In the embodiment of the invention, because the corresponding network resources need to be pre-allocated in the process of creating the virtual machine, but whether the network resources can be bound to the created virtual machine or not is finally judged, the subnet identification and the IP address can be pre-allocated by the network module when the network resources are created, 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 identifier; querying an operation record of the target virtual machine from a virtual machine table based on the virtual machine identification to determine the state of the target virtual machine, wherein all historically created virtual machine operation records are recorded in the virtual machine table; and judging whether the state of the target virtual machine is a deletion 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 deletion state.
In the embodiment of the present invention, the virtual machine table may refer to an instances table, which records an operation record in a virtual machine creation process, so that the operation record of the target virtual machine may be queried from the table, and a state of the target virtual machine (i.e., a virtual machine associated with a network resource) may be determined from a final operation record, so as to further determine 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 deleted in the virtual machine table.
In the embodiment of the present invention, OpenStack is taken as an example to introduce a virtual machine creation flow and a network resource conflict solution in the embodiment of the present invention. As shown in fig. 3: receiving, by a 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:
nova schedules a virtual machine to an optimal computing node according to the bottom-layer resource condition;
after receiving the request for creating the virtual machine, the CPN calls Nova, network, Neutron, 2, api, allocate, for instance, to send a message for creating network resource logic verification to the Neutron (network module); the new, network, neutral, 2, api, update, port, for instance interface is called to update the series of messages (uuid, device _ owner, host _ id, etc.) associated with the virtual machine. In this embodiment, the network resource specifically refers to a network card port or the like.
After receiving the message for creating the network resource logic verification, the Neutron finds that the fix IP address is already existed (remained) during verification, and returns an IP address { xxx } allowed in subnet { xxxx } Neutron server request _ ids [ 'req- { xxxx }' ] message to an IP confluent-solution module, namely an IP conflict resolution module. Specifically, a judgment logic code may be added to 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 the IP collision, the message is not directly sent to Nova-computer, but is forwarded to the IP conflict-solution module for processing by the IP conflict-solution module.
After receiving the IP conflict message, the IP confluent-solution module queries the corresponding devic _ ID, namely the virtual machine uuid, from the IP + subnet ID mysql database, takes the virtual machine uuid to the virtual machine, then queries whether the state of the virtual machine is deleted from the instances table, and if not, the IP confluent-solution module does not process the network card; if the network card is in a deletion state, the IP confllict-solution module directly deletes the network card. The logic processing flow of the IP confllict-solution module is as follows:
ip_array=fix_IPs.qury.json(“IP address”)
subnet_array=fix_IPs.qury.json(“subnet”)
@ port _ id,// u id for obtaining network card from database
select*from neutron.ipallocations where ip_address='2.0.3.216'&&network_id='760a07a7-587f-4cfe-89b2-577ae2f954cf';
@ device _ id,// then get the virtual machine uuid
select*from neutron.ports where id='3ee16018-f93b-431f-928e-60ffad2e2a27';
@ vm _ state,// determining whether the virtual machine state is deleted
select*from nova.instances where uuid='97db9448-d535-418b-8bb9-0a752404e8e3';
After @ DELETE port,// confirming that the virtual machine state is deleted, execution DELETEs the port
“DELETE”/v2.0/ports/{port-uuid};
After the status of the virtual machine is confirmed to be not the deleted status, the status is not processed, and normal conflict is returned to Neutron; otherwise, returning abnormal conflict and having been released
If the port is deleted, the IP conflict-solution module will return to Neutron abnormal conflict and be released; if a port is not deleted, then IP conflict-solution module returns to Neutron normal conflicts.
Sixthly, the Nova-computer process of the computing node cpn-xxx sends IP address { xxx } adaptive in subnet { xxxx } Neutron server requests _ ids [' req- { xxxx } ]toa computing module Nova.
And seventhly, the Nova returns the message in the fourth step to the os-computer-core. And ending the process of creating the virtual machine due to the network resource conflict.
And the flow is interaction between services such as Nova and Neutron and a database, and the Nova and Neutron update the state of the virtual machine to the mysql database for subsequent system calling when the virtual machine is operated.
According to the embodiment of the invention, the network card conflict processing mechanism is introduced by extremely difficult troubleshooting when the network card residue occurs 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 number of virtual machines and network resources is large in the environment, a large amount of time and manpower are needed for checking the residual network card problem, a network resource conflict processing mechanism is introduced, and the time and the manpower needed for processing the network card residual problem are greatly reduced; for scenes with high concurrency and over-high bottom layer resource usage, the problem of network card residue is easy to occur, the problem is difficult to process, so that the evaluation of the usability and maintainability of a product by a client is poor, a network resource conflict processing mechanism is introduced, the problem can be well avoided, and the usability and maintainability of the product are improved.
Example 2
An embodiment of the present invention further provides a device for processing network resource conflict, where the device may be configured to execute the method for processing network resource conflict in embodiment 1, and as shown in fig. 4, the device includes:
the query module 401 is configured to query a target virtual machine associated with a network resource when it is determined that a resource conflict occurs when the network resource is allocated to a virtual machine to be currently created.
A determining module 402, configured to determine whether the target virtual machine has been deleted.
A releasing module 403, configured to release the network resource if the target virtual machine has been deleted.
For specific description, reference is made to the above method embodiments, which are not described herein again.
According to the embodiment of the invention, under the condition that the conflict of the network resources provided for the virtual machine to be created currently occurs, whether the target virtual machine is deleted or not is judged by inquiring the target virtual machine, and under the condition that the target virtual machine is deleted, the network resources are released, so that the problem of network resource conflict can be avoided under the condition that the network resources are remained if the virtual machine is subsequently created and the same network resources as the previous network resources remained are created for the virtual machine.
It should be noted that the apparatus provided by the present invention may be disposed in the IP conflict resolution module in fig. 3, or the conflict resolution module may implement the above function. Specifically, as shown in fig. 3, the IP conflict resolution module receives a message sent by the network module to indicate that the network resource is allocated, and the message may be implemented by the network resource conflict processing apparatus interacting with the network module, and in addition, the network resource conflict processing apparatus may further obtain identification information such as a subnet identifier and an IP address pre-allocated by the network module to the virtual machine to be created, and interact with the database by using the information, so as to implement operation record query of the previously associated target virtual machine of the network resource, so as to determine the state of the target virtual machine. And after the network resource conflict processing device determines the result, feeding the result back to the network module.
On the other hand, the network resource conflict processing method of the embodiment of the invention does not need to record and process the deleted virtual machine, the required data can be inquired from the existing database of the platform, the occupation of the storage space is reduced, no additional processor and memory resource is needed, the corresponding content in the database can be inquired only by regular matching, and the processor resource is rarely consumed.
Optionally, the network resource conflict processing apparatus determines that resource conflict occurs when allocating network resources to the virtual machine to be currently created, through the following modules: a receiving module, configured to determine whether a message indicating that the network resource is allocated is received; and the determining module is used for determining that the network resources provided for the virtual machine to be created currently have conflicts if the message is received.
In the embodiment of the invention, under the condition of not changing the original main flow of virtual machine creation, a conflict solution module is newly added, the reason for the failure of virtual machine creation cannot be judged during batch creation, the virtual machine creation is triggered only when the network cards conflict, and the subsequent flows are inquired through the database, so that the creation flow is not influenced, and the resources and the performance of the platform are not consumed.
Optionally, the query module includes: a first obtaining unit, configured to obtain identification information of the network resource; and the query unit is used for querying the virtual machine identifier corresponding to the identification information from the database, and taking the target virtual machine corresponding to the queried virtual machine identifier as the target virtual machine associated with the network resource.
Optionally, the obtaining unit includes: the first acquiring subunit is configured to acquire a subnet identifier pre-allocated to the virtual machine to be currently created; and the second acquiring subunit is configured to acquire an IP address pre-allocated to the virtual machine to be currently created, and use the subnet identifier and the IP address as the identifier information.
Optionally, the determining module includes: the second acquisition unit is used for acquiring the virtual machine identifier; a second query unit, configured to query, based on the virtual machine identifier, an operation record of the target virtual machine from a virtual machine table to determine a state of the target virtual machine, where all historically created virtual machine operation records 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 deleted 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 deleted state.
Optionally, the release module comprises: and 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: a sending module, configured to send a message indicating that the network resource is occupied if the target virtual machine is not deleted.
For the description of the device part, reference may be made to the above method embodiments, and details are not described in this embodiment.
Example 3
In an embodiment of the present invention, a computer device is also provided, and an internal structure diagram thereof may be as shown in fig. 5. The computer device comprises a processor, a memory and a network interface which are connected through a system bus, and also comprises a display screen and an input device. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile 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 an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external computer device through a network connection. The computer program is executed by a processor to implement a network resource conflict processing method, the computer device may further include a display screen and an input device, the display screen may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, a trackball or a touch pad arranged on a housing of the computer device.
On the other hand, the computer device may not include a display screen and an input device, and those skilled in the art will understand that the structure shown in fig. 5 is only a block diagram of a part of the structure related to the present application, and does not constitute a limitation to 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 figure, or combine some components, or have a different arrangement of components.
In one embodiment, a computer device is provided, which includes a memory and a processor, the memory and the processor are communicatively connected with each other, the memory stores computer instructions, and the processor executes the computer instructions to perform the following steps:
when determining that resource conflict occurs when network resources are allocated to a virtual machine to be created currently, inquiring a target virtual machine associated with the network resources;
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 having stored thereon computer instructions for causing the computer to perform:
when determining that resource conflict occurs when network resources are allocated to a virtual machine to be created currently, inquiring a target virtual machine associated with the network resources;
judging whether the target virtual machine is deleted or not;
and if the target virtual machine is deleted, releasing the network resources.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile 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), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
The foregoing detailed description of the preferred embodiments of the invention has been presented. It should be understood that numerous modifications and variations could be devised by those skilled in the art in light of the present teachings without departing from the inventive concepts. Therefore, the technical solutions available to those skilled in the art through logic analysis, reasoning and limited experiments based on the prior art according to the concept of the present invention should be within the scope of protection defined by the claims.
Claims (10)
1. A network resource conflict processing method is characterized by comprising the following steps:
when determining that resource conflict occurs when network resources are allocated to a virtual machine to be created currently, inquiring a target virtual machine associated with the network resources;
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 according to claim 1, wherein the resource conflict is determined by allocating network resources to the virtual machine to be created:
judging whether a message for indicating that the network resource is allocated is received or not;
and if the message is received, determining that the network resources provided for the virtual machine to be created currently have conflict.
3. The method of claim 1, wherein querying the target virtual machine associated with the network resource comprises:
acquiring identification information of the network resource;
and querying a virtual machine identifier corresponding to the identification information from a database, and taking a target virtual machine corresponding to the queried virtual machine identifier as a target virtual machine associated with the network resource.
4. The method according to claim 3, wherein the obtaining the identification information of the network resource comprises:
acquiring subnet identifications pre-allocated to the virtual machine to be created currently;
and acquiring an IP address pre-allocated to the virtual machine to be created currently, and taking the subnet identification and the IP address as the identification information.
5. The method according to claim 3, wherein the determining whether the target virtual machine has been deleted comprises:
acquiring the virtual machine identifier;
querying an operation record of the target virtual machine from a virtual machine table based on the virtual machine identification to determine the state of the target virtual machine, wherein the virtual machine table records the historically created virtual machine operation record;
and judging whether the state of the target virtual machine is a deletion 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 deletion state.
6. The method according to claim 3, wherein the releasing the network resource comprises:
and 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.
7. The method of claim 2, further comprising:
and if the target virtual machine is not deleted, sending a message for indicating that the network resource is occupied.
8. A network resource conflict processing apparatus, comprising:
the query module is used for querying a target virtual machine associated with the network resource when determining that the resource conflict occurs 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;
and the release module is used for releasing the network resource if the target virtual machine is deleted.
9. A computer device, comprising: a memory and a processor communicatively coupled to 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 a computer to perform the method of any one of claims 1-7.
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 true CN113992630A (en) | 2022-01-28 |
CN113992630B 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) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115373824A (en) * | 2022-10-24 | 2022-11-22 | 恒生电子股份有限公司 | Conflict detection method, device, computing equipment and computer readable storage medium |
CN115941388A (en) * | 2022-11-10 | 2023-04-07 | 浪潮思科网络科技有限公司 | Virtual private network issuing method, device, equipment and medium |
Citations (5)
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 |
US20140130043A1 (en) * | 2012-11-07 | 2014-05-08 | International Business Machines Corporation | Automated and optimal deactivation of service to enable effective resource reusability |
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 |
-
2021
- 2021-09-10 CN CN202111063814.6A patent/CN113992630B/en active Active
Patent Citations (5)
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 |
US20140130043A1 (en) * | 2012-11-07 | 2014-05-08 | International Business Machines Corporation | Automated and optimal deactivation of service to enable effective resource reusability |
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 |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115373824A (en) * | 2022-10-24 | 2022-11-22 | 恒生电子股份有限公司 | Conflict detection method, device, computing equipment and computer readable storage medium |
CN115373824B (en) * | 2022-10-24 | 2023-02-03 | 恒生电子股份有限公司 | Conflict detection method, device, computing equipment and computer readable storage medium |
CN115941388A (en) * | 2022-11-10 | 2023-04-07 | 浪潮思科网络科技有限公司 | Virtual private network issuing method, device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN113992630B (en) | 2023-08-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110532025B (en) | Data processing method, device and equipment based on micro-service architecture and storage medium | |
US20190034460A1 (en) | Co-locating Microservice Persistence Containers within Tenant-Specific Database | |
CN113992630A (en) | Network resource conflict processing method, device, equipment and storage medium | |
CN109788068B (en) | Heartbeat state information reporting method, device and equipment and computer storage medium | |
US20200174818A1 (en) | Virtual machine management | |
CN107005435B (en) | Network service descriptor shelving method and device | |
CN111159233B (en) | Distributed caching method, system, computer equipment and storage medium | |
CN111626858A (en) | Processing method and device for transaction, electronic equipment and computer readable medium | |
EP3879875A1 (en) | Resource change method and device, apparatus, and storage medium | |
CN112965784B (en) | Service access method, device, equipment and computer readable storage medium | |
CN108595505A (en) | The method and apparatus of data query | |
CN112860386A (en) | Method for switching nodes in distributed master-slave system | |
CN111314241B (en) | Task scheduling method and scheduling system | |
US11442756B2 (en) | Common service resource application method, related device, and system | |
EP4087206A1 (en) | Internet-of-things device registration method and apparatus, device and storage medium | |
CN114422580B (en) | Information processing method, device, electronic equipment and 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 | |
CN110933192A (en) | Local area network IP address allocation method, device, system and computer equipment | |
CN113064732A (en) | Distributed system and management method thereof | |
CN114490681A (en) | Service request response method and device and server cluster | |
CN114662102A (en) | File processing method and device and storage medium | |
CN112463748A (en) | Storage system file lock identification method, system, terminal and storage medium | |
CN113760446A (en) | Resource scheduling method, device, equipment and medium | |
CN113472823A (en) | Server access method and device, intelligent terminal 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 |