CN110795220B - Task merging method and device and computer readable storage medium - Google Patents

Task merging method and device and computer readable storage medium Download PDF

Info

Publication number
CN110795220B
CN110795220B CN201911025099.XA CN201911025099A CN110795220B CN 110795220 B CN110795220 B CN 110795220B CN 201911025099 A CN201911025099 A CN 201911025099A CN 110795220 B CN110795220 B CN 110795220B
Authority
CN
China
Prior art keywords
task
port
network
library
subunit
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
CN201911025099.XA
Other languages
Chinese (zh)
Other versions
CN110795220A (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.)
Zhengzhou Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology 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 Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN201911025099.XA priority Critical patent/CN110795220B/en
Publication of CN110795220A publication Critical patent/CN110795220A/en
Application granted granted Critical
Publication of CN110795220B publication Critical patent/CN110795220B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/50Address allocation
    • H04L61/5007Internet protocol [IP] addresses
    • H04L61/5014Internet protocol [IP] addresses using dynamic host configuration protocol [DHCP] or bootstrap protocol [BOOTP]

Abstract

The embodiment of the invention discloses a task merging method, a device and a medium based on an OpenStack DHCP agent, which are used for receiving a task; and when the resource type of the task is the network or subnet type, adding or covering the task in the task library according to the network identifier recorded in the task library. And when the resource type of the task is the port type, performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library. The second-level covering operation is to perform covering processing on the tasks of the same port, and the second-level adding operation is to perform merging processing on the tasks of different ports in the same network. The operation of all ports in the same network finally needs to restart the configuration file, so that the port tasks in the same network effectively reduce the times of restarting the configuration file by executing secondary addition and secondary coverage, and improve the processing speed and the concurrent processing capacity of the tasks.

Description

