A method and apparatus for private image customization

CN116048877BActive Publication Date: 2026-11-03CHINA TELECOM CLOUD TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211703652.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-11-03
Estimated Expiration
2042-12-29

AI Technical Summary

Technical Problem

Existing technologies struggle to meet users' customization needs when generating and providing images, resulting in complex and inefficient processes, especially in bare-metal environments where image customization is difficult to achieve.

Method used

Through a customized PXE environment and Agent program on a bare-metal platform, it identifies mainstream storage hardware, disk partitions, and file systems, accurately obtains system partition layout information, generates image files including squashfs format, and includes partition layout information, supporting automated image verification and generation processes.

Benefits of technology

It enables efficient image generation and verification under complex operating procedures, ensures that images run normally under the same hardware environment, reduces manual intervention, and improves the reliability and efficiency of images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116048877B_ABST
    Figure CN116048877B_ABST
Patent Text Reader

Abstract

The application provides a private image customization method and device, electronic equipment and a storage medium, relates to the technical field of IT and software development, and is applied to a bare machine system.The method comprises the following steps: in response to an image saving operation, restarting a PXE system;the PXE system identifies disk partitions and file systems of a bare machine instance;image verification is performed according to the disk partitions and the file systems;and if the image verification is passed, an image file is generated.The scheme of the application is suitable for physical machines, and the compatibility and reliability are guaranteed, a plurality of images and output formats are supported by secondary customization of the image, the image output form is flexible and optional, and the image can also be quickly deployed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of IT and software development technology, and in particular to a method, apparatus, electronic device and storage medium for customizing proprietary images. Background Technology

[0002] User images are a crucial factor. On one hand, they form the foundation for meeting users' needs for instance operating systems. Providing high-quality, secure, easy-to-use, and stable images, along with numerous options, significantly improves the user experience. On the other hand, they are an integral part of resource management; the generation, storage, and downloading of images directly impact the efficiency and quality of the entire delivery process. Furthermore, an increasing number of users have customized needs when standard user images fail to meet their requirements, further complicating image provision and processes. Currently, simplifying image provision and processes remains a challenge. Summary of the Invention

[0003] This invention provides a private image customization method, apparatus, electronic device, and storage medium. The PXE environment and Agent program customized for bare-metal platforms can identify most mainstream storage hardware, disk partitions, and file systems. It can accurately obtain system partition layout information and supports outputting various image files, including squashfs format, along with partition layout information. It can not only copy the user's partition layout but also ensure the high efficiency of application images.

[0004] To achieve the above objectives, the present invention adopts the following technical solution:

[0005] Firstly, a private image customization method is provided for use in bare-metal systems. The method includes: responding to an image save operation and restarting the PXE system; the PXE system identifying the disk partitions and file system of the bare-metal instance; performing image verification based on the disk partitions and file system; and generating an image file if the image verification passes.

[0006] As can be seen from the method described in the first aspect, the present invention restarts the PXE system in response to the image saving operation. The PXE system identifies the disk partitions and file system of the bare metal instance and performs image verification based on the disk partitions and file system. If the image verification passes, an image file is generated, thereby ensuring that even under complex operating procedures, the output user image can run normally on the same hardware environment.

[0007] In conjunction with the first aspect, in one possible design scheme, before performing image verification based on the disk partitions and the file system, the steps include: reading the partition mount configuration and executing the mounting of all partitions in the chroot tool and environment; and executing the mounting of all partitions in the chroot tool and environment.

[0008] Based on this possible design scheme, it can be seen that it can identify most mainstream storage hardware, disk partitions and file systems, and can accurately obtain system partition layout information.

[0009] In conjunction with the first aspect, in one possible design scheme, the image verification based on the disk partition and the file system includes: verifying the integrity of the target user image content, the configuration items and security configurations required by the bare-metal platform, the file system and device drivers in a chroot environment; if the verification passes, it is determined that the image can be installed and used in the same hardware environment; if the verification fails, the steps of verifying the image based on the disk partition and the file system are repeated.

[0010] Based on the possible design schemes, it is known that the reliability of the user image can be guaranteed.

[0011] In conjunction with the first aspect, in one possible design scheme, generating an image file if the image verification passes includes: copying and compressing system files and generating an image file according to a preset format if the image verification passes.

