CN113867774A - Operation method and device of hot patch and electronic equipment - Google Patents

Operation method and device of hot patch and electronic equipment Download PDF

Info

Publication number
CN113867774A
CN113867774A CN202111159660.0A CN202111159660A CN113867774A CN 113867774 A CN113867774 A CN 113867774A CN 202111159660 A CN202111159660 A CN 202111159660A CN 113867774 A CN113867774 A CN 113867774A
Authority
CN
China
Prior art keywords
hot patch
patch file
operating system
kernel
file
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.)
Pending
Application number
CN202111159660.0A
Other languages
Chinese (zh)
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.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network 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 Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202111159660.0A priority Critical patent/CN113867774A/en
Publication of CN113867774A publication Critical patent/CN113867774A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a hot patch running method, a hot patch running device and electronic equipment, wherein a hot patch file package comprising a hot patch file and a configuration file is obtained; determining that the current kernel environment and the operating system environment conform to the kernel environment configuration information and the operating system environment configuration information; and executing the hot patch file based on the operation information. In the method, the hot patch file package comprises the hot patch file and the configuration file, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file, so that operation and maintenance personnel are not required to execute operation and maintenance operations on the hot patch file, the correctness of the related operations executed when the hot patch file is used can be ensured, the risk of operation and maintenance work is reduced, and major faults are prevented from being caused.

Description

