Bare metal mirror image manufacturing method, device, equipment and medium

Through the method of creating mirrors in stages, the cumbersome problem of naked metal mirroring in the existing technology is solved, and efficient mirroring and simplified configuration process is achieved.

CN119806557APending Publication Date: 2025-04-11CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411773934.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The process of making bare metal mirrors in the prior art is cumbersome, resulting in multiple steps required for each repetition of mirrors, which is inefficient.

Method used

The method of creating mirrors in stages is adopted. First, the initial system image is installed in the virtual machine and the intermediate image is generated. Then, the bare metal configuration is performed in the initial operating system environment and converted into a bare metal image file.

Benefits of technology

By creating mirrors in stages, the time of repetitive mirroring is saved, the production efficiency of bare metal mirroring is improved, and the mirror configuration process is simplified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806557A_ABST
    Figure CN119806557A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of computers, and discloses a bare metal mirror image manufacturing method and device, equipment and a medium, and the method comprises the steps: obtaining an initial system mirror image file, and creating a virtual machine; starting the virtual machine in the pre-installed system environment, and installing the initial operating system to the virtual machine according to the initial system mirror image file; closing the virtual machine; copying a system file in the virtual machine, and saving the system file as an intermediate mirror image; starting the virtual machine in the initial operating system environment, and performing bare metal configuration on the initial operating system; and converting the operating system after bare metal configuration into a first bare metal mirror image file. According to bare metal configuration and user-defined configuration, the mirror image in the middle stage can be repeatedly utilized, mirror image modification is carried out on the basis of the middle mirror image, the time for repeatedly manufacturing the mirror image is saved, and the manufacturing efficiency of the bare metal mirror image is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a bare metal image production method, device, equipment and medium. Background Art

[0002] Bare metal images are designed for bare metal servers. They do not contain a virtualization layer and run directly on the physical hardware of bare metal servers. At present, the common method of making bare metal images is to obtain a specified ISO format image file from a CD, USB flash drive or the network, and install the initial operating system on a physical machine or virtual machine through the ISO format image file. The installed initial operating system cannot be directly used for bare metal servers, and necessary drivers, software packages, etc. need to be configured. Therefore, users often configure the necessary drivers and software packages through manual commands, or configure the necessary drivers and software packages into automatic installation tools through automatic installation technologies such as kickstart, and automatically configure the necessary drivers and software packages by running the automatic installation tools. At this time, the configured operating system is converted into a format to obtain the bare metal image file. However, for some reasons, bare metal images often need to be made repeatedly. The above method of making bare metal images is too cumbersome, and too many steps need to be repeated each time the image is made, resulting in low efficiency in image making. Summary of the invention

[0003] In view of this, the present invention provides a bare metal image production method, device, equipment and medium to solve the problem of tedious production of bare metal images multiple times.

[0004] In a first aspect, the present invention provides a bare metal image production method, the method comprising: obtaining an initial system image file and creating a virtual machine; starting the virtual machine in a preinstalled system environment, and installing an initial operating system to the virtual machine according to the initial system image file; shutting down the virtual machine; copying system files in the virtual machine and saving them as an intermediate image; starting the virtual machine in the initial operating system environment, and performing bare metal configuration on the initial operating system; converting the bare metal configured operating system into a first bare metal image file.

[0005] In some optional implementations, the method further includes: starting the virtual machine through the intermediate image; performing bare metal configuration on the operating system of the intermediate image; and converting the bare metal configured operating system into a second bare metal image file.

[0006] In some optional implementations, the method further includes: custom configuring the bare metal configured system through the user-defined configuration script; and converting the custom configured operating system into a third bare metal image file.

[0007] In some optional implementations, installing the initial operating system on the virtual machine according to the initial system image file includes: installing the initial operating system on the virtual machine through an automatic installation tool; and injecting an SSH public key into the virtual machine through the automatic installation tool after the installation is complete.

[0008] In some optional implementations, the virtual machine is started in the initial operating system environment, and the initial operating system is bare-metal configured, including: starting the virtual machine in the initial operating system environment and obtaining the IP address of the virtual machine; sending an SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key; establishing SSH communication with the host machine when the verification passes; and sending a bare-metal configuration script to the virtual machine through the SSH channel, so that the virtual machine performs bare-metal configuration according to the bare-metal configuration script.