[0012] Based on the possible design schemes, it is known that it can support the output of various image files, including squashfs format, and include partition layout information. It can not only copy the user's partition layout, but also ensure the high efficiency of application images.

[0013] In conjunction with the first aspect, in one possible design scheme, the method further includes: acquiring the image file and sending the image file to an image service management platform, wherein the image service provides image download services internally; storing the image file and determining a download address based on the image file; and publishing the download address.

[0014] Based on the possible design schemes, it can be seen that this embodiment has almost no other external dependencies except for being published to an external distributed storage, requires no manual intervention, and has a high degree of automation.

[0015] In conjunction with the first aspect, in one possible design scheme, the method further includes: receiving a DHCP request and determining the IP address, lease, and system boot file name based on the DHCP request; requesting a TFTP service based on the IP address, the lease, and the system boot file name; booting the PXE system based on the feedback information from the TFTP service request; and uploading the boot image configuration to an image service via HTTP to complete image customization.

[0016] Based on possible design schemes, it can be seen that the customized PXE environment and Agent program on the bare metal platform can identify most mainstream storage hardware, disk partitions and file systems, and can accurately obtain system partition layout information.

[0017] In conjunction with the first aspect, in one possible design scheme, the method further includes: obtaining an image boot instruction; determining, based on the image boot instruction, the relevant services, drivers, and configurations corresponding to the image service in the bare metal system; and saving the image based on the relevant services, drivers, and configurations corresponding to the image service.

[0018] Based on the possible design schemes, it can be seen that the PXE environment is a temporary environment and does not have the ability to store images. The generated images will be transferred to the bare metal management platform image service, which only provides image download services internally to improve reliability.

[0019] Secondly, a private image customization device is applied to a bare-metal system. The device includes: a response module for responding to an image saving operation and restarting the PXE system; an identification module for the PXE system to identify the disk partitions and file system of the bare-metal instance; an image verification module for verifying the image based on the disk partitions and the file system; and an image file generation module for generating an image file if the image verification passes.

[0020] Furthermore, the technical effects of the private image customization device described in the second aspect can be referenced from the technical effects of the distributed caching method described in the first aspect, and will not be repeated here.

[0021] Thirdly, embodiments of the present invention provide an electronic device. The electronic device includes a processor and a memory; the memory stores a computer program, which, when executed by the processor, causes the electronic device to perform the method described in any of the implementations of the first aspect.

[0022] Fourthly, embodiments of the present invention provide a computer-readable storage medium, comprising: a computer program or instructions; when the computer program or instructions are executed on a computer, causing the computer to perform the method described in any possible implementation of the first aspect. Attached Figure Description

[0023] Figure 1 A flowchart illustrating the private image customization method provided in this embodiment of the invention;

[0024] Figure 2 A schematic diagram of the private image customization process provided in this embodiment of the invention.

[0025] Figure 3 This is a schematic diagram of system modules provided in an embodiment of the present invention;

[0026] Figure 4 This is a schematic diagram of the image export operation command interaction provided in an embodiment of the present invention;

[0027] Figure 5 This is a schematic diagram of the structure of a distributed caching device provided in an embodiment of the present invention;

[0028] Figure 6 A schematic diagram of the structure of a readable storage medium provided in an embodiment of the present invention. Detailed Implementation

[0029] The technical solution of the present invention will now be described with reference to the accompanying drawings.

[0030] In embodiments of the present invention, words such as "exemplarily," "for example," etc., are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" in the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the word "exemplary" is intended to present the concept in a concrete manner. Furthermore, in embodiments of the present invention, the meaning expressed by "and / or" can be both, or either one.

[0031] In the embodiments of this invention, the terms "image" and "picture" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent. Similarly, the terms "of," "corresponding (relevant)," and "corresponding" may sometimes be used interchangeably. It should be noted that, without emphasizing the distinction between them, their intended meanings are consistent.

