System disk generation method and device, computer equipment, readable storage medium and program product

By calculating the difference between the baseline system disk and the public image, the target system disk is generated, and the problem of limited performance of the system disk in the prior art is solved, and performance improvement and resource savings are achieved to meet user needs.

CN119718350APending Publication Date: 2025-03-28CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411692217.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, the performance of the system disk is limited by the performance of the public image, which cannot meet the actual performance needs of users, and leads to waste of storage resources.

Method used

By obtaining the baseline system disk, template volume and public image, calculate the difference between the baseline system disk and the public image, and generate the target system disk to meet the performance needs of users and avoid waste of resources.

Benefits of technology

The generated target system disk can meet the user's performance needs for the system disk, while avoiding resource waste and improving storage efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718350A_ABST
    Figure CN119718350A_ABST
Patent Text Reader

Abstract

The invention relates to a system disk generation method and device, computer equipment, a computer readable storage medium and a computer program product. The method comprises the following steps: acquiring a reference system disk, a template volume corresponding to the reference system disk and a public mirror image of the system disk; under the condition that the dependency relationship does not exist between the reference system disk and the template volume, data blocks in the reference system disk and data blocks in the public mirror image are obtained, and a clone mirror image of the public mirror image is obtained; and based on the difference between the data blocks in the reference system disk and the data blocks in the common mirror image, performing data operation on the clone mirror image, and generating a target system disk based on the clone mirror image after the data operation. According to the method provided by the invention, the generated target system disk can meet the performance requirement of a user on the system disk, and resource waste can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a system disk generation method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art

[0002] In a cloud platform composed of Openstack (an open source cloud computing management platform) and Ceph (an open source distributed unified storage system), Ceph's block storage pool is usually used to save image files and cloud hard disks, where cloud hard disks are divided into system disks and data disks. System disks are usually created through RBD (RADOS Block Device, a block device interface in Ceph) cloning technology to achieve fast creation and space saving.

[0003] In the prior art, a system disk is usually directly cloned from a public image of the system disk. The performance of the system disk obtained by this method is limited by the performance of the public image and cannot meet the actual performance requirements of users. Summary of the invention

[0004] Based on this, it is necessary to provide a system disk generation method, apparatus, computer equipment, computer-readable storage medium and computer program product that can meet the performance requirements of users in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for generating a system disk, the method comprising:

[0006] Acquire a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk;

[0007] In the case where there is no dependency relationship between the reference system disk and the template volume, obtaining data blocks in the reference system disk and data blocks in the public image, and obtaining a clone image of the public image;

[0008] Based on the difference between the data blocks in the reference system disk and the data blocks in the public image, data operation is performed on the clone image, and a target system disk is generated based on the clone image after the data operation.

[0009] In one embodiment, the performing data operations on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes:

[0010] For each data block, if the data block exists in both the reference system disk and the public image, obtain a first hash value of the data block in the reference system disk and a second hash value of the data block in the public image;

[0011] When the first hash value is different from the second hash value, the data in the data block corresponding to the first hash value is written into the clone image.

[0012] In one embodiment, the performing data operations on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes:

[0013] For each data block, if the data block does not exist in the reference system disk and exists in the public image, data in the data block in the clone image is replaced with a preset value.

[0014] In one embodiment, the performing data operations on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes:

[0015] For each data block, if the data block exists in the reference system disk and does not exist in the public image, the data in the data block in the reference system disk is directly written into the clone image.

[0016] In one embodiment, the method further comprises:

[0017] In a case where there is a dependency relationship between the reference system disk and the template volume, and data in the template volume is the same as data in the public image, obtaining first difference data between the reference system disk and the public image;

[0018] A target image is generated based on the data in the public image and the first difference data, and the target system disk is generated based on the target image.

[0019] In one embodiment, the method further comprises:

[0020] In the case where there is a dependency relationship between the reference system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining second difference data between the reference system disk and the custom image, and obtaining third difference data between the custom image and the public image;