[0009] In some optional implementations, the custom configuration of the bare metal configured system through the user-defined configuration script includes: starting the virtual machine in the initial operating system environment and obtaining the IP address of the virtual machine; sending the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key; establishing SSH communication with the host machine when the verification passes; sending the user-defined configuration script to the virtual machine through the SSH channel, so that the virtual machine is custom configured according to the user-defined configuration script.

[0010] In some optional implementations, starting the virtual machine in the initial operating system environment and performing bare metal configuration on the initial operating system also includes: starting the virtual machine in the initial operating system environment; inserting a bare metal configuration script into the virtual machine through a virtual machine customization tool, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

[0011] In a second aspect, the present invention provides a bare metal image production device, the device comprising: an image acquisition module, used to obtain an initial system image file and create a virtual machine; an initial system installation module, used to start the virtual machine in a preinstalled system environment, and install the initial operating system to the virtual machine according to the initial system image file; a virtual machine shutdown module, used to shut down the virtual machine; an intermediate image production module, used to copy the system files in the virtual machine and save them as an intermediate image; a bare metal configuration module, used to start the virtual machine in the initial operating system environment, and perform bare metal configuration on the initial operating system; a bare metal image generation module, used to convert the bare metal configured operating system into a first bare metal image file.

[0012] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, wherein the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes any one of the methods described in the first aspect by executing the computer instructions.

[0013] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, wherein the computer instructions are used to enable a computer to execute any one of the methods described in the first aspect.

[0014] The technical solution provided by the present invention has the following advantages:

[0015] The embodiment of the present invention provides a method for making an image in stages, which divides the process of making a bare metal image into two stages. In the first stage, only the initial system image is installed to the virtual machine, and then the installed system is integrated into a new image file, and the image of the intermediate stage is cached. If the installation process of the initial system image does not change, the intermediate image does not need to be regenerated, and the bare metal configuration and custom configuration performed at any other time can reuse the image of the intermediate stage, and the image is modified based on the intermediate image, which saves the time of repeated image production and improves the production efficiency of the bare metal image. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 is a schematic flow chart of a bare metal image manufacturing method according to an embodiment of the present invention;

[0018] Figure 2 is another flow chart of a bare metal image manufacturing method according to an embodiment of the present invention;

[0019] Figure 3 is a structural schematic diagram of a bare metal image production device according to an embodiment of the present invention;

[0020] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0022] Bare metal images are designed for bare metal servers. They do not contain a virtualization layer and run directly on the physical hardware of bare metal servers. At present, the common method of making bare metal images is to obtain a specified ISO format image file from a CD, USB flash drive or the Internet, and install the initial operating system on a physical machine or virtual machine through the ISO format image file. The installed initial operating system cannot be directly used for bare metal servers, and necessary drivers, software packages, etc. need to be configured. Therefore, users often configure the necessary drivers and software packages through manual commands, or configure the necessary drivers and software packages into the automatic installation tool through automatic installation technologies such as kickstart, and automatically configure the necessary drivers and software packages by running the automatic installation tool. At this time, the configured operating system is converted into a format to obtain the bare metal image file.

[0023] However, there are some reasons that often require repeated bare metal images. For example, one scenario is that as the hardware is updated, the corresponding drivers in the image must also be continuously updated, so the image often needs to be repeated. Another scenario is that the initial operating system is installed in a simple preinstallation system environment (Preinstallation Environment, PE), and the initial operating system is actually configured in a simple preinstallation system environment. In the end, the bare metal server is required to be able to run the bare metal image system, so the configured driver also needs to be able to run in the bare metal image corresponding system environment. Because the bare metal image corresponding system environment is inconsistent with the preinstallation system environment, the conventional solution uses automatic installation technologies such as kickstart to configure the necessary drivers and software packages in the preinstallation system environment. The kickstart automatic configuration script is easy to write errors, so the bare metal image configured in the simple preinstallation system environment is likely to be wrong, and finally cannot be run in the bare metal server, resulting in repeated re-production.

