A method, device, equipment and medium for concurrent downloading of images of bare metal nodes
By performing multi-mounting of mirror volumes, concurrency management and mirror cache processing on the OpenStack Glance system, the problem of insufficient mirror concurrent download capabilities in existing systems is solved, and the concurrent download and accelerated distribution of bare metal nodes is realized, server deployment efficiency in large-scale scenarios is improved, and the integrity of mirror cache is ensured.
Patent Information
- Application Number
- CN202411524269.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-10-30
AI Technical Summary
The existing OpenStack Glance system does not support the multi-mount processing mechanism of mirror volumes, which limits the ability of concurrent download of a single mirror, and is difficult to achieve concurrent download and accelerated distribution of bare metal nodes, affecting the rapid deployment of bare metal servers in large-scale scenarios.
By mounting the mirror volumes on the backend of the local block storage service and setting up the mount mode, introducing a mirror volume concurrency management mechanism under multiple processes and multi-threads, adding local file locks to the mirror volume; building multiple mirror relay nodes and adding a mirror cache mechanism to it; calculating the mirror hash value in the mirror relay node for integrity verification, realizing mirror concurrent download and accelerated distribution.
The mirror concurrent download and accelerated distribution of bare metal nodes is realized, which improves the rapid deployment capability of bare metal servers in large-scale scenarios, and ensures the integrity and security of the mirror cache content through the integrity verification mechanism of mirror cache.
Smart Images