Operation method and device of hot patch and electronic equipment
Technical Field
The invention relates to the technical field of software development, in particular to a hot patch running method and device and electronic equipment.
Background
The hot patch can repair the defects of the current software version of the equipment under the condition of not restarting the equipment and the service; in the related art, in the process of using a manufactured hot patch, there are usually more usage restrictions due to different problems repaired by the hot patch, for example, before loading the hot patch into a kernel, some necessary checking operations are usually required to be performed, such as checking whether the version of the kernel is correct, checking whether there is a mutual exclusion relationship between a new version of the hot patch and an old version of the hot patch, and the like; however, at present, development and production of a hot patch are mainly completed by research and development personnel, and operation and maintenance of the hot patch are mainly completed by operation and maintenance personnel, but the operation and maintenance personnel are unfamiliar with the working principle and production details of the hot patch, and it is difficult to ensure the correctness of related operations executed when the hot patch is used, so that a great risk is brought to operation and maintenance work, and even major faults are caused.
Disclosure of Invention
The invention aims to provide a hot patch running method, a hot patch running device and electronic equipment, so as to ensure the correctness of relevant operations executed when a hot patch is used and reduce the risk of running and maintaining work.
The invention provides a hot patch operation method, which comprises the following steps: acquiring a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; determining kernel environment configuration information required by the current kernel environment according with the hot patch file, and determining operating system environment configuration information required by the current operating system environment according with the hot patch file; and running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
Further, the kernel environment configuration information includes: running version information of a target kernel corresponding to the hot patch file; the operating system environment configuration information includes: running version information of a target operating system corresponding to the hot patch file; the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file comprises the following steps: and if the version information of the current kernel is the same as that of the target kernel and the version information of the current operating system is the same as that of the target operating system, determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file and the current operating system environment conforms to operating system environment configuration information required by the hot patch file.
Further, the kernel environment configuration information includes: a first condition that a software package on which the hot patch file depends needs to meet; the operating system environment configuration information includes: a second condition that needs to be satisfied by an application package on which the hot patch file depends; the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file comprises the following steps: judging whether a first software package meeting a first condition exists in the current kernel environment or not and whether a first application package meeting a second condition exists in the current operating system environment or not; if the first software package does not exist, acquiring the first software package, and loading the first software package to the current kernel environment; if the first application program package does not exist, acquiring the first application program package, and installing the first application program package to the current operating system environment; determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and determining that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
Further, the kernel environment configuration information includes: information of a second software package that conflicts with a function of the hot patch file; the operating system environment configuration information includes: information of a second application package that conflicts with running the hot patch file; the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file comprises the following steps: if a second software package which conflicts with the function of the hot patch file exists in the current kernel environment, deleting the second software package and other software packages depending on the second software package from the current kernel environment; if a second application package which conflicts with the running of the hot patch file exists in the current operating system environment, deleting the second application package and other application packages depending on the second application package from the current operating system environment; determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and determining that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
Further, the step of running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information includes: and loading the hot patch file into the current kernel environment based on the loading operation information in the running operation information so as to run the hot patch file in the current kernel environment and the current operating system environment.
Further, the method further comprises: if an uninstalling instruction for the hot patch file is received, uninstalling the hot patch file from the current kernel environment based on the uninstalling operation information in the operation information; and deleting the hot patch file package.
Further, the hot patch file package is generated in advance by the following method: acquiring a hot patch file and a configuration file corresponding to the hot patch file; and if an encapsulating instruction aiming at the hot patch file is received, encapsulating the hot patch file and the configuration file to generate a hot patch file package.
Further, the hot patch file package is pre-installed at a specified installation position; the step of obtaining the hot patch file package comprises the following steps: and acquiring the hot patch file package from the specified installation position.
The invention provides a device for operating hot patch, comprising: the obtaining module is used for obtaining the hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; the determining module is used for determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file; and the running module is used for running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
The invention provides an electronic device which comprises a processor and a memory, wherein the memory stores machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions to realize the running method of the hot patch.
The present invention provides a machine-readable storage medium storing machine-executable instructions which, when called and executed by a processor, cause the processor to implement the above-described method of hot-patch execution.
According to the operation method, the device and the electronic equipment of the hot patch, the hot patch file package is firstly obtained; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; then determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file; and finally, running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the corresponding configuration file thereof, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file.
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 flowchart of a method for operating a hot patch according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for operating a hot patch according to an embodiment of the present invention;
FIG. 3 is a flowchart of another method for operating a hot patch according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method for operating a hot patch according to an embodiment of the present invention;
FIG. 5 is a flowchart of another method for operating a hot patch according to an embodiment of the present invention;
FIG. 6 is a flowchart of another method for operating a hot patch according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of an apparatus for operating a hot patch according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions of the present invention will be described clearly and completely with reference to the following embodiments, 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.
Compared with upgrading the whole kernel, the kernel hot patch has the main advantage that the defects of the kernel and the kernel module can be repaired under the condition of not restarting the kernel and the service. The current tool for making the hot patch is mainly kpatch, the kpatch is open source software which is released by an open source community and can freely acquire tool source codes, a kernel hot patch file is generated by the kpatch tool according to a patch file for repairing codes, the generated hot patch file can be in an ELF (Executable and Linkable Format) Format, is usually named after a 'ko' suffix and can be directly installed in a kernel through a script of the kpatch tool so that the hot patch file takes effect.
The install hot patch command may refer to the following example:
kpatch load patch_1.ko
kpatch load patch_2.ko
the unload hot patch command may refer to the following example:
kpatch unload patch_2.ko
kpatch unload patch_1.ko
in the related art, in the process of using a manufactured hot patch, there are usually more use limitations due to different problems repaired by the hot patch, for example, the dependency relationship between the hot patch and the sequence of other software packages, the mutual exclusion relationship between a new version hot patch and an old version hot patch, and the like, and the hot patch strongly depends on the kernel version and can only be installed in a matched kernel, otherwise, the software is faulty or a major fault is caused. Therefore, when the hot patch is used to repair a problem, attention needs to be paid to the sequence, the dependency relationship, the mutual exclusion relationship, and the like between the hot patch and other software packages, and the installation, the use, the uninstallation, and the version management need to be operated by using a special script provided by a kpatch tool. Administrators need to be familiar with the actual functionality and implementation details of the hot patch in order to properly use kernel hot patches.
However, at present, development and production of a hot patch are mainly completed by research and development personnel, and operation and maintenance of the hot patch are mainly completed by professional operation and maintenance personnel, but the operation and maintenance personnel are unfamiliar with hot patch principles and production details, and do not know the interrelationship between the hot patch and other software packages, so that the correctness of related operations executed when the hot patch is used is difficult to ensure, thereby bringing greater risks to operation and maintenance work, and even causing major faults if the operation is improper.
Based on this, the embodiment of the invention provides a method and a device for operating a hot patch and an electronic device, and the technology can be applied to devices such as a mobile terminal and a computer, and especially can be applied to a scene needing the hot patch.
In order to facilitate understanding of the embodiment, first, a detailed description is given to an operation method of a hot patch disclosed in the embodiment of the present invention; as shown in fig. 1, the method comprises the steps of:
step S102, obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
The hot patch file can also be called kernel hot patch, and can be understood as a program package which can be used for repairing defects of a kernel or a kernel module; the kernel environment configuration information generally includes conditions that need to be met by the kernel environment in order to ensure that the hot patch file can be correctly loaded to the kernel, for example, if the hot patch file needs to depend on other software packages to be correctly used, it is necessary to ensure that the kernel environment has the other software packages that depend on the hot patch file, and if the hot patch file does not depend on other software packages, it may need to download, install, and load the other software packages that depend on the hot patch file; the operating system environment configuration information generally includes conditions that need to be met by the operating system environment to ensure that the hot patch file can be correctly loaded to the kernel, for example, if the hot patch file needs to depend on some application packages or tool packages to be correctly loaded or run, it is necessary to ensure that the dependent application packages or tool packages exist in the operating system environment, and if the hot patch file does not exist, the dependent application packages or tool packages may need to be downloaded or installed, and the like; the operation information usually includes related operation steps, operation commands and the like required for loading the hot patch file into the kernel, and also includes related operation steps, operation commands and the like required for unloading the hot patch file from the kernel; in actual implementation, the manufactured hot patch file and the configuration file corresponding to the hot patch file may be packaged into a hot patch file package in advance, and when the hot patch file needs to be run, the hot patch file package generally needs to be obtained first. It should be noted that for some complex operations, a form of a script file may be adopted, that is, the hot patch package may further include a script file, and some relevant operation contents when the hot patch file is running are encapsulated in the script file, for example, before the hot patch file is installed in the kernel, an actual symbol address of a symbol that needs to be relocated is first queried, and when the hot patch file is modified, the symbol address is modified, and these two operation contents may be encapsulated in the script.
Step S104, determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
The current kernel environment can be understood as a kernel with a certain defect, and the kernel with the defect needs to be repaired by using a hot patch file; in actual implementation, after the hot patch file package is obtained, before the hot patch file is loaded to the current kernel, it is usually required to determine whether the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and whether the current operating system environment conforms to the operating system environment configuration information required by the hot patch file and the configuration file, for example, if the hot patch file needs to be loaded correctly depending on other software packages, it may be determined whether other software packages that the hot patch file needs to depend on exist in the current kernel environment, and if other software packages that the hot patch file depends on exist, it may be determined that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file; if the hot-patch file needs to depend on some application packages or tool packages to be loaded or run correctly, whether the application packages or tool packages on which the hot-patch file depends exist in the current operating system environment can be confirmed, and if the application packages or tool packages on which the hot-patch file depends exist, the current operating system environment can be generally determined to conform to operating system environment configuration information and the like required by the hot-patch file.
And step S106, operating the hot patch file in the current kernel environment and the current operating system environment based on the operating information.
After determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file, it can be understood that the current kernel environment and the current operating system environment can ensure that the hot patch file can be correctly used. If the current kernel environment does not conform to the kernel environment configuration information required by the hot patch file or the current operating system environment does not conform to the operating system environment configuration information required by the hot patch file, the hot patch file will not generally be run in the current kernel environment and the current operating system environment.
The operation method of the hot patch comprises the following steps of firstly obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; then determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file; and finally, running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the configuration file, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file, so that operation and maintenance personnel are not required to execute operation and maintenance operations on the hot patch file, the correctness of the related operations executed when the hot patch file is used can be ensured, the risk of operation and maintenance work is reduced, and major faults are prevented from being caused.
The embodiment of the invention provides another operation method of a hot patch, which is realized on the basis of the method of the embodiment, and the method mainly describes a specific process of determining that the current kernel environment conforms to the kernel environment configuration information required by a hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file, wherein in the method, the kernel environment configuration information comprises the following steps: running version information of a target kernel corresponding to the hot patch file; the operating system environment configuration information includes: running version information of a target operating system corresponding to the hot patch file; because the hot patch file depends strongly on the kernel version and the operating system version, the hot patch file can only be loaded into a matched kernel and an operating system, otherwise, the problem of loading or running error can occur, and even major faults can be caused, therefore, the kernel environment configuration information usually comprises the version information of a target kernel corresponding to the hot patch file, and different kernels can be distinguished through the version information; the operating system environment configuration information usually includes version information of a target operating system corresponding to the hot patch file, and different operating systems can be distinguished through the version information; as shown in fig. 2, the method comprises the steps of:
step S202, obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
Step S204, if the version information of the current kernel is the same as that of the target kernel and the version information of the current operating system is the same as that of the target operating system, determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file and the current operating system environment conforms to operating system environment configuration information required by the hot patch file.
If the version information of the current kernel is the same as that of the target kernel and the version information of the current operating system is the same as that of the target operating system, the current kernel can be understood as the kernel matched with the hot patch file, the current operating system is the operating system matched with the hot patch file, the hot patch file can be normally loaded into the current kernel, and at this time, it can be determined that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file. During actual implementation, a certain naming rule can be set for the naming mode of the hot patch file package, so that the kernel version matched with the hot patch file can be distinguished through the name of the hot patch file package; for example, referring to an example of a naming rule shown in table 1, the naming rule includes Package name, Kernel Version, Release, Arch (system architecture), and suffix (suffix), that is, when naming a hot patch Package, naming is required according to the naming rule, and since the name of the hot patch Package includes Kernel Version information, the name of the hot patch Package can be used to distinguish Kernel versions adapted to different hot patch files, such as: the kernel version matched with the hot patch file package with the name of kpatch-name-3.10.0-123.el7.x86_64-0.9.1-1.x86_64.rpm is 3.10.0-123.el7.x86_ 64; the kernel version adapted by the hot patch file package with the name of kpatch-name-4.12.0-456.el7.x86_64-0.9.1-1.x86_64.rpm is 4.12.0-456.el7.x86_ 64; the kernel version adapted by the hot patch package with the name of kpatch-name-5.8.0-789.el7.x86_64-0.9.1-1.x86_64.rpm is 5.8.0-789.el7.x86 _64.
In this way, the hot patch files for repairing the same kernel problem can be simultaneously installed to a specified position although being adapted to different kernels, and the matched hot patch files can be automatically loaded to the started kernels according to different started kernels; it should be noted that, although the same kernel problem is repaired, the hot patch file is usually recompiled for different kernel versions, and the specific content of the hot patch file may be different.
TABLE 1
Figure BDA0003289627380000111
And step S206, operating the hot patch file in the current kernel environment and the current operating system environment based on the operating information.
The operation method of the hot patch obtains a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file. And if the version information of the current kernel is the same as that of the target kernel, determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file. And running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the corresponding configuration file thereof, and can automatically execute the relevant operation based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file, because the operation and maintenance personnel are not required to execute the operation and maintenance operation on the hot patch file, the correctness of the relevant operation executed when the hot patch file is used can be ensured, in addition, because the kernel environment configuration information comprises the version information of the target kernel corresponding to the hot patch file, and the operating system environment configuration information comprises the version information of the target operating system corresponding to the hot patch file, the hot patch file can be further ensured to run in the matched kernel and the operating system, so that the risk of running and maintaining work can be reduced, and major faults are avoided.
The embodiment of the invention provides another operation method of a hot patch, which is realized on the basis of the method of the embodiment, and the method mainly describes a specific process of determining that the current kernel environment conforms to the kernel environment configuration information required by a hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file, wherein in the method, the kernel environment configuration information comprises the following steps: a first condition that a software package on which the hot patch file depends needs to meet; the operating system environment configuration information includes: a second condition that needs to be satisfied by an application package on which the hot patch file depends; the software package may be understood as a program or a set of programs having specific functions which may be used to perform a specific task; the software package on which the hot patch file depends can be other hot patch file packages, or can also be other programs and the like which need to be depended on; the first condition that the software package needs to meet may be that the software package is a software package of a specified version, or the version of the software package cannot be lower than the specified version, or the software package is a software package of a specified issue number, and the like, and specifically, the first condition that the software package that the hot patch file depends on needs to meet may be set according to actual requirements; the application package may be understood as a tool package and the like that an operation command needs to be used, and the second condition that the application package needs to satisfy may be that the application package is an application package of a specified version, or that the version of the application package cannot be lower than the specified version, and the like, and specifically, the second condition that the application package that the hot patch file depends on needs to satisfy may be set according to an actual requirement, which is not limited herein; as shown in fig. 3, the method comprises the steps of:
step S302, obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
Step S304, whether a first software package meeting a first condition exists in the current kernel environment or not and whether a first application package meeting a second condition exists in the current operating system environment or not are judged.
In practical implementation, if the kernel environment configuration information includes a first condition that a software package dependent on a hot patch file needs to satisfy and the operating system environment configuration information includes a second condition that an application package dependent on the hot patch file needs to satisfy, it can be understood that, in order to enable the hot patch file to normally operate in the current kernel environment, other software packages and other application packages need to be relied on, and therefore, after the hot patch file package is obtained, it can be determined whether a first software package satisfying the first condition exists in the current kernel environment and whether a first application package satisfying the second condition exists in the current operating system environment.
Step S306, if the first software package does not exist, the first software package is obtained, and the first software package is loaded to the current kernel environment.
If the first software package meeting the first condition does not exist in the current kernel environment, the first software package needs to be acquired, for example, the first software package meeting the first condition may be automatically downloaded, and the acquired first software package may be installed at a specified location. If there are a plurality of first software packages satisfying the first condition, for example, if only the name of the first software package is specified and no version number or issue number is specified, the first software package with the highest version number or issue number is generally selected by default; of course, a specific first software package may also be directly specified, in this case, the specified first software package may be directly obtained, and after the first software package is obtained, the first software package may be loaded to the current kernel environment, so that it may be ensured that the first software package exists in the current kernel environment.
Step S308, if the first application program package does not exist, the first application program package is obtained, and the first application program package is installed in the current operating system environment.
If the first application package meeting the second condition does not exist in the current operating system environment, the first application package needs to be acquired, for example, the first application package meeting the second condition can be automatically downloaded, and the acquired first application package can be installed at a specified position. If a plurality of first application packages satisfying the second condition exist, for example, if only the name of the first application package is specified and no version number is specified, the first application package with the highest version number is generally selected by default; of course, a specific first application package may also be directly specified, in which case the specified first application package may be directly obtained, and after the first application package is obtained, the first application package may be installed to the current operating system environment, so that it may be ensured that the first application package exists in the current operating system environment.
Step S310, determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
If the first software package exists in the current kernel environment and the first application program package exists in the current operating system environment, the first software package can be understood as meeting the dependence condition required by normal loading and running of the hot patch file, the hot patch file can be normally loaded into the current kernel, and at this time, the current kernel environment can be determined to accord with the kernel environment configuration information required by the hot patch file, and the current operating system environment accords with the operating system environment configuration information required by the hot patch file. For example, the dependency relationship may be configured by a Requires configuration item, and assuming that the hot patch file needs to depend on the kpatch-runtime-0.9.1-1.el7. normal.rpm or higher, the related configuration may refer to the following:
Requires:kpatch-runtime>=0.9.1
when the hot patch file needs to be loaded to the current kernel, the missing depended software packages meeting the conditions can be automatically installed and loaded; because the kernel environment configuration information is provided with the version number meeting the conditions, the software package with the lower version can be automatically deleted, and the software package with the loading version number meeting the requirements is installed.
Step S312, the hot patch file is executed in the current kernel environment and the current operating system environment based on the operation information.
The operation method of the hot patch obtains a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; and judging whether a first software package meeting a first condition exists in the current kernel environment or not and whether a first application program package meeting a second condition exists in the current operating system environment or not. And if the first software package does not exist, acquiring the first software package. Loading the first software package to the current kernel environment, if the first application package does not exist, acquiring the first application package, and installing the first application package to the current operating system environment; determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and determining that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file. And running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the corresponding configuration file thereof, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file.
In addition, since the kernel environment configuration information includes a first condition that the software package on which the hot patch file depends needs to satisfy, the operating system environment configuration information includes: the second condition that the application package that the hot patch file depends on needs to meet can be when loading the hot patch file, load the software package and application package that depend on, thus can further guarantee the normal operation of hot patch file in the current kernel environment and current operating system environment, reduce the risk of operation maintenance work, avoid causing major failure.
The embodiment of the invention provides another operation method of a hot patch, which is realized on the basis of the method of the embodiment, and the method mainly describes a specific process of determining that the current kernel environment conforms to the kernel environment configuration information required by a hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file, wherein in the method, the kernel environment configuration information comprises the following steps: information of a second software package that conflicts with a function of the hot patch file; the operating system environment configuration information includes: information of a second application package that conflicts with running the hot patch file; the second software package may be another hot-patch file package that conflicts with the function of the hot-patch file, for example, the second software package may be a lower version hot-patch file for repairing the same defect, etc.; the second application package may be another application package that conflicts with running the hot patch file, for example, the second application package may be an application package running a lower version of the hot patch file, etc.; in actual implementation, the name of the second software package which conflicts with the function of the hot patch file can be configured in the kernel environment configuration information, and the name of the second application package which conflicts with the running of the hot patch file can be configured in the operating system environment configuration information; as shown in fig. 4, the method includes the steps of:
step S402, obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
Step S404, if a second software package which conflicts with the function of the hot patch file exists in the current kernel environment, deleting the second software package and other software packages depending on the second software package from the current kernel environment.
In practical implementation, if the core environment configuration information includes information of a second software package that conflicts with the function of the hot patch file, it may be understood that, when the second software package exists in the current core environment, if the hot patch file is loaded, a conflict may occur, and in order to enable the hot patch file to operate normally in the current core environment, the second software package that conflicts with the function of the hot patch file needs to be deleted.
If a second software package which conflicts with the function of the hot patch file exists in the current kernel environment, the second software package can be automatically deleted from the current kernel environment, so that the conflict with the function of the hot patch file to be loaded is avoided, for example, the following can be configured in the configuration file: obsolees: kpatch-oldname. It should be noted that, if there are other software packages in the current kernel environment that depend on the second software package, when the second software package is deleted, the other software packages that depend on the second software package are also automatically deleted; for example, if the second software package is an old version of a hot patch file, other hot patch files in the current kernel environment depend on the old version of the hot patch file, and when the old version of the hot patch file is deleted, other hot patch files that depend on the old version of the hot patch file are also automatically deleted.
In step S406, if a second application package conflicting with the running of the hot patch file exists in the current operating system environment, the second application package and other application packages depending on the second application package are deleted from the current operating system environment.
In practical implementation, if the operating system environment configuration information includes information of a second application package that conflicts with running a hot patch file, it can be understood that, when the second application package exists in the current operating system environment, if the hot patch file is loaded, a conflict may occur, and in order to enable the hot patch file to be loaded and run normally, the second application package that conflicts with running the hot patch file needs to be deleted.
If a second application package which conflicts with the operation of the hot patch file exists in the current operating system environment, the second application package can be automatically deleted from the current operating system environment, so that the conflict with the loading and the operation of the hot patch file to be loaded is avoided; it should be noted that if there are other application packages in the current operating system environment that depend on the second application package, when the second application package is deleted, the other application packages that depend on the second application package are also usually deleted automatically.
Step S408, determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
When the second software package and other software packages depending on the second software package are deleted from the current kernel environment, and the second application program package and other application program packages depending on the second application program package are deleted from the current operating system environment, it can be determined that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file, and the hot patch file can be correctly loaded and run.
And step S410, running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
The operation method of the hot patch obtains a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file. If a second software package which conflicts with the function of the hot patch file exists in the current kernel environment, deleting the second software package and other software packages depending on the second software package from the current kernel environment, if a second application package which conflicts with the operation of the hot patch file exists in the current operating system environment, deleting the second application package and other application packages depending on the second application package from the current operating system environment, and determining that the current operating system environment accords with the kernel environment configuration information required by the hot patch file and the current operating system environment accords with the operating system environment configuration information required by the hot patch file. And running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the corresponding configuration file thereof, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file.
In addition, the kernel environment configuration information comprises information of a second software package which conflicts with the function of the hot patch file, and the operating system environment configuration information comprises information of a second application package which conflicts with the operation of the hot patch file; when the related operation is executed, the information of the second software package and the information of the second application program package can be automatically deleted, so that the normal operation of the hot patch file in the current kernel environment and the current operating system environment is further ensured, the risk of operation and maintenance work is reduced, and major faults are avoided.
An embodiment of the present invention provides another method for running a hot patch, which is implemented on the basis of the method in the above embodiment, and the method mainly describes a specific process of running a hot patch file in a current kernel environment and a current operating system environment based on running operation information, as shown in fig. 5, the method includes the following steps:
step S502, obtaining a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
Step S504, determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
Step S506, based on the loading operation information in the running operation information, loads the hot patch file into the current kernel environment, so as to run the hot patch file in the current kernel environment and the current operating system environment.
The loading operation information may include related operation steps, operation commands, and the like required for loading the hot patch file to the current kernel environment; in actual implementation, it is considered that the existing kpatch tool can implement automatic loading of a hot patch file that has been installed by the kpatch install command when the kernel is restarted. In the installation process of the hot patch file package, the contained related files are only stored in the specified directory, and the hot patch files are not automatically loaded to the current kernel environment, so that the hot patch files can be automatically loaded to the current kernel environment by using a patch load command, and the related commands can be specifically configured in a% post part of a configuration file, so that the purpose of automatically loading the hot patch files can be realized.
Before loading into the kernel, necessary checking and preprocessing operations are usually executed, for example, whether the kernel version matched with the hot patch file is correct is checked, whether the hot patch file is loaded is checked, and a mutual exclusion relationship, a dependency relationship and the like between the hot patch file and other software packages are checked; all operational configurations can be encapsulated in a post _ install.sh script, for example, the configuration can be referred to as follows:
%post
sh pre.sh
kpatch load kpatchname.ko
description of the drawings: the file name actually has directory-related information, and is only briefly described here.
Step S508, if an uninstall instruction for the hot patch file is received, uninstalling the hot patch file from the current kernel environment based on the uninstall operation information in the operation information, and deleting the hot patch file package.
The uninstall instruction may be understood as an instruction issued when a user needs to uninstall a hot patch file from a current kernel environment, in general, the user may issue an instruction to delete a hot patch package, and when deleting the hot patch package, there may be some sub-commands, which files may be instructed to be uninstalled or removed through the sub-commands, and the like, where the uninstall instruction for the hot patch file is generally included; the uninstalling operation information may include related operation steps, operation commands, and the like required when the hot patch file is uninstalled from the current kernel environment; in actual implementation, when an uninstall instruction for a hot patch file is received, the hot patch file can be uninstalled from the current kernel environment based on the uninstall operation information, it should be noted that if a first software package on which the hot patch file depends is loaded before the hot patch file is loaded, when the hot patch file is uninstalled, the newly loaded first software package is usually needed to be uninstalled first, and then the hot patch file is uninstalled, so that the hot patch file is prevented from remaining in the current kernel environment and remaining hidden danger is avoided, and other kernel post-processing work can be encapsulated in a pre _ uninstantal. For example, the post-processing operation may be: before deleting the hot patch file package, the configuration in the original configuration file is wrong, the wrong configuration is modified when the hot patch file is loaded, when the hot patch file is unloaded, the hot patch file is unloaded from the kernel, and then the modified configuration is recovered to the original wrong configuration; sh script configuration can be referred to as follows:
%preun
kpatch unload kpatchname
sh pre_uninstall.sh
when the hot patch file is unloaded from the current kernel environment, the hot patch file package can be deleted, namely, the files contained in the hot patch file package are deleted.
The operation method of the hot patch obtains a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file. Determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and determining that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file. And loading the hot patch file into the current kernel environment based on the loading operation information in the running operation information so as to run the hot patch file in the current kernel environment and the current operating system environment. And if an unloading instruction aiming at the hot patch file is received, unloading the hot patch file from the current kernel environment based on the unloading operation information in the running operation information. And deleting the hot patch file package. The method can automatically execute the loading and unloading operation of the hot patch file based on the loading operation information and the unloading operation information in the operation information, delete the hot patch file package after the hot patch file is unloaded, and reduce manual intervention in the process of using the hot patch file, thereby ensuring the correctness of the related operation executed when the hot patch file is used, reducing the risk of operation maintenance work and avoiding major faults.
The embodiment of the invention provides another operation method of a hot patch, which is realized on the basis of the method of the embodiment, wherein the method mainly describes the specific process of obtaining a hot patch file package; in practical implementation, the installation position of the packed hot patch file package is usually configured in advance in a configuration file, and after a user or a research and development staff packs a hot patch file and a related configuration file, the hot patch file package obtained after packing can be installed at the installation position, the hot patch file package is usually decompressed, and related files in the decompressed hot patch file package are stored at the installation position; as shown in fig. 6, the method includes the steps of:
step S602, obtaining a hot patch file package from a specified installation position; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: the method comprises the following steps of running kernel environment configuration information, operating system environment configuration information and running operation information of the hot patch file, wherein the kernel environment configuration information, the operating system environment configuration information and the running operation information are required by the hot patch file.
The hot patch file package can be acquired from the specified installation position because the hot patch file package is installed in the specified installation position in advance; the hot patch file package can be generated in advance through the following steps one and two:
step one, obtaining a hot patch file and a configuration file corresponding to the hot patch file.
And step two, if an encapsulating instruction aiming at the hot patch file is received, encapsulating the hot patch file and the configuration file to generate a hot patch file package.
The package instruction can be understood as an instruction sent when a user needs to package a hot patch file, a corresponding configuration file and the like; in actual implementation, after a user develops and manufactures a hot patch file, the user can configure a configuration file corresponding to the hot patch file, adjust the relevant configuration in the configuration file according to the content of hot patch file repair, and configure the relevant operation command of the kpatch at the corresponding configuration position of the configuration file; after the relevant configuration in the configuration file is adjusted, the hot patch file and the corresponding configuration file can be packaged, the configuration file usually includes specific operation steps, some operation steps relate to script files related to the operation steps, and the script files and the hot patch file can be packaged together.
In specific implementation, the hot patch file can be manufactured, deployed and managed by using a related software Package management standard, such as an RPM (Red-Hat Package Manager) standard, a DEB (software Package Manager) standard and the like; the RPM is an open software package management standard invented by RedHat, and the standard is widely used in rhol (Red Hat Enterprise Linux), a Community Enterprise Operating System (one of Linux distribution), Fedora (one of Linux distribution, a fast, stable, and powerful Operating System for daily applications constructed by global Community enthusiasts), including Linux distribution such as OpenLinux (one of Linux distribution), s.u.s.e. (one of Linux distribution), and Turbo Linux (one of Linux distribution). A user does not need to pay attention to software implementation details, only needs simple installation and load deletion, and is convenient and quick to deploy. The dependence and restriction relation between the complex implementation details in the software and the software version is processed by the producer of the hot patch file package.
For convenience of description, taking the RPM standard as an example, in a specific implementation, an rpmbuild command may be used to pack a specified directory and a specified file according to a specified spec profile to generate an RPM packet, before the packing, a relevant checking step may be written into the spec profile to prevent an error from occurring when the RPM packet is made, and what files need to be packed to generate the RPM packet are generally configured in the spec profile, whether the files need to be loaded into a kernel, and the like. During installation of the RPM pack, firstly, the testing environment is depended on according to the software version set in the spec configuration file, and if the testing condition cannot be met, the installation is not allowed. After the check condition is met, the related installation operation specified in the spec configuration file is executed, and the installation of the RPM packet is completed, namely the RPM packet is installed at the specified installation position. During the deleting process of the RPM packet, the related deleting operation specified in the spec configuration file is executed, and the deleting of the RPM packet is completed.
The user of the RPM pack can conveniently install, use and uninstall the software only by mastering the basic installation and deletion operations of the RPM pack, and the software is easy to deploy, manage and use. In the related art, a hot patch file generated by a kpatch tool is a kernel module file, and required operations are different and different according to different hot patch repair contents, so that related configuration and operation contents need to be determined according to specific conditions, for example, before installing a hot patch, whether the hot patch is installed is checked; if the hot patch file is upgraded, whether the old version of the hot patch file is deleted or not needs to be checked. Due to the lack of recognized installation procedures and commands, hot patch files and the like are not packaged twice at present. According to the embodiment, the hot patch file generated by the kpatch tool, the complex operations required to be executed during deployment, installation and uninstallation, the used script and configuration file and the like are packaged and packed by using the RPM standard to generate the RPM package taking the RPM as the suffix, namely the hot patch file package, so that the deployment and version management of the hot patch file are facilitated, the related dependence and mutual exclusion relation among the hot patch files are definitely configured in the spec configuration file, the hidden danger caused by function loss or old version residue is avoided, the operation and maintenance risk is reduced, and the usability of the hot patch file is improved. Each kernel hot patch is configured in a spec configuration file according to different functions, different repaired problems and different required dependence and limiting conditions, and the installation environment can be automatically detected during installation, so that the kernel hot patch can be correctly used.
The generation method of the hot patch file package is described by taking an RPM standard as an example, the related operation and the dependency relationship of the kernel hot patch are configured in the spec configuration file, and the details of the related installation and deletion operation are encapsulated, so that the usability of the hot patch file is improved. As an alternative, other packaging and packaging manners may also be selected to improve the usability of the hotpatch file, for example, the DEB standard may be adopted to package the hotpatch file and the like into a DEB package, or may also be packaged into other packaging packages, the related deployment manner may refer to the related description in the foregoing embodiment, and since the files and the like related to the operation process are packaged, the problem of misoperation of the maintenance personnel may be avoided.
Step S604, it is determined that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
And step S606, operating the hot patch file in the current kernel environment and the current operating system environment based on the operating information.
According to the operation method of the hot patch, after the hot patch file package is generated by packaging, if an instruction for installing the hot patch file package sent by a user is received, the inspection work before installation is automatically executed, after the condition is met, the hot patch file package is automatically installed at the specified installation position, the subsequent various dependency relationship inspections are carried out, the processes of loading the hot patch file to the kernel and the like can be automatically executed according to the steps in the configuration file, after the instruction for deleting the hot patch file package sent by the user is received, the unloading of the hot patch file and the deleting operation of the hot patch file package are automatically executed according to the deleting steps in the configuration file, due to the fact that manual intervention is reduced, the correctness of related operations executed when the hot patch file is used can be guaranteed, the risk of operation and maintenance work is reduced, and major faults are avoided.
An embodiment of the present invention provides an apparatus for running a hot patch, as shown in fig. 7, the apparatus includes: an obtaining module 70, configured to obtain a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; a determining module 71, configured to determine that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and that the current operating system environment conforms to operating system environment configuration information required by the hot patch file; and the running module 72 is used for running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
The running device of the hot patch firstly obtains a hot patch file package; wherein, the hot patch file package includes: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file; then determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file; and finally, running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information. In the method, the hot patch file package comprises the hot patch file and the corresponding configuration file thereof, and can automatically execute related operations based on the kernel environment configuration information and the operating system environment configuration information in the configuration file to ensure that the current kernel environment conforms to the kernel environment configuration information, and the current operating system environment conforms to the operating system environment configuration information, and then automatically execute the hot patch file based on the operation information in the configuration file.
Further, the kernel environment configuration information includes: running version information of a target kernel corresponding to the hot patch file; the operating system environment configuration information includes: running version information of a target operating system corresponding to the hot patch file; the determination module is further configured to: and if the version information of the current kernel is the same as that of the target kernel and the version information of the current operating system is the same as that of the target operating system, determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file and the current operating system environment conforms to operating system environment configuration information required by the hot patch file.
Further, the kernel environment configuration information includes: a first condition that a software package on which the hot patch file depends needs to meet; the operating system environment configuration information includes: a second condition that needs to be satisfied by an application package on which the hot patch file depends; the determination module is further configured to: judging whether a first software package meeting a first condition exists in the current kernel environment or not and whether a first application package meeting a second condition exists in the current operating system environment or not; if the first software package does not exist, acquiring the first software package, and loading the first software package to the current kernel environment; if the first application package does not exist, the first application package is obtained, the first application package is installed in the current operating system environment, the fact that the current kernel environment meets kernel environment configuration information required by a hot patch file is determined, and the current operating system environment meets operating system environment configuration information required by the hot patch file is determined.
Further, the kernel environment configuration information includes: information of a second software package that conflicts with a function of the hot patch file; the operating system environment configuration information includes: information of a second application package that conflicts with running the hot patch file; the determination module is further configured to: if a second software package which conflicts with the function of the hot patch file exists in the current kernel environment, deleting the second software package and other software packages depending on the second software package from the current kernel environment; if a second application package which conflicts with the running of the hot patch file exists in the current operating system environment, deleting the second application package and other application packages depending on the second application package from the current operating system environment; determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and determining that the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
Further, the operation module is further configured to: and loading the hot patch file into the current kernel environment based on the loading operation information in the running operation information so as to run the hot patch file in the current kernel environment and the current operating system environment.
Further, the operation module is further configured to: if an uninstalling instruction for the hot patch file is received, uninstalling the hot patch file from the current kernel environment based on the uninstalling operation information in the operation information; and deleting the hot patch file package.
Further, the apparatus further includes a generation module, where the hot patch package is generated by the generation module, and the generation module is configured to: acquiring a hot patch file and a configuration file corresponding to the hot patch file; and if an encapsulating instruction aiming at the hot patch file is received, encapsulating the hot patch file and the configuration file to generate a hot patch file package.
Further, the hot patch file package is pre-installed at a specified installation position; the acquisition module is further configured to: and acquiring the hot patch file package from the specified installation position.
The implementation principle and the generated technical effect of the operation device of the hot patch provided by the embodiment of the invention are the same as those of the operation method embodiment of the hot patch, and for brief description, corresponding contents in the operation method embodiment of the hot patch can be referred to where the embodiment of the operation device of the hot patch is not mentioned.
An embodiment of the present invention further provides an electronic device, which is shown in fig. 8, and the electronic device includes a processor 130 and a memory 131, where the memory 131 stores machine executable instructions that can be executed by the processor 130, and the processor 130 executes the machine executable instructions to implement the above-mentioned operation method of the hot patch.
Further, the electronic device shown in fig. 8 further includes a bus 132 and a communication interface 133, and the processor 130, the communication interface 133, and the memory 131 are connected through the bus 132.
The Memory 131 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 133 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, and the like can be used. The bus 132 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
The processor 130 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 130. The Processor 130 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 131, and the processor 130 reads the information in the memory 131 and completes the steps of the method of the foregoing embodiment in combination with the hardware thereof.
The embodiment of the present invention further provides a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the operation method of the hot patch.
The operation of the hot patch, the apparatus and the computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program codes, where instructions included in the program codes may be used to execute the method described in the foregoing method embodiments, and specific implementations may refer to the method embodiments and are not described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (11)