[0032] The image customization process is complex, prone to errors, and cumbersome in its verification, generally requiring significant manual intervention. Furthermore, compared to virtual machine services, providing private image customization for bare metal platforms is more challenging and more susceptible to serious issues caused by missing drivers or misconfigurations. Building upon the current stable and reliable bare metal platform infrastructure, and by fully utilizing management service capabilities, network capabilities, and storage capacity, this patent proposes a feasible, reliable, and verifiable method for customizing private images on a bare metal platform. This method will provide platform users with reliable services such as private image customization, image uploading and publishing, and platform deployment, with the main processes initiated and automatically completed by the user on the platform.

[0033] Therefore, in order to overcome the above-mentioned defects, embodiments of the present invention provide a private image customization method, device, electronic device, and readable storage medium. Through the solution of the present invention, the PXE environment and Agent program customized for the bare metal platform can identify most mainstream storage hardware, disk partitions and file systems, accurately obtain system partition layout information, support output of various image files including squashfs format, and include partition layout information. It can not only copy the user's partition layout, but also ensure the high efficiency of application images.

[0034] Please see Figure 1 , Figure 1 This is a flowchart illustrating a distributed caching method provided in an embodiment of the present invention. This method can be executed by an electronic device with processing capabilities, such as a server or cloud server, without specific limitations. The method is applied to a distributed hierarchical caching system, and specifically includes steps 210 to 240.

[0035] Step 210: Respond to the image save operation and restart the PXE system.

[0036] Step 220: The PXE system identifies the disk partitions and file system of the bare metal instance.

[0037] Step 230: Perform image verification based on the disk partition and the file system.

[0038] Step 240: If the image verification passes, an image file is generated.

[0039] In some embodiments, such as Figure 4 As shown, a stable and reliable method for customizing private images is proposed. This method mainly includes the following steps:

[0040] S1, the user calls the bare metal management platform API to create a bare metal instance containing the base image of the target image;

[0041] S2, the user executes a customization process, in which the user adds relevant services, drivers, configurations and other changes according to their own needs, which can be completed by an automated script;

[0042] S3, User image customization is complete, and the user triggers the image save operation;

[0043] S4, the bare-metal instance performs a reboot operation and enters the PXE system state. The special feature of this PXE image is that, in addition to containing the environment for a normal boot system, it includes an Agent program capable of executing a series of operational commands (such as...). Figure 3 ) and a set of tools that work in conjunction with instructions;

[0044] S5, the PXE system identifies the user's bare metal instance disk partitions and file systems, reads the partition mount configurations contained in / etc / fstab, and executes the mount of all partitions in the chroot tool and environment;

[0045] S6, the image verification program, in a chroot environment, verifies the integrity of the target user image content and the configuration items required by the bare-metal platform (such as serial port, kernel parameters, etc.), security configuration, file system, and device drivers. If the verification is successful, it means that the user image can be installed and used in the same hardware environment; otherwise, the process cannot guarantee the reliability of the user image.

[0046] S7 outputs a user image based on the settings for the output user image format. The output format can be squashfs (default), qcow2, raw, etc. At the same time, it will generate a partition layout file based on the current mount status. This file will retain the user system partition scheme and apply it to the installation of the new instance.

[0047] The S8 PXE environment is a temporary environment and does not have the ability to store images; the generated images will be transferred to the bare metal management platform image service, which only provides image download services internally.

[0048] After receiving the user's image, the S9 image service will synchronously upload it to object storage services such as S3 and provide the user with a download address;

[0049] S10 allows users to rename the target image and configure it on the bare metal management platform for subsequent verification and application.

[0050] This embodiment has the following beneficial effects: 1. The PXE environment and Agent program customized for the bare metal platform can identify most mainstream storage hardware, disk partitions and file systems, and can accurately obtain system partition layout information;

[0051] 2. Supports outputting various image files, including squashfs format, with partition layout information. It can not only copy the user's partition layout, but also ensure the high efficiency of application images.

[0052] 3. The introduction of automated verification processes can ensure that even under complex operating procedures, the output user images can run normally on the same hardware environment;

[0053] 4. The core processes throughout the entire procedure can be automated by executing commands.

[0054] This invention restarts the PXE system in response to an image save operation. The PXE system identifies the disk partitions and file system of the bare metal instance and performs image verification based on the disk partitions and file system. If the image verification passes, an image file is generated, thereby ensuring that even under complex operating procedures, the output user image can run normally on the same hardware environment.