Task merging method and device and computer readable storage medium
Technical Field
The invention relates to the technical field of task processing, in particular to a task merging method and device based on an OpenStack DHCP Agent and a computer readable storage medium.
Background
The DHCP Agent is a component of a network module (Openstack Neutron) of a cloud platform open source framework, is used for realizing a DHCP function in a local area network, and serves as a DHCP server. The DHCP Agent runs on a network node in a service fashion and provides DHCP functionality for each network by starting a dnsmasq process for that network.
The DHCP Agent will receive some tasks: such as creation, update, deletion, etc. of a network, subnet, or port. These tasks may involve operations such as creating a dnsmasq process, changing a configuration file for the dnsmasq process, restarting a configuration file for the dnsmasq process, and so on. DHCP Agents restarting the configuration file for dnsemasq in the process flow is a relatively time consuming operation.
At present, Openstack DHCP Agent processing tasks adopt first-come first-processed logic, and some coverable tasks are not distinguished. For example, the update of the network, the subnet and the port can be completely processed according to the final update result. However, based on the current first-come first-processed logic, the configuration file of dnsmasq needs to be restarted every time of updating, which results in unnecessary time-consuming operations being performed for many times. For some tasks with conflicts, for example, port updates, which may involve the same network, a thread lock is used with the network ID as a key to avoid operating the same dnsemasq process, which causes other port updates in the same network to be in a blocked state.
Therefore, how to reduce useless operations and improve the concurrent processing capacity of tasks is a problem to be solved by the technical personnel in the field.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, and a computer-readable storage medium for task merging based on an OpenStack DHCP Agent, which can reduce useless operations and improve concurrent processing capability of tasks.
In order to solve the above technical problem, an embodiment of the present invention provides a task merging method based on an OpenStack DHCP Agent, including:
receiving a task;
when the resource type of the task is a network or subnet type, adding or covering operation is executed on the task in the task library according to the network identifier recorded in the task library;
when the resource type of the task is a port type, performing primary addition, secondary addition or secondary covering operation on the task in a task library according to a primary network identifier and a secondary port identifier recorded in the task library;
the first-stage adding operation is to add a new port task into the task library, the second-stage covering operation is to perform covering processing on the tasks of the same port, and the second-stage adding operation is to perform merging processing on the tasks of different ports in the same network.
Optionally, when the resource type of the task is a network or subnet type, performing an add or override operation on the task in the task library according to the network identifier recorded in the task library includes:
when the resource type of the task is a network or subnet type, judging whether a network ID of the task exists in a task library;
if so, covering the resource information of the task with original resource information corresponding to the network ID;
and if not, adding the network ID and the resource information of the task into the task library.
Optionally, when the resource type of the task is a port type, performing a primary addition, a secondary addition, or a secondary overlay operation on the task in the task library according to a primary network identifier and a secondary port identifier recorded in a task library includes:
when the resource type of the task is a port type, judging whether a network ID of the task exists in a primary task library;
if not, adding the resource information of the network ID of the task to a primary task library, and adding the port ID and the port information of the task to a secondary task library;
if yes, judging whether a port ID of the task exists in the secondary task library or not;
when the port ID of the task does not exist in the secondary task library, adding the port ID and the port information of the task to the secondary task library;
and when the port ID of the task exists in the secondary task library, covering the port information of the task with the original port information corresponding to the port ID in the secondary task library.
Optionally, after performing a primary adding operation, a secondary adding operation, or a secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library, the method further includes:
acquiring a configuration file corresponding to a network ID according to the network ID recorded in a primary task library;
reading all port information recorded in a secondary task library to which the network ID belongs, modifying the configuration file according to all the port information, and restarting the modified configuration file.
Optionally, the task library is a python ordered dictionary.
The embodiment of the invention also provides a task merging device based on the OpenStack DHCP Agent, which comprises a receiving unit, a first processing unit and a second processing unit;
the receiving unit is used for receiving tasks;
the first processing unit is configured to, when the resource type of the task is a network or subnet type, perform an addition or overlay operation on the task in the task library according to a network identifier recorded in the task library;
the second processing unit is used for performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library when the resource type of the task is the port type;
the first-stage adding operation is to add a new port task into the task library, the second-stage covering operation is to perform covering processing on the tasks of the same port, and the second-stage adding operation is to perform merging processing on the tasks of different ports in the same network.
Optionally, the first processing unit includes a first judging subunit, a first covering subunit, and a first adding subunit;
the first judging subunit is configured to, when the resource type of the task is a network or subnet type, judge whether a network ID of the task exists in a task library; if yes, triggering the first covering subunit; if not, triggering the first adding subunit;
the first covering subunit is configured to cover the resource information of the task with original resource information corresponding to the network ID;
the first adding subunit is configured to add the network ID and the resource information of the task to the task library.
Optionally, the second processing unit includes a second judging subunit, a primary adding subunit, a third judging subunit, a secondary adding subunit, and a secondary covering subunit;
the second judging subunit is configured to, when the resource type of the task is a port type, judge whether a network ID of the task exists in a primary task library; if not, triggering the primary adding subunit; if yes, triggering the third judgment subunit;
the primary adding subunit is configured to add the resource information of the network ID of the task to a primary task library, and add the port ID and the port information of the task to a secondary task library;
the third judging subunit is configured to judge whether a port ID of the task exists in the secondary task library;
the secondary adding subunit is configured to, when the port ID of the task does not exist in the secondary task library, add the port ID of the task and the port information to the secondary task library;
and the secondary covering subunit is configured to, when the port ID of the task exists in the secondary task library, cover the port information of the task with original port information corresponding to the port ID in the secondary task library.
Optionally, the system further includes an obtaining unit, a modifying unit, and a restarting unit after performing a primary adding, a secondary adding, or a secondary covering operation on the task in the task library according to a primary network identifier and a secondary port identifier recorded in the task library;
the acquisition unit is used for acquiring a configuration file corresponding to the network ID according to the network ID recorded in the primary task library;
the modification unit is used for reading all port information recorded in a secondary task library to which the network ID belongs and modifying the configuration file according to all the port information;
and the restarting unit is used for restarting the modified configuration file.
Optionally, the task library is a python ordered dictionary.
The embodiment of the invention also provides a task merging device based on the OpenStack DHCP Agent, which comprises the following steps:
a memory for storing a computer program;
a processor configured to execute the computer program to implement the steps of the OpenStack DHCP Agent-based task merging method according to any one of the above.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method implements the steps of any of the above-mentioned methods for task merging based on OpenStack DHCP Agent.
According to the technical scheme, the task is received; and when the resource type of the task is the network or subnet type, adding or covering the task in the task library according to the network identifier recorded in the task library. For the tasks of the network or the subnet type under the same network, the operation is performed on the configuration file corresponding to the network, so that only the latest task can be reserved in the task library, and unnecessary task processing is reduced. And when the resource type of the task is the port type, performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library. The second-level covering operation is covering processing executed for tasks of the same port, the second-level adding operation is merging processing executed for tasks of different ports under the same network, and the first-level adding operation is adding new port tasks into a first-level task library. The operation of all ports in the same network finally needs to restart the configuration file, so that the port tasks in the same network effectively reduce the times of restarting the configuration file by executing secondary addition and secondary coverage, and improve the processing speed and the concurrent processing capacity of the tasks.
Drawings
In order to illustrate the embodiments of the present invention more clearly, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a flowchart of a task merging method based on an OpenStack DHCP Agent according to an embodiment of the present invention;
fig. 2 is a flowchart of a task process for executing a network or subnet type according to a network ID according to an embodiment of the present invention;
FIG. 3 is a flowchart of a port task process according to a network ID and a port ID according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a task merging device based on an OpenStack DHCP Agent according to an embodiment of the present invention;
fig. 5 is a schematic hardware structure diagram of a task merging device based on an OpenStack DHCP Agent according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Next, a task merging method based on an OpenStack DHCP Agent according to an embodiment of the present invention is described in detail. Fig. 1 is a flowchart of a task merging method based on an OpenStack DHCP Agent according to an embodiment of the present invention, where the method includes:
s101: a task is received.
Tasks based on the OpenStack DHCP Agent include task types including a network type, a subnet type, and a port type. In the embodiment of the present invention, two different service processing logics may be set for the type of the received task.
S102: and when the resource type of the task is the network or subnet type, adding or covering the task in the task library according to the network identifier recorded in the task library.
For the tasks of the network or the subnet type under the same network, the operation is performed on the configuration file corresponding to the network, so that only the latest task can be reserved in the task library, and unnecessary task processing is reduced.
In an embodiment of the invention, a python ordered dictionary may be used as a task library. The python ordered dictionary ensures the sequence of each task and realizes the ordered execution of each task.
The received tasks of the network or subnet type include tasks of creating, updating or deleting operation of the network or subnet, and the processing of the tasks should be processed according to the final state of the network or subnet, i.e. the latter task can override the former task.
For example, according to the time sequence, the received first task is to update the network, the received second task is also to update the network, and finally the received second task is to be in the final state of the network.
Because the tasks in the same network correspond to the same configuration file, the tasks in the network or subnet type in the same network can be covered, and the tasks in different networks can not execute the covering. In the embodiment of the invention, different networks can be distinguished according to the network identifiers.
S103: and when the resource type of the task is the port type, performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library.
There are often multiple ports contained in the same network, and each port may have its corresponding task. In view of the fact that tasks corresponding to different ports in the same network all involve restarting of configuration files, and the restarting of the configuration files takes a long time, in the embodiment of the present invention, tasks corresponding to different ports in the same network can be merged, so that the number of times of restarting the configuration files is reduced.
The primary network identification is used for distinguishing the network to which the port belongs, and the secondary port identification is used for distinguishing different ports.
For ease of introduction, a task whose resource type is a port type may be referred to as a port task.
In the embodiment of the present invention, when the network identifier to which the port task belongs does not exist in the task library, the network identifier and the port task thereof need to be added in the task library, and the adding operation may be referred to as primary adding. When the network identifier to which the port task belongs exists in the task library but the port identifier does not exist, the port task needs to be added under the network identifier in the task library, and the adding operation can be called secondary adding. When the network identifier to which the port task belongs exists in the task library and the port identifier exists, it is indicated that the task corresponding to the port is recorded in the task library, and for the port task corresponding to the same port, the covering operation of the port task can be executed, and the covering operation of the port task can be called secondary covering operation.
In practical applications, a corresponding network ID is set for each network, and in the embodiment of the present invention, the network ID may be used as a network identifier for distinguishing different networks. Fig. 2 is a flowchart illustrating a task process for executing a network or subnet type according to a network ID, the process flow includes:
s201: and when the resource type of the task is the network or subnet type, judging whether the network ID of the task exists in the task library.
The processing capacity of the server is limited, and when a large number of received tasks are available, the server cannot process all the tasks at the same time, so that unprocessed tasks need to be cached first.
Each task has its own network, and the task can carry its own network ID, and when the network ID exists in the task library, it indicates that the task under the network has been recorded in the task library. For the network or subnet type task in the same network, the latest task may be used as the final state, and in order to improve the processing efficiency of the task, S202 may be executed at this time.
If the network ID does not exist in the task library, it indicates that the task under the network is not recorded in the task library, and at this time, the task may be recorded in the task library, that is, S203 is executed.
S202: and covering the resource information of the task with the original resource information corresponding to the network ID.
In the embodiment of the present invention, a key-value (key-value) mode may be used to record the task, where the key is the network ID and the value is the resource information. The resource information refers to specific task information to be executed.
When the network ID which is the same as the network ID carried by the received task exists in the task library, the resource information of the received task can be covered by the original resource information which is the original resource information corresponding to the network ID in the task library, and when the server executes the task in the task library, only the task which is recorded latest at present needs to be executed, so that unnecessary tasks executed by the server are reduced, and the task processing efficiency of the server is effectively improved.
S203: and adding the network ID and the resource information of the task into the task library.
When the network ID identical to the network ID carried by the received task does not exist in the task library, it is indicated that the task library does not have the task corresponding to the network ID, and at this time, the received task needs to be added to the task library. Taking the key-value pair as an example, it is necessary to record the network ID of the task as a key and the resource information of the task as a value in the task library.
By recording the tasks in the task library in a key value pair mode, whether the tasks which belong to the same network as the newly received tasks exist can be quickly inquired from the task library, and the inquiring and recording efficiency of the tasks is further improved.
In the embodiment of the present invention, the network ID may be used as the primary network identifier, and the port ID may be used as the secondary port identifier. Fig. 3 is a flowchart illustrating a process of performing a port task according to a network ID and a port ID, the process flow including:
s301: and when the resource type of the task is the port type, judging whether the network ID of the task exists in the primary task library.
In the embodiment of the present invention, in order to distinguish different ports and networks to which the ports belong, the task library may be divided into two levels, namely a primary task library and a secondary task library. The primary task library records the network to which the port belongs, and the secondary task library records the port ID and the port information of the port.
When a new task is received, if the network ID identical to the network ID of the task does not exist in the primary task library, it is indicated that the task of the network to which the port belongs is not recorded in the primary task library, and at this time, the newly received task needs to be added to the task library, that is, S302 is executed.
When a new task is received, if a network ID identical to the network ID of the task exists in the primary task library, it indicates that a task of the network to which the port belongs is recorded in the primary task library, and at this time, it is necessary to further determine whether a task of the port exists, that is, to execute S303.
S302: and adding the resource information of the network ID of the task to the primary task library, and adding the port ID and the port information of the task to the secondary task library.
When adding a port task in a task library, firstly, a network ID of the port task needs to be added as a key in a primary task library, and a port ID and port information of the port task need to be added in a secondary task library. The secondary task library is the value of the network ID. The port information refers to specific port task information required to be executed.
S303: and judging whether the port ID of the task exists in the secondary task library.
When the network ID identical to the network ID of the task exists in the primary task library, it is necessary to further determine whether a port ID identical to the port ID of the task exists in the secondary task library.
When the port ID of the task does not exist in the secondary task library, that is, the port ID identical to the port ID of the task does not exist in the secondary task library, it is indicated that the task of the port is not recorded in the secondary task library, and at this time, the port task needs to be added in the secondary task library, that is, S304 is executed.
When the port ID of the task exists in the secondary task library, that is, the port ID identical to the port ID of the task exists in the secondary task library, it indicates that the task of the port is recorded in the secondary task library, and the task of the same port can be processed in an overlay manner, that is, S305 is executed.
S304: and adding the port ID and the port information of the task to a secondary task library.
Taking the key value pair mode to record the task as an example, when the port ID of the task does not exist in the secondary task library, the port ID is taken as a key, the port information is taken as a value in the secondary task library, and the port task is recorded.
S305: and covering the port information of the task with the original port information corresponding to the port ID in the secondary task library.
When the port ID which is the same as the port ID carried by the received task exists in the task library, namely the port ID of the task exists in the secondary task library, the port information of the received task can be covered by the port information which is originally corresponding to the port ID in the secondary task library, namely the original port information, and when the server executes the task in the task library, only the port task which is recorded at the latest currently needs to be executed, so that unnecessary tasks executed by the server are reduced, and the task processing efficiency of the server is effectively improved.
According to the technical scheme, the task is received; and when the resource type of the task is the network or subnet type, adding or covering the task in the task library according to the network identifier recorded in the task library. For the tasks of the network or the subnet type under the same network, the operation is performed on the configuration file corresponding to the network, so that only the latest task can be reserved in the task library, and unnecessary task processing is reduced. And when the resource type of the task is the port type, performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library. The second-level covering operation is covering processing executed for tasks of the same port, the second-level adding operation is merging processing executed for tasks of different ports under the same network, and the first-level adding operation is adding new port tasks into a first-level task library. The operation of all ports in the same network finally needs to restart the configuration file, so that the port tasks in the same network effectively reduce the times of restarting the configuration file by executing secondary addition and secondary coverage, and improve the processing speed and the concurrent processing capacity of the tasks.
In practical application, the recording task and the processing task can be regarded as two parallel processing flows, when the number of tasks required to be processed currently exceeds the processing capacity of the server, the tasks to be processed are put into the task library, and the subsequent server can read the tasks from the task library for processing.
When storing port tasks, a primary task library and a secondary task library are divided, so that when reading the tasks, a server needs to acquire a configuration file corresponding to a network ID according to the network ID recorded in the primary task library; reading all port information recorded in a secondary task library to which the network ID belongs, modifying the configuration file according to all the port information, and restarting the modified configuration file.
The port information records the operation to be executed on the corresponding port, and in the embodiment of the invention, all port tasks in the same network can be merged, and at the moment, the restarting of the configuration file is only needed to be executed once.
For example, 10 pieces of port information are recorded in the secondary task library to which one network ID belongs, at this time, the relevant information in the configuration file may be modified according to the operation mode recorded in each piece of port information, and finally, the modified configuration file is restarted, and for 10 port tasks in the same network, the restart operation of the configuration file is only needed to be performed once. Compared with the prior art that 10 port tasks need to execute 10 times of restarting of the configuration file, the concurrent processing capacity of the tasks is increased and the processing time of the tasks is greatly shortened by carrying out the merging processing on the port tasks.
Fig. 4 is a schematic structural diagram of a task merging device based on an OpenStack DHCP Agent according to an embodiment of the present invention, including a receiving unit 41, a first processing unit 42, and a second processing unit 43;
a receiving unit 41 for receiving a task;
the first processing unit 42 is configured to, when the resource type of the task is a network or subnet type, perform an add or override operation on the task in the task library according to the network identifier recorded in the task library;
a second processing unit 43, configured to, when the resource type of the task is a port type, perform a primary addition, a secondary addition, or a secondary overlay operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library;
the first-stage adding operation is to add a new port task into the task library, the second-stage covering operation is to perform covering processing on the tasks of the same port, and the second-stage adding operation is to perform merging processing on the tasks of different ports in the same network.
Optionally, the first processing unit includes a first judging subunit, a first covering subunit and a first adding subunit;
the first judgment subunit is used for judging whether the network ID of the task exists in the task library or not when the resource type of the task is the network or subnet type; if yes, triggering the first covering subunit; if not, triggering the first adding subunit;
the first covering subunit is used for covering the resource information of the task with original resource information corresponding to the network ID;
and the first adding subunit is used for adding the network ID and the resource information of the task into the task library.
Optionally, the second processing unit includes a second judging subunit, a primary adding subunit, a third judging subunit, a secondary adding subunit, and a secondary covering subunit;
the second judging subunit is used for judging whether the network ID of the task exists in the primary task library or not when the resource type of the task is the port type; if not, triggering a primary adding subunit; if yes, triggering a third judgment subunit;
the primary adding subunit is used for adding the resource information of the network ID of the task to the primary task library and adding the port ID and the port information of the task to the secondary task library;
the third judging subunit is used for judging whether the port ID of the task exists in the secondary task library or not;
the secondary adding subunit is used for adding the port ID and the port information of the task to the secondary task library when the port ID of the task does not exist in the secondary task library;
and the secondary covering subunit is used for covering the port information of the task with the original port information corresponding to the port ID in the secondary task library when the port ID of the task exists in the secondary task library.
Optionally, the system further includes an obtaining unit, a modifying unit, and a restarting unit after performing a primary adding, a secondary adding, or a secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library;
the acquisition unit is used for acquiring a configuration file corresponding to the network ID according to the network ID recorded in the primary task library;
the modification unit is used for reading all port information recorded in a secondary task library to which the network ID belongs and modifying the configuration file according to all the port information;
and the restarting unit is used for restarting the modified configuration file.
Optionally, the task library is a python ordered dictionary.
For the description of the features in the embodiment corresponding to fig. 4, reference may be made to the related description of the embodiments corresponding to fig. 1 to fig. 3, which is not repeated here.
According to the technical scheme, the task is received; and when the resource type of the task is the network or subnet type, adding or covering the task in the task library according to the network identifier recorded in the task library. For the tasks of the network or the subnet type under the same network, the operation is performed on the configuration file corresponding to the network, so that only the latest task can be reserved in the task library, and unnecessary task processing is reduced. And when the resource type of the task is the port type, performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library. The second-level covering operation is covering processing executed for tasks of the same port, the second-level adding operation is merging processing executed for tasks of different ports under the same network, and the first-level adding operation is adding new port tasks into a first-level task library. The operation of all ports in the same network finally needs to restart the configuration file, so that the port tasks in the same network effectively reduce the times of restarting the configuration file by executing secondary addition and secondary coverage, and improve the processing speed and the concurrent processing capacity of the tasks.
Fig. 5 is a schematic hardware structure diagram of a task merging device 50 based on an OpenStack DHCP Agent according to an embodiment of the present invention, where the schematic hardware structure diagram includes:
a memory 51 for storing a computer program;
a processor 52 configured to execute a computer program to implement the steps of any of the OpenStack DHCP Agent based task merging methods described above.
The embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and when being executed by a processor, the computer program realizes the steps of any one of the above-mentioned task merging methods based on the OpenStack DHCP Agent.
The method, the device and the computer-readable storage medium for task merging based on the OpenStack DHCP Agent provided by the embodiment of the present invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