1. A method of operating a hot patch, the method comprising:
acquiring a hot patch file package; wherein the hot patch package comprises: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file;
determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to operating system environment configuration information required by the hot patch file;
and running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
2. The method of claim 1, wherein the kernel environment configuration information comprises: running version information of a target kernel corresponding to the hot patch file; the operating system environment configuration information includes: running version information of a target operating system corresponding to the hot patch file;
the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file includes:
and if the version information of the current kernel is the same as that of the target kernel and the version information of the current operating system is the same as that of the target operating system, determining that the current kernel environment conforms to kernel environment configuration information required by the hot patch file and the current operating system environment conforms to operating system environment configuration information required by the hot patch file.
3. The method of claim 1, wherein the kernel environment configuration information comprises: a first condition that the software package on which the hot patch file depends needs to meet; the operating system environment configuration information includes: a second condition that the application package on which the hot patch file depends needs to satisfy;
the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file includes:
judging whether a first software package meeting the first condition exists in the current kernel environment or not and whether a first application package meeting the second condition exists in the current operating system environment or not;
if the first software package does not exist, acquiring the first software package, and loading the first software package to the current kernel environment;
if the first application program package does not exist, acquiring the first application program package, and installing the first application program package to the current operating system environment;
and determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
4. The method of claim 1, wherein the kernel environment configuration information comprises: information of a second software package that conflicts with a function of the hot patch file; the operating system environment configuration information includes: information of a second application package that conflicts with running the hot patch file;
the step of determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file includes:
if the second software package which conflicts with the function of the hot patch file exists in the current kernel environment, deleting the second software package and other software packages depending on the second software package from the current kernel environment;
if the second application package which conflicts with the operation of the hot patch file exists in the current operating system environment, deleting the second application package and other application packages depending on the second application package from the current operating system environment;
and determining that the current kernel environment conforms to the kernel environment configuration information required by the hot patch file, and the current operating system environment conforms to the operating system environment configuration information required by the hot patch file.
5. The method of claim 1, wherein the step of running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information comprises:
and loading the hot patch file into the current kernel environment based on loading operation information in the running operation information so as to run the hot patch file in the current kernel environment and the current operating system environment.
6. The method of claim 5, further comprising:
if an uninstalling instruction for the hot patch file is received, uninstalling the hot patch file from the current kernel environment based on uninstalling operation information in the running operation information;
and deleting the hot patch file package.
7. The method of claim 1, wherein the hot patch package is generated in advance by:
acquiring a hot patch file and a configuration file corresponding to the hot patch file;
and if an encapsulation instruction aiming at the hot patch file is received, encapsulating the hot patch file and the configuration file to generate a hot patch file package.
8. The method of claim 1, wherein the hot patch package is pre-installed at a specified installation location; the step of obtaining the hot patch file package comprises the following steps:
and acquiring the hot patch file package from the specified installation position.
9. An apparatus for running a hot patch, the apparatus comprising:
the obtaining module is used for obtaining the hot patch file package; wherein the hot patch package comprises: the hot patch file and a configuration file corresponding to the hot patch file; the configuration file includes: kernel environment configuration information, operating system environment configuration information and operation information of the hot patch file, which are required by the operation of the hot patch file;
a determining module, configured to determine that a current kernel environment conforms to kernel environment configuration information required by the hot patch file, and that a current operating system environment conforms to operating system environment configuration information required by the hot patch file;
and the running module is used for running the hot patch file in the current kernel environment and the current operating system environment based on the running operation information.
10. An electronic device comprising a processor and a memory, the memory storing machine executable instructions executable by the processor, the processor executing the machine executable instructions to implement a method of operation of a hot patch as claimed in any one of claims 1 to 8.
11. A machine-readable storage medium having stored thereon machine-executable instructions which, when invoked and executed by a processor, cause the processor to implement a method of operation of a hot patch as claimed in any one of claims 1 to 8.
CN202111159660.0A 2021-09-30 2021-09-30 Operation method and device of hot patch and electronic equipment Pending CN113867774A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111159660.0A CN113867774A (en) 2021-09-30 2021-09-30 Operation method and device of hot patch and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111159660.0A CN113867774A (en) 2021-09-30 2021-09-30 Operation method and device of hot patch and electronic equipment

