Method, device and equipment for upgrading operating system
Generating a target operating system image by customizing system files solves the problem of poor operating system upgrade flexibility in the existing technology, enables user-defined upgrades and batch synchronous upgrades, and improves the efficiency and flexibility of operating system upgrades.
Patent Information
- Application Number
- CN202410871866.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-10-15
AI Technical Summary
Existing operating system upgrade technology has poor flexibility during the upgrade process and cannot meet the diverse needs of users. In addition, all data needs to be reconfigured in the event of an exception or failure, which reduces upgrade efficiency.
By obtaining customized system files, including basic operating system images and execution parameters, the target operating system image is generated and stored to achieve user-defined operating system upgrades. When an exception or failure occurs during the upgrade process, the stored target is directly used. The operating system image continues to be upgraded, avoiding reconfiguration.
It improves the flexibility and efficiency of operating system upgrades, meets the diverse needs of users, reduces reconfiguration steps in the event of exceptions or failures, and improves the stability of upgrades.
Smart Images

Figure CN118778980A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of cloud computing and big data technology, and in particular, relates to a method, device, equipment, storage medium and computer program product for upgrading an operating system. Background Art
[0002] An operating system is a set of interrelated system software programs that manage and control computer operations, utilize and run hardware and software resources, and provide common services to organize user interactions.
[0003] With the continuous development of technology, the upgrade of operating system versions has become a necessary requirement. However, in the process of upgrading existing operating systems, most of them use operating system files containing fixed system parameters for upgrading. However, in actual application scenarios, the requirements for upgrading the operating system may be diverse; and in the process of upgrading existing operating systems, no matter which link is abnormal or fails, it is necessary to go back to the beginning and upgrade again, which has poor flexibility and reduces the efficiency of upgrading. Therefore, the existing operating system upgrade technology has the problem of being unable to meet user needs and poor flexibility. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device, storage medium and computer program product for upgrading an operating system, which can enable users to customize the version and content of the operating system to meet user needs. When an exception or failure occurs during the upgrade process, there is no need to reconfigure all data for upgrading, and the system has high flexibility.
[0005] In a first aspect, an embodiment of the present application provides a method for upgrading an operating system, the method comprising:
[0006] Obtain a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters;
[0007] Generate and store a target operating system image based on the base operating system image and execution parameters;
[0008] An upgrade operation is performed based on the target operating system image to obtain the target operating system.
[0009] In a second aspect, an embodiment of the present application provides an operating system upgrade device, the device comprising:
[0010] An acquisition module is used to acquire a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters;
[0011] An execution module, used to generate and store a target operating system image based on a base operating system image and execution parameters;
[0012] The upgrade module is used to perform an upgrade operation based on the target operating system image to obtain the target operating system.
[0013] In a third aspect, an embodiment of the present application provides an operating system upgrade device, the device comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the method for upgrading the operating system as in the first aspect is implemented.
[0014] In a fourth aspect, an embodiment of the present application provides a computer storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, a method for upgrading an operating system as in the first aspect is implemented.
[0015] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for upgrading the operating system of the first aspect.
[0016] The operating system upgrade method, device, equipment, storage medium and computer program product of the embodiment of the present application obtains the first system file, generates and stores the target operating system image based on the basic operating system image and execution parameters in the first system file; then performs the upgrade operation based on the target operating system image to obtain the target operating system. The target operating system image is generated by the first system file containing the customized system parameters, and the operating system is further upgraded, so that the user customizes the version and content of the operating system and meets the user's needs; when the upgrade process is abnormal or fails, the stored target operating system image can be directly used to continue the upgrade without having to reconfigure all data for the upgrade, which improves the flexibility of the operating system upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 It is a flowchart of a method for upgrading an operating system provided by an embodiment of the present application;
[0019] Figure 2 It is a flowchart of generating and storing a target operating system image based on a basic operating system image and execution parameters provided by an embodiment of the present application;
[0020] Figure 3 It is a flowchart of obtaining a target operating system by performing an upgrade operation based on a target operating system image provided by an embodiment of the present application;
[0021] Figure 4 It is a structural diagram of an operating system upgrade device provided by an embodiment of the present application;
[0022] Figure 5 It is a structural diagram of an operating system upgrade device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0023] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0024] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0025] An operating system (OS) is a set of interrelated system software programs that manage and control computer operations, use and run hardware and software resources, and provide public services to organize user interactions. Depending on the operating environment, operating systems can be divided into desktop operating systems, mobile operating systems, server operating systems, embedded operating systems, etc.
[0026] In the PaaS platform, multiple computing nodes collaborate to perform high-performance computing and data processing. The operating system, as the basic software environment of the computing nodes, is crucial to the stability and performance of the PaaS platform. However, with the continuous development of technology, the update and upgrade of the operating system version has become a necessary requirement.
[0027] In the process of operating system upgrade, the prior art uses traditional operating system files (OSFILE) for upgrade. Traditional OSFILE is mostly a file containing fixed system parameters. However, in actual scenarios, the requirements for the upgraded operating system may be diverse, that is, the operating system upgrade of the prior art cannot meet user needs.
[0028] Meanwhile, in the prior art, during the operating system upgrade process, no matter which link has an abnormality or failure, it is necessary to go back to the initial link and upgrade again, which has poor flexibility and reduces the efficiency of the upgrade.
[0029] In addition, the existing technology can only upgrade one operating system environment, which cannot meet the needs of simultaneously upgrading batch host operating systems in a large-scale host group or cluster mode, and the operating system upgrade efficiency is low.
[0030] In summary, existing operating system upgrade technologies have the problems of being unable to meet user needs, having poor flexibility and low upgrade efficiency.
[0031] In order to solve the problems of the prior art, the embodiments of the present application provide a method, device, equipment, computer storage medium and computer program product for upgrading an operating system. By generating a target operating system image through a first system file containing customized system parameters, the operating system is further upgraded, so that the user can customize the version and content of the operating system and meet the needs of the user; when an exception or failure occurs during the upgrade process, the stored target operating system image can be directly used to continue the upgrade without having to reconfigure all data for the upgrade, thereby improving the flexibility of the operating system upgrade; at the same time, batch synchronous upgrades of multiple hosts to be upgraded can be achieved, thereby improving the efficiency of the operating system upgrade.
[0032] The following first introduces an operating system upgrade system to which the operating system upgrade method provided in the embodiment of the present application can be applied.
[0033] The operating system upgrade system is used to store and manage a first system file and a target operating system image, to automatically generate a first system file based on user-defined data, to generate a target operating system image based on the first system file, and to perform an upgrade operation based on the target operating system image to obtain a target operating system.
[0034] The operating system upgrade system includes an operating system image library (OSHUB), which is used to store operating system images of all versions, and operating system images can be pulled and pushed from the operating system image library.
[0035] The following is an introduction to the operating system upgrade method provided in the embodiment of the present application in conjunction with the accompanying drawings.
[0036] Figure 1 A schematic diagram of a method for upgrading an operating system provided by an embodiment of the present application is shown. Figure 1 As shown, the method may include the following steps: S101 to S103.
[0037] S101: Acquire a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters.
[0038] Most of the prior art uses an operating system file containing fixed system parameters to upgrade the operating system. However, in actual scenarios, the requirements for upgrading the operating system may be diverse, that is, the existing operating system upgrade technology cannot meet user needs. Therefore, the embodiment of the present application provides a first system file in which users can customize parameters for upgrading the operating system.
[0039] A first system file is obtained for generating an operating system image. The execution parameters in the first system file may be user-defined parameters, which declare the actual needs of the user.
[0040] The first system file containing user-defined system parameters is used to generate an operating system image. Through the user-defined system parameters, the operating system upgrade method can be applicable to application scenarios of various user needs, thereby meeting the actual needs of users.
[0041] In one embodiment, the operation of obtaining the first system file may be completed by an operating system upgrade system.
[0042] S102: Generate and store a target operating system image based on the basic operating system image and execution parameters.
[0043] The base operating system image may be an initialized original operating system image or an operating system image of a previous version before upgrading. The execution parameters may be system parameters customized by the user in the first system file, which declare the user's requirements for the generated target operating system image.
[0044] On the basis of the basic operating image, according to the execution parameters, a target operating system image required for the operating system upgrade is generated, and the generated target operating system image is stored.
[0045] Through customized execution parameters, the target operating system image is generated based on the basic operating system image, which solves the problem of high threshold for making existing operating system images and makes it easier for users to make their own customized versions of operating system images.
[0046] At the same time, the generated target operating system image is stored. When an exception or failure occurs during the operating system upgrade, the upgrade operation can be continued based on the stored target operating system image without having to reconfigure all data for upgrade, thereby realizing the rollback and reset of the current exception or failure step.
[0047] In one embodiment, the above process of generating and storing the target operating system image may be completed by an operating system upgrade system.
[0048] S103: Perform an upgrade operation based on the target operating system image to obtain the target operating system.
[0049] Through step S102, the target operating system image, that is, the user-customized version of the operating system image, can be obtained, and the user-customized version of the operating system image is used to perform an upgrade operation to obtain an upgraded operating system.
[0050] In one embodiment, the above-mentioned upgrade operation based on the target operating system image can be completed by an operating system upgrade system.
[0051] The embodiment of the present application obtains the first system file, generates and stores the target operating system image based on the basic operating system image and execution parameters in the first system file; then performs an upgrade operation based on the target operating system image to obtain the target operating system. The target operating system image is generated by the first system file containing the customized system parameters, and the operating system is further upgraded, so that the user customizes the version and content of the operating system and meets the user's needs; when the upgrade process is abnormal or fails, the stored target operating system image can be directly used to continue the upgrade, without having to re-upgrade from the stage of obtaining the first system file, thereby improving the flexibility of the operating system upgrade.
[0052] In some embodiments, in step S101: a first system file is obtained, the first system file is a custom file, the first system file includes a basic operating system image and execution parameters, and the basic operating system image is used to generate a target operating system image.
[0053] The execution parameters may include command indication information, image version number indication information, file copy indication information, and environment variable information.
[0054] The command instruction information (EXECUTE) is used to specify the operating system to run the command;
[0055] The image version number indication information (TAG) is used to assign a version number to the target operating system image;
[0056] The file copy instruction information (APPEND) is used to copy executable files, scripts, documents, etc. to the operating system;
[0057] Environment variable information (ENV) is used to configure the initialization environment variables of the base operating system image.
[0058] In one embodiment, the base operating system image may be provided by an operating system image library.
[0059] In one embodiment, the file copy indication information may contain default information, and the default information may be that no operation is required.
[0060] In one embodiment, the command instruction information may be configured with operations that must be performed during the operating system upgrade process.
[0061] In some embodiments, in step S102: generating and storing a target operating system image based on a base operating system image and execution parameters, the following steps are included:
[0062] S111: Run the basic operating system image, and execute a script writing instruction to create a first script in a first shared file;
[0063] S112: copy the command instruction information to the first script;
[0064] S113: Generate and store a target operating system image based on the first script.
[0065] The first script may be an execution script, which is created and written in a first shared file in the running basic operating system image. When writing the first script, the command instruction information in the first system file is written into the first script, and a target operating system image is generated according to the written first script, and the generated target operating system image is stored.
[0066] The generated target operating system image is stored. When an exception or failure occurs during the operating system upgrade, the upgrade operation can be continued based on the stored target operating system image without having to reconfigure all data for upgrade, which can achieve rollback and reset of the current exception or failure step.
[0067] In one embodiment, the target operating system image can be stored in an operating system image library in the operating system upgrade system, so that when an abnormality or failure occurs during the operating system upgrade, the target operating system image can be pulled from the operating system image library in a timely manner, and the upgrade operation can be continued based on the pulled target operating system image.
[0068] In one embodiment, the address of the first shared file may be the running basic operating system image / share / script.
[0069] In one embodiment, the first script may be a start.sh script.
[0070] In some embodiments, before step S113: generating and storing the target operating system image based on the first script, the method further includes:
[0071] The execution condition of the first script is configured according to the preset first script execution condition.
[0072] Before the first script is executed, a condition for executing the first script may be set.
[0073] In one embodiment, the preset first script execution condition may be to execute the first script when the computer is powered on.
[0074] In some embodiments, in step S113: generating and storing a target operating system image based on the first script, the following steps may be included:
[0075] S121: based on the command instruction information in the first script, suspend the running of the basic operating system image and generate a snapshot of the basic operating system image;
[0076] S122: Based on the image version number indication information, a unique version number is assigned to the snapshot of the basic operating system image and stored to obtain a target operating system image.
[0077] After the first script is created and written, according to the command instructions in the first script, the basic operating system image is suspended, and a snapshot of the basic operating system image is generated. At the same time, a unique version number is assigned to the snapshot of the basic operating system image, and the target operating system image is obtained and stored.
[0078] Assigning a unique version number to the target operating system image can effectively prevent the target operating system image from being overwritten due to misoperation, thereby causing the target operating system image storage failure.
[0079] In one embodiment, the command instruction information in the first script may be a pause current running image (OSPACK) command.
[0080] In one embodiment, the process of storing the target operating system image can be completed by an operating system upgrade system. In the operating system upgrade system, the generated target operating system image can be set to be automatically uploaded to the operating system image library.
[0081] In some embodiments, before executing the script writing instruction in step S111 and creating the first script in the first shared file, the method may further include:
[0082] Run the basic operating system image and determine whether the execution parameters include file copy instruction information;
[0083] If it is determined that the file copy instruction information is included, the information to be copied indicated by the file copy instruction information is stored in the second shared file, and it is determined whether the execution parameter includes the environment variable information; if it is determined that the file copy instruction information is not included, it is determined whether the execution parameter includes the environment variable information;
[0084] When it is determined that the execution parameters include environment variable information, the environment variable information in the basic operating system image is configured, and the script writing instruction is executed to create the first script in the first shared file; when it is determined that the execution parameters do not include environment variable information, the script writing instruction is executed to create the first script in the first shared file.
[0085] Before executing the first script, first determine whether the execution parameters include file copy indication information. If so, copy the information indicated by the file copy indication information to the second shared file. If not, it means that there is no copyable file and no copy operation is required.
[0086] Then determine whether the execution parameters include environment variable information. If the environment variable information exists, configure the variables in the environment variable information in the running basic operating system image; if the environment variable information does not exist, no environment variable configuration operation is required.
[0087] By configuring the environment variables to prepare for the subsequent execution of the first script, it is possible to avoid repeatedly defining variables during the script execution process, thereby avoiding abnormal errors.
[0088] In one embodiment, the address of the second shared file may be the running basic operating system image / share / file.
[0089] In some embodiments, before step S103: performing an upgrade operation based on the target operating system image to obtain the target operating system, the method may further include:
[0090] Get the addresses of the environments to be upgraded for multiple hosts to be upgraded.
[0091] The existing technology can only upgrade one operating system environment, which cannot meet the needs of simultaneous upgrade of batch host operating systems in large-scale host groups or cluster modes, and the operating system upgrade efficiency is low. Based on the operating system upgrade method of the embodiment of the present application, the addresses of the environments to be upgraded of multiple hosts to be upgraded can be obtained at the same time to achieve batch synchronous upgrade of the hosts to be upgraded.
[0092] In one embodiment, the address of the environment to be upgraded of the host to be upgraded may be the IP address of the host to be upgraded.
[0093] In some embodiments, in step S103: performing an upgrade operation based on the target operating system image to obtain the target operating system, the following steps are included:
[0094] S131: Execute a script writing instruction to create a second script in the first shared file;
[0095] S132: copying the version number information and address information of the target operating system image to the second script, and storing the second script;
[0096] S133: Execute the second script to perform an upgrade operation to obtain a target operating system.
[0097] The second script may be an upgrade script. The second script is created and written in the first shared file. During the writing of the second script, the version number information and address information of the target operating system image are copied to the second script. The second script is executed to perform an upgrade operation to obtain an upgraded operating system.
[0098] In one embodiment, the second script may be an upgrade.sh script.
[0099] In some embodiments, in step S133: executing the second script to perform an upgrade operation to obtain a target operating system, including:
[0100] Push the second script to all environment addresses to be upgraded and execute the second script;
[0101] Based on the version number information and address information of the target operating system image in the second script, pull the corresponding target operating system image to the upgrade environment address of the host to be upgraded, and run the target operating system image to obtain the target operating system.
[0102] The second script is pushed to the upgrade environment address of all hosts to be upgraded and executed to achieve batch synchronous upgrade of multiple hosts to be upgraded. During the execution of the second script in each host to be upgraded, based on the version number information and address information of the target operating system image in each second script, each corresponding target operating system image is pulled to the upgrade environment address of each host to be upgraded, thereby achieving batch synchronous upgrade of multiple hosts to be upgraded.
[0103] In one embodiment, the corresponding target operating system image is pulled from an operating system image library.
[0104] In one embodiment, in the process of pulling each corresponding target operating system image to the upgrade environment address of each host to be upgraded, it may also include checking the connectivity between the current upgrade environment address and the operating system image library if the pulling fails.
[0105] In some embodiments, in step S131: executing a scripting instruction, before creating a second script in the first shared file, the method further includes:
[0106] Determine whether the target operating system image is stored successfully;
[0107] If it is determined that the target operating system image is not stored successfully, the target operating system image is stored, and the script writing instruction is executed to create a second script in the first shared file; if it is determined that the target operating system image is stored successfully, the script writing instruction is executed to create a second script in the first shared file.
[0108] Only when the target operating system image is successfully stored can the effectiveness of the rollback and reset operation be guaranteed in the event of an exception or failure during the upgrade process. The rollback and reset operation means that when an exception or failure occurs during the upgrade of the operating system, the operating system is reset to the state before the upgrade operation based on the target operating system image, and the upgrade process is rolled back to the step of obtaining the target operating system image, and the upgrade operation is continued after the stored target operating system image is re-obtained.
[0109] Before creating the second script, determine whether the target operating system image is stored successfully. If the storage is successful, execute the script writing instruction to create the second script in the first shared file. If the storage fails, return to step S113 to re-store the target operating system image.
[0110] In some embodiments, Figure 2 As shown, in step S102: generating and storing a target operating system image based on a basic operating system image and execution parameters, the following steps may be included:
[0111] S401: Determine whether a basic operating system image exists. If the basic operating system image exists, go to step S411. If not, generating the basic operating system image fails and the current process ends.
[0112] S411: Run the current basic operating system image.
[0113] S402: Determine whether the file copy indication information exists, if so, go to step S412, if not, continue the steps.
[0114] S412: Copy the file indicated by the file copy instruction information to the shared directory of the running basic operating system image / share / file, and grant permissions such as read, write, and execute to the file.
[0115] S403: Determine whether the environment variable information exists, if so, go to step S413, if not, continue the step.
[0116] S413: Configure environment variable information in the basic operating system image.
[0117] S404: Write an execution script, create a start.sh script in the running basic operating system image / share / script shared file, and copy the execution command to the start.sh script.
[0118] S405: Execute the start.sh script at startup to generate a target operating system image, and the generated target operating system image is automatically uploaded to OSHUB for storage.
[0119] In some embodiments, Figure 3 As shown, in S103: performing an upgrade operation based on the target operating system image to obtain the target operating system, the following steps may be included:
[0120] S501: Back up the target operating system image.
[0121] S502: Determine whether the target operating system image backup is successful. If successful, store the backed-up target operating system image in OSHUB; if failed, return to step S501.
[0122] S503: Generate an upgrade script upgrade.sh, in which the version number and address of the target operating system image are configured.
[0123] S504: The IP addresses of the hosts to be upgraded are obtained in batches. The hosts to be upgraded automatically obtain the upgrade script upgrade.sh. After being obtained, upgrade.sh is stored in the shared directory / share / code of the hosts to be upgraded.
[0124] S505: The host to be upgraded executes the upgrade.sh script to pull the target operating system image from the OSHUB image library.
[0125] S506: The hosts to be upgraded execute the upgrade.sh script synchronously in batches, and the environments to be upgraded of the upgraded hosts run the target operating system image. The new operating system overwrites the old system, and the current operating system upgrade is completed.
[0126] S507: Determine whether the operating system upgrade is successful. If it fails, pull the backup target operating system image from OSHUB and go to step S503. If it succeeds, continue the step.
[0127] S508: Test and use the current operating system.
[0128] Figure 4 2 is a schematic diagram of the structure of an operating system upgrade device 200 provided in an embodiment of the present application. Figure 4 As shown, the device may include a data acquisition module 210 , an execution module 220 , and an upgrade module 230 .
[0129] The acquisition module 210 is used to acquire a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters;
[0130] An execution module 220, configured to generate and store a target operating system image based on a base operating system image and execution parameters;
[0131] The upgrade module 230 is used to perform an upgrade operation based on the target operating system image to obtain the target operating system.
[0132] The embodiment of the present application obtains the first system file through the acquisition module, generates and stores the target operating system image based on the basic operating system image and execution parameters in the first system file through the execution module; and then obtains the target operating system by performing an upgrade operation based on the target operating system image through the upgrade module. The target operating system image is generated through the first system file containing the customized system parameters, and the operating system is further upgraded, so that the user customizes the version and content of the operating system and meets the user's needs; when the upgrade process is abnormal or fails, the stored target operating system image can be directly used to continue the upgrade, without having to re-upgrade from the acquisition of the first system file, thereby improving the flexibility of the operating system upgrade.
[0133] In one embodiment, the execution module 220 is also used to run the basic operating system image and execute script writing instructions to create a first script in a first shared file; copy command instruction information to the first script; and generate and store the target operating system image based on the first script.
[0134] In one embodiment, the execution module 220 is further configured to configure the execution condition of the first script according to the preset first script execution condition.
[0135] In one embodiment, the execution module 220 is further used to suspend the operation of the basic operating system image based on the command instruction information in the first script and generate a snapshot of the basic operating system image;
[0136] Based on the image version number indication information, a unique version number is assigned to the snapshot of the basic operating system image and stored to obtain the target operating system image.
[0137] In one embodiment, the operating system upgrade device 200 further includes a judgment module;
[0138] The judgment module is used to run the basic operating system image and judge whether the execution parameters include file copy indication information;
[0139] If it is determined that the file copy instruction information is included, the information to be copied indicated by the file copy instruction information is stored in the second shared file, and it is determined whether the execution parameter includes the environment variable information; if it is determined that the file copy instruction information is not included, it is determined whether the execution parameter includes the environment variable information;
[0140] When it is determined that the execution parameters include environment variable information, the environment variable information in the basic operating system image is configured, and the script writing instruction is executed to create the first script in the first shared file; when it is determined that the execution parameters do not include environment variable information, the script writing instruction is executed to create the first script in the first shared file.
[0141] In one embodiment, the acquisition module 210 is further used to acquire addresses of environments to be upgraded of multiple hosts to be upgraded.
[0142] The execution module 220 is also used to execute the script writing instruction to create a second script in the first shared file; copy the version number information and address information of the target operating system image to the second script, and store the second script; execute the second script to perform the upgrade operation to obtain the target operating system.
[0143] The upgrade module 230 is further used to push the second script to all addresses of the environments to be upgraded and execute the second script;
[0144] Based on the version number information and address information of the target operating system image in the second script, pull the corresponding target operating system image to the upgrade environment address of the host to be upgraded, and run the target operating system image to obtain the target operating system.
[0145] In one embodiment, the determination module is further used to determine whether the target operating system image is stored successfully;
[0146] If it is determined that the target operating system image is not stored successfully, the target operating system image is stored, and the script writing instruction is executed to create a second script in the first shared file; if it is determined that the target operating system image is stored successfully, the script writing instruction is executed to create a second script in the first shared file.
[0147] Figure 4 The various modules in the device shown can be implemented Figure 1 Each step in the above steps can achieve the corresponding technical effect, which will not be repeated here for the sake of brevity.
[0148] Figure 5 A schematic diagram of the hardware structure of an operating system upgrade device provided in an embodiment of the present application is shown.
[0149] The operating system upgrade device may include a processor 301 and a memory 302 storing computer program instructions.
[0150] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0151] The memory 302 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 302 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 302 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 302 is a non-volatile solid-state memory.
[0152] In certain embodiments, the memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present application.
[0153] The processor 301 implements any one of the operating system upgrade methods in the above embodiments by reading and executing computer program instructions stored in the memory 302 .
[0154] In one example, the operating system upgrade device may further include a communication interface 303 and a bus 310. Figure 5As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.
[0155] The communication interface 303 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0156] Bus 310 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 310 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0157] In addition, in combination with the operating system upgrade method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the operating system upgrade methods in the above embodiment is implemented.
[0158] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed, implements any one of the operating system upgrade methods in the above embodiments.
[0159] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0160] The functional blocks shown in the above block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0161] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0162] The above reference is to the flowchart and / or block diagram of the method, device, equipment, computer storage medium and computer program product according to the embodiment of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0163] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for upgrading an operating system, characterized in that: include: Obtaining a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters; Generate and store a target operating system image based on the base operating system image and the execution parameters; An upgrade operation is performed based on the target operating system image to obtain the target operating system.
2. The method for upgrading an operating system according to claim 1, characterized in that: The execution parameters include command instruction information; the generating and storing the target operating system image based on the basic operating system image and the execution parameters includes: Running the basic operating system image and executing a script writing instruction to create a first script in a first shared file; Copying the command instruction information to the first script; A target operating system image is generated and stored based on the first script.
3. The method for upgrading an operating system according to claim 2, characterized in that: Before generating and storing the target operating system image based on the first script, the method further includes: The execution condition of the first script is configured according to the preset first script execution condition.
4. The method for upgrading an operating system according to claim 2, characterized in that: The execution parameter also includes image version number indication information; the generating and storing the target operating system image based on the first script includes: Based on the command instruction information in the first script, suspend the operation of the basic operating system image and generate a snapshot of the basic operating system image; Based on the image version number indication information, a unique version number is assigned to the snapshot of the basic operating system image and stored to obtain a target operating system image.
5. The method for upgrading an operating system according to claim 2, characterized in that: The execution parameter also includes at least one of file copy instruction information and environment variable information; Before executing the script writing instruction and creating the first script in the first shared file, the method further includes: Running the basic operating system image, and determining whether the execution parameters include the file copy indication information; In the case where it is determined that the file copy instruction information is included, the information to be copied indicated by the file copy instruction information is stored in the second shared file, and it is determined whether the execution parameter includes the environment variable information; in the case where it is determined that the file copy instruction information is not included, it is determined whether the execution parameter includes the environment variable information; When it is determined that the execution parameters include environment variable information, the environment variable information in the basic operating system image is configured, and a script writing instruction is executed to create a first script in a first shared file; when it is determined that the execution parameters do not include environment variable information, a script writing instruction is executed to create a first script in the first shared file.
6. The method for upgrading an operating system according to claim 1, characterized in that: The target operating system image includes version number information and address information; Before performing an upgrade operation based on the target operating system image to obtain the target operating system, the method further includes: Get the addresses of the environments to be upgraded for multiple hosts to be upgraded.
7. The method for upgrading an operating system according to claim 6, characterized in that: The step of performing an upgrade operation based on the target operating system image to obtain the target operating system includes: Execute the script writing instruction to create a second script in the first shared file; Copying the version number information and address information of the target operating system image to the second script, and storing the second script; Execute the second script to perform an upgrade operation to obtain a target operating system.
8. The method for upgrading an operating system according to claim 7, characterized in that: The executing the second script to perform an upgrade operation to obtain a target operating system includes: Pushing the second script to all the addresses of the environments to be upgraded, and executing the second script; Based on the version number information and address information of the target operating system image in the second script, the corresponding target operating system image is pulled to the upgrade environment address of the host to be upgraded, and the target operating system image is run to obtain the target operating system.
9. The method for upgrading an operating system according to claim 7, characterized in that: Before executing the script writing instruction to create the second script in the first shared file, the method further includes: Determine whether the target operating system image is stored successfully; If it is determined that the target operating system image is not stored successfully, the target operating system image is stored, and a script writing instruction is executed to create a second script in the first shared file; if it is determined that the target operating system image is stored successfully, the script writing instruction is executed to create a second script in the first shared file.
10. An operating system upgrade device, characterized in that: The device comprises: An acquisition module, used to acquire a first system file, where the first system file is a custom file and includes a basic operating system image and execution parameters; An execution module, configured to generate and store a target operating system image based on the base operating system image and the execution parameters; The upgrade module is used to perform an upgrade operation based on the target operating system image to obtain the target operating system.
11. An operating system upgrade device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for upgrading the operating system as described in any one of claims 1 to 9 is implemented.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for upgrading the operating system according to any one of claims 1 to 9 is implemented.
13. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for upgrading the operating system as described in any one of claims 1 to 9.
Citation Information
Cited By
Method, system and computer-readable storage medium for upgrading container orchestration platform
TWI926744B