Claims (6)

1. A task merging method based on OpenStack DHCP Agent is characterized by comprising the following steps:
receiving a task;
when the resource type of the task is a network or subnet type, adding or covering operation is executed on the task in the task library according to the network identifier recorded in the task library;
when the resource type of the task is a port type, performing primary addition, secondary addition or secondary covering operation on the task in a task library according to a primary network identifier and a secondary port identifier recorded in the task library;
the first-stage adding operation is to add a new port task into a task library, the second-stage covering operation is to perform covering processing on tasks of the same port, and the second-stage adding operation is to perform merging processing on tasks of different ports under the same network;
when the resource type of the task is a network or subnet type, the adding or covering operation performed on the task in the task library according to the network identifier recorded in the task library comprises:
when the resource type of the task is a network or subnet type, judging whether a network ID of the task exists in a task library;
if so, covering the resource information of the task with original resource information corresponding to the network ID;
if not, adding the network ID and the resource information of the task into the task library;
when the resource type of the task is a port type, performing primary adding, secondary adding or secondary covering operation on the task in the task library according to a primary network identifier and a secondary port identifier recorded in a task library comprises:
when the resource type of the task is a port type, judging whether a network ID of the task exists in a primary task library;
if not, adding the resource information of the network ID of the task to a primary task library, and adding the port ID and the port information of the task to a secondary task library;
if yes, judging whether a port ID of the task exists in the secondary task library or not;
when the port ID of the task does not exist in the secondary task library, adding the port ID and the port information of the task to the secondary task library;
and when the port ID of the task exists in the secondary task library, covering the port information of the task with the original port information corresponding to the port ID in the secondary task library.
2. The method of claim 1, further comprising, after performing a primary add, a secondary add, or a secondary overlay operation on the task in the task repository based on a primary network identifier and a secondary port identifier recorded in a task repository:
acquiring a configuration file corresponding to a network ID according to the network ID recorded in a primary task library;
reading all port information recorded in a secondary task library to which the network ID belongs, modifying the configuration file according to all the port information, and restarting the modified configuration file.
3. The method of any of claims 1-2, wherein the task library is a python ordered dictionary.
4. A task merging device based on an OpenStack DHCP Agent is characterized by comprising a receiving unit, a first processing unit and a second processing unit;
the receiving unit is used for receiving tasks;
the first processing unit is configured to, when the resource type of the task is a network or subnet type, perform an addition or overlay operation on the task in the task library according to a network identifier recorded in the task library;
the second processing unit is used for performing primary addition, secondary addition or secondary covering operation on the task in the task library according to the primary network identifier and the secondary port identifier recorded in the task library when the resource type of the task is the port type;
the first-stage adding operation is to add a new port task into a task library, the second-stage covering operation is to perform covering processing on tasks of the same port, and the second-stage adding operation is to perform merging processing on tasks of different ports under the same network;
the first processing unit comprises a first judging subunit, a first covering subunit and a first adding subunit;
the first judging subunit is configured to, when the resource type of the task is a network or subnet type, judge whether a network ID of the task exists in a task library; if yes, triggering the first covering subunit; if not, triggering the first adding subunit;
the first covering subunit is configured to cover the resource information of the task with original resource information corresponding to the network ID;
the first adding subunit is configured to add the network ID and the resource information of the task to the task library;
the second processing unit comprises a second judging subunit, a first-level adding subunit, a third judging subunit, a second-level adding subunit and a second-level covering subunit;
the second judging subunit is configured to, when the resource type of the task is a port type, judge whether a network ID of the task exists in a primary task library; if not, triggering the primary adding subunit; if yes, triggering the third judgment subunit;
the primary adding subunit is configured to add the resource information of the network ID of the task to a primary task library, and add the port ID and the port information of the task to a secondary task library;
the third judging subunit is configured to judge whether a port ID of the task exists in the secondary task library;
the secondary adding subunit is configured to, when the port ID of the task does not exist in the secondary task library, add the port ID of the task and the port information to the secondary task library;
and the secondary covering subunit is configured to, when the port ID of the task exists in the secondary task library, cover the port information of the task with original port information corresponding to the port ID in the secondary task library.
5. A task merging device based on OpenStack DHCP Agent is characterized by comprising:
a memory for storing a computer program;
a processor for executing the computer program for implementing the steps of the OpenStack DHCP Agent based task merging method according to any of claims 1 to 3.
6. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the OpenStack DHCP Agent based task merging method according to any one of claims 1 to 3.
CN201911025099.XA 2019-10-25 2019-10-25 Task merging method and device and computer readable storage medium Active CN110795220B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911025099.XA CN110795220B (en) 2019-10-25 2019-10-25 Task merging method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911025099.XA CN110795220B (en) 2019-10-25 2019-10-25 Task merging method and device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110795220A CN110795220A (en) 2020-02-14
CN110795220B true CN110795220B (en) 2022-04-22