[0021] A target image is generated based on the data in the public image, the second difference data and the third difference data, and the target system disk is generated based on the target image.

[0022] In a second aspect, the present application further provides a system disk generation device, the device comprising:

[0023] A first acquisition module, used for acquiring a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk;

[0024] A second acquisition module, configured to acquire data blocks in the reference system disk and data blocks in the public image, and acquire a clone image of the public image, when there is no dependency relationship between the reference system disk and the template volume;

[0025] The data operation module is used to perform data operation on the clone image based on the difference between the data blocks in the reference system disk and the data blocks in the public image, and generate a target system disk based on the clone image after the data operation.

[0026] In a third aspect, the present application further provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method in any one of the above embodiments when executing the computer program.

[0027] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0028] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.

[0029] The above-mentioned system disk generation method, device, computer equipment, computer-readable storage medium and computer program product obtain a reference system disk, a template volume corresponding to the reference system disk and a public image of the system disk; in the case where there is no dependency between the reference system disk and the template volume, obtain data blocks in the reference system disk and data blocks in the public image, and obtain a clone image of the public image; based on the difference between the data blocks in the reference system disk and the data blocks in the public image, perform data operations on the clone image, and generate a target system disk based on the clone image after the data operation. The method provided by the present application can generate a target system disk that can meet the user's performance requirements for the system disk and can avoid waste of resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0031] Figure 1 It is a flowchart of a system disk generation method in the prior art;

[0032] Figure 2 A schematic diagram of a process of generating a system disk in an embodiment;

[0033] Figure 3 A schematic diagram of a data operation method in one embodiment;

[0034] Figure 4 A flowchart of uploading an rbd system disk to an image in another embodiment;

[0035] Figure 5 A schematic diagram of a process of calculating the difference between a system disk and a public image in another embodiment;

[0036] Figure 6 is a structural block diagram of a system disk generating device in one embodiment;

[0037] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0039] In order to solve the technical problems in the background technology, the prior art creates a base system disk according to user needs, and uploads the image of the base system disk to the Ceph storage pool, so as to quickly create system disks that meet user needs in batches. The specific process is as follows: Figure 1 However, usually, the base system disk created by users is obtained by installing a small amount of special application software on the basis of the public image of the system disk. Most of the content in the base system disk is consistent with the content in the public image. Different users upload the images of the base system disks created by themselves to the storage pool, which will cause the storage pool to store the content in the public image repeatedly, thereby causing a waste of storage resources.

[0040] In one embodiment, Figure 2 As shown, a method for generating a system disk is provided. This embodiment uses the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0041] S202: Acquire a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk.

[0042] Among them, the system disk refers to the hard disk where the operating system is installed, which is the basis for the startup and operation of the virtual machine; the baseline system disk is a user-defined system disk that can meet the needs of the user; the template volume is a pre-configured virtual hard disk image, which is based on the system disk or the image clone of the system disk; the data stored in the public image is the data shared by different system disks, and users can create the required customized system disk based on the public image and their own needs.

[0043] S204: In the case where there is no dependency relationship between the reference system disk and the template volume, obtain data blocks in the reference system disk and data blocks in the public image, and obtain a clone image of the public image.

[0044] The data block refers to the smallest addressable storage unit on the storage device; the data blocks in the clone image are completely consistent with the data blocks in the public image.

[0045] Optionally, a custom system disk is created based on the template volume and user needs, and a baseline system disk is obtained after operating on the custom system disk. If the corresponding data of the template volume in the baseline system disk has changed, there is no dependency between the baseline system disk and the template volume. For example, the operation performed on the custom system disk can be a backup and restore operation.

[0046] S206: Based on the difference between the data blocks in the reference system disk and the data blocks in the public image, perform data operations on the cloned image, and generate a target system disk based on the cloned image after the data operations.

[0047] Optionally, based on the difference between the data blocks in the reference system disk and the data blocks in the public image, the part of the public image that does not meet the user's needs can be determined, and data operations are performed on this part of the clone image based on the data blocks in the reference system disk, so that the clone image can meet the user's needs.