[0024] In addition, there are some other problems with the current bare metal image production method. For example, when a user requires to upgrade the kernel of a bare metal image, when compiling and installing the driver in a simple pre-installed system environment, most drivers are compiled by default for the kernel of the pre-installed system environment currently in use, not for the bare metal image kernel upgraded by the user. In order to ensure that these driver programs are compiled accurately, some driver programs can specify which kernel to compile for by passing command parameters or setting environment variables, but some drivers obtain the kernel version through methods such as the uname command. At this time, it is often necessary to overwrite the default uname command or modify the script for compiling the driver to specify which kernel to compile for. This operation method is very troublesome.

[0025] In order to solve the above problems, the present invention provides a new bare metal mirror manufacturing method.

[0026] According to an embodiment of the present invention, an embodiment of a bare metal image production method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0027] In this embodiment, a bare metal image production method is provided, which can be used in a host machine. Figure 1 is a flow chart of a bare metal image manufacturing method according to an embodiment of the present invention, the process includes the following steps:

[0028] Step S101, obtaining an initial system image file and creating a virtual machine;

[0029] Step S102, starting the virtual machine in the preinstalled system environment, and installing the initial operating system to the virtual machine according to the initial system image file;

[0030] Step S103, shutting down the virtual machine;

[0031] Step S104, copying the system files in the virtual machine and saving them as an intermediate image;

[0032] Step S105, starting the virtual machine in the initial operating system environment, and performing bare metal configuration on the initial operating system;

[0033] Step S106, converting the bare metal configured operating system into a first bare metal image file.

[0034] The bare metal image production method provided by the present invention includes two stages, namely, the system installation stage and the modification stage. The system installation stage refers to obtaining the initial system image file in ISO format from a CD, a USB flash drive, a network, etc., and installing the file in a virtual machine or a physical machine.

[0035] The initial system image file is the image before bare metal configuration. The processing of this step is the same as that of the related technology. The initial operating system can be automatically installed for the virtual machine through automatic installation tools such as kickstart and preseed. The installation environment is performed in the preinstalled system environment.

[0036] Kickstart and preseed are used to configure some automatic operations for system installation, thus saving users the steps of manually selecting some system installation options.

[0037] In the embodiment of the present invention, the initial system image file is first installed into a virtual machine so that the first stage is ended when the virtual machine is shut down. At the same time, an intermediate image can be easily created using the system files of the virtual machine. This process is not convenient for operation on a physical machine, and multiple virtual machines can be created. Creating multiple intermediate images at the same time can also improve the efficiency of image production.

[0038] The significance of this technical means is that it is usually time-consuming to install the operating system using ISO format files (about tens of minutes), but it is actually less error-prone. Therefore, as long as the automatic installation tool does not modify the configuration during the system installation phase, there is no need to repeatedly create the intermediate image.

[0039] Furthermore, because many problems often occur in steps such as compiling and installing drivers and configuring the system, the embodiment of the present invention divides the image production process into two stages, caches the intermediate image obtained by the ISO installation system in the first stage, and then only debugs the script for the intermediate image in the modification stage, which can save a lot of time and improve the efficiency of image production.

[0040] Based on this, the embodiment of the present invention saves the created intermediate image separately in a storage location, and then starts the virtual machine based on the intermediate image. At this time, the operating environment of the virtual machine is no longer the pre-installed system environment, but the initial operating system environment. In this environment, the user performs bare metal configuration on the initial operating system, and then performs other operations such as extracting the image production log, verifying the image integrity, deleting redundant image data, converting the image format, etc. on the bare metal configured operating system, thereby obtaining the first bare metal image file.

[0041] Through the technical solution provided by the embodiment of the present invention, in the first stage, only the initial system image is installed to the virtual machine, and then the installed system is integrated into a new image file, and the image of the intermediate stage is cached. If the installation process of the initial system image does not change, the intermediate image does not need to be regenerated, and the bare metal configuration and custom configuration performed at any other time can reuse the image of the intermediate stage. On this basis, the driver and software package of the bare metal configuration do not need to be written in automatic installation tools such as kickstart and preseed, but the image is modified on the basis of the intermediate image after the virtual machine is restarted, saving the time of repeated image production and improving the production efficiency of the bare metal image. In addition, because the bare metal configuration is performed after the virtual machine is restarted, the bare metal configuration is performed in the initial operating system environment. When compiling the driver, it is defaulted to the latest kernel for compilation, rather than defaulting to the kernel compilation of the pre-installed system environment. There is no need to perform operations such as kernel selection, which saves a lot of cumbersome image configuration tasks.