Figure CN119127578B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of cloud computing technology, and in particular to a method, device, equipment and medium for concurrent downloading images of bare metal nodes. Background Art
[0002] OpenStack Glance is a core component of the OpenStack cloud computing platform, mainly responsible for image management. Glance provides multiple functions such as image upload, retrieval, update, deletion, and storage, allowing users to easily discover, register, and download the required images. Glance supports multiple backends, mainly Cinder (block storage service), RBD (RADOS Block Device), File, etc. Among them, Cinder backend has the highest compatibility. Its principle is to save the image data as a storage volume of the platform, and Cinder manages the volume. Glance mounts and unmounts the backend volume of a specific image by calling Cinder's standard interface to implement operations such as filling or reading image data. At present, the implementation of Glance does not support the multi-mount processing mechanism of image volumes, which limits the ability to download a single image concurrently.
[0003] As can be seen from the above, how to achieve concurrent downloading and accelerated distribution of images for bare metal nodes and improve the rapid deployment capability of bare metal servers in large-scale scenarios is a problem to be solved in this field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a method, device, equipment and medium for concurrent downloading of images of bare metal nodes, which can realize concurrent downloading and accelerated distribution of images of bare metal nodes, and improve the rapid deployment capability of bare metal servers in large-scale scenarios. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a method for concurrently downloading images of bare metal nodes, which is applied to an open source image service, including:
[0006] Multiple mirror volumes are mounted on the local block storage service backend, and the mounting mode is set. A concurrent management mechanism for mirror volumes under multi-process and multi-thread is introduced, and a local file lock is added to the mirror volume to obtain the target block storage service backend, and the target image is obtained by using the target block storage service backend;
[0007] Constructing multiple image transfer nodes, and adding an image cache mechanism to the image transfer nodes, and using the image transfer nodes after adding the image cache mechanism to obtain the target image from the target block storage service backend;
[0008] When the target image in the image transfer node after adding the image caching mechanism is downloaded and cached to the cache node, the first hash value of the target image is calculated. When multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image to the bare metal node is completed.
[0009] Optionally, mounting multiple mirror volumes on the local block storage service backend and setting the mounting mode include:
[0010] Modify the driver code in the Glance store library of the local block storage service backend and repackage the Cinder interface to support multiple mounts of mirror volumes;
[0011] Set the mount mode to read-only.
[0012] Optionally, the introduction of a concurrent management mechanism for mirror volumes under multiple processes and multiple threads to add a local file lock to the mirror volume includes:
[0013] Introduce attachment status manager, mirror volume concurrent management mechanism under multi-process and multi-thread, and add local file locks for attachment creation information and attachment removal information in mirror volume.
[0014] Optionally, after the image transfer node with the added image cache mechanism obtains the target image from the target block storage service backend, the method further includes:
[0015] The LRU replacement algorithm is used to manage the elimination of the images in the image transfer node after the image cache mechanism is added.
[0016] Optionally, the adopting of an LRU replacement algorithm to perform elimination management on the images in the image transfer node after adding the image cache mechanism includes:
[0017] Constructing an ordered dictionary; wherein the unique identification value of the ordered dictionary is the image identifier, and the values of the ordered dictionary include the cache path, size, image integrity summary and most recent use time of the image;
[0018] When a new image exists in the image transfer node after the image cache mechanism is added, the images in the ordered dictionary are eliminated based on the new image to complete the elimination management.
[0019] Optionally, calculating the first hash value of the target image includes:
[0020] Calculate the first hash value of the target image using the SM3 national secret digest algorithm;
[0021] Correspondingly, calculating the second hash value of the target image includes:
[0022] The second hash value of the target image is calculated using the SM3 national secret digest algorithm.
[0023] Optionally, when multiple bare metal nodes concurrently download the target image from the cache node, the method includes:
[0024] When obtaining an image acquisition request sent by a bare metal node, determining whether a target image corresponding to the image acquisition request exists in a local cache node;
[0025] If the target image corresponding to the image acquisition request exists in the local cache node, the target image is concurrently downloaded from the cache node using the bare metal node.
[0026] In a second aspect, the present application discloses a concurrent image downloading device for a bare metal node, which is applied to an open source image service, including:
[0027] The backend configuration module is used to mount multiple mirror volumes on the local block storage service backend, set the mounting mode, introduce a mirror volume concurrent management mechanism under multi-process and multi-thread, add a local file lock to the mirror volume, obtain the target block storage service backend, and use the target block storage service backend to obtain the target image;
[0028] A transfer node construction and configuration module, used to construct multiple mirror transfer nodes, and add a mirror cache mechanism to the mirror transfer nodes, and use the mirror transfer nodes after adding the mirror cache mechanism to obtain the target image from the target block storage service backend;
[0029] The image concurrent download module is used to calculate the first hash value of the target image when the target image in the image transfer node after adding the image caching mechanism is downloaded and cached to the cache node, and when multiple bare metal nodes concurrently download the target image from the cache node, calculate the second hash value of the target image, verify the first hash value and the second hash value, and if the verification passes, complete the concurrent download of the image to the bare metal node.
[0030] In a third aspect, the present application discloses an electronic device, comprising:
[0031] Memory, used to store computer programs;
[0032] The processor is used to execute the computer program to implement the aforementioned method for concurrent downloading of images of bare metal nodes.
[0033] In a fourth aspect, the present application discloses a computer storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the aforementioned method for concurrent downloading of images of bare metal nodes disclosed above are implemented.
[0034] It can be seen that the present application provides a method for concurrent downloading images of bare metal nodes, including mounting multiple image volumes on a local block storage service backend, setting a mount mode, introducing a concurrent management mechanism for image volumes under multi-process and multi-threading, adding a local file lock to the image volume to obtain a target block storage service backend, and using the target block storage service backend to obtain a target image; constructing multiple image transfer nodes, and adding an image cache mechanism to the image transfer node, and using the image transfer node after adding the image cache mechanism to obtain the target image from the target block storage service backend; when the target image in the image transfer node after adding the image cache mechanism is downloaded and cached to the cache node, calculating the first hash value of the target image, when multiple bare metal nodes concurrently download the target image from the cache node, calculating the second hash value of the target image, and verifying the first hash value and the second hash value. If the verification passes, the concurrent download of the image of the bare metal node is completed. The present application performs multiple mounting of image volumes on the back end of the block storage service, sets the mounting mode, ensures that the same image volume will not be mounted repeatedly, introduces a concurrent management mechanism for image volumes under multi-process and multi-threading, adds a local file lock for the image volume, ensures that the actual link disconnection is not performed until the last attachment information of the multi-mounted volume is cleared, and uses the image transfer node after adding the image cache mechanism to obtain the target image from the target block storage service back end to accelerate the deployment of the bare metal node. When the target image in the image transfer node after adding the image cache mechanism is downloaded and cached to the cache node, the first hash value of the target image is calculated. When multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, which can increase the integrity verification mechanism of the cache image, ensure that the image cache content is not tampered with, realize the concurrent download and accelerated distribution of images of bare metal nodes, and improve the rapid deployment capability of bare metal servers in large-scale scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0036] Figure 1 A flowchart of a method for concurrent downloading images of a bare metal node disclosed in this application;
[0037] Figure 2 A specific flow chart of concurrent downloading of images of a bare metal node disclosed in this application;
[0038] Figure 3 This is a schematic diagram of the structure of a concurrent image downloading device for a bare metal node disclosed in this application;
[0039] Figure 4 A structural diagram of an electronic device provided for this application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] OpenStack Glance is a core component in the OpenStack cloud computing platform, mainly responsible for image management. Glance provides multiple functions such as image upload, retrieval, update, deletion and storage, allowing users to easily discover, register and download the required images. Glance supports multiple backends, mainly Cinder, RBD, File, etc. Among them, Cinder backend has the highest compatibility. Its principle is to save the image data as a storage volume of the platform and manage the volume by Cinder. Glance mounts and unmounts the backend volume of a specific image by calling Cinder's standard interface to implement operations such as filling or reading image data. At present, the implementation of Glance does not support the multi-mount processing mechanism of image volumes, which limits the ability to download a single image concurrently. As can be seen from the above, how to achieve concurrent downloading and accelerated distribution of images for bare metal nodes and improve the rapid deployment capability of bare metal servers in large-scale scenarios is a problem to be solved in this field.
[0042] See also Figure 1 As shown, an embodiment of the present invention discloses a method for concurrently downloading images of a bare metal node, which is applied to an open source image service and may specifically include:
[0043] Step S11: Multiple mirror volumes are mounted on the local block storage service backend, and the mounting mode is set, a mirror volume concurrent management mechanism under multi-process and multi-thread is introduced, and a local file lock is added to the mirror volume to obtain a target block storage service backend, and the target image is obtained by using the target block storage service backend.
[0044] In this embodiment, the driver code in the Glance store library of the local block storage service backend is modified, and the Cinder interface is repackaged to support multiple mounting of mirror volumes; the mounting mode is set to read-only; an attachment state manager, a mirror volume concurrent management mechanism under multi-process and multi-thread are introduced, and local file locks are added for attachment creation information and attachment removal information in the mirror volume to obtain a target block storage service backend, and the target image is obtained by using the target block storage service backend.
[0045] Specifically, it is necessary to modify the driver code of the _drivers / cinder part in the Glance store library of the backend of the block storage service, re-encapsulate the Cinder interface, be compatible with the newer Cinder attachemt process, realize multiple mounting of the mirror volume, and support setting the mounting mode to or (read-only) to ensure that the same mirror volume will not be mounted repeatedly; add glance_store / common / attachment_state_manager.py to introduce the attachment state manager. The state manager mainly implements the following functions: (1) manage the attachment information of the volume. The actual link will be disconnected only when the last attachment of the multi-mounted volume is cleaned up; (2) realize the concurrent control of unloading and mounting by locking attachment_create and remove_attachment; when serving ironic conductors of different logics requesting to download the same image, the concurrent download of the image can be realized; in order to manage the attachment information of the volume and ensure that the actual link will be disconnected only when the last attachment of the multi-mounted volume is cleaned up, add a local file lock, bind the file name to the image name, and the file content is the attachment list. When the last attachment in the list is removed, the actual mount link of the volume will be disconnected. This file lock ensures that the concurrency control mechanism of the state manager is still effective in the case of multiple glance processes (no shared memory space).
[0046] Step S12: construct multiple image transfer nodes, and add an image cache mechanism to the image transfer nodes, and use the image transfer nodes with the added image cache mechanism to obtain the target image from the target block storage service backend.
[0047] Specifically, an image caching mechanism is added to the image transfer node (ironic conductor). After the image is downloaded to the conductor node, it will be retained as a cache. The ironic conductor records the images cached by the current node by maintaining a data structure, including node information, image ID (Identity document), and image summary. The data is persisted to a database or a local file. The image transfer node after adding the image caching mechanism is used to obtain the target image from the target block storage service backend. The ironic conductor can simultaneously distribute images to the bare metal nodes it manages, accelerating the deployment of bare metal nodes.
[0048] In this embodiment, after the image transfer node after adding the image cache mechanism obtains the target image from the target block storage service backend, it also includes: using the LRU replacement algorithm to perform elimination management on the image in the image transfer node after adding the image cache mechanism. The elimination management process is: constructing an ordered dictionary; wherein the unique identification value of the ordered dictionary is the image identifier, and the value of the ordered dictionary includes the cache path, size, image integrity summary and most recent use time of the image; when there is a new image in the image transfer node after adding the image cache mechanism, the image in the ordered dictionary is eliminated based on the new image to complete the elimination management.
[0049] Specifically, the mirror cache of the ironic conductor node is eliminated through the LRU replacement algorithm. An ordered dictionary is designed to record cached images. The elements of the ordered dictionary are sorted according to the most recent use time, and the dictionary length is limited to 5. When inserting a new element will make the dictionary length exceed 5, the last element of the ordered dictionary will be kicked out, and the mirror cache corresponding to the record will be cleared. When the length of the dictionary element is less than 5, but the sum of the recorded mirror sizes is greater than 200G, the last element of the dictionary will be actively kicked out, and the mirror cache corresponding to the record will be cleared to complete the elimination management and limit the image cache's occupation of the conductor node's local space.
[0050] Step S13: When the target image in the image transfer node after adding the image caching mechanism is downloaded and cached to the cache node, the first hash value of the target image is calculated. When multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image to the bare metal node is completed.
[0051] In this embodiment, when the target image in the image transfer node after adding the image caching mechanism is downloaded and cached to the cache node, the SM3 national secret digest algorithm is used to calculate the first hash value of the target image, and when the image acquisition request sent by the bare metal node is obtained, it is determined whether there is a target image corresponding to the image acquisition request in the local cache node. If there is a target image corresponding to the image acquisition request in the local cache node, the bare metal node is used to concurrently download the target image from the cache node, and then the SM3 national secret digest algorithm is used to calculate the second hash value of the target image, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image to the bare metal node is completed.
[0052] In this embodiment, when the ironic driver sends a request to the ironic conductor serving the bare metal node to obtain the target image corresponding to the request, it will first determine whether the image has been cached in the cache node. If the image has been cached and has not been tampered with, there is no need to obtain it from Glance. The target image can be downloaded concurrently from the cache node directly. The ironic conductor can distribute the image to the bare metal nodes it manages at the same time.
[0053] This application adds an integrity verification mechanism for cached images. When the image is downloaded to the conductor node (cache node) for the first time, the first hash value is calculated using the SM3 national secret digest algorithm through the hashlib module and recorded in an ordered dictionary. When a bare metal node needs to send an image from a conductor node, it is necessary to first calculate the second hash value of the image, and verify the first hash value and the second hash value to ensure that the image cache content has not been tampered with. If the verification passes, the concurrent download of the image for the bare metal node is completed.
[0054] In this embodiment, the specific process of concurrent downloading of images of bare metal nodes (i.e. bare metal) is as follows: Figure 2As shown in the figure, in the image delivery phase, the ironic driver first attempts to initiate a deploy image request (image acquisition request) to the ironic conductor (bare metal management service). If the image has been cached in the conductor node and the image cache has passed the integrity check, the step of downloading the image from Glance is skipped and the image data is directly read from the cache. If the cached image does not exist at this time, the conductor calls glance-api to download the image. Glance mounts the corresponding image volume to the glance-api node to read data through the cinder api encapsulated in glance_store. At this time, the mount mode is read-only, and the local lock maintained by the attachment state manager adds an attachment information. If another ironic conductor initiates a request for the same image at the same time, glance will initiate a mount request again to create a new attachment. Since the local lock content is not empty at this time, the image volume will not be remounted, and only an attachment record will be added to the local file lock at the same time. When the download of a conductor is completed, an attachment record is deleted. When the attachment record is cleared, that is, all current downloads of the image are completed, the image volume will be unmounted. After the Conductor node caches the image locally, it considers the image cache to be the most recently used, so it inserts its id, size, cache path, and integrity summary information into the header of the ordered dictionary. Then the image is sent down.
[0055] In this embodiment, multiple image volumes are mounted on the local block storage service backend, and the mounting mode is set, a concurrent management mechanism of image volumes under multi-process and multi-thread is introduced, a local file lock is added to the image volume to obtain a target block storage service backend, and the target block storage service backend is used to obtain the target image; multiple image transfer nodes are constructed, and an image cache mechanism is added to the image transfer node, and the target image is obtained from the target block storage service backend by using the image transfer node after the image cache mechanism is added; when the target image in the image transfer node after the image cache mechanism is added is downloaded and cached to the cache node, the first hash value of the target image is calculated, and when multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image of the bare metal node is completed. The present application performs multiple mounting of image volumes on the back end of the block storage service, sets the mounting mode, ensures that the same image volume will not be mounted repeatedly, introduces a concurrent management mechanism for image volumes under multi-process and multi-threading, adds a local file lock for the image volume, ensures that the actual link disconnection is not performed until the last attachment information of the multi-mounted volume is cleared, and uses the image transfer node after adding the image cache mechanism to obtain the target image from the target block storage service back end to accelerate the deployment of the bare metal node. When the target image in the image transfer node after adding the image cache mechanism is downloaded and cached to the cache node, the first hash value of the target image is calculated. When multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, which can increase the integrity verification mechanism of the cache image, ensure that the image cache content is not tampered with, realize the concurrent download and accelerated distribution of images of bare metal nodes, and improve the rapid deployment capability of bare metal servers in large-scale scenarios.
[0056] See also Figure 3 As shown, the embodiment of the present invention discloses a concurrent image downloading device for a bare metal node, which is applied to an open source image service and may specifically include:
[0057] The backend configuration module 11 is used to mount multiple mirror volumes on the local block storage service backend, set the mounting mode, introduce a mirror volume concurrent management mechanism under multi-process and multi-thread, add a local file lock to the mirror volume, so as to obtain a target block storage service backend, and use the target block storage service backend to obtain a target image;
[0058] The transfer node construction and configuration module 12 is used to construct multiple mirror transfer nodes, and add a mirror cache mechanism to the mirror transfer nodes, and use the mirror transfer nodes after adding the mirror cache mechanism to obtain the target image from the target block storage service backend;
[0059] The image concurrent download module 13 is used to calculate the first hash value of the target image when the target image in the image transfer node after adding the image caching mechanism is downloaded and cached to the cache node, and when multiple bare metal nodes concurrently download the target image from the cache node, calculate the second hash value of the target image, verify the first hash value and the second hash value, and if the verification passes, complete the concurrent download of the image to the bare metal node.
[0060] In this embodiment, multiple image volumes are mounted on the local block storage service backend, and the mounting mode is set, a concurrent management mechanism of image volumes under multi-process and multi-thread is introduced, a local file lock is added to the image volume to obtain a target block storage service backend, and the target block storage service backend is used to obtain the target image; multiple image transfer nodes are constructed, and an image cache mechanism is added to the image transfer node, and the target image is obtained from the target block storage service backend by using the image transfer node after the image cache mechanism is added; when the target image in the image transfer node after the image cache mechanism is added is downloaded and cached to the cache node, the first hash value of the target image is calculated, and when multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image of the bare metal node is completed. The present application performs multiple mounting of image volumes on the back end of the block storage service, sets the mounting mode, ensures that the same image volume will not be mounted repeatedly, introduces a concurrent management mechanism for image volumes under multi-process and multi-threading, adds a local file lock for the image volume, ensures that the actual link disconnection is not performed until the last attachment information of the multi-mounted volume is cleared, and uses the image transfer node after adding the image cache mechanism to obtain the target image from the target block storage service back end to accelerate the deployment of the bare metal node. When the target image in the image transfer node after adding the image cache mechanism is downloaded and cached to the cache node, the first hash value of the target image is calculated. When multiple bare metal nodes concurrently download the target image from the cache node, the second hash value of the target image is calculated, which can increase the integrity verification mechanism of the cache image, ensure that the image cache content is not tampered with, realize the concurrent download and accelerated distribution of images of bare metal nodes, and improve the rapid deployment capability of bare metal servers in large-scale scenarios.
[0061] In some specific embodiments, the backend configuration module 11 may specifically include:
[0062] The code modification module is used to modify the driver code in the Glance store library of the local block storage service backend and repackage the Cinder interface to support multiple mounts of mirror volumes.
[0063] The mount mode setting module is used to set the mount mode to read-only.
[0064] In some specific embodiments, the backend configuration module 11 may specifically include:
[0065] The local lock adding module is used to introduce the attachment status manager, the mirror volume concurrent management mechanism under multi-process and multi-thread, and add local file locks for attachment creation information and attachment removal information in the mirror volume.
[0066] In some specific embodiments, the transit node construction and configuration module 12 may specifically include:
[0067] The elimination management module is used to adopt an LRU replacement algorithm to perform elimination management on the images in the image transfer node after the image cache mechanism is added.
[0068] In some specific embodiments, the transit node construction and configuration module 12 may specifically include:
[0069] An ordered dictionary construction module, used to construct an ordered dictionary; wherein the unique identification value of the ordered dictionary is an image identifier, and the values of the ordered dictionary include the cache path, size, image integrity summary and most recent use time of the image;
[0070] The elimination module is used to eliminate the images in the ordered dictionary based on the new images when there are new images in the image transfer node after the image cache mechanism is added, so as to complete the elimination management.
[0071] In some specific embodiments, the mirror concurrent download module 13 may specifically include:
[0072] The first hash value calculation module is used to calculate the first hash value of the target image by using the SM3 national secret digest algorithm.
[0073] In some specific embodiments, the mirror concurrent download module 13 may specifically include:
[0074] The second hash value calculation module is used to calculate the second hash value of the target image by using the SM3 national secret digest algorithm.
[0075] In some specific embodiments, the mirror concurrent download module 13 may specifically include:
[0076] A judgment module is used to determine whether a target image corresponding to the image acquisition request exists in a local cache node when the image acquisition request is received from the bare metal node;
[0077] The concurrent download module is used to concurrently download the target image from the cache node using the bare metal node if the target image corresponding to the image acquisition request exists in the local cache node.
[0078] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the image concurrent download method of a bare metal node executed by an electronic device disclosed in any of the aforementioned embodiments.
[0079] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0080] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0081] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the image concurrent download method of the bare metal node executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to including data transmitted from an external device received by the image concurrent download device of the bare metal node, the data 223 can also include data collected by its own input and output interface 25, etc.
[0082] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0083] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the steps of the method for concurrent downloading images of bare metal nodes disclosed in any of the aforementioned embodiments are implemented.
[0084] Finally, 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 sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0085] The above is a detailed introduction to the method, device, equipment and storage medium for concurrent downloading of images of a bare metal node provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for concurrent downloading images of a bare metal node, characterized in that: Applied to open source image services, including: Multiple mirror volumes are mounted on the local block storage service backend, and the mounting mode is set. A concurrent management mechanism for mirror volumes under multi-process and multi-thread is introduced, and a local file lock is added to the mirror volume to obtain the target block storage service backend, and the target image is obtained by using the target block storage service backend; Constructing multiple image transfer nodes, and adding an image cache mechanism to the image transfer nodes, and using the image transfer nodes after adding the image cache mechanism to obtain the target image from the target block storage service backend; When the target image in the image transfer node after adding the image cache mechanism is downloaded and cached to the cache node, a first hash value of the target image is calculated; when multiple bare metal nodes concurrently download the target image from the cache node, a second hash value of the target image is calculated, and the first hash value and the second hash value are verified. If the verification passes, the concurrent download of the image to the bare metal node is completed; The method of mounting multiple mirror volumes on the local block storage service backend and setting the mount mode includes: modifying the driver code in the Glance store library of the local block storage service backend and repackaging the Cinder interface to support multiple mirror volume mounting; and setting the mount mode to read-only.
2. The method for concurrent downloading images of bare metal nodes according to claim 1, characterized in that: The introduction of the mirror volume concurrent management mechanism under multi-process and multi-threading, adding a local file lock for the mirror volume, includes: Introduce attachment status manager, mirror volume concurrent management mechanism under multi-process and multi-thread, and add local file locks for attachment creation information and attachment removal information in mirror volume.
3. The method for concurrent downloading images of bare metal nodes according to claim 1, characterized in that: After the image transfer node with the added image cache mechanism obtains the target image from the target block storage service backend, the method further includes: The LRU replacement algorithm is used to manage the elimination of the images in the image transfer node after the image cache mechanism is added.
4. The method for concurrent downloading images of bare metal nodes according to claim 3, characterized in that: The LRU replacement algorithm is used to perform elimination management on the images in the image transfer node after the image cache mechanism is added, including: Constructing an ordered dictionary; wherein the unique identification value of the ordered dictionary is the image identifier, and the values of the ordered dictionary include the cache path, size, image integrity summary and most recent use time of the image; When a new image exists in the image transfer node after the image cache mechanism is added, the images in the ordered dictionary are eliminated based on the new image to complete the elimination management.
5. The method for concurrent downloading images of bare metal nodes according to claim 1, characterized in that: The calculating the first hash value of the target image includes: Calculate the first hash value of the target image using the SM3 national secret digest algorithm; Correspondingly, calculating the second hash value of the target image includes: The second hash value of the target image is calculated using the SM3 national secret digest algorithm.
6. The method for concurrent downloading images of bare metal nodes according to any one of claims 1 to 5, characterized in that: When the multiple bare metal nodes concurrently download the target image from the cache node, it includes: When obtaining an image acquisition request sent by a bare metal node, determining whether a target image corresponding to the image acquisition request exists in a local cache node; If the target image corresponding to the image acquisition request exists in the local cache node, the target image is concurrently downloaded from the cache node using the bare metal node.
7. A concurrent image downloading device for a bare metal node, characterized in that: Applied to open source image services, including: The backend configuration module is used to mount multiple mirror volumes on the local block storage service backend, set the mounting mode, introduce a mirror volume concurrent management mechanism under multi-process and multi-thread, add a local file lock to the mirror volume, obtain the target block storage service backend, and use the target block storage service backend to obtain the target image; A transfer node construction and configuration module, used to construct multiple mirror transfer nodes, and add a mirror cache mechanism to the mirror transfer nodes, and use the mirror transfer nodes after adding the mirror cache mechanism to obtain the target image from the target block storage service backend; An image concurrent download module, for calculating a first hash value of the target image when the target image in the image transfer node after adding an image cache mechanism is downloaded and cached to a cache node, and for calculating a second hash value of the target image when multiple bare metal nodes concurrently download the target image from the cache node, and for verifying the first hash value and the second hash value. If the verification passes, the concurrent download of the image to the bare metal node is completed; The method of mounting multiple mirror volumes on the local block storage service backend and setting the mount mode includes: modifying the driver code in the Glance store library of the local block storage service backend and repackaging the Cinder interface to support multiple mirror volume mounting; and setting the mount mode to read-only.
8. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the image concurrent downloading method for a bare metal node as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the image concurrent downloading method for a bare metal node as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Verification method and device for mirror image file, electronic equipment and storage medium
CN113342745A
Method and system for mounting cinder volume on pod based on cloud physical machine
CN113485786A