[0048] Optionally, the cloned image may be mirrored to obtain a target system disk.

[0049] In the above system disk generation method, a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk are obtained; in the case where there is no dependency between the reference system disk and the template volume, data blocks in the reference system disk and data blocks in the public image are obtained, and a clone image of the public image is obtained; based on the difference between the data blocks in the reference system disk and the data blocks in the public image, data operations are performed on the clone image, and a target system disk is generated based on the clone image after the data operations. The method provided by the present application can generate a target system disk that can meet the user's performance requirements for the system disk and can avoid waste of resources.

[0050] In some embodiments, Figure 3 As shown, based on the difference between the data blocks in the reference system disk and the data blocks in the public image, data operations are performed on the cloned image, including:

[0051] S302 . For each data block, if the data block exists in both the reference system disk and the public image, obtain a first hash value of the data block in the reference system disk and a second hash value of the data block in the public image.

[0052] S304: When the first hash value is different from the second hash value, write the data in the data block corresponding to the first hash value into the clone image.

[0053] The hash value of a data block refers to a unique identifier of the data block calculated by a hash function.

[0054] Optionally, when the first hash value is different from the second hash value, it means that the data of this data block in the baseline system disk and the data in the public image are different. In order to make the finally generated target system disk meet the user's needs, the data of this data block in the baseline system disk needs to be written into the clone image; when the first hash value is the same as the second hash value, it means that the data of this data block in the baseline system disk and the data in the public image are the same, and there is no need to process the clone image again.

[0055] In this embodiment, when the first hash value is different from the second hash value, the data in the data block corresponding to the first hash value is written into the clone image, so that the target system disk generated based on the clone image can meet the user's needs without wasting resources.

[0056] In some embodiments, data operations are performed on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block does not exist in the baseline system disk and the data block exists in the public image, replacing the data in the data block in the clone image with a preset value.

[0057] Optionally, the data block does not exist in the base system disk, indicating that the user's requirement is that the data block does not exist in the final generated system disk, but the data block exists in the public image. In order to make the target system disk generated based on the clone image meet the user's requirements, the data in the data block in the clone image needs to be deleted. A common method for deleting data in a data block is to fill the data block with 0.

[0058] In this embodiment, when there is no data block in the base system disk and there is a data block in the public image, the data in the data block in the clone image is replaced with a preset value, so that the target system disk generated based on the clone image can meet the user's needs without causing a waste of resources.

[0059] In some embodiments, data operations are performed on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block exists in the baseline system disk and does not exist in the public image, directly writing the data in the data block in the baseline system disk into the clone image.

[0060] Optionally, the data block exists in the baseline system disk, indicating that the user's requirement is that the data block exists in the final generated system disk, but the data block does not exist in the public image. In order to make the target system disk generated based on the clone image meet the user's needs, the data in the data block in the baseline system disk needs to be written into the clone image.

[0061] In this embodiment, when there are data blocks in the base system disk and no data blocks in the public image, the data in the data blocks in the base system disk are directly written into the clone image, so that the target system disk generated based on the clone image can meet the user's needs without causing waste of resources.

[0062] In some embodiments, the method also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the public image, obtaining the first difference data between the baseline system disk and the public image; generating a target image based on the data in the public image and the first difference data, and generating a target system disk based on the target image.

[0063] Optionally, there is a dependency relationship between the reference system disk and the template volume, and the target image of the system disk can be generated directly based on the data difference between the reference system disk and the template volume and the public image, so that the obtained target image can meet the needs of users.

[0064] In this embodiment, a target image is generated based on the data in the public image and the first difference data, which can meet the needs of users without causing waste of resources.

[0065] In some embodiments, the method also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining second difference data between the baseline system disk and the custom image, and obtaining third difference data between the custom image and the public image; generating a target image based on the data in the public image, the second difference data and the third difference data, and generating a target system disk based on the target image.