[0042] In some optional implementations, the bare metal mirror manufacturing method provided by the present invention further includes:

[0043] Step a1, starting the virtual machine through the intermediate image;

[0044] Step a2, performing bare metal configuration on the operating system of the intermediate image;

[0045] Step a3: convert the bare metal configured operating system into a second bare metal image file.

[0046] Specifically, when the bare metal image needs to be remade due to hardware driver upgrades or other reasons, there is no need to install the ISO file of the initial operating system to the virtual machine again. You only need to extract the previously saved intermediate image, start the virtual machine through the intermediate image, and then perform bare metal configuration on the operating system of the intermediate image to obtain the remade second bare metal image file, which significantly improves the production efficiency of bare metal images.

[0047] In some optional implementations, the bare metal mirror manufacturing method provided by the present invention further includes:

[0048] Step a4, customizing the bare metal configured system through a user-defined configuration script;

[0049] Step a5: convert the customized operating system into a third bare metal image file.

[0050] Specifically, when the user has some customized requirements for the bare metal image, the present invention can customize the bare metal configured system again through the user customized configuration script based on the bare metal configuration, thereby obtaining a third bare metal image file. This process can also reuse the intermediate files generated by the first image production, which can significantly improve the image production efficiency.

[0051] In some optional implementations, the above step S102 includes:

[0052] Step b1, installing the initial operating system into the virtual machine through an automatic installation tool;

[0053] Step b2: After the installation is complete, use the automatic installation tool to inject the SSH public key into the virtual machine.

[0054] In some optional implementations, the above step S105 includes:

[0055] Step c1, start the virtual machine in the initial operating system environment and obtain the IP address of the virtual machine;

[0056] Step c2, sending the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key;

[0057] Step c3, establishing SSH communication with the host machine when verification passes;

[0058] Step c4: Send the bare metal configuration script to the virtual machine through the SSH channel, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

[0059] Specifically, SSH (Secure Shell) is a protocol for secure remote login and other secure network services on an insecure network. In order to modify the image in the virtual machine after restart, an SSH server can be installed on the virtual machine, and then the host machine can be connected to the virtual machine through the SSH client to realize the communication between the virtual machine and the host machine, so that the host machine can send the bare metal configuration script to the virtual machine, and the virtual machine can configure the corresponding driver and software package by executing the bare metal configuration script. Through this scheme, a script for automatically configuring the bare metal image of the host machine is transmitted to the virtual machine, and then the virtual machine is made to run the script to automatically configure the bare metal image, which also saves a lot of manual configuration steps and improves the efficiency of image configuration. Among them, the SSH public key and the SSH private key are a pair of keys generated in pairs, which are used to encrypt and decrypt data to ensure the security of communication. The SSH public key is a key that can be shared publicly and is used to encrypt information or verify digital signatures. Anyone can obtain the public key, but only the person holding the corresponding private key can decrypt the information or verify the signature. The SSH public key is used to be placed on one side of the virtual machine. The SSH private key is a key that must be kept confidential. It is used to decrypt information or create digital signatures. The private key can only be kept by the key holder and cannot be made public. The SSH private key is stored in the host. The host creates a digital signature through the SSH private key and sends the digital signature and the bare metal configuration script to the virtual machine. The virtual machine verifies the digital signature with the SSH public key to determine the security of communication with the host, and then uses the bare metal configuration script to perform automatic configuration.

[0060] In some optional implementations, the above step a4 includes:

[0061] Step d1, starting the virtual machine in the initial operating system environment and obtaining the IP address of the virtual machine;

[0062] Step d2, sending the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key;

[0063] Step d3, establishing SSH communication with the host machine when verification passes;