[0055] For example, Figure 5 This is a schematic diagram of the private image customization device provided in an embodiment of the present invention. Figure 5 As shown, the distributed caching device 600 includes: a response module 610, an identification module 620, an image verification module 630, and an image file generation module 640.

[0056] Specifically, the response module 610 is used to respond to the image saving operation and restart the PXE system; the identification module 620 is used for the PXE system to identify the disk partitions and file system of the bare metal instance; the image verification module 630 is used to perform image verification based on the disk partitions and the file system; and the image file generation module 640 is used to generate an image file if the image verification passes.

[0057] Furthermore, before performing image verification based on the disk partitions and the file system, the process includes: retrieving the partition mount configuration and mounting all partitions in the chroot tool and environment; and mounting all partitions in the chroot tool and environment.

[0058] Furthermore, the image verification based on the disk partition and the file system includes: verifying the integrity of the target user image content, the configuration items and security configurations required by the bare metal platform, the file system and device drivers in a chroot environment; if the verification passes, it is determined that the image can be installed and used in the same hardware environment; if the verification fails, the steps of verifying the image based on the disk partition and the file system are repeated.

[0059] Furthermore, the step of generating an image file if the image verification passes includes: copying and compressing system files and generating an image file according to a preset format if the image verification passes.

[0060] Furthermore, the device further includes: acquiring the image file and sending the image file to an image service management platform, wherein the image service provides image download services internally; storing the image file and determining a download address based on the image file; and publishing the download address.

[0061] Furthermore, the device further includes: receiving a DHCP request and determining an IP address, a lease, and a system boot file name based on the DHCP request; requesting a TFTP service based on the IP address, the lease, and the system boot file name; guiding PXE startup based on the feedback information from the TFTP service request; and uploading the boot image configuration to an image service via HTTP to complete image customization.

[0062] Furthermore, the device further includes: acquiring an image boot command; determining, according to the image boot command, the relevant services, drivers, and configurations corresponding to the image service in the bare metal system; and saving the image according to the relevant services, drivers, and configurations corresponding to the image service.

[0063] For ease of explanation, Figure 5 Only the main components of the proprietary mirror customization device 600 are shown.

[0064] Furthermore, the technical effects of the private image customization device 600 can be referenced from the technical effects of any of the aforementioned private image customization methods, and will not be elaborated here.

[0065] Optionally, embodiments of the present invention also provide a computer-readable storage medium, which includes a computer program or instructions that, when executed on a computer, cause the private image customization method or training method provided in any embodiment of the present invention to be executed.

[0066] Optionally, embodiments of the present invention also provide an electronic device for executing the private image customization method and apparatus provided in any embodiment of the present invention.

[0067] like Figure 6 As shown, electronic device 2000 may include processor 2001.

[0068] Optionally, the electronic device 2000 may also include a memory 2002 and / or a transceiver 2003.

[0069] The processor 2001 is coupled to the memory 2002 and the transceiver 2003, which can be connected via a communication bus.

[0070] The following is combined with Figure 6 A detailed introduction to each component of the electronic device 2000:

[0071] The processor 2001 is the control center of the electronic device 2000. It can be a single processor or a collective term for multiple processing elements. For example, the processor 2001 can be one or more central processing units (CPUs), application-specific integrated circuits (AICs), or one or more integrated circuits configured to implement embodiments of the present invention, such as one or more digital signal processors (DPs), or one or more field-programmable gate arrays (FPGAs).

[0072] Optionally, the processor 2001 can perform various functions of the electronic device 2000 by running or executing software programs stored in the memory 2002 and calling data stored in the memory 2002.

[0073] In a specific implementation, as one example, the processor 2001 may include one or more CPUs, for example... Figure 6 CPU0 and CPU1 are shown in the diagram.

[0074] In a specific implementation, as one example, the electronic device 2000 may also include multiple processors, for example... Figure 6 The processors 2001 and 2004 are shown. Each of these processors can be a single-core processor or a multi-core processor. Here, "processor" can refer to one or more devices, circuits, and / or processing cores used to process data (e.g., computer program instructions).

[0075] The memory 2002 is used to store the software program that executes the present invention, and is controlled by the processor 2001 to execute it. The specific implementation method can be referred to the above method embodiment, and will not be repeated here.

