Complete machine mirror image creating method and device, complete machine mirror image importing method and device, equipment and medium
By including snapshots of the system disk and data disk during the image creation process, the problem of insufficient integrity of existing custom mirror data is solved, and more comprehensive mirror data coverage and convenience of batch virtual machine creation is achieved.
Patent Information
- Application Number
- CN202311167547.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-11
- Publication Date
- 2025-03-11
AI Technical Summary
Existing custom images only contain the system disk of the virtual machine and do not contain the data disk, resulting in insufficient data integrity and it is difficult to quickly batch create virtual machines of the same business.
By determining the system disk position and data disk position, send snapshot creation instructions to the corresponding components, create system disk snapshots and data disk snapshots, and add their IDs to the entire machine image.
Enhanced data integrity of the mirror, allowing custom images to contain full amount of data, making it easier to quickly batch create virtual machines for the same business.
Smart Images

Figure CN119597392A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method for creating, a method for importing, a device, a equipment, and a medium for a whole machine image. Background Art
[0002] An image is a complete data copy of a system disk snapshot, which can be used for customer booting. Images are divided into standard images (provided by cloud manufacturers), custom images (made by customers), shared images (shared by other customers), and imported images (imported by customers themselves). In actual use, many customers' business data is stored on a separate data disk.
[0003] Currently, customers can create complete images based on their own virtual machines, but custom images only contain the system disk of the virtual machine, not the data disk. It can be seen that the data integrity of current custom images is insufficient, making it inconvenient to quickly and batch create virtual machines for the same business. Summary of the invention
[0004] At least one embodiment of the present disclosure provides a method for creating, a method for importing, an apparatus, a device, and a medium for a whole machine image to enhance the data integrity of the image.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for creating a whole machine image, the method comprising:
[0006] The image component responds to the request to create the whole machine image and creates a whole machine image ID as a response to the creation request;
[0007] The mirror component determines the system disk location and the data disk location, and sends a system disk snapshot creation instruction corresponding to the system disk location to the component for creating a system disk snapshot corresponding to the system disk location, and sends a data disk snapshot creation instruction corresponding to the data disk location to the component for creating a data disk snapshot corresponding to the data disk location;
[0008] The mirror component receives the system disk snapshot ID created by the component for creating the system disk snapshot in response to the system disk snapshot creation instruction, and receives the data disk snapshot ID created by the component for creating the data disk snapshot in response to the data disk snapshot creation instruction;
[0009] After the component for creating a system disk snapshot completes creating the system disk snapshot, the image component adds the system disk snapshot ID to the entire machine image; and after the component for creating a data disk snapshot completes creating the data disk snapshot, the image component adds the data disk snapshot ID to the entire machine image.
[0010] In some embodiments, sending a system disk snapshot creation instruction corresponding to the system disk position to a component for creating a system disk snapshot corresponding to the system disk position includes:
[0011] If the system disk is located locally, a local system disk snapshot creation instruction is sent to the computing component;
[0012] If the system disk is located in the cloud, a cloud disk system disk snapshot creation instruction is sent to the storage component;
[0013] Sending a data disk snapshot creation instruction corresponding to the data disk location to a component for creating a data disk snapshot corresponding to the data disk location includes:
[0014] If the data disk is located locally, a local data disk snapshot creation instruction is sent to the computing component; if the data disk is located in the cloud, a cloud disk data disk snapshot creation instruction is sent to the storage component.
[0015] In some embodiments, the method for creating a whole machine image further includes:
[0016] The mirror component creates a whole-machine mirror state in response to a request to create a whole-machine mirror, wherein the whole-machine mirror state is a state for indicating waiting for a system disk snapshot;
[0017] When the image component adds the system disk snapshot ID to the whole machine image and the data disk snapshot creation is not completed, the whole machine image state is updated to indicate a state for waiting for the data disk snapshot creation;
[0018] After the image component adds the system disk snapshot ID and the data disk snapshot ID to the whole machine image, it updates the whole machine image state to the activated state, which is used to indicate that the whole machine image is available.
[0019] In a second aspect, the embodiment of the present disclosure further provides a method for importing a whole machine image, the method comprising:
[0020] The image component responds to the import request of the whole machine image and creates a whole machine image ID as a response to the import request;
[0021] The image component sends a cloud disk creation instruction to the storage component;
[0022] The image component receives the cloud disk ID created by the storage component in response to the cloud disk creation instruction;
[0023] After the cloud disk corresponding to the cloud disk ID is created, the image component sends a cloud disk snapshot creation instruction to the storage component. The cloud disk snapshot creation instruction carries the cloud disk ID.
[0024] The image component receives the cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction;
[0025] After the storage component completes creating the cloud disk snapshot, the image component adds the cloud disk snapshot ID to the whole machine image, writes the metadata of the whole machine image to the whole machine image, and updates the whole machine image state to the activated state, which is used to indicate that the whole machine image is available.
[0026] In some embodiments, the cloud disk creation instruction carries the storage address of the whole machine image, and the whole machine image import method further includes:
[0027] The storage component responds to the cloud disk creation instruction and sends a cloud disk snapshot creation instruction to the cloud disk corresponding to the storage component, where the cloud disk snapshot creation instruction includes the cloud disk type and the storage address of the whole machine image;
[0028] The cloud disk corresponding to the storage component responds to the instruction, creates an empty disk mounted locally, downloads the whole machine image from the storage address of the whole machine image, and writes the whole machine image to the empty disk based on the cloud disk type; updates the cloud disk status corresponding to the cloud disk ID to an available status, and the available status is used to indicate that the cloud disk creation is complete.
[0029] In some embodiments, the method for importing the whole machine image further includes:
[0030] The image component creates a whole-machine image state in response to the whole-machine image import request, wherein the whole-machine image state is a state for indicating waiting for the cloud disk snapshot to be created;
[0031] After the image component adds the cloud disk snapshot ID to the whole machine image, it updates the whole machine image status to the activated status, which is used to indicate that the whole machine image is available.
[0032] In a third aspect, the embodiment of the present disclosure further provides a device for creating a whole machine image, which is applied to an image component, and the device includes:
[0033] A creation unit, configured to respond to a request for creating a whole machine image and create a whole machine image ID as a response to the creation request;
[0034] a sending unit, used to determine the system disk position and the data disk position, and send a system disk snapshot creation instruction corresponding to the system disk position to the component for creating a system disk snapshot corresponding to the system disk position, and send a data disk snapshot creation instruction corresponding to the data disk position to the component for creating a data disk snapshot corresponding to the data disk position;
[0035] a receiving unit, configured to receive a system disk snapshot ID created by a component for creating a system disk snapshot in response to a system disk snapshot creation instruction, and receive a data disk snapshot ID created by a component for creating a data disk snapshot in response to a data disk snapshot creation instruction;
[0036] The adding unit is used to add the system disk snapshot ID to the whole machine image after the component for creating the system disk snapshot completes the creation of the system disk snapshot; and to add the data disk snapshot ID to the whole machine image after the component for creating the data disk snapshot completes the creation of the data disk snapshot.
[0037] In a fourth aspect, the embodiment of the present disclosure further provides a whole machine image importing device, which is applied to the image component, and the device includes:
[0038] A creating unit, configured to respond to a request for importing a whole machine image and create a whole machine image ID as a response to the import request;
[0039] A first sending unit, configured to send a cloud disk creation instruction to a storage component;
[0040] A first receiving unit, configured to receive a cloud disk ID created by the storage component in response to a cloud disk creation instruction;
[0041] A second sending unit is used to send a cloud disk snapshot creation instruction to the storage component after the cloud disk corresponding to the cloud disk ID is created, where the cloud disk snapshot creation instruction carries the cloud disk ID;
[0042] A second receiving unit is used to receive a cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction;
[0043] The processing unit is used to add the cloud disk snapshot ID to the whole machine image and write the metadata of the whole machine image into the whole machine image after the storage component completes creating the cloud disk snapshot.
[0044] In a fifth aspect, an embodiment of the present disclosure further proposes an electronic device, comprising a memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the steps of the method for creating a whole machine image as described in any embodiment of the first aspect or the steps of the method for importing a whole machine image as described in any embodiment of the second aspect.
[0045] In a sixth aspect, an embodiment of the present disclosure further proposes a computer-readable storage medium, wherein the computer-readable storage medium stores a program or instruction, and the program or instruction enables a computer to execute the steps of the method for creating a whole machine image as described in any embodiment of the first aspect or the steps of the method for importing a whole machine image as described in any embodiment of the second aspect.
[0046] In the seventh aspect, an embodiment of the present disclosure further provides a computer program product, wherein the computer program product includes a computer program, the computer program is stored in a computer-readable storage medium, and at least one processor of a computer reads and executes the computer program from the computer-readable storage medium, so that the computer performs the steps of the method for creating a whole machine image as described in any embodiment of the first aspect or the steps of the method for importing a whole machine image as described in any embodiment of the second aspect.
[0047] It can be seen that in at least one embodiment of the present disclosure, by determining the system disk location and the data disk location, a system disk snapshot creation instruction is sent to the component for creating a system disk snapshot corresponding to the system disk location, and a data disk snapshot creation instruction is sent to the component for creating a data disk snapshot corresponding to the data disk location; and then the system disk snapshot ID sent by the component for creating the system disk snapshot and the data disk snapshot ID sent by the component for creating the data disk snapshot can be received; thereby, the system disk snapshot ID and the data disk ID are added to the whole machine image, so that the whole machine image contains not only the system disk data but also the data disk data, thereby improving the data integrity of the whole machine image, supporting customers to define the full amount of data in the image, and facilitating the rapid batch creation of virtual machines for the same business. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, 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 some embodiments of the present disclosure, and a person skilled in the art can also obtain other drawings based on these drawings.
[0049] Figure 1 A schematic diagram of a process for creating a whole machine image provided by an embodiment of the present disclosure;
[0050] Figure 2 A schematic diagram of a process flow of another method for creating a whole machine image provided by an embodiment of the present disclosure;
[0051] Figure 3 A schematic diagram of a flow chart of a method for importing a whole machine image provided in an embodiment of the present disclosure;
[0052] Figure 4 A flowchart of another method for importing a whole machine image provided by an embodiment of the present disclosure;
[0053] Figure 5 A schematic diagram of a process of creating and importing a whole machine image provided by an embodiment of the present disclosure;
[0054] Figure 6 A schematic diagram of a device for creating a whole machine image provided by an embodiment of the present disclosure;
[0055] Figure 7 A schematic diagram of a whole machine image importing device provided in an embodiment of the present disclosure;
[0056] Figure 8 An exemplary block diagram of an electronic device provided for an embodiment of the present disclosure. DETAILED DESCRIPTION
[0057] In order to more clearly understand the above-mentioned purposes, features and advantages of the present disclosure, the present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. The specific embodiments described herein are only used to explain the present disclosure, rather than to limit the present disclosure. Based on the described embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in the field belong to the scope of protection of the present disclosure.
[0058] It should be noted that, in this document, relational terms such as “first” and “second” are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0059] Figure 1 A flow chart of a method for creating a whole machine image provided in an embodiment of the present disclosure, wherein the execution subject of the method for creating a whole machine image is an electronic device, and the electronic device includes but is not limited to a smart phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, a server, etc., wherein the server can be an independent server or a cluster of multiple servers, and can include a server built locally and a server built in the cloud.
[0060] In some embodiments, the method for creating a whole machine image is applied to an image component, which is a component responsible for imaging in an open source cloud operating system. For example, the open source cloud operating system is OpenStack, and the image component is a component responsible for imaging in OpenStack (referred to as Glance).
[0061] like Figure 1 As shown, the method for creating the whole machine image may include but is not limited to steps 101 to 104:
[0062] In step 101, the image component creates a whole machine image ID as a response to the creation request in response to the creation request.
[0063] In this embodiment, the creation request of the whole machine image can be initiated by the user in the virtual machine through the console, and the image component can obtain the creation request of the whole machine image initiated by the console, and then after completing the parameter verification, the whole machine image ID can be created, and the whole machine image ID is sent to the console as a response to the creation request, so that the user can know the created whole machine image ID. Among them, parameter verification is a necessary step when creating an image, which belongs to the conventional operation in this field and will not be repeated.
[0064] In step 102, the mirror component determines the system disk location and the data disk location, and sends a system disk snapshot creation instruction corresponding to the system disk location to the component for creating a system disk snapshot corresponding to the system disk location, and sends a data disk snapshot creation instruction corresponding to the data disk location to the component for creating a data disk snapshot corresponding to the data disk location.
[0065] In this embodiment, in order to improve the data integrity of the whole machine image, the image component determines the location of the system disk and the data disk, so as to take snapshots of the system disk and the data disk respectively and use them as part of the whole machine image to improve the data integrity of the whole machine image. The system disk is the system disk of the virtual machine (i.e., virtual machine), and the data disk is the data disk of the virtual machine (i.e., virtual machine). Among them, the snapshot is the image of the disk data at a certain point in time; the snapshot can be used for data rollback; snapshots can be created for both the system disk and the data disk, and they are all incremental snapshots.
[0066] In this embodiment, in order to take a snapshot of the system disk, it is necessary to send a system disk snapshot creation instruction corresponding to the system disk location to the component for creating the system disk snapshot corresponding to the system disk location, so that the component for creating the system disk snapshot creates the system disk snapshot in response to the system disk snapshot creation instruction. Among them, the system disk location determines the component for creating the system disk snapshot and the system disk snapshot creation instruction. Different system disk locations correspond to different components for creating system disk snapshots, and different system disk locations correspond to different system disk snapshot creation instructions. For example, if the system disk location is local, a local system disk snapshot creation instruction is sent to the computing component; if the system disk location is in the cloud, a cloud disk system disk snapshot creation instruction is sent to the storage component. Among them, if the image component is the component responsible for image in OpenStack (referred to as Glance), the computing component is the component responsible for computing in OpenStack (referred to as Nova), and the storage component is the component responsible for block storage in OpenStack (referred to as Cinder).
[0067] In this embodiment, in order to take a snapshot of the data disk, it is necessary to send a data disk snapshot creation instruction corresponding to the data disk location to the component for creating the data disk snapshot corresponding to the data disk location, so that the component for creating the data disk snapshot creates the data disk snapshot in response to the data disk snapshot creation instruction. Among them, the data disk location determines the component for creating the data disk snapshot and the data disk snapshot creation instruction. Different data disk locations correspond to different components for creating data disk snapshots, and different data disk locations correspond to different data disk snapshot creation instructions. For example, if the data disk location is local, a local data disk snapshot creation instruction is sent to the computing component; if the data disk location is in the cloud, a cloud disk data disk snapshot creation instruction is sent to the storage component. Among them, if the image component is the component responsible for image in OpenStack (referred to as Glance), the computing component is the component responsible for computing in OpenStack (referred to as Nova), and the storage component is the component responsible for block storage in OpenStack (referred to as Cinder).
[0068] In step 103, the mirror component receives the system disk snapshot ID created by the component for creating the system disk snapshot in response to the system disk snapshot creation instruction, and receives the data disk snapshot ID created by the component for creating the data disk snapshot in response to the data disk snapshot creation instruction.
[0069] In this embodiment, after receiving the system disk snapshot creation instruction, the component for creating the system disk snapshot may create a system disk snapshot ID and a system disk snapshot, and send the system disk snapshot ID to the mirror component.
[0070] For example, the image component is the component in OpenStack responsible for images (denoted as Glance), the computing component is the component in OpenStack responsible for computing (denoted as Nova), and the storage component is the component in OpenStack responsible for block storage (denoted as Cinder).
[0071] If the system disk location is local, the component used to create the system disk snapshot is Nova, the system disk snapshot ID is the local system disk snapshot ID, the system disk snapshot creation instruction is the local system disk snapshot creation instruction, and the local system disk snapshot creation instruction is the create image instruction (createImage):
[0072] createImage:
[0073] name=create-from-machine image ID;
[0074] backup_execution_type=manual;
[0075] metadata.image_type=local_backup.
[0076] It can be seen that the local system disk snapshot creation instruction carries the whole machine image ID, the backup execution type (backup_execution_type) is manual, and the image metadata type (metadata.image_type) is local backup (local_backup), where metadata is data about data used to describe data, mainly describing information about data properties.
[0077] If the system disk location is a cloud disk, the component used to create the system disk snapshot is Cinder, the system disk snapshot ID is the cloud disk system disk snapshot ID, the system disk snapshot creation instruction is the cloud disk system disk snapshot creation instruction, and the cloud disk system disk snapshot creation instruction is the snapshot creation instruction (snapshot):
[0078] snapshot:
[0079] volume_id = cloud disk system disk ID;
[0080] name=create-from-machine image ID;
[0081] force=true.
[0082] It can be seen that the cloud disk system disk snapshot creation instruction carries the whole machine image ID and the cloud disk system disk ID.
[0083] In this embodiment, after receiving the data disk snapshot creation instruction, the component for creating the data disk snapshot may create a data disk snapshot ID and a data disk snapshot, and send the data disk snapshot ID to the mirror component.
[0084] For example, the image component is the component in OpenStack responsible for images (denoted as Glance), the computing component is the component in OpenStack responsible for computing (denoted as Nova), and the storage component is the component in OpenStack responsible for block storage (denoted as Cinder).
[0085] If the data disk location is local, the component used to create the data disk snapshot is Nova, the data disk snapshot ID is the local data disk backup ID, the data disk snapshot creation instruction is the local data disk snapshot creation instruction, and the local data disk snapshot creation instruction is the temporary backup instruction (backupEphemeral):
[0086] backupEphemeral:
[0087] name=create-from-machine image ID
[0088] backup_execution_type=manual
[0089] It can be seen that the local data disk snapshot creation instruction carries the whole machine image ID, and the backup execution type (backup_execution_type) is manual.
[0090] If the data disk location is a cloud disk, the component used to create a data disk snapshot is Cinder, the data disk snapshot ID is the cloud disk data disk snapshot ID, the data disk snapshot creation instruction is the cloud disk data disk snapshot creation instruction, and the cloud disk data disk snapshot creation instruction is the snapshot creation instruction (snapshot):
[0091] snapshot:
[0092] volume_id = cloud disk data disk ID;
[0093] name=create-from-machine image ID;
[0094] force=true.
[0095] It can be seen that the cloud disk data disk snapshot creation instruction carries the whole machine image ID and the cloud disk data disk ID.
[0096] In step 104, the mirror component adds the system disk snapshot ID to the entire machine image after the component for creating the system disk snapshot completes the creation of the system disk snapshot; and adds the data disk snapshot ID to the entire machine image after the component for creating the data disk snapshot completes the creation of the data disk snapshot.
[0097] In this embodiment, after the image component determines that the system disk snapshot and the data disk snapshot are created, the system disk snapshot ID and the data disk ID are added to the location of the whole machine image (image.locations).
[0098] It can be seen that in the embodiment of the present disclosure, by determining the system disk location and the data disk location, a system disk snapshot creation instruction is sent to the component for creating a system disk snapshot corresponding to the system disk location, and a data disk snapshot creation instruction is sent to the component for creating a data disk snapshot corresponding to the data disk location; then, the system disk snapshot ID sent by the component for creating a system disk snapshot and the data disk snapshot ID sent by the component for creating a data disk snapshot can be received; thereby, the system disk snapshot ID and the data disk ID are added to the whole machine image, so that the whole machine image contains not only the system disk data but also the data disk data, thereby improving the data integrity of the whole machine image, supporting customers to define images that contain full data, and facilitating the rapid batch creation of virtual machines for the same business.
[0099] In some embodiments, the image component creates a whole-machine image status (image.status) in response to a request to create a whole-machine image, wherein the whole-machine image status is a status (snapshot_system_disk) for indicating waiting for a system disk snapshot, that is, image.status=snapshot_system_disk.
[0100] In this embodiment, when the image component adds the system disk snapshot ID to the whole machine image and the data disk snapshot creation is not completed, the whole machine image status is updated to indicate the status of waiting for the data disk snapshot creation (snapshot_data_disk), that is, image.status=snapshot_system_disk.
[0101] In this embodiment, after the image component adds the system disk snapshot ID and the data disk snapshot ID to the whole machine image, it updates the whole machine image status to the active status (Active), that is, image.status=Active, where the active status is used to indicate that the whole machine image is available.
[0102] based on Figure 1 Related embodiments, Figure 2 A schematic diagram of a process flow of another method for creating a whole machine image provided by an embodiment of the present disclosure, in Figure 2In the example, the user initiates a request to create a whole-machine image from a virtual machine (i.e., a virtual machine) through the console to the image component Glance. In response to the request to create a whole-machine image, Glance can create a whole-machine image ID and a whole-machine image status (image.status) after completing parameter verification. The whole-machine image status is used to indicate the status of waiting for a system disk snapshot (snapshot_system_disk), that is, image.status = snapshot_system_disk. Glance sends the created whole-machine image ID to the console so that the user can know the created whole-machine image ID.
[0103] exist Figure 2 In the process, after Glance sends the whole machine image ID to the console, if it determines that the system disk is a local system disk, it executes Figure 2 The process steps in the dotted box corresponding to the local system disk in FIG. 1 are as follows. Specifically, Glance sends a local system disk snapshot creation instruction to the computing component Nova. The local system disk snapshot creation instruction is a create image instruction (createImage):
[0104] createImage:
[0105] name=create-from-machine image ID;
[0106] backup_execution_type=manual;
[0107] metadata.image_type=local_backup.
[0108] After Glance sends the local system disk snapshot creation command, it receives the local system disk snapshot ID created by Nova in response to the local system disk snapshot creation command. Glance waits for the local system disk snapshot to be created. If the creation is completed, it adds the local system disk snapshot ID to the whole machine image, for example, to the location of the whole machine image (image.locations). Glance also inherits the virtual machine image metadata to the whole machine image.
[0109] exist Figure 2 In the process, after Glance sends the whole machine image ID to the console, if it is determined that the system disk is a cloud disk system disk, execute Figure 2 The process steps in the dotted box corresponding to the cloud disk system disk are as follows: specifically, Glance sends a cloud disk system disk snapshot creation instruction to the storage component Cinder. The cloud disk system disk snapshot creation instruction is a snapshot creation instruction (snapshot):
[0110] snapshot:
[0111] volume_id = cloud disk system disk ID;
[0112] name=create-from-machine image ID;
[0113] force=true.
[0114] After Glance sends the cloud disk system disk snapshot creation instruction, it receives the cloud disk system disk snapshot ID created by Cinder in response to the cloud disk system disk snapshot creation instruction. Glance waits for the cloud disk system disk snapshot to be created. If the creation is completed, the cloud disk system disk snapshot ID is added to the whole machine image, for example, to the location of the whole machine image (image.locations). Glance also inherits the virtual machine image metadata to the whole machine image.
[0115] exist Figure 2 In the example, after Glance adds the system disk snapshot ID to the whole machine image, it updates the whole machine image status to indicate a status (snapshot_data_disk) for waiting for the creation of a data disk snapshot, that is, image.status=snapshot_system_disk.
[0116] exist Figure 2 In the process, after Glance updates the whole machine image status to snapshot_data_disk, if the data disk is determined to be a local data disk, execute Figure 2 The process steps in the dotted box corresponding to the local data disk in the figure are as follows: Specifically, Glance sends a local data disk snapshot creation instruction to the computing component Nova. The local data disk snapshot creation instruction is a temporary backup instruction (backupEphemeral):
[0117] backupEphemeral:
[0118] name=create-from-machine image ID;
[0119] backup_execution_type=manual.
[0120] After Glance sends the local data disk snapshot creation instruction, it receives the local data disk snapshot ID created by Nova in response to the local data disk snapshot creation instruction. Glance waits for the local data disk snapshot to be created. If the creation is completed, the local data disk snapshot ID is added to the whole machine image, for example, to the location of the whole machine image (image.locations). Glance also inherits the virtual machine image metadata to the whole machine image.
[0121] exist Figure 2 After Glance sends the whole machine image ID to the console, if it is determined that the data disk is a cloud disk, execute Figure 2 The process steps in the dotted box corresponding to the cloud disk data disk are as follows: specifically, Glance sends a cloud disk data disk snapshot creation instruction to the storage component Cinder. The cloud disk data disk snapshot creation instruction is a snapshot creation instruction (snapshot):
[0122] snapshot:
[0123] volume_id = cloud disk data disk ID;
[0124] name=create-from-machine image ID;
[0125] force=true.
[0126] After Glance sends the cloud disk data disk snapshot creation instruction, it receives the cloud disk data disk snapshot ID created by Cinder in response to the cloud disk data disk snapshot creation instruction. Glance waits for the cloud disk data disk snapshot to be created. If the creation is completed, the cloud disk data disk snapshot ID is added to the whole machine image, for example, to the location of the whole machine image (image.locations).
[0127] exist Figure 2 In the example, after Glance adds the system disk snapshot ID and the data disk snapshot ID to the whole machine image, it updates the whole machine image status to the active status (Active), that is, image.status=Active, where the active status is used to indicate that the whole machine image is available.
[0128] Figure 3 A flow chart of a method for importing a whole machine image provided in an embodiment of the present disclosure is provided. The execution subject of the method for importing a whole machine image is an electronic device, and the electronic device includes but is not limited to a smart phone, a PDA, a tablet computer, a wearable device with a display screen, a desktop computer, a laptop computer, an all-in-one machine, a smart home device, a server, etc., wherein the server can be an independent server or a cluster of multiple servers, including a server built locally and a server built in the cloud.
[0129] In some embodiments, the whole machine image import method is applied to the image component, which is the component responsible for the image in the open source cloud operating system. For example, the open source cloud operating system is OpenStack, and the image component is the component responsible for the image in OpenStack (referred to as Glance).
[0130] like Figure 3As shown, the method for importing the whole machine image may include but is not limited to steps 301 to 306:
[0131] 301. The image component responds to a request to import a whole machine image and creates a whole machine image ID as a response to the import request.
[0132] In this embodiment, the import request of the whole machine image can be initiated by the user in the virtual machine through the console, and the image component can obtain the import request of the whole machine image initiated by the console, and then after completing the parameter verification, the whole machine image ID can be created, and the whole machine image ID is sent to the console as a response to the import request, so that the user can know the imported whole machine image ID. Among them, parameter verification is a necessary step when importing an image, which belongs to the conventional operation in this field and will not be repeated.
[0133] In this embodiment, the user needs to first store the whole machine image in the object storage corresponding to the user, and then initiate an import request for the whole machine image through the console. The import request carries the address of the object storage. There are many types of object storage. This article uses the self-developed object storage, which is recorded as KS3. Correspondingly, the address of the object storage is recorded as: KS3_url.
[0134] 302. The image component sends a cloud disk creation instruction to the storage component.
[0135] In this embodiment, if the image component is the component responsible for image in OpenStack (denoted as Glance), then the storage component is the component responsible for block storage in OpenStack (denoted as Cinder). Glance uses the administrator (admin) tenant to create a cloud disk, that is, uses the admin tenant to send a cloud disk creation instruction to Cinder: create_volume_from_KS3, indicating that a cloud disk is created in KS3.
[0136] 303. The mirror component receives the cloud disk ID created by the storage component in response to the cloud disk creation instruction.
[0137] In this embodiment, the image component Glance receives the cloud disk ID created by the storage component Cinder in response to the cloud disk creation instruction. In response to the cloud disk creation instruction, the storage component Cinder reads the configuration file, obtains the default distributed block storage (recorded as EBS) cluster, and can create a cloud disk ID and cloud disk status, and send the cloud disk ID to the image component Glance.
[0138] In this embodiment, the storage component Cinder responds to the cloud disk creation instruction and sends a cloud disk snapshot creation instruction: create_volume_from_KS3 to the cloud disk corresponding to the storage component (recorded as CinderVolume). The cloud disk snapshot creation instruction includes the cloud disk type and the storage address of the entire machine image (ie, KS3_url).
[0139] CinderVolume responds to the cloud disk snapshot creation instruction, creates an empty disk mounted locally, downloads the whole machine image from the storage address of the whole machine image, and writes the whole machine image to the empty disk based on the cloud disk type; CinderVolume updates the cloud disk status corresponding to the cloud disk ID to available status (available), and the available status is used to indicate that the cloud disk creation is complete.
[0140] For example, in response to the cloud disk snapshot creation instruction, CinderVolume creates an empty disk in the EBS cluster and mounts it locally ( / dev / nbdX), downloads the entire machine image from KS3 based on KS3_url, and determines whether the cloud disk type is raw. If not, the entire machine image is converted to raw type and written to the empty disk; if it is raw, the entire machine image is downloaded from KS3 based on KS3_url while being written to the empty disk.
[0141] 304. After the cloud disk corresponding to the cloud disk ID is created, the mirror component sends a cloud disk snapshot creation instruction to the storage component, where the cloud disk snapshot creation instruction carries the cloud disk ID.
[0142] In this embodiment, after the image component Glance receives the cloud disk ID sent by the storage component Cinder, it waits for the cloud disk to be created. After the cloud disk is created, Glance uses the customer tenant to take a snapshot of the cloud disk corresponding to the cloud disk ID, that is, uses the customer tenant to send a cloud disk snapshot creation instruction (snapshot) to Cinder:
[0143] snapshot:
[0144] volume_id = cloud disk ID;
[0145] name=create-from-machine image ID;
[0146] force=true.
[0147] 305. The mirror component receives the cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction.
[0148] 306. After the storage component completes creating the cloud disk snapshot, the image component adds the cloud disk snapshot ID to the whole machine image and writes the metadata of the whole machine image into the whole machine image.
[0149] In some embodiments, the image component creates a whole-machine image status (image.status) in response to a request to import a whole-machine image, wherein the whole-machine image status is a status (creating) for indicating waiting for cloud disk creation, that is, image.status=creating.
[0150] In this embodiment, after the image component adds the cloud disk snapshot ID to the whole machine image, it updates the whole machine image status to the active status (Active), that is, image.status=Active, and the active status is used to indicate that the whole machine image is available.
[0151] based on Figure 3 Related embodiments, Figure 4 A flowchart of another method for importing a whole machine image provided by an embodiment of the present disclosure is provided. Figure 4 In the process, the user initiates a whole-machine image import request to the image component Glance through the console in the virtual machine. Glance responds to the whole-machine image import request and, after completing parameter verification, can create a whole-machine image ID and a whole-machine image status (image.status). The whole-machine image status is used to indicate the state (creating) of waiting for the cloud disk to be created, that is, image.status = creating. Glance sends the created whole-machine image ID to the console so that the user can know the created whole-machine image ID.
[0152] exist Figure 4 In the process, after Glance sends the whole machine image ID to the console, it sends a cloud disk creation instruction to the storage component Cinder. For example, Glance uses the admin tenant to send a cloud disk creation instruction to Cinder: create_volume_from_KS3, which means to create a cloud disk in KS3. Cinder responds to the cloud disk creation instruction, reads the configuration file, obtains the default distributed block storage (recorded as EBS) cluster, and can create a cloud disk ID and cloud disk status (volume status). The cloud disk status is used to indicate the status of waiting for a cloud disk snapshot. Cinder sends the created cloud disk ID to the image component Glance.
[0153] exist Figure 4In the example, after Cinder sends the created cloud disk ID to the image component Glance, it sends a cloud disk snapshot creation instruction: create_volume_from_KS3 to the cloud disk corresponding to the storage component (recorded as CinderVolume). The cloud disk snapshot creation instruction includes the cloud disk type and the storage address of the whole machine image (i.e., KS3_url).
[0154] exist Figure 4 In the CinderVolume response to the cloud disk snapshot creation instruction, determine whether the cloud disk type is raw (original) type, if not raw type, then execute Figure 4 The process steps in the dotted box where the cloud disk type is not the raw type are as follows: CinderVolume downloads the whole machine image from KS3 based on KS3_url, creates an empty disk in the EBS cluster and mounts it locally ( / dev / nbdX), and converts the whole machine image to the raw type and writes it to the empty disk. This can be achieved through the following command line: qemu_img convert-O local file / dev / nbdX.
[0155] If the cloud disk type is raw, execute Figure 4 The cloud disk type is the process step in the dotted box corresponding to the raw type. Specifically, CinderVolume creates an empty disk in the EBS cluster and mounts it locally ( / dev / nbdX), while downloading the entire machine image from KS3 based on KS3_url and writing to the empty disk.
[0156] exist Figure 4 In the process, after CinderVolume writes the entire machine image to the empty disk, it updates the cloud disk status corresponding to the cloud disk ID to available status (available). The available status is used to indicate that the cloud disk creation is complete.
[0157] exist Figure 4 In the process, after receiving the cloud disk ID sent by Cinder, Glance waits for the cloud disk to be created. After the cloud disk is created, Glance uses the customer tenant to take a snapshot of the cloud disk corresponding to the cloud disk ID. That is, it uses the customer tenant to send a cloud disk snapshot creation instruction (snapshot) to Cinder:
[0158] snapshot:
[0159] volume_id = cloud disk ID;
[0160] name=create-from-machine image ID;
[0161] force=true.
[0162] exist Figure 4 In the process, after Glance sends a cloud disk snapshot creation instruction to Cinder, Glance receives the cloud disk snapshot ID created by Cinder for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction. After Cinder completes the creation of the cloud disk snapshot, Glance adds the cloud disk snapshot ID to the whole machine image and writes the metadata of the whole machine image into the whole machine image.
[0163] exist Figure 4 In the example, after Glance adds the cloud disk snapshot ID to the whole machine image, it updates the whole machine image status to the active status (Active), that is, image.status=Active, where the active status is used to indicate that the whole machine image is available.
[0164] based on Figure 2 The method for creating a whole machine image shown in Figure 4 The method of importing the whole machine image shown in the figure is as follows: Figure 5 A schematic diagram of a process for creating and importing a whole machine image is provided in an embodiment of the present disclosure. Figure 5 In the example, snapshots are taken of the local system disk, local data disk, and cloud disk on virtual machine A (VM A) to obtain Glance (KS3), KVM (Kernel-based Virtual Machine) backups, and EBS snapshots. These snapshots together constitute the whole machine image. When the whole machine image is imported to virtual machine B (VM B) for use, cloud disks are created for Glance (KS3), KVM backups, and EBS snapshots. VM B uses the whole machine image based on the created cloud disks.
[0165] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all described as a series of action combinations, but those skilled in the art can understand that the embodiments of the present disclosure are not limited by the described action sequence, because according to the embodiments of the present disclosure, some steps can be performed in other sequences or simultaneously. In addition, those skilled in the art can understand that the embodiments described in the specification are all optional embodiments.
[0166] Figure 6 The present invention provides a schematic diagram of a device for creating a whole machine image, which is applied to an image component. Figure 6 As shown, the whole machine image creation device includes but is not limited to: a creation unit 61, a sending unit 62, a receiving unit 63 and an adding unit 64:
[0167] A creation unit 61, configured to, in response to a request for creating a whole machine image, create a whole machine image ID as a response to the creation request;
[0168] The sending unit 62 is used to determine the system disk position and the data disk position, and send a system disk snapshot creation instruction corresponding to the system disk position to the component for creating a system disk snapshot corresponding to the system disk position, and send a data disk snapshot creation instruction corresponding to the data disk position to the component for creating a data disk snapshot corresponding to the data disk position;
[0169] The receiving unit 63 is used to receive the system disk snapshot ID created by the component for creating the system disk snapshot in response to the system disk snapshot creation instruction, and receive the data disk snapshot ID created by the component for creating the data disk snapshot in response to the data disk snapshot creation instruction;
[0170] The adding unit 64 is used to add the system disk snapshot ID to the whole machine image after the component for creating the system disk snapshot completes the creation of the system disk snapshot; and to add the data disk snapshot ID to the whole machine image after the component for creating the data disk snapshot completes the creation of the data disk snapshot.
[0171] In some embodiments, the sending unit 62 sends a system disk snapshot creation instruction corresponding to the system disk position to the component for creating a system disk snapshot corresponding to the system disk position, including:
[0172] If the system disk is located locally, a local system disk snapshot creation instruction is sent to the computing component;
[0173] If the system disk is located in the cloud, a cloud disk system disk snapshot creation instruction is sent to the storage component;
[0174] The sending unit 62 sends a data disk snapshot creation instruction corresponding to the data disk position to the component for creating a data disk snapshot corresponding to the data disk position, including:
[0175] If the data disk location is local, a local data disk snapshot creation instruction is sent to the computing component; if the data disk location is in the cloud, a cloud disk data disk snapshot creation instruction is sent to the storage component.
[0176] In some embodiments, the creation unit 61 is further used to: create a whole machine image state in response to a request to create a whole machine image, wherein the whole machine image state is a state for indicating a state of waiting for a system disk snapshot;
[0177] The whole machine image creation device further includes an updating unit, which is used to update the whole machine image state to a state indicating waiting for the data disk snapshot to be created when the adding unit 64 adds the system disk snapshot ID to the whole machine image and the data disk snapshot creation is not completed;
[0178] The updating unit is further configured to update the state of the whole machine image to an activated state after the adding unit 64 adds the system disk snapshot ID and the data disk snapshot ID to the whole machine image. The activated state is used to indicate that the whole machine image is available.
[0179] Figure 7 The present invention provides a schematic diagram of a whole machine mirroring device for use in an embodiment of the present invention, wherein the device is applied to a mirroring component. Figure 7 As shown, the whole machine image importing device includes but is not limited to: a creation unit 71, a first sending unit 72, a first receiving unit 73, a second sending unit 74, a second receiving unit 75 and a processing unit 76:
[0180] A creation unit 71, configured to create a whole machine image ID as a response to the import request in response to the whole machine image import request;
[0181] A first sending unit 72, configured to send a cloud disk creation instruction to a storage component;
[0182] A first receiving unit 73 is used to receive a cloud disk ID created by the storage component in response to a cloud disk creation instruction;
[0183] The second sending unit 74 is used to send a cloud disk snapshot creation instruction to the storage component after the cloud disk corresponding to the cloud disk ID is created, and the cloud disk snapshot creation instruction carries the cloud disk ID;
[0184] The second receiving unit 75 is used to receive a cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction;
[0185] The processing unit 76 is used to add the cloud disk snapshot ID to the whole machine image and write the metadata of the whole machine image into the whole machine image after the storage component completes creating the cloud disk snapshot.
[0186] In some embodiments, the cloud disk creation instruction carries the storage address of the whole machine image, and the storage component is used to respond to the cloud disk creation instruction and send a cloud disk snapshot creation instruction to the cloud disk corresponding to the storage component, and the cloud disk snapshot creation instruction includes the cloud disk type and the storage address of the whole machine image;
[0187] The cloud disk corresponding to the storage component is used to respond to instructions, create an empty disk mounted locally, download the whole machine image from the storage address of the whole machine image, and write the whole machine image to the empty disk based on the cloud disk type; update the cloud disk status corresponding to the cloud disk ID to an available status, and the available status is used to indicate that the cloud disk creation is complete.
[0188] In some embodiments, the creation unit 71 is further used to create a whole machine image state in response to a request to import the whole machine image, wherein the whole machine image state is a state for indicating waiting for the cloud disk snapshot to be created;
[0189] The whole machine image importing device also includes an updating unit, which is used to update the whole machine image state to an activated state after the processing unit 76 adds the cloud disk snapshot ID to the whole machine image. The activated state is used to indicate that the whole machine image is available.
[0190] Figure 8 is an exemplary block diagram of an electronic device provided by an embodiment of the present disclosure. Figure 8 As shown, the electronic device includes: a memory 81, a processor 82, and a computer program stored in the memory 81. It can be understood that the memory 81 in this embodiment can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories.
[0191] In some implementations, the memory 81 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof: an operating system and application programs.
[0192] Among them, the operating system includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic tasks and process hardware-based tasks. The application program includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application tasks. The program that implements the method for creating a whole machine image or the method for importing a whole machine image provided by the embodiment of the present disclosure can be included in the application program.
[0193] In the embodiment of the present disclosure, at least one processor 82 calls a program or instruction stored in at least one memory 81, specifically, a program or instruction stored in an application, and at least one processor 82 is used to execute the whole machine image creation method or the whole machine image import method provided in the embodiment of the present disclosure.
[0194] The method for creating a whole machine image or the method for importing a whole machine image provided in the embodiment of the present disclosure can be applied to the processor 82 or implemented by the processor 82. The processor 82 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 82 or an instruction in the form of software. The above-mentioned processor 82 can be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0195] The method for creating a whole machine image or the method for importing a whole machine image provided by the embodiment of the present disclosure can be directly embodied as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 81, and the processor 82 reads the information in the memory 81, and the steps of the method are completed in combination with its hardware.
[0196] The embodiment of the present disclosure also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program or instruction, wherein the program or instruction enables a computer to execute a method for creating a whole machine image or a method for importing a whole machine image, which will not be described here in order to avoid repeated description. The computer-readable storage medium may be a non-transitory computer-readable storage medium.
[0197] The embodiment of the present disclosure also proposes a computer program product, which includes a computer program, which is stored in a computer-readable storage medium, and the computer-readable storage medium may be a non-transitory computer-readable storage medium. At least one processor of a computer reads and executes the computer program from the computer-readable storage medium, so that the computer executes a method for creating a whole machine image or a method for importing a whole machine image, which will not be described here in detail to avoid repeated description.
[0198] It should be noted that, in this article, the terms "include", "comprises" or any other variations 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, an element defined by the sentence "includes..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0199] Those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present disclosure and to form different embodiments.
[0200] Those skilled in the art will appreciate that the description of each embodiment has its own emphasis, and for parts not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0201] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for creating a whole machine image, the method comprising: The image component responds to the request to create the whole machine image and creates a whole machine image ID as a response to the creation request; The mirror component determines the system disk location and the data disk location, and sends a system disk snapshot creation instruction corresponding to the system disk location to a component for creating a system disk snapshot corresponding to the system disk location, and sends a data disk snapshot creation instruction corresponding to the data disk location to a component for creating a data disk snapshot corresponding to the data disk location; The mirror component receives the system disk snapshot ID created by the component for creating the system disk snapshot in response to the system disk snapshot creation instruction, and receives the data disk snapshot ID created by the component for creating the data disk snapshot in response to the data disk snapshot creation instruction; The image component adds the system disk snapshot ID to the whole machine image after the component for creating the system disk snapshot completes creating the system disk snapshot; After the component for creating a data disk snapshot completes creating the data disk snapshot, the data disk snapshot ID is added to the entire machine image.
2. The method according to claim 1, wherein: The sending a system disk snapshot creation instruction corresponding to the system disk position to a component for creating a system disk snapshot corresponding to the system disk position includes: If the system disk is located locally, a local system disk snapshot creation instruction is sent to the computing component; If the system disk is located in the cloud, a cloud disk system disk snapshot creation instruction is sent to the storage component; The sending a data disk snapshot creation instruction corresponding to the data disk position to a component for creating a data disk snapshot corresponding to the data disk position includes: If the data disk is located locally, a local data disk snapshot creation instruction is sent to the computing component; if the data disk is located in the cloud, a cloud disk data disk snapshot creation instruction is sent to the storage component.
3. The method according to claim 1, wherein: The method further comprises: The mirror component creates a whole-machine mirror state in response to a request to create a whole-machine mirror, wherein the whole-machine mirror state is a state for indicating a state of waiting for a system disk snapshot; When the image component adds the system disk snapshot ID to the whole machine image and the data disk snapshot creation is not completed, updating the whole machine image state to indicate a state for waiting for the data disk snapshot creation; After the image component adds the system disk snapshot ID and the data disk snapshot ID to the whole machine image, the whole machine image state is updated to an activated state, where the activated state is used to indicate that the whole machine image is available.
4. A method for importing a whole machine image, the method comprising: The image component responds to the import request of the whole machine image and creates a whole machine image ID as a response to the import request; The mirror component sends a cloud disk creation instruction to the storage component; The mirroring component receives the cloud disk ID created by the storage component in response to the cloud disk creation instruction; After the cloud disk corresponding to the cloud disk ID is created, the mirror component sends a cloud disk snapshot creation instruction to the storage component, where the cloud disk snapshot creation instruction carries the cloud disk ID; The mirroring component receives a cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction; After the storage component completes creating the cloud disk snapshot, the mirror component adds the cloud disk snapshot ID to the whole machine image and writes the metadata of the whole machine image into the whole machine image.
5. The method according to claim 4, wherein: The cloud disk creation instruction carries the storage address of the whole machine image, and the method further includes: The storage component sends a cloud disk snapshot creation instruction to the cloud disk corresponding to the storage component in response to the cloud disk creation instruction, wherein the cloud disk snapshot creation instruction includes a cloud disk type and a storage address of the whole machine image; The cloud disk corresponding to the storage component responds to the instruction, creates an empty disk mounted locally, downloads the whole machine image from the storage address of the whole machine image, and writes the whole machine image to the empty disk based on the cloud disk type; updates the cloud disk status corresponding to the cloud disk ID to an available status, and the available status is used to indicate that the cloud disk creation is complete.
6. The method according to claim 4, wherein: The method further comprises: The image component creates a whole-machine image state in response to a request to import a whole-machine image, wherein the whole-machine image state is a state for indicating a state of waiting for a cloud disk snapshot to be created; After the image component adds the cloud disk snapshot ID to the whole machine image, the whole machine image state is updated to an activated state, where the activated state is used to indicate that the whole machine image is available.
7. A device for creating a whole machine image, applied to an image component, the device comprising: A creation unit, configured to, in response to a request for creating a whole machine image, create a whole machine image ID as a response to the creation request; a sending unit, configured to determine a system disk location and a data disk location, and to send a system disk snapshot creation instruction corresponding to the system disk location to a component for creating a system disk snapshot corresponding to the system disk location, and to send a data disk snapshot creation instruction corresponding to the data disk location to a component for creating a data disk snapshot corresponding to the data disk location; a receiving unit, configured to receive a system disk snapshot ID created by the component for creating a system disk snapshot in response to the system disk snapshot creation instruction, and receive a data disk snapshot ID created by the component for creating a data disk snapshot in response to the data disk snapshot creation instruction; an adding unit, configured to add the system disk snapshot ID to the whole machine image after the component for creating the system disk snapshot completes creating the system disk snapshot; After the component for creating a data disk snapshot completes creating the data disk snapshot, the data disk snapshot ID is added to the entire machine image.
8. A whole machine mirror image importing device, applied to a mirror assembly, the device comprising: A creating unit, configured to, in response to a request for importing a whole machine image, create a whole machine image ID as a response to the import request; A first sending unit, configured to send a cloud disk creation instruction to a storage component; A first receiving unit, configured to receive a cloud disk ID created by the storage component in response to the cloud disk creation instruction; A second sending unit is configured to send a cloud disk snapshot creation instruction to the storage component after the cloud disk corresponding to the cloud disk ID is created, wherein the cloud disk snapshot creation instruction carries the cloud disk ID; A second receiving unit, configured to receive a cloud disk snapshot ID created by the storage component for the cloud disk corresponding to the cloud disk ID in response to the cloud disk snapshot creation instruction; The processing unit is used to add the cloud disk snapshot ID to the whole machine image and write the metadata of the whole machine image into the whole machine image after the storage component completes creating the cloud disk snapshot.
9. An electronic device, wherein: The invention comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method for creating a whole machine image as described in any one of claims 1 to 3 or the steps of the method for importing a whole machine image as described in any one of claims 4 to 6.
10. A computer-readable storage medium, wherein: The computer-readable storage medium stores a program or instruction, which enables a computer to execute the steps of the method for creating a whole machine image as described in any one of claims 1 to 3 or the steps of the method for importing a whole machine image as described in any one of claims 4 to 6.