[0064] Step d4, sending the user-defined configuration script to the virtual machine through the SSH channel, so that the virtual machine is customized according to the user-defined configuration script.

[0065] Specifically, the principle of customizing the system according to user needs in the embodiment of the present invention is the same as the process of bare metal configuration mentioned above. Please refer to the relevant description of the above embodiment and will not be repeated here.

[0066] In particular, there can be multiple stages for modifying an image, and different methods can be used in each stage as needed. For example, if there is a time-consuming but less variable part in the operation of modifying an image, this part can be put into a separate stage to save time for subsequent image production.

[0067] In some optional implementations, the above step S105 further includes:

[0068] Step e1, starting the virtual machine in the initial operating system environment;

[0069] Step e2: insert the bare metal configuration script into the virtual machine through the virtual machine customization tool, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

[0070] Specifically, in another implementation, in addition to the SSH configuration path, the image can also be modified through the virtual machine customization tool virt-customize, and the basic method is similar. virt-customize is a tool for virtual machine customization, which provides many command line options, such as uploading a customized image to a virtual machine and modifying a virtual machine system image. Therefore, virt-customize can also copy the bare metal configuration script to the image, and then use virt-customize to execute the script.

[0071] Compared with using the SSH method to modify the image, virt-customize does not need to obtain the virtual machine IP, which is simpler and faster. However, the program running environment similar to chroot provided by virt-customize is different from the simulated environment executed by the virtual machine itself. For example, in the virt-customize environment, uname returns the information of the host machine instead of the system information in the image. Therefore, virt-customize may be more cumbersome to install certain drivers and requires more steps. Based on this, when no large-scale modifications are made to the driver, the image can be modified based on the virtual machine customization tool virt-customize in the second stage provided in the embodiment of the present invention. If a large number of driver configurations are involved, the SSH method can be used, and the specific technical means can be flexibly selected according to user needs.

[0072] To facilitate the understanding of the scheme, Figure 2As shown, in a complete specific application embodiment, this embodiment is a project that applies the fully automatic phased plugin mode Linux and Windows bare metal image production method provided by the embodiment of the present invention, and the target images are CentOS-7.9-standard (standard bare metal image) and CentOS-7.9-private (bare metal image customized by the user based on the CentOS-7.9 standard image). The specific work content of the original project does not limit this embodiment, so it will not be repeated. The bare metal image production method provided by the present invention includes the following steps:

[0073] 1. CentOS-7.9-standard image production process:

[0074] A01. The host machine downloads the initial system image file in ISO format and checks the image integrity by verifying the MD5.

[0075] A02. After installing the initial operating system in the virtual machine based on the kickstart automatic installation method, shut down the virtual machine, use the kickstart automatic installation configuration file to use a script to inject an SSH public key into the virtual machine after installation, and then save the virtual machine system files as an intermediate image.

[0076] A03. Copy the above intermediate image to the CentOS-7.9-standard target image folder, automatically restart the virtual machine, and obtain the virtual machine IP.

[0077] A04. Use the corresponding SSH private key to connect to the virtual machine, copy the bare metal configuration script for bare metal related configuration to the virtual machine, and execute the script.

[0078] A05. Extract the log of image creation (to check whether the image is correct and locate the step where the error occurred), verify the image (verify the integrity and legality of the image), delete the SSH public key used to modify the image in the image, convert the image format (the configured virtual machine image needs to be converted to squashfs, raw, qcow2 and other formats that can be installed on the bare metal server), perform other image content cleanup operations, and complete the creation of the CentOS-7.9-standard image.

[0079] CentOS-7.9-private image production process:

[0080] B01. Copy the above intermediate image to the CentOS-7.9-private target image folder, automatically start the virtual machine, and obtain the virtual machine IP.

[0081] B02. Use the corresponding SSH private key to connect to the virtual machine, copy the bare metal related configuration scripts and the user-defined related user configuration scripts to the virtual machine, and execute the scripts.

[0082] B03. Extract the log of image creation, verify the image, delete the image content cleanup operations used to modify the image ssh public key, convert the image format, and complete the creation of the CentOS-7.9-private image.

