Online upgrading method and device, electronic equipment and storage medium
By using two system partitions in the firmware, online upgrade is achieved, which solves the problem that traditional firmware update methods cannot be upgraded online and ensures the stability and security of the system.
Patent Information
- Application Number
- CN202410767709.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-14
- Publication Date
- 2024-10-11
AI Technical Summary
Traditional firmware update methods cannot achieve online upgrades, interrupt services, and cannot simultaneously fix security vulnerabilities and introduce new features.
Use the method of two system partitions, one active partition and one inactive partition. The inactive partition is updated when an update task is detected, and the updated partition is determined to be the active partition when the system restarts to ensure that the online upgrade does not affect the active partition. normal operation.
It realizes online upgrade of firmware, avoids service interruption, enables system upgrade in inactive partitions, ensures the normal operation of active partitions, and improves the stability and security of firmware.
Smart Images

Figure CN118760451A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer systems, and in particular to an online upgrade method, device, electronic equipment and storage medium. Background Art
[0002] As power grids become more intelligent and complex, higher requirements are placed on the stability and security of firmware; firmware is software in embedded systems that directly controls the behavior of hardware devices; therefore, firmware updates become critical, not only to introduce new features and performance improvements, but also to fix security vulnerabilities and other defects to meet evolving threats and technical challenges.
[0003] Currently, traditional firmware update methods will interrupt service and cannot upgrade the firmware online. Summary of the invention
[0004] The present invention provides an online upgrade method, device, electronic equipment and storage medium to realize online upgrade of firmware.
[0005] According to one aspect of the present invention, there is provided an online upgrade method, which is applied to any system, wherein the system comprises two system partitions, the two system partitions have the same application program and data, and the two system partitions comprise an active partition and an inactive partition; the method comprises:
[0006] When an update task for the system is detected, an update data packet corresponding to the update task is obtained, the update data packet is loaded into the inactive partition for an update operation, and the updated inactive partition is marked as an update partition; wherein the active partition is in an online running state;
[0007] When the system is restarted, the update partition is determined as the current active partition, and the system is run in the current active partition.
[0008] According to another aspect of the present invention, there is provided an online upgrade device, which is applied to any system, wherein the system includes two system partitions, the two system partitions have the same application program and data, and the two system partitions include an active partition and an inactive partition; the device includes:
[0009] an inactive partition update module, for, when an update task for the system is detected, obtaining an update data packet corresponding to the update task, loading the update data packet into the inactive partition for an update operation, and marking the updated inactive partition as an update partition; wherein the active partition is in an online running state;
[0010] The current active partition running module is used to determine the updated partition as the current active partition and run the system in the current active partition when the system is restarted.
[0011] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0012] at least one processor; and
[0013] a memory communicatively connected to the at least one processor; wherein,
[0014] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the online upgrade method described in any embodiment of the present invention.
[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the online upgrade method described in any embodiment of the present invention when executed.
[0016] The technical solution of the embodiment of the present invention is to obtain the update data packet corresponding to the update task when detecting the update task of the system, load the update data packet into the inactive partition for the update operation, and mark the updated inactive partition as the update partition; wherein the active partition is in the online running state; when the system is restarted, the update partition is determined as the current active partition, and the current active partition is run. The system can be upgraded in the inactive partition without affecting the normal operation of the active partition, thereby realizing the online upgrade of the system.
[0017] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0019] Figure 1 is a flow chart of an online upgrade method provided by Embodiment 1 of the present invention;
[0020] Figure 2 is a flow chart of an online upgrade method provided by Embodiment 2 of the present invention;
[0021] Figure 3 It is a structural diagram of an online upgrade device provided by Embodiment 3 of the present invention;
[0022] Figure 4 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] Embodiment 1
[0026] Figure 1 This is a flowchart of an online upgrade method provided in the first embodiment of the present invention. This embodiment is applicable to the case of online upgrade of the system. The method can be executed by an online upgrade device. The online upgrade device can be implemented in the form of hardware and / or software. The online upgrade device can be configured in a server of any system. The system includes two system partitions. The two system partitions have the same application and data. The two system partitions include an active partition and an inactive partition. The active partition is in a running state, and the inactive partition is in an idle state. The system can be any system, such as an Euler system. It should be noted that if the active partition is in the process of running
[0027] like Figure 1 As shown, the method includes:
[0028] S110. When an update task for the system is detected, an update data packet corresponding to the update task is obtained, the update data packet is loaded into the inactive partition for an update operation, and the updated inactive partition is marked as an update partition; wherein the active partition is in an online running state.
[0029] The update task refers to an update task for the system or an application in the system. Specifically, the update task includes but is not limited to a system update task, an application update task, a firmware update task, etc., which are not limited here. In this embodiment, the update task of the system is detected in real time. When the update task is detected, the update data packet corresponding to the update task is obtained. Further, the update data packet is loaded into the inactive partition for the update operation, and the updated inactive partition is marked with an update tag, and the updated inactive partition is marked as an update partition.
[0030] In some embodiments, optionally, after obtaining the update data packet corresponding to the update task, the method further includes: obtaining a digital signature and certificate of the update data packet, and performing validity check on the certificate; the certificate includes a public key of the certificate; if the certificate is valid, decrypting the digital signature based on the public key of the certificate to obtain a signature summary; determining a data packet summary of the update data packet based on the update data packet; and performing security verification based on the signature summary and the data packet summary.
[0031] Among them, the signature summary refers to the summary obtained by verifying the digital signature through the public key, and the summary is a hash value; the data packet summary is the summary obtained by hashing the update data packet through the hash algorithm, which is also a hash value. It should be noted that the signature summary and the data packet summary use the same hash algorithm. In this embodiment, after obtaining the update data packet, the update data packet needs to be verified for security. First, the digital signature and certificate of the update data packet are obtained to detect whether the certificate is issued by a trusted certificate authority and whether the certificate is within a limited period. If the certificate is issued by a trusted certificate authority and the certificate is within the validity period, the certificate is considered valid; further, the public key in the certificate is decrypted to obtain the digital signature summary, and the content of the update data packet is hashed to obtain the data packet summary; the signature summary and the data packet summary are compared. If the two are the same, the signature verification is successful and the update data packet is secure.
[0032] Based on the above embodiment, optionally, marking the updated inactive partition as an updated partition includes: testing the updated inactive partition, and if the test result is normal, marking the updated inactive partition as an updated partition; wherein the test items include one or more of integrity testing, functional testing and log checking.
[0033] It is understandable that after the inactive area is updated, the updated inactive partition needs to be tested to ensure that the upgrade is successful. In this embodiment, the updated inactive partition is tested to obtain the test results of each test item. If the test results of each test item are normal, it indicates that the upgrade is successful, and the updated inactive partition is marked as an updated partition; if the test results of each test item are abnormal, the abnormality is recorded and an alarm is issued. Among them, the test items include one or more of integrity testing, functional testing and log checking. The integrity test is based on the verification tool to verify the integrity of the system or application in the updated inactive area; the functional test is to run the functional test of the system or application in the environment of the updated inactive area; the log check is to traverse the system log and monitoring data on the updated inactive area. If an abnormality is found, an abnormal alarm information is generated.
[0034] S120. When the system is started again, the update partition is determined as the current active partition, and the system is run in the current active partition.
[0035] After the inactive partition is updated, when the system is restarted, the system partition with the update label is determined, the system partition is determined as the current active partition, and the system and application are loaded and run in the current active partition.
[0036] Based on the above embodiment, optionally, after the system is run in the current active partition, the method further includes: loading the update data packet to the current inactive partition for update operation; the current inactive partition is the active partition when the system was last started.
[0037] In this embodiment, after running the current active partition, the update data package can be loaded into the current inactive partition to perform an update operation, and the current inactive partition can be upgraded. The current inactive partition is the active partition when the system was last started, and can also be understood as a system partition that has not been upgraded. It should be noted that after updating and upgrading the current inactive partition, it is not necessary to mark the current inactive partition.
[0038] In some embodiments, optionally, if the update data package includes update data of a historical version, after running the current active partition, the current inactive partition may not be updated temporarily, and when a new update task for the system is detected again, steps S110-S120 are performed on the current inactive partition. It is understandable that, since the update data package includes update data of a historical version, the system can skip the intermediate version and directly update from the current version to the latest version.
[0039] In some embodiments, optionally, the method further includes: if the current active partition fails to run, switching the system to a system partition corresponding to a preset rollback point, and running the system partition corresponding to the preset rollback point.
[0040] The preset rollback point is the mark point corresponding to the stable version of the system partition when the system was last started. In this embodiment, if the current active partition fails to run, it indicates that there is an abnormality in the updated system partition. At this time, you can roll back to the system partition corresponding to the preset rollback point, and run the system partition corresponding to the preset rollback point to ensure the normal operation of the system. It is understandable that if the current active partition runs successfully, the preset rollback point is set to the current active partition to update the preset rollback point.
[0041] The technical solution of this embodiment is to obtain the update data packet corresponding to the update task when detecting the update task for the system, load the update data packet into the inactive partition for the update operation, and mark the updated inactive partition as the update partition; wherein the active partition is in the online running state; when the system is restarted, the update partition is determined as the current active partition, and the current active partition is run. The system can be upgraded in the inactive partition without affecting the normal operation of the active partition, thereby realizing the online upgrade of the system.
[0042] Embodiment 2
[0043] Figure 2This is a flow chart of an online upgrade method provided by the second embodiment of the present invention. In this embodiment, based on the above embodiments, the system includes at least one volume group, the volume group includes two logical volumes and reserved storage space, and the two logical volumes correspond to the active partition and the inactive partition respectively. Specifically, in the system, each volume group (Volume Group, VG) is composed of at least one physical volume (Physical Volume, PV), which is used to manage the physical hard disk and logical space. The logical volume (Logical Volume, LV) is a part of the volume group and can be dynamically added in the volume group. The volume group has two logical volumes and reserved storage space, and the two logical volumes correspond to the active partition and the inactive partition respectively, providing storage space for the corresponding active partition or inactive partition to support the operation of the active partition or the upgrade of the inactive partition; the reserved storage space is the storage space in the volume group except the storage space occupied by the two logical volumes, and the reserved storage space can dynamically provide storage space to the two logical volumes. For example, assuming that the storage space of the volume group is 100G, if two logical volumes respectively occupy part of the storage space, for example, the two logical volumes each occupy 40G, then the remaining 20G is used as reserved storage space. When the storage space of any logical volume is insufficient, the reserved storage space can be expanded to the storage space of the logical volume.
[0044] like Figure 2 As shown, the method includes:
[0045] S210. When an update task for the system is detected, an update data packet corresponding to the update task is obtained, the update data packet is loaded into the inactive partition for an update operation, and the updated inactive partition is marked as an update partition; wherein the active partition is in an online running state.
[0046] S220. When the system is started again, determine the update partition as the current active partition, and run the system in the current active partition.
[0047] S230. During the online upgrade process, for any of the logical volumes, obtain the available storage space of the logical volume, and determine whether to expand the logical volume based on the available storage space of the logical volume and the available storage space threshold of the logical volume; if so, perform the expansion task on the logical volume.
[0048] During the online upgrade process, in order to avoid the problem of insufficient storage space in the system partition, for any logical volume (i.e., the logical volume corresponding to the active partition or the logical volume corresponding to the inactive partition), the available storage space of the logical volume can be obtained, and whether to expand the logical volume is determined based on the available storage space of the logical volume and the available storage space threshold of the logical volume. If the available storage space of the logical volume is greater than or equal to the available storage space threshold of the logical volume, it indicates that the logical volume does not need to be expanded. If the available storage space of the logical volume is less than the available storage space threshold of the logical volume, it indicates that the logical volume needs to be expanded, and the expansion task is performed on the logical volume. Among them, the available storage space threshold refers to the threshold of the storage space that can be used in the logical volume. The application determines whether to expand the logical volume. For example, the total storage space of the logical volume is 40G, and the available storage space threshold can be 10G. If the available storage space of the logical volume is less than 10G, the expansion task needs to be performed on the logical volume. It should be noted that step S230 can be executed in parallel with S210-S220.
[0049] In some embodiments, optionally, executing the expansion task on the logical volume includes: determining the volume group where the logical volume is located based on a logical volume information viewing command; determining the volume group information of the volume group based on a volume group information viewing command, and judging whether the reserved storage space of the volume group is sufficient to expand the logical volume based on the volume group information of the volume group, if the reserved storage space of the volume group is insufficient to expand the logical volume, adding a new physical volume as the reserved storage space in the volume group; if the reserved storage space of the volume group is sufficient to expand the logical volume, expanding the space of the logical volume based on the logical volume extension command; obtaining the file type of the file system in the logical volume, and executing the expansion task on the file system that supports online expansion in the logical volume to match the expanded space of the logical volume.
[0050] In this embodiment, the logical volume is expanded through the logical management command of the logical volume manager. Specifically, the logical volume information can be viewed based on the logical volume information viewing command; wherein the logical volume information viewing command is the lvdisplay command, and the logical volume information includes the logical volume name, the volume group where the logical volume is located, etc., which are not limited here. Further, based on the volume group information viewing command, the volume group information of the volume group where the logical volume is located is viewed, and based on the volume group information of the volume group, it is determined whether the reserved storage space of the volume group is sufficient to expand the logical volume. If the reserved storage space of the volume group is not sufficient to expand the logical volume, a new physical volume is added to the volume group as the reserved storage space; wherein the volume group information viewing command is the vgdisplay command, and the volume group information includes but is not limited to the total capacity of the volume group, the space used by the logical volume of the volume group, the available reserved storage space, etc., which are not limited here. Further, in the case where the reserved storage space of the volume group is sufficient to expand the logical volume, the space of the logical volume is expanded based on the logical volume extension command; wherein the logical volume extension command is the lvextend command. Furthermore, in order to match the storage space after the logical volume is expanded, the file type of the file system in the logical volume is obtained, and the expansion task is performed on the file system in the logical volume that supports online expansion; the file system type includes supporting online expansion and not supporting online expansion.
[0051] In some embodiments, after the logical volume expansion is completed, the space of the logical volume file system is obtained to confirm whether the expansion operation will be successful. If successful, an expansion completion indication is generated; if failed, a failure indication is generated and an alarm is issued.
[0052] On the basis of the above embodiment, optionally, the method judges whether the reserved storage space of the volume group is sufficient to expand the logical volume based on the volume group information of the volume group; if the reserved storage space of the volume group is insufficient to expand the logical volume, then adds a new physical volume in the volume group as the reserved storage space, including: for any logical volume, determining the space to be expanded of the logical volume based on the volume group information, judging whether to expand the reserved storage space based on the reserved storage space and the space to be expanded of the logical volume; if so, adding a new physical volume in the volume group as the expanded reserved storage space.
[0053] Among them, the space to be expanded refers to the storage space for expanding the logical volume to meet the operation or update of the logical volume. It can be understood that if the space to be expanded of the logical volume is larger than the reserved storage space of the volume group, the reserved storage space needs to be expanded to meet the expansion of the logical volume, wherein the expansion space of the logical volume is converted from the reserved storage space.
[0054] In this embodiment, for the logical volume corresponding to the active partition, the space to be expanded of the logical volume of the active partition is determined based on the current used space of each file system that supports online expansion in the logical volume, the proportion of available space of the file system, the expected growth rate of storage space usage within a preset time period of the file system, and the total storage space of the file system. The space to be expanded of the logical volume corresponding to the active partition is compared with the reserved storage space of the volume group. If the space to be expanded of the logical volume corresponding to the active partition is larger than the reserved storage space of the volume group, a new physical volume is added to the volume group as the reserved storage space for expansion.
[0055] Exemplarily, the calculation formula for the space to be expanded of the logical volume corresponding to the active partition is:
[0056] TS=∑(US i / (1-TR))*(1+GR i ) t -FS i )
[0057] Among them, TS represents the space to be expanded for the logical volume corresponding to the active partition, and US i Indicates the current used space of the i-th file system that supports online expansion. TR indicates the available space ratio of the file system. The available space ratio is set by technical personnel according to needs and is not limited here, for example, 20%. GR i represents the expected growth rate of storage space usage of the i-th file system supporting online expansion within a preset time period; t represents the preset time period; FS i Represents the total storage space of the i-th file system that supports online expansion.
[0058] For the logical volume corresponding to the inactive partition, when there is an update task for the inactive partition, the space to be expanded of the logical volume corresponding to the inactive partition is determined based on the memory consumed by the update task, the available storage space of the logical volume corresponding to the inactive area, and the memory redundancy of the logical volume corresponding to the inactive area. Specifically, the space to be expanded of the logical volume corresponding to the inactive partition is (the memory consumed by the update task + the memory redundancy of the logical volume corresponding to the inactive area) - the difference between the available storage space of the logical volume corresponding to the inactive area. Further, the space to be expanded of the logical volume corresponding to the inactive partition is compared with the reserved storage space of the volume group. If the space to be expanded of the logical volume corresponding to the active partition is larger than the reserved storage space of the volume group, a new physical volume is added to the volume group as the reserved storage space for expansion.
[0059] It is understandable that if there is no update task for the inactive partition, there is no need to expand the logical volume corresponding to the inactive partition, and further, there is no need to expand the reserved storage space of the volume group.
[0060] In some embodiments, optionally, the method further includes: when there is no update task for the inactive partition, for the logical volume corresponding to the inactive partition, obtaining the available storage space of the logical volume, comparing the available storage space with a preset available storage space threshold, and if the available storage space is greater than a preset reduction threshold, performing a reduction task on the storage space of the logical volume, reducing the available storage space of the logical volume to the preset available storage space reduction threshold, and allocating the storage space released after the storage space of the logical volume is reduced to the reserved storage space of the volume group. The preset reduction threshold is a threshold for determining whether to reduce the available storage space of the logical volume corresponding to the inactive partition. For example, assuming that the storage space of the logical volume is 100G, the preset reduction threshold may be 40G. When the available storage space is greater than 40G, the storage space of the logical volume is reduced.
[0061] The technical solution of this embodiment realizes dynamic division of storage space between two system partitions by setting reserved storage space in the volume group, thereby avoiding problems caused by insufficient storage space between two system partitions and improving the stability of operation or upgrade of system partitions.
[0062] Embodiment 3
[0063] Figure 3 Schematic diagram of the structure of an online upgrade device provided by Embodiment 3 of the present invention. Figure 3 As shown, the device is applied to any system, the system includes two system partitions, the two system partitions have the same application program and data, and the two system partitions include an active partition and an inactive partition; including:
[0064] The inactive partition update module 310 is used to, when an update task for the system is detected, obtain an update data packet corresponding to the update task, load the update data packet into the inactive partition for an update operation, and mark the updated inactive partition as an update partition; wherein the active partition is in an online running state;
[0065] The current active partition running module 320 is used to determine the updated partition as the current active partition and run the system in the current active partition when the system is restarted.
[0066] The technical solution of this embodiment is to obtain the update data packet corresponding to the update task when detecting the update task for the system, load the update data packet into the inactive partition for the update operation, and mark the updated inactive partition as the update partition; wherein the active partition is in the online running state; when the system is restarted, the update partition is determined as the current active partition, and the current active partition is run. The system can be upgraded in the inactive partition without affecting the normal operation of the active partition, thereby realizing the online upgrade of the system.
[0067] Based on the above embodiment, optionally, the device also includes a current inactive partition update module, which is used to load the update data packet to the current inactive partition for update operation after the system is run in the current active partition; the current inactive partition is the active partition when the system was last started.
[0068] Based on the above embodiment, optionally, the inactive partition update module 310 includes an inactive partition test unit, which is used to test the updated inactive partition. If the test result is normal, the updated inactive partition is marked as an updated partition; wherein the test items include one or more of integrity test, functional test and log check.
[0069] On the basis of the above embodiment, optionally, the system includes at least one volume group, the volume group includes two logical volumes and a reserved storage space, and the two logical volumes correspond to the active partition and the inactive partition respectively.
[0070] Based on the above embodiment, optionally, the device also includes a logical volume expansion module, which is used to obtain the available storage space of any of the logical volumes during the online upgrade process, and determine whether to expand the logical volume based on the available storage space of the logical volume and the available storage space threshold of the logical volume; if so, perform the expansion task on the logical volume.
[0071] Based on the above embodiment, optionally, the logical volume expansion module includes an expansion task execution unit, which is used to determine the volume group where the logical volume is located based on the logical volume information viewing command; determine the volume group information of the volume group based on the volume group information viewing command, and judge whether the reserved storage space of the volume group is sufficient to expand the logical volume based on the volume group information of the volume group; if the reserved storage space of the volume group is insufficient to expand the logical volume, add a new physical volume as the reserved storage space in the volume group; if the reserved storage space of the volume group is sufficient to expand the logical volume, expand the space of the logical volume based on the logical volume extension command; obtain the file system that supports online expansion in the logical volume, and perform expansion on the file system that supports online expansion to match the expanded space of the logical volume.
[0072] Based on the above embodiment, optionally, the extended task execution unit includes a reserved storage space expansion sub-unit, which is used to determine, for any logical volume, the space to be expanded of the logical volume based on the volume group information; based on the reserved storage space and the space to be expanded of the logical volume, determine whether to expand the reserved storage space; if so, add a new physical volume in the volume group as the expanded reserved storage space.
[0073] The online upgrade device provided in the embodiment of the present invention can execute the online upgrade method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0074] Embodiment 4
[0075] Figure 4 1 is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0076] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, ROM 12 and RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0077] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0078] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as an online upgrade method.
[0079] In some embodiments, the online upgrade method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the online upgrade method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the online upgrade method in any other appropriate manner (e.g., by means of firmware).
[0080] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0081] The computer program for implementing the online upgrade method of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program can be executed completely on the machine, partially on the machine, partially on the machine as an independent software package and partially on a remote machine, or completely on a remote machine or server.
[0082] Embodiment 5
[0083] Embodiment 5 of the present invention further provides a computer-readable storage medium, the computer-readable storage medium storing computer instructions, the computer instructions being used to cause a processor to execute an online upgrade method, the method being applied to any system, the system comprising two system partitions, the two system partitions having the same application program and data, the two system partitions comprising an active partition and an inactive partition; the method comprising:
[0084] When an update task for the system is detected, an update data packet corresponding to the update task is obtained, the update data packet is loaded into the inactive partition for update operation, and the updated inactive partition is marked as an update partition; wherein the active partition is in an online running state;
[0085] When the system is restarted, the update partition is determined as the current active partition, and the system is run in the current active partition.
[0086] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0087] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0088] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0089] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0090] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0091] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An online upgrade method, It is characterized in that Applied to any system, the system includes two system partitions, the two system partitions have the same application program and data, and the two system partitions include an active partition and an inactive partition; the method includes: When an update task for the system is detected, an update data packet corresponding to the update task is obtained, the update data packet is loaded into the inactive partition for an update operation, and the updated inactive partition is marked as an update partition; wherein the active partition is in an online running state; When the system is restarted, the update partition is determined as the current active partition, and the system is run in the current active partition.
2. The method according to claim 1, It is characterized in that After running the system in the current active partition, the method further includes: The update data package is loaded into the current inactive partition for update operation; the current inactive partition is the active partition when the system was last started.
3. The method according to claim 1, It is characterized in that The step of marking the updated inactive partition as an updated partition comprises: The updated inactive partition is tested, and if the test result is normal, the updated inactive partition is marked as an updated partition; wherein the test items include one or more of integrity test, function test and log check.
4. The method according to claim 1, It is characterized in that The system includes at least one volume group, the volume group includes two logical volumes and a reserved storage space, the two logical volumes correspond to the active partition and the inactive partition respectively.
5. The method according to claim 4, It is characterized in that During the online upgrade process, the method further includes: For any of the logical volumes, obtaining the available storage space of the logical volume, and determining whether to expand the logical volume based on the available storage space of the logical volume and the available storage space threshold of the logical volume; If yes, the expansion task is performed on the logical volume.
6. The method according to claim 5, It is characterized in that The performing of the expansion task on the logical volume includes: Determine the volume group where the logical volume is located based on the logical volume information viewing command; Determine the volume group information of the volume group based on the volume group information viewing command, and judge whether the reserved storage space of the volume group is sufficient to expand the logical volume based on the volume group information of the volume group, and if the reserved storage space of the volume group is insufficient to expand the logical volume, add a new physical volume in the volume group as the reserved storage space; In a case where the reserved storage space of the volume group is sufficient to expand the logical volume, expanding the space of the logical volume based on a logical volume expansion command; A file system supporting online expansion is obtained in the logical volume, and the file system supporting online expansion is expanded to match the expanded space of the logical volume.
7. The method according to claim 6, It is characterized in that The step of judging whether the reserved storage space of the volume group is sufficient to expand the logical volume based on the volume group information of the volume group, and if the reserved storage space of the volume group is insufficient to expand the logical volume, adding a new physical volume in the volume group as the reserved storage space comprises: For any logical volume, determining the space to be expanded of the logical volume based on the volume group information; Based on the reserved storage space and the space to be expanded of the logical volume, it is determined whether to expand the reserved storage space; if so, a new physical volume is added to the volume group as the expanded reserved storage space.
8. An online upgrade device, It is characterized in that Applied to any system, the system includes two system partitions, the two system partitions have the same application program and data, and the two system partitions include an active partition and an inactive partition; the device includes: an inactive partition update module, for, when an update task for the system is detected, obtaining an update data packet corresponding to the update task, loading the update data packet into the inactive partition for an update operation, and marking the updated inactive partition as an update partition; wherein the active partition is in an online running state; The current active partition running module is used to determine the updated partition as the current active partition when the system is restarted, and run the system in the current active partition.
9. An electronic device, It is characterized in that The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the online upgrade method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the online upgrade method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Logical volume partition automatic expansion device for Linux system
CN108874317A
Disk partition expansion method and device and server
CN109445706A
System upgrading method and device, equipment and storage medium
CN113641390A
A method and system for expanding virtual machine capacity based on LVM
CN114936068A
Capacity expansion method of computing device and computing device
CN116661677A