[0066] Optionally, a custom image is generated based on a public image and user requirements, and the template volume is cloned from the custom image. Therefore, in order to obtain the data difference between the baseline system disk and the public image, it is necessary to obtain the second difference data between the baseline system disk and the custom image, as well as the third difference data between the custom image and the public image.

[0067] In this embodiment, a target image is generated based on the data in the public image, the second difference data and the third difference data, and a target system disk is generated based on the target image, which can meet the needs of users without wasting resources.

[0068] In some embodiments, another method for generating a system disk is provided, the method comprising the following contents:

[0069] like Figure 4 As shown, when creating a custom image, first determine whether its corresponding template volume is created from a public image or a custom image.

[0070] (1) If the template volume corresponding to the system disk is created through a public image, a new image is cloned from the public image, and then the interface for quickly calculating the difference between the clone disk and the master disk is called to calculate the difference between the system disk and the module volume. The difference is read from the system disk and written to the newly created image. After the difference is written, the cloned image is completely consistent with the content of the system disk.

[0071] (2) If the template volume corresponding to the system disk is created by custom image A, first find the corresponding public image based on custom image A, and then clone a new image from the public image. Use the same method to write the difference between custom image A and the public image into the cloned image to make its content consistent with custom image A, and then write the difference between the system disk and the template volume into the cloned image to make its content consistent with the system disk.

[0072] (3) Some special system disks (such as those that have been backed up and restored) no longer have a clone relationship with the template volume, and the difference cannot be quickly calculated. Figure 5 The process shown calculates the difference between the system disk and the public image and writes it into the clone image, so that the content of the clone image is consistent with the system disk.

[0073] 1) Use the rbd diff interface to detect the allocated space of the public image, read out and calculate the hash value of each allocated space data block. The result can be saved and reused, and each public image only needs to be calculated once.

[0074] 2) Use the rbd diff interface to detect the data blocks of the allocated space on the system disk.

[0075] 3) For data blocks that have space allocated on the system disk but not on the public image, read their contents and write them into the clone image; for data blocks that have space allocated on both the system disk and the public image, read their contents from the system disk to calculate the hash value, and write the blocks with different hash values ​​into the clone disk; for data blocks that have space allocated on the public image but not on the system disk, fill them with 0 in the clone image.

[0076] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0077] Based on the same inventive concept, the embodiment of the present application also provides a system disk generation device for implementing the system disk generation method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more system disk generation device embodiments provided below can refer to the limitations of the system disk generation method above, and will not be repeated here.

[0078] In an exemplary embodiment, Figure 6 As shown, a system disk generation device 600 is provided, comprising: a first acquisition module 601, a second acquisition module 602 and a data operation module 603, wherein:

[0079] The first acquisition module 601 is used to acquire a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk.

[0080] The second acquisition module 602 is used to acquire data blocks in the reference system disk and data blocks in the public image, and acquire a clone image of the public image when there is no dependency relationship between the reference system disk and the template volume.

[0081] The data operation module 603 is used to perform data operation on the clone image based on the difference between the data blocks in the reference system disk and the data blocks in the public image, and generate a target system disk based on the clone image after the data operation.

[0082] In some embodiments, the data operation module 603 is also used to obtain, for each data block, a first hash value of the data block in the baseline system disk and a second hash value of the data block in the public image, when the data block exists in both the baseline system disk and the public image; and when the first hash value is different from the second hash value, write the data in the data block corresponding to the first hash value into the clone image.

[0083] In some embodiments, the data operation module 603 is further used to replace the data in the data block in the clone image with a preset value for each data block if the data block does not exist in the base system disk and exists in the public image.

[0084] In some embodiments, the data operation module 603 is also used to directly write the data in the data block in the base system disk into the clone image for each data block if the data block exists in the base system disk and does not exist in the public image.

[0085] In some embodiments, the system disk generation device 600 is specifically used to obtain the first difference data between the baseline system disk and the public image when there is a dependency relationship between the baseline system disk and the template volume and the data in the template volume is the same as the data in the public image; generate a target image based on the data in the public image and the first difference data, and generate the target system disk based on the target image.