[0083] In this embodiment, by adopting the bare metal image automation production method in stages, in the CentOS-7.9-standard image production process, the initial operating system downloaded is first installed in the virtual machine using the kickstart automatic installation method, and the SSH public key required in the subsequent stage is injected and saved as an intermediate image. Under normal circumstances, the system installation rarely goes wrong, and the configuration and modification system are more variable due to script errors, modification requirements and other reasons, and it is necessary to make images multiple times. In the image production process, as long as the kickstart automatic installation configuration file is not modified, this intermediate image can be reused all the time, and there is no need to repeatedly install the operating system. Subsequently, the bare metal related configuration script is copied to the virtual machine, the script is executed through SSH, and then the log of the image production, the verification image, the conversion of the image format and other image content cleaning operations are extracted. If you encounter problems during the script execution process, you can manually configure the virtual machine through SSH connection, and modify the script, and then remake the target image on the basis of the intermediate image.

[0084] In the process of making the CentOS-7.9-private image, the intermediate image of the CentOS-7.9-standard standard image is used as the intermediate image of CentOS-7.9-private, which saves a lot of time. In the subsequent stage, relevant scripts are added according to the configuration required by the bare metal, and user-defined configuration scripts are added according to the configuration required by the user. This process reuses the bare metal configuration script, and only a small number of scripts need to be written according to user needs (upgrade driver, network card configuration, etc.). This solution reduces the workload and shortens the image production cycle.

[0085] The technical solution provided by the embodiment of the present invention has the following advantages:

[0086] 1. Create images in stages, cache the results of the previous stage, and save time on repeated image creation.

[0087] 2. Different images can share the results of the previous stage and execute differentiated scripts in subsequent stages, saving image production time.

[0088] 3. There are many ways to modify the image, such as using virt-customize or SSH to modify the image. The flexible way to modify the image can simplify the creation of the image. The specific advantages include simplifying the writing of scripts such as compiling and installing drivers when upgrading the kernel; when an error occurs during the SSH image modification stage, you can manually SSH into the virtual machine to check the cause of the error. Speed ​​up the process of "manually trying to modify → writing automation scripts → testing scripts".

[0089] The above are preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the principle and implementation scope of the present invention should be included in the protection scope of the present invention.

[0090] In this embodiment, a bare metal image production device is also provided, which is used to implement the above embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0091] This embodiment provides a bare metal mirror manufacturing device, such as Figure 3 As shown, including:

[0092] Image acquisition module 301, used to acquire the initial system image file and create a virtual machine;

[0093] The initial system installation module 302 is used to start the virtual machine in the pre-installed system environment and install the initial operating system to the virtual machine according to the initial system image file;

[0094] A virtual machine shutdown module 303 is used to shut down the virtual machine;

[0095] The intermediate image making module 304 is used to copy the system files in the virtual machine and save them as an intermediate image;

[0096] The bare metal configuration module 305 is used to start the virtual machine in the initial operating system environment and perform bare metal configuration on the initial operating system;

[0097] The bare metal image generation module 306 is used to convert the bare metal configured operating system into a first bare metal image file.

[0098] In some optional embodiments, the device further comprises:

[0099] A first restart module, used to start the virtual machine through the intermediate image;

[0100] A second bare metal configuration module is used to perform bare metal configuration on the operating system of the intermediate image;

[0101] The second bare metal image generation module is used to convert the bare metal configured operating system into a second bare metal image file.

[0102] In some optional embodiments, it also includes:

[0103] The custom configuration module is used to customize the bare metal configured system through user-defined configuration scripts;

[0104] The third bare metal image generation module is used to convert the custom configured operating system into a third bare metal image file.

[0105] In some optional implementations, the initial system installation module 302 includes:

[0106] An automatic installation unit, used for installing an initial operating system into the virtual machine through an automatic installation tool;

[0107] The SSH public key injection unit is used to inject the SSH public key into the virtual machine through the automatic installation tool after the installation is completed.

[0108] In some optional implementations, the bare metal configuration module 305 includes:

[0109] A first IP acquisition unit, used to start the virtual machine in the initial operating system environment and obtain the IP address of the virtual machine;

[0110] A first private key verification unit, used to send an SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key;