Family

ID=69441308

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911025099.XA Active CN110795220B (en) 2019-10-25 2019-10-25 Task merging method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110795220B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1786906A (en) * 2004-12-08 2006-06-14 微软公司 Method and system of taskbar button interfaces
CN101453367A (en) * 2007-11-30 2009-06-10 华为技术有限公司 Software deployment method and system, software deployment server and user server
CN105357124A (en) * 2015-11-22 2016-02-24 华中科技大学 MapReduce bandwidth optimization method
CN107423894A (en) * 2017-07-19 2017-12-01 东软集团股份有限公司 The task measures and procedures for the examination and approval, device and computer equipment
CN107451831A (en) * 2016-05-30 2017-12-08 北京京东尚科信息技术有限公司 Task method for pushing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1786906A (en) * 2004-12-08 2006-06-14 微软公司 Method and system of taskbar button interfaces
CN101453367A (en) * 2007-11-30 2009-06-10 华为技术有限公司 Software deployment method and system, software deployment server and user server
CN105357124A (en) * 2015-11-22 2016-02-24 华中科技大学 MapReduce bandwidth optimization method
CN107451831A (en) * 2016-05-30 2017-12-08 北京京东尚科信息技术有限公司 Task method for pushing
CN107423894A (en) * 2017-07-19 2017-12-01 东软集团股份有限公司 The task measures and procedures for the examination and approval, device and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于动态任务模型的LBS架构的研究;刘厚泉等;《小型微型计算机系统》;20090531;第30卷(第5期);第1013-1016页 *