[0086] In some embodiments, the system disk generation device 600 is also used to obtain the second difference data between the baseline system disk and the custom image, and obtain the third difference data between the custom image and the public image when there is a dependency relationship between the baseline system disk and the template volume and the data in the template volume is the same as the data in the custom image; generate a target image based on the data in the public image, the second difference data and the third difference data, and generate the target system disk based on the target image.

[0087] Each module in the above system disk generation device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.

[0088] In an exemplary embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 7 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a system disk generation method is implemented.

[0089] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0090] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a baseline system disk, a template volume corresponding to the baseline system disk, and a public image of the system disk; obtaining data blocks in the baseline system disk and data blocks in the public image, and obtaining a clone image of the public image in the absence of a dependency relationship between the baseline system disk and the template volume; performing data operations on the clone image based on the differences between the data blocks in the baseline system disk and the data blocks in the public image, and generating a target system disk based on the clone image after the data operations.

[0091] In one embodiment, the data operation on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image implemented by the processor when executing the computer program includes: for each data block, if the data block exists in both the baseline system disk and the public image, obtaining the first hash value of the data block in the baseline system disk and the second hash value of the data block in the public image; if the first hash value is different from the second hash value, writing the data in the data block corresponding to the first hash value into the clone image.

[0092] In one embodiment, the data operation on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image implemented by the processor when executing the computer program includes: for each data block, if the data block does not exist in the baseline system disk and the data block exists in the public image, replacing the data in the data block in the clone image with a preset value.

[0093] In one embodiment, the data operation on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image implemented by the processor when executing the computer program includes: for each data block, if the data block exists in the baseline system disk and does not exist in the public image, directly writing the data in the data block in the baseline system disk into the clone image.

[0094] In one embodiment, the method implemented when the processor executes the computer program also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the public image, obtaining the first difference data between the baseline system disk and the public image; generating a target image based on the data in the public image and the first difference data, and generating the target system disk based on the target image.

[0095] In one embodiment, the method implemented when the processor executes the computer program also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining the second difference data between the baseline system disk and the custom image, and obtaining the third difference data between the custom image and the public image; generating a target image based on the data in the public image, the second difference data and the third difference data, and generating the target system disk based on the target image.

[0096] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: obtaining a baseline system disk, a template volume corresponding to the baseline system disk, and a public image of the system disk; obtaining data blocks in the baseline system disk and data blocks in the public image, and obtaining a clone image of the public image in the absence of a dependency relationship between the baseline system disk and the template volume; performing data operations on the clone image based on the differences between the data blocks in the baseline system disk and the data blocks in the public image, and generating a target system disk based on the clone image after the data operations.

[0097] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block exists in both the baseline system disk and the public image, obtaining a first hash value of the data block in the baseline system disk and a second hash value of the data block in the public image; if the first hash value is different from the second hash value, writing the data in the data block corresponding to the first hash value into the clone image.

[0098] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block does not exist in the baseline system disk and the data block exists in the public image, replacing the data in the data block in the clone image with a preset value.

[0099] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block exists in the baseline system disk and does not exist in the public image, directly writing the data in the data block in the baseline system disk into the clone image.

[0100] In one embodiment, the method implemented when the computer program is executed by the processor also includes: obtaining first difference data between the baseline system disk and the public image when there is a dependency relationship between the baseline system disk and the template volume and the data in the template volume is the same as the data in the public image; generating a target image based on the data in the public image and the first difference data, and generating the target system disk based on the target image.

[0101] In one embodiment, the method implemented when the computer program is executed by the processor also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining the second difference data between the baseline system disk and the custom image, and obtaining the third difference data between the custom image and the public image; generating a target image based on the data in the public image, the second difference data and the third difference data, and generating the target system disk based on the target image.

[0102] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps: obtaining a reference system disk, a template volume corresponding to the reference system disk, and a common image of the system disk; obtaining data blocks in the reference system disk and data blocks in the common image, and obtaining a clone image of the common image, in the absence of a dependency relationship between the reference system disk and the template volume; performing data operations on the clone image based on the differences between the data blocks in the reference system disk and the data blocks in the common image, and generating a target system disk based on the clone image after the data operations.