[0111] A first communication establishing unit, used to establish SSH communication with the host machine when the verification passes;

[0112] The bare metal automatic configuration unit is used to send a bare metal configuration script to a virtual machine through an SSH channel, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

[0113] In some optional implementations, the custom configuration module includes:

[0114] A second IP acquisition unit, used to start the virtual machine in the initial operating system environment and obtain the IP address of the virtual machine;

[0115] A second private key verification unit, used to send the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key;

[0116] The second communication establishing unit is used to establish SSH communication with the host machine when the verification passes;

[0117] The custom automatic configuration unit is used to send a user-defined configuration script to the virtual machine through an SSH channel, so that the virtual machine performs custom configuration according to the user-defined configuration script.

[0118] In some optional implementations, the bare metal configuration module 305 further includes:

[0119] A second restart module is used to start the virtual machine in the initial operating system environment;

[0120] The customization tool configuration module is used to insert the bare metal configuration script into the virtual machine through the virtual machine customization tool, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

[0121] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0122] The embodiment of the present invention also provides a computer device having the above Figure 3 The bare metal image production device shown.

[0123] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.

[0124] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0125] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0126] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0127] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0128] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0129] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0130] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0131] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A bare metal mirror manufacturing method, characterized in that: The method comprises: Get the initial system image file and create a virtual machine; Start the virtual machine in the preinstalled system environment, and install the initial operating system to the virtual machine according to the initial system image file; Shut down the virtual machine; Copying system files in the virtual machine and saving them as an intermediate image; Starting the virtual machine in the environment of the initial operating system and performing bare metal configuration on the initial operating system; Convert the bare metal configured operating system into the first bare metal image file.

2. The method according to claim 1, characterized in that The method further comprises: Start the virtual machine through the intermediate image; Performing bare metal configuration on the operating system of the intermediate image; Convert the bare metal configured operating system into the second bare metal image file.

3. The method according to claim 2, characterized in that The method further comprises: Customize the bare metal configured system through user-defined configuration scripts; Convert the customized operating system into a third-party bare metal image file.

4. The method according to claim 3, characterized in that The step of installing the initial operating system to the virtual machine according to the initial system image file comprises: Installing the initial operating system into the virtual machine by an automatic installation tool; After the installation is complete, the SSH public key is injected into the virtual machine through the automatic installation tool.

5. The method according to claim 4, characterized in that Starting the virtual machine in the environment of the initial operating system and performing bare metal configuration on the initial operating system includes: Starting the virtual machine in the initial operating system environment and obtaining the IP address of the virtual machine; Sending the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key; Establish SSH communication with the host machine when verification passes; The bare metal configuration script is sent to the virtual machine through the SSH channel, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

6. The method according to claim 4, characterized in that The step of customizing the bare metal configured system by using the user-defined configuration script includes: Starting the virtual machine in the initial operating system environment and obtaining the IP address of the virtual machine; Sending the SSH private key to the virtual machine through the IP address of the virtual machine, so that the virtual machine verifies the SSH private key and the SSH public key; Establish SSH communication with the host machine when verification passes; The user-defined configuration script is sent to the virtual machine through the SSH channel, so that the virtual machine performs custom configuration according to the user-defined configuration script.

7. The method according to claim 3, characterized in that The step of starting the virtual machine in the environment of the initial operating system and performing bare metal configuration on the initial operating system further includes: Starting the virtual machine in the environment of the initial operating system; The bare metal configuration script is inserted into the virtual machine through a virtual machine customization tool, so that the virtual machine performs bare metal configuration according to the bare metal configuration script.

8. A bare metal mirror production device, characterized in that: The device comprises: The image acquisition module is used to obtain the initial system image file and create a virtual machine; An initial system installation module, used to start the virtual machine in a preinstalled system environment and install an initial operating system to the virtual machine according to the initial system image file; A virtual machine shutdown module, used to shut down the virtual machine; An intermediate image production module is used to copy the system files in the virtual machine and save it as an intermediate image; A bare metal configuration module, used to start the virtual machine in the environment of the initial operating system and perform bare metal configuration on the initial operating system; The bare metal image generation module is used to convert the bare metal configured operating system into a first bare metal image file.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.