Publications (1)

Publication Number Publication Date
CN113867774A true CN113867774A (en) 2021-12-31

Family

ID=79001102

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111159660.0A Pending CN113867774A (en) 2021-09-30 2021-09-30 Operation method and device of hot patch and electronic equipment

Country Status (1)

Country Link
CN (1) CN113867774A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630547A (en) * 2015-12-21 2016-06-01 浙江中控技术股份有限公司 Patch program installing method and patch program installing device
CN105824623A (en) * 2016-03-14 2016-08-03 广州趣丸网络科技有限公司 Android application hotfix method and device
CN107451474A (en) * 2016-05-31 2017-12-08 百度在线网络技术(北京)有限公司 Software vulnerability restorative procedure and device for terminal
CN110780894A (en) * 2018-07-31 2020-02-11 阿里巴巴集团控股有限公司 Hot upgrade processing method and device and electronic equipment
CN112527403A (en) * 2019-09-19 2021-03-19 华为技术有限公司 Application starting method and electronic equipment
CN112906008A (en) * 2018-11-15 2021-06-04 百度在线网络技术(北京)有限公司 Kernel vulnerability repairing method, device, server and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630547A (en) * 2015-12-21 2016-06-01 浙江中控技术股份有限公司 Patch program installing method and patch program installing device
CN105824623A (en) * 2016-03-14 2016-08-03 广州趣丸网络科技有限公司 Android application hotfix method and device
CN107451474A (en) * 2016-05-31 2017-12-08 百度在线网络技术(北京)有限公司 Software vulnerability restorative procedure and device for terminal
CN110780894A (en) * 2018-07-31 2020-02-11 阿里巴巴集团控股有限公司 Hot upgrade processing method and device and electronic equipment
CN112906008A (en) * 2018-11-15 2021-06-04 百度在线网络技术(北京)有限公司 Kernel vulnerability repairing method, device, server and system
CN112527403A (en) * 2019-09-19 2021-03-19 华为技术有限公司 Application starting method and electronic equipment