[0103] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block exists in both the baseline system disk and the public image, obtaining a first hash value of the data block in the baseline system disk and a second hash value of the data block in the public image; if the first hash value is different from the second hash value, writing the data in the data block corresponding to the first hash value into the clone image.

[0104] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block does not exist in the baseline system disk and the data block exists in the public image, replacing the data in the data block in the clone image with a preset value.

[0105] In one embodiment, the computer program implemented when executed by the processor performs data operations on the clone image based on the difference between the data blocks in the baseline system disk and the data blocks in the public image, including: for each data block, if the data block exists in the baseline system disk and does not exist in the public image, directly writing the data in the data block in the baseline system disk into the clone image.

[0106] In one embodiment, the method implemented when the computer program is executed by the processor also includes: obtaining first difference data between the baseline system disk and the public image when there is a dependency relationship between the baseline system disk and the template volume and the data in the template volume is the same as the data in the public image; generating a target image based on the data in the public image and the first difference data, and generating the target system disk based on the target image.

[0107] In one embodiment, the method implemented when the computer program is executed by the processor also includes: when there is a dependency relationship between the baseline system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining the second difference data between the baseline system disk and the custom image, and obtaining the third difference data between the custom image and the public image; generating a target image based on the data in the public image, the second difference data and the third difference data, and generating the target system disk based on the target image.

[0108] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0109] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.

[0110] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0111] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A method for generating a system disk, characterized in that: The method comprises: Acquire a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk; In the case where there is no dependency relationship between the reference system disk and the template volume, obtaining data blocks in the reference system disk and data blocks in the public image, and obtaining a clone image of the public image; Based on the difference between the data blocks in the reference system disk and the data blocks in the public image, data operation is performed on the clone image, and a target system disk is generated based on the clone image after the data operation.

2. The method according to claim 1, characterized in that The performing data operation on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes: For each data block, if the data block exists in both the reference system disk and the public image, obtain a first hash value of the data block in the reference system disk and a second hash value of the data block in the public image; When the first hash value is different from the second hash value, the data in the data block corresponding to the first hash value is written into the clone image.

3. The method according to claim 1, characterized in that The performing data operation on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes: For each data block, if the data block does not exist in the reference system disk and exists in the public image, data in the data block in the clone image is replaced with a preset value.

4. The method according to claim 1, characterized in that: The performing data operation on the cloned image based on the difference between the data blocks in the reference system disk and the data blocks in the public image includes: For each data block, if the data block exists in the reference system disk and does not exist in the public image, the data in the data block in the reference system disk is directly written into the clone image.

5. The method according to claim 1, characterized in that The method further comprises: In a case where there is a dependency relationship between the reference system disk and the template volume, and data in the template volume is the same as data in the public image, obtaining first difference data between the reference system disk and the public image; A target image is generated based on the data in the public image and the first difference data, and the target system disk is generated based on the target image.

6. The method according to claim 1, characterized in that The method further comprises: In the case where there is a dependency relationship between the reference system disk and the template volume, and the data in the template volume is the same as the data in the custom image, obtaining second difference data between the reference system disk and the custom image, and obtaining third difference data between the custom image and the public image; A target image is generated based on the data in the public image, the second difference data and the third difference data, and the target system disk is generated based on the target image.

7. A system disk generation device, characterized in that: The device comprises: A first acquisition module, used for acquiring a reference system disk, a template volume corresponding to the reference system disk, and a public image of the system disk; A second acquisition module, configured to acquire data blocks in the reference system disk and data blocks in the public image, and acquire a clone image of the public image, when there is no dependency relationship between the reference system disk and the template volume; The data operation module is used to perform data operation on the clone image based on the difference between the data blocks in the reference system disk and the data blocks in the public image, and generate a target system disk based on the clone image after the data operation.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • System disk generation method and apparatus, and computer device, readable storage medium and program product

    WO2026108821A1