[0076] Optionally, the memory 2002 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. The memory 2002 may be integrated with the processor 2001 or may exist independently and be accessible through the interface circuit of the electronic device 2000. Figure 6 (Not shown in the figure) is coupled to processor 2001, and the embodiments of the present invention do not specifically limit this.

[0077] Transceiver 2003 is used for communication with other electronic devices. For example, if electronic device 2000 is a smartphone, transceiver 2003 can be used to communicate with network devices or with another terminal device. As another example, if electronic device 2000 is a network device, transceiver 2003 can be used to communicate with a terminal device or with another network device.

[0078] Alternatively, transceiver 2003 may include a receiver and a transmitter. Figure 6 (Not shown separately). The receiver is used to implement the receiving function, and the transmitter is used to implement the sending function.

[0079] Optionally, the transceiver 2003 can be integrated with the processor 2001, or it can exist independently and be connected via the interface circuit of the electronic device 2000. Figure 6 (Not shown in the figure) is coupled to processor 2001, and the embodiments of the present invention do not specifically limit this.

[0080] It should be noted that, Figure 6 The structure of the electronic device 2000 shown does not constitute a limitation on the electronic device. Actual electronic devices may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0081] It should be understood that the processor in the embodiments of the present invention can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DP), application-specific integrated circuits (AIC), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.

[0082] The above embodiments can be implemented, in whole or in part, by software, hardware (such as circuits), firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more sets of available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. A semiconductor medium can be a solid-state drive.

[0083] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0084] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0085] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0086] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0087] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for customizing private images, characterized in that, Applied to bare-metal systems, the method includes: In response to the image save operation, restart the bare metal instance and enter the PXE system; The PXE system can identify the disk partitions and file systems of a bare-metal instance; Read the partition mount configuration and execute the mount of all partitions in the chroot tool and environment; Mount all partitions using the chroot tool and environment; Image verification is performed based on the disk partitions and the file system, including: In the chroot environment, the integrity of the target user image content, the configuration items and security configurations required by the bare metal platform, and the file system and device drivers are verified. If the verification passes, it is determined that the image can be installed and used in the same hardware environment; If the verification fails, repeat the steps of image verification based on the disk partition and the file system; If the image verification passes, an image file is generated, and a partition layout file is generated based on the current mount status.

2. The method according to claim 1, characterized in that, If the image verification passes, generating the image file includes: If the image verification passes, the system files are copied, compressed, and an image file is generated according to a preset format.

3. The method according to any one of claims 1-2, characterized in that, The method further includes: The image file is obtained and sent to the image service management platform, which provides image download services internally. The image file is stored, and the download address is determined based on the image file; The download link will be published.

4. The method according to any one of claims 1-2, characterized in that, The method further includes: Receive DHCP requests and determine the IP address, lease, and system boot file name based on the DHCP requests; Request TFTP service based on the IP address, the lease name, and the system boot file name; PXE is started based on the feedback information from the TFTP service request; Upload the startup image configuration to the image service via HTTP to complete the image customization.

5. The method according to claim 4, characterized in that, The method further includes: Obtain the image boot command; Based on the image boot command, the relevant services, drivers, and configurations corresponding to the image service are determined in the bare metal system. The image is saved according to the relevant services, drivers, and configurations corresponding to the image service.

6. A private mirror customization device, characterized in that, Applied to a bare-metal system, for executing a private image customization method as described in any one of claims 1-5, the apparatus includes: The response module is used to respond to image save operations and restart the PXE system; The identification module is used by the PXE system to identify the disk partitions and file systems of a bare-metal instance; The image verification module is used to perform image verification based on the disk partition and the file system. The image file generation module is used to generate an image file if the image verification passes.

7. An electronic device, characterized in that, include: Processors, each of which is coupled to a memory; The processor is configured to execute a computer program stored in the memory, causing the electronic device to perform the private image customization method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a computer program or instructions that, when executed on a computer, cause the private image customization method as described in any one of claims 1-5 to be performed.

Citation Information

Patent Citations

  • Deployment method and device of physical bare machine, electronic device and storage medium of physical bare machine

    CN109388475A

  • Operating system customization method, batch deployment method and batch deployment system

    CN110825392A