Similar Documents

Publication Publication Date Title
CN108829593B (en) Code coverage rate calculation and analysis method, device, equipment and storage medium
CN102736978B (en) A kind of method and device detecting the installment state of application program
CN103455354A (en) Method and equipment for preventing hardware update from failing
CN101807152B (en) Basic output and input system for self verification of selection read only memory and verification method thereof
CN109933350B (en) Method and device for embedding codes in application and electronic equipment
CN110597544A (en) Software system upgrading method and device
TW201621647A (en) Operating system updating method
WO2020029967A1 (en) Method and apparatus for repairing fault in operating system
CN103970564A (en) Automatic repairing and upgrading method of embedded operating system and embedded operating system with automatic repairing and upgrading functions
CN113268366A (en) Kernel operation method, device and system
CN113242288B (en) Internet of things equipment firmware upgrading method, system and device and storage medium
KR101658485B1 (en) Appratus and method for booting for debug in portable terminal
CN113867774A (en) Operation method and device of hot patch and electronic equipment
CN112015587B (en) Method and device for enhancing reliability of operating system
CN116820528A (en) Firmware version upgrading method and device, chip and electronic equipment
CN115827024A (en) Vehicle-mounted program updating method and system
CN112965697B (en) Code file generation method and device and electronic equipment
CN114880244A (en) Application testing method and device, storage medium and electronic equipment
CN111475220B (en) Cold start method and device, electronic equipment and computer storage medium
CN112328288A (en) Method, system, equipment and storage medium for updating server component
CN111752548A (en) SDK embedding method and device and computer readable storage medium
CN115544521B (en) Method and device for generating checksum of offline installation file
CN111913720A (en) Program deployment method and device
CN113553071B (en) Software installation method, computer device, and storage medium
CN118113308A (en) Code automatic deployment method, system, server 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