Also Published As

Publication number Publication date
CN110795220A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
CN107181636B (en) Health check method and device in load balancing system
CN112241439B (en) Attack organization discovery method, device, medium and equipment
CN110889132A (en) Distributed application permission verification method and device
CN112860412B (en) Service data processing method and device, electronic equipment and storage medium
CN110941632A (en) Database auditing method, device and equipment
CN107741891B (en) Object reconstruction method, medium, device and computing equipment
CN110795220B (en) Task merging method and device and computer readable storage medium
CN107422991B (en) Storage strategy management system
CN111488117A (en) Method, electronic device, and computer-readable medium for managing metadata
EP3119043A1 (en) Flow table entry management method and device
CN112685094B (en) Service unloading method, device, equipment and computer readable storage medium
CN114791985A (en) Domain name matching method and device and prefix tree updating method and device
CN111080250B (en) Flow backspacing compensation method and device, storage medium and electronic equipment
CN114139079A (en) API request processing method, device, equipment and storage medium
CN113572747A (en) Method and device for processing IP address, storage medium and processor
CN107463374B (en) Subset model extraction method and system based on inheritance and association automatic deduction
CN113810242A (en) System log analysis method and device
CN104808985B (en) The management method and device of object in application program
CN113821193B (en) Information generation method, device and storage medium
CN109542631A (en) A kind of recurrence method, apparatus, server and the storage medium of standby host
US11768704B2 (en) Increase assignment effectiveness of kubernetes pods by reducing repetitive pod mis-scheduling
CN116578247B (en) Metadata-based data access method and system
CN113114493B (en) Network element configuration constraint checking method and system
CN111090500B (en) Storage process management method and device
CN109101187B (en) Method and device for reconstructing data

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
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20231205

Address after: Room 1801, 18th Floor, Jiyun Investment Building, No. 278 Xinyi Road, Zhengdong New District, Zhengzhou City, Henan Province, 450018

Patentee after: Zhengzhou Inspur Data Technology Co.,Ltd.

Address before: 100085 5 / F, building C, No.2, Shangdi Information Road, Haidian District, Beijing

Patentee before: Beijing Inspur Data Technology Co.,Ltd.