Method and system for reinstalling operating system of virtual machine

By reinstalling the operating system of the virtual machine on the original system disk in the cloud computing virtualization scenario, the problems of repeated charges and abnormal scenarios during the reinstallation of the virtual machine operating system are solved, and the user experience is improved.

CN112579104BActive Publication Date: 2025-04-29HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910939681.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-09-30
Publication Date
2025-04-29
Estimated Expiration
2039-09-30

AI Technical Summary

Technical Problem

In cloud computing virtualization scenarios, during the reinstallation of the operating system of the virtual machine, the coexistence of the new system disk and the original system disk leads to repeated charges of user fees and difficult to deal with abnormal scenarios. Moreover, it takes a long time to mount and uninstall the system disk, which makes the user experience poor.

Method used

Provides a virtual machine operating system reinstallation method. Through the collaborative work of computing services and storage services, reinstalls the operating system on the original system disk, including receiving operating system reinstallation commands, deleting the original operating system, obtaining operating system images, writing the image to the system disk, and notifying the reinstallation to be completed.

Benefits of technology

This method effectively avoids duplicate costs and abnormal scenario problems caused by the coexistence of the new system disk and the original system disk, and reduces the time for mounting and uninstalling the system disk, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112579104B_ABST
    Figure CN112579104B_ABST
Patent Text Reader

Abstract

The present application discloses a method for reinstalling an operating system of a virtual machine, comprising: a computing service receives an operating system reinstallation command for a virtual machine; the computing service sends a first notification message to a storage service in response to the operating system reinstallation command; the storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message; the storage service obtains an operating system image to be installed; the storage service writes the operating system image to the system disk and sends a second notification message to the computing service, wherein the second notification message is used to notify the computing service that the reinstallation of the operating system of the virtual machine is completed.
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, and in particular to a method and system for reinstalling an operating system of a virtual machine. Background Art

[0002] In the cloud computing virtualization scenario, the operating system of the virtual machine is set in the system disk of the virtual machine. The owner of the system disk is the operator, and the user of the system disk is the user. The operator cannot provide the system disk with residual data to the user of the virtual machine to avoid unpredictable dangers. Therefore, under the existing technical conditions, the reinstallation process of the operating system of the virtual machine is as follows: keep the original system disk, wherein the original system volume is installed with the original operating system; create a new system disk, wherein the new system disk is used to install the new operating system; after the new system disk is created, uninstall the original system disk, mount the new system disk, and delete the original system disk.

[0003] After long-term research, technicians in this field have found that the coexistence of a new system disk and an original system disk will lead to problems such as repeated charges to users and difficulty in handling abnormal scenarios. In addition, it takes a long time to mount and unmount the system disk, resulting in a poor user experience. Summary of the invention

[0004] In order to solve the above problems, the present application provides a method and system for reinstalling an operating system of a virtual machine, which can reinstall the operating system on the original system disk.

[0005] In a first aspect, a method for reinstalling an operating system of a virtual machine is provided, comprising:

[0006] The computing service receives an operating system reinstallation command for the virtual machine;

[0007] The computing service sends a first notification message to the storage service in response to the operating system reinstallation command;

[0008] The storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message;

[0009] The storage service obtains the operating system image to be installed;

[0010] The storage service writes the operating system image to the system disk, and sends a second notification message to the computing service, where the second notification message is used to notify the computing service that the operating system reinstallation of the virtual machine is complete.

[0011] In some possible designs, the storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message, including:

[0012] The storage service confirms the storage node corresponding to the system disk in the distributed storage system;

[0013] The storage service erases metadata corresponding to the system disk on the distributed storage system in the storage nodes respectively.

[0014] In some possible designs, the storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message, further comprising:

[0015] The storage service searches for snapshot tree information of the volume corresponding to the system disk, modifies the snapshot tree identifier of the parent volume of the volume to empty in the snapshot tree information, and modifies the tree identifier of the volume in the snapshot tree identifier of the volume to a newly allocated tree identifier.

[0016] In some possible designs, the storage service obtains the operating system image to be installed, including: the storage service downloads the operating system image from the object storage device to the system disk.

[0017] In a second aspect, a cloud system is provided, including: computing services and storage services,

[0018] The computing service is used to receive an operating system reinstallation command for a virtual machine;

[0019] The computing service is used to send a first notification message to the storage service in response to the operating system reinstallation command;

[0020] The storage service is used to delete the operating system in the system disk of the virtual machine in response to the first notification message;

[0021] The storage service is used to obtain the operating system image to be installed;

[0022] The storage service is used to write the operating system image to the system disk and send a second notification message to the computing service, where the second notification message is used to notify the computing service that the operating system reinstallation of the virtual machine is complete.

[0023] In some possible designs, the storage service is used to confirm the storage node corresponding to the system disk in the distributed storage system; the storage service is used to erase the metadata of the system disk corresponding to the distributed storage system in the storage nodes respectively.

[0024] In some possible designs, the storage service is used to search for snapshot tree information of the volume corresponding to the system disk, modify the snapshot tree identifier of the parent volume of the volume to empty in the snapshot tree information, and modify the tree identifier of the volume in the snapshot tree identifier of the volume to a newly allocated tree identifier.

[0025] In some possible designs, the storage service is used to download the operating system image from the object storage device to the system disk.

[0026] In a third aspect, a computing device is provided, comprising a memory and a processor, wherein the processor executes a program in the memory to run computing services and storage services, thereby performing the method as described in any one of the first aspects.

[0027] According to a fourth aspect, a readable storage medium is provided, comprising instructions, which, when executed on a computing node, cause the computing node to execute the method as described in any one of the first aspects.

[0028] According to a fifth aspect, a computer program product is provided. When the computer program product is read and executed by a computer, the method described in any one of the first aspects will be executed.

[0029] In the above solution, the cloud system reinstalls the operating system on the original system disk, which can effectively avoid the coexistence of the new system disk and the original system disk, resulting in repeated charges to users and difficulty in handling abnormal scenarios. In addition, it takes a long time to mount and unmount the system disk, resulting in a poor user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.

[0031] Figure 1 It is a structural diagram of a cloud system involved in this application;

[0032] Figure 2 It is a structural diagram of a specific cloud system involved in this application;

[0033] Figure 3 It is a structural diagram of a virtual machine involved in this application;

[0034] Figure 4 It is a schematic diagram of the structure of a virtual machine in a computing node involved in this application;

[0035] Figure 5 This is a schematic diagram of the structure of the virtual machine when the operating system is correctly reinstalled;

[0036] Figure 6 This is a schematic diagram of the structure of the virtual machine when the operating system is reinstalled incorrectly;

[0037] Figure 7 It is a flow chart of a method for reinstalling an operating system of a virtual machine provided by the present application;

[0038] Figure 8is a schematic diagram of a relationship tree involved in this application;

[0039] Fig. 9 is a schematic diagram of the relationship between the first metadata and the data area in this application;

[0040] Fig.10 is a schematic diagram of the relationship tree after reinstalling the operating system in this application;

[0041] Fig.11 is a schematic diagram of the relationship between the first metadata and the data before data erasure in the present application;

[0042] Fig.12 is a schematic diagram of the relationship between the first metadata and the data after data erasure in the present application;

[0043] Fig.13 It is a structural diagram of a physical host provided by this application;

[0044] Fig.14 It is a structural diagram of a computing node provided by this application;

[0045] Fig.15 It is a structural diagram of an object storage device provided by the present application;

[0046] Fig.16 It is a structural diagram of a distributed storage system provided by this application. DETAILED DESCRIPTION

[0047] See also Figure 1 , Figure 1 It is a structural diagram of a cloud system involved in this application. The owner of the cloud system deploys the cloud computing infrastructure by himself, that is, deploys computing resources (for example, servers) 110, deploys storage resources (for example, memory) 120, and deploys network resources (for example, network card) 130, etc. Then, the owner of the public cloud (for example, the operator) virtualizes the computing resources, storage resources, and network resources of the cloud computing infrastructure, and provides corresponding services to the users of the cloud (for example, users). Among them, the operator can provide the following three services to users: cloud computing infrastructure as a service (Infrastructure as a Service, IaaS), platform as a service (Platform as a Service, PaaS) and software as a service (Software as a Service, SaaS).

[0048] The service provided by IaaS to users is the use of cloud computing infrastructure, including processing, storage, network and other basic computing resources. Users can deploy and run any software, including operating systems and applications. Users do not manage or control any cloud computing infrastructure, but can control the choice of operating system, storage space, deployment of applications, and may also obtain control of limited network components (for example, firewalls, load balancers, etc.).

[0049] The service provided by PaaS is to deploy the applications developed or acquired by users using the development languages ​​and tools provided by the supplier (such as Java, Python, Net, etc.) to the cloud computing infrastructure. Users do not need to manage or control the underlying cloud computing infrastructure, including networks, servers, operating systems, storage, etc., but users can control the deployed applications and may also control the configuration of the hosting environment that runs the applications.

[0050] The service provided by SaaS to users is the application program that the operator runs on the cloud computing infrastructure. Users can access the application program on the cloud computing infrastructure through the client interface, such as the browser, on various devices. Users do not need to manage or control any cloud computing infrastructure, including the network, server, operating system, storage, etc.

[0051] Users can use the services provided by operators to run their own businesses, such as deep learning, artificial intelligence, and big data.

[0052] See also Figure 2 , Figure 2 2 is a schematic diagram of a specific cloud system involved in the present application. The cloud system of the present application includes: a physical host 210, a computing node 220, a distributed storage system 230, a network 240, and an object storage device 250. Among them, the physical host 210, the computing node 220, the distributed storage system 230, and the object storage device 250 are connected through the network 240.

[0053] The physical host 210 includes a cloud management platform 211. The cloud management platform 211 may be AWS (Amazon Web Service), OpenStack, CloudStack, Hadoop, Apache Mesos, Docker-based kubernetes, swarm, etc., which are not specifically limited here. The cloud management platform 211 may include a computing service 212, a storage service 213, and a network service 214. The computing service 212 may be a computing organization controller in the cloud management platform 211, which is a component for deploying virtual machines, etc. The storage service 213 may be a component in the cloud management platform 211 for providing distributed, persistent virtual object storage, etc. The network service 214 may be a component in the cloud management platform 211 for providing network topology management of network nodes. Taking the cloud management platform 211 as OpenStack as an example, the computing service 212 may be Nova, the storage service 213 may be Swift, and the network service 214 may be Neutron. In addition, the physical body also includes an operating system 215 and hardware 216. The hardware 216 may include a physical network card 217.

[0054] The computing node 220 includes a virtual machine 221, an operating system 224, and hardware 225. The virtual machine 221 may include a system disk 222 and a data disk 223. The operating system is installed in the system disk 222, and the user's data is stored in the data disk 223. The computing service client is installed in the operating system 224. The hardware 225 includes a physical network card 226.

[0055] The distributed storage system 230 includes a plurality of storage nodes, for example, storage node 1 and storage node 2. Storage node 1 includes an operating system 231 and hardware 233, wherein a storage service client is installed in the operating system 231. Hardware 233 includes a plurality of disks, for example, disk 5 to disk 8, and a physical network card 235. Storage node 2 includes an operating system 232 and hardware 234, wherein a storage service client is installed in the operating system 232. Hardware 234 includes a plurality of disks, for example, disk 1 to disk 4, and a physical network card 236.

[0056] The network 240 provides a data transmission path, for example, an optical fiber data transmission path, a cable data transmission path, etc., which is not specifically limited here.

[0057] The object-based storage device 250 (OSD) has certain intelligence and can automatically manage the data distribution thereon.

[0058] See also Figure 3 , Figure 3It is a structural diagram of the computing node involved in this application. This application is a cloud computing virtualization scenario of a computing node, that is, the operator virtualizes multiple virtual machines in the computing node through cloud computing virtualization technology and rents them to multiple users for use. In this scenario, from bottom to top, it includes hardware resources 310, virtual software (Hypervisor) 320, virtual machine (Virtual Machine, VM) 330, operating system 340 and application software (Application, APP) 350. Among them, hardware resources 310 are the basic physical hardware in the computing node, which may include processors, memory, disks, networks, etc. Virtual software 320 runs in the middle software layer between hardware resources and virtual machines, for example, VMware vSphere, Hyper-V, Citrix XenServer, IBM PowerVM, Red Hat Enterprise Virtulization, HuaweiFusionSphere, KVM, Xen, VirtualBSD, etc., which allows multiple virtual machines to share a set of basic physical hardware. Virtual machine 330 refers to a complete computer system with complete hardware system functions simulated by software and running in a completely isolated environment. The operating system (OS) 340 is a computer program that manages and controls computer hardware and software resources, an interface between users and computers, and also an interface between computer hardware and other software, such as SUN Solaris, IBM-AIX, HP-UX, FreeBSD, Red Hat Linux, CentOS, Debian, Ubuntu, Windows Server 2003, Windows Server 2008, and Windows Server 2008R2. The application software 350 is a collection of various programming languages ​​that users can use and application programs compiled in various programming languages, such as office software, ICQ software, and browser software. The virtual software 320 can use a hypervisor, which can coordinate access to all basic physical hardware and virtual machines on the computing node. When the computing node starts and executes the hypervisor, it will allocate appropriate hardware resources to each virtual machine, such as processors, memory, disks, and networks, and load the operating systems of all virtual machines.

[0059] It should be understood that the above application scenario is described by taking the installation of an operating system on a virtual machine as an example. In actual applications, the application scenario may also be the installation of an operating system on a physical machine, etc., which is not specifically limited here.

[0060] See also Figure 4 , Figure 4Schematic diagram of the structure of a virtual machine in a computing node involved in this application. Figure 4 As shown, the virtual machine in this embodiment includes: a first system disk 410, a first data disk 420 and a second data disk 430. The first system disk is used to install the first operating system, the first data disk 420 is used to store user business data, and the second data disk 430 is also used to store user business data.

[0061] If the operating system needs to be reinstalled, a second system disk 440 is created outside the virtual machine, and the second operating system is installed on the second system disk 440. Then, the virtual machine uninstalls the first system disk 410 and mounts the second system disk 440. After the second system disk 440 is successfully mounted, the virtual machine deletes the first system disk 410. Figure 5 As shown, the virtual machine after successfully reinstalling the operating system should include a second system disk 440 , a first data disk 420 , and a second data disk 430 .

[0062] However, there may be the following problems in the above method:

[0063] (1) If the computing node where the virtual machine is located is undergoing an upgrade or maintenance after the virtual machine mounts the second system disk 440 and before the virtual machine deletes the first system disk 410, the virtual machine will be unable to delete the first system disk 410. Figure 6 As shown, at this time, the first system disk 410, the second system disk 440, the first data disk 420 and the second data disk 430 will exist in the virtual machine at the same time. However, for the user, the user does not actually need to use the first system disk 410, but only needs to use the second system disk 440. The first system disk 410 is redundant. For the operator, the operator provides two system disks for users to use, and needs to charge for both system disks. Therefore, the problem of the operator charging the user repeatedly arises.

[0064] (2) Even after the virtual machine mounts the second system disk 440, the first system disk 410 is successfully deleted. The disk identifier of the second system disk 440 is different from the disk identifier of the first system disk 410. Therefore, when the virtual machine replaces the first system disk 410 with the second system disk 440, the disk identifier changes, which causes problems in the services implemented based on the disk identifier. For example, when the user monitors the usage of the first system disk 410 in the virtual machine through his own monitoring device, the monitoring device finds the first system disk 410 through the disk identifier of the first system disk 410 and monitors the usage of the first system disk 410. Therefore, when the virtual machine changes from the first system disk 410 to the second system disk 440, the monitoring device cannot know that the virtual machine has replaced the system disk, so it still searches through the disk identifier of the first system disk 410, resulting in the monitoring device being unable to find the corresponding system disk and monitor it.

[0065] (3) Even if the virtual machine successfully deletes the first system disk 410 after mounting the second system disk 440, the virtual machine needs to perform operations of uninstalling the first system disk 410, mounting the second system disk 440, and deleting the first system disk 410, which takes a lot of time.

[0066] In order to solve the above problems, the present application proposes a method for reinstalling the operating system of a virtual machine, which can reinstall the operating system in the original system disk in a cloud computing virtualization scenario. Figure 2 Take the cloud system shown in the figure as an example. Figure 7 As shown, the method for reinstalling the operating system of a virtual machine in this embodiment may include the following steps:

[0067] S101: The computing service receives an operating system reinstallation command for a virtual machine.

[0068] S102: The computing service sends a first notification message to the storage service in response to the operating system reinstallation command.

[0069] S103: The storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message.

[0070] S104: The storage service obtains the operating system image to be installed, wherein the storage service downloads the operating system image from the object storage device to the system disk.

[0071] S105 The storage service writes the operating system image to the system disk and sends a second notification message to the computing service, where the second notification message is used to notify the computing service that the operating system reinstallation of the virtual machine is complete.

[0072] In a specific embodiment of the present application, the process of installing an operating system in the system disk of a virtual machine is as follows: Figure 8 Taking the relationship tree shown as an example, the relationship tree includes multiple volumes, for example, a parent volume, a clone volume A, a clone volume B, a clone volume B1, a clone volume B2, a snapshot C, and a clone volume C1. The parent volume is installed with an operating system. The operating system in the parent volume is linked cloned to generate a clone volume A containing the operating system. The operating system in the parent volume is linked cloned to generate a clone volume B containing the operating system. A snapshot is taken of the clone volume B to generate a clone volume B1 containing the operating system. Data recovery is performed on the clone volume B to generate a clone volume B2 containing the operating system. A snapshot is taken of the operating system in the parent volume to generate a snapshot C containing the operating system. A snapshot is taken of the snapshot C again to generate a clone volume C1 containing the operating system. Assume that the volume corresponding to the system disk is Figure 8 For clone volume C1 in the example, the system disk is obtained by taking a snapshot of snapshot C, and snapshot C is obtained by taking a snapshot of the parent volume. It should be understood that Figure 8 The example shown is only a specific implementation example. In actual applications, the operating system in the parent volume can also be linked cloned to generate a clone volume D containing the operating system, or snapshot C can be snapshotted again to generate a clone volume C2 containing the operating system, and so on. No specific limitation is made here.

[0073] In a specific embodiment of the present application, the volumes on the relationship tree can have a snapshot tree identifier, wherein the snapshot tree identifier includes a tree identifier, a branch identifier, and a snapshot identifier. The tree identifier is used to indicate the identifier of the relationship tree where the volume is located, the branch identifier is used to indicate the identifier of the branch of the relationship tree where the volume is located, and the snapshot identifier is used to indicate the identifier of the snapshot situation of the branch of the relationship tree where the volume is located. In a specific embodiment, the snapshot tree identifier of the volume on the relationship tree can be determined in the following manner: the computing node assigns a tree identifier 1 to the first relationship tree, and the tree identifier of the newly added relationship tree increases by 1 for each additional relationship tree. The computing node assigns a branch identifier 0 to the first branch of the relationship tree 1, and the branch identifier of the newly added branch increases by 1 for each additional branch. The computing node assigns a snapshot identifier 0 to the volume of branch 0 of the relationship tree 1 that has not been snapshotted, and the snapshot identifier of the newly added volume increases by 1 for each additional snapshot of branch 0 of the relationship tree 1. Figure 8 Take the relationship tree shown as an example,

[0074] The snapshot tree identifier of the parent volume is (t=1, b=0, s=0), where t=1 indicates that the tree identifier of the parent volume's relationship tree is 1, b=0 indicates that the branch identifier of the parent volume's relationship tree is 0, and s=0 indicates that no snapshot is taken on the branch (b=0) of the parent volume's relationship tree (t=1).

[0075] The snapshot tree identifier of clone volume A is (t=1, b=0, s=1), where t=1 indicates that the tree identifier of the relationship tree where clone volume A is located is 1, b=0 indicates that the branch identifier of the relationship tree where clone volume A is located is 0, and s=1 indicates that the first snapshot of the parent volume is taken on the branch (b=0) of the relationship tree (t=1) where clone volume A is located;

[0076] The snapshot tree identifier of clone volume B is (t=1, b=1, s=0), where t=1 indicates that the tree identifier of the relationship tree where clone volume A is located is 1, b=1 indicates that the branch identifier of the branch of the relationship tree where clone volume A is located is 1, and s=0 indicates that no snapshot of the parent volume is taken on the branch (b=1) of the relationship tree (t=1) where clone volume A is located;

[0077] The snapshot tree identifier of clone volume B1 is (t=1, b=1, s=1), where t=1 indicates that the tree identifier of the relationship tree where clone volume B1 is located is 1, b=1 indicates that the branch identifier of the branch of the relationship tree where clone volume B1 is located is 1, and s=1 indicates that a snapshot of clone volume B is taken on the branch (b=1) of the relationship tree (t=1) where clone volume B1 is located;

[0078] The snapshot tree identifier of clone volume B2 is (t=1, b=2, s=0), where t=1 indicates that the tree identifier of the relationship tree where clone volume B1 is located is 1, b=2 indicates that the branch identifier of the relationship tree where clone volume B1 is located is 2, and s=0 indicates that no snapshot of clone volume B is taken on the branch (b=2) of the relationship tree (t=1) where clone volume B1 is located;

[0079] The snapshot tree identifier of snapshot C is (t=1, b=3, s=0), where t=1 indicates that the tree identifier of the relationship tree where snapshot C is located is 1, b=3 indicates that the branch identifier of the relationship tree where snapshot C is located is 3, and s=0 indicates that no snapshot of the parent volume is taken on the branch (b=3) of the relationship tree (t=1) where snapshot C is located;

[0080] The snapshot tree identifier of the clone volume C1 is (t=1, b=3, s=1), where t=1 indicates that the tree identifier of the relationship tree where the clone volume C1 is located is 1, b=3 indicates that the branch identifier of the branch of the relationship tree where the clone volume C1 is located is 3, and s=0 indicates that the first snapshot of snapshot C is taken on the branch (b=3) of the relationship tree (t=1) where snapshot C is located.

[0081] It can be understood that the above examples of snapshot tree identification are only used as examples. In actual applications, snapshot tree identification can also be performed in other ways, which are not specifically limited here.

[0082] In a specific embodiment of the present application, the system disk of the virtual machine includes a data area and a metadata area. Among them, the data area includes multiple sub-data areas for storing data including the operating system, and the metadata area is used to store the first metadata of the usage conditions of each sub-data area in the data area and the second metadata describing the relationships between multiple volumes of the relationship tree where the system disk of the virtual machine is located.

[0083] The data area is used to store data including the operating system. In a specific embodiment, the data area can be divided into multiple sub-data areas including sub-data area 1, sub-data area 2, …, sub-data area n, where n is a positive integer. The operating system can be distributed and stored in sub-data area 1, sub-data area 2, …, sub-data area n. For example, the operating system can be divided into n data blocks, data block 1, data block 2, …, data block n. Among them, data block 1 is stored in sub-data area 1, data block 2 is stored in sub-data area 2, …, data block n is stored in sub-data area n. Also for example, the operating system can also be divided into n - k data blocks, data block 1, data block 2, …, data block n - k, where k is a positive integer and k < n. Among them, data block 1 is stored in sub-data area 1, data block 2 is stored in sub-data area 2, …, data block n - k is stored in sub-data area n - k, that is to say, there are k sub-data areas not used for storing the operating system. It can be understood that the sizes of data block 1, data block 2, …, data block n can be equal or unequal, and no specific limitation is made here.

[0084] The first metadata is used to describe the usage conditions of each sub-data area in the data area. In a specific embodiment, the first metadata includes metadata 1, metadata 2, …, metadata n. Among them, metadata 1 records the storage condition of sub-data area 1, metadata 2 records the storage condition of sub-data area 2, …, metadata n records the storage condition of sub-data area n. Taking metadata i as an example, when the value of metadata i is 0, it means that sub-data area i has no stored data, and when the value of metadata i is 1, it means that there is data stored in sub-data area i, where i is a positive integer and i < n. For the sake of simplicity, the first metadata can use a bitmap form to record the usage conditions of n sub-data areas. For example, assuming that the first metadata is represented in bitmap form as: 00100100, it means that both sub-data area 3 and sub-data area 6 have stored data, and other sub-data areas have no stored data. It can be understood that the first metadata can be represented in other ways in addition to the bitmap form, and no specific limitation is made here.

[0085] The second metadata is used to describe the relationship between multiple volumes in the relationship tree where the volume corresponding to the system disk is located. In a specific embodiment, the second metadata includes multiple snapshot tree information, and the snapshot tree information includes the volume name, the snapshot tree identifier of the current volume, and the snapshot tree identifier of the parent volume. Among them, the volume name can be a unique identifier of the volume in the relationship tree. The snapshot tree identifier of the current volume includes a first tree identifier, a first branch identifier, and a first snapshot identifier. Among them, the first tree identifier is used to indicate the identifier of the relationship tree where the volume corresponding to the volume name is located, the first branch identifier is used to indicate the identifier of the branch of the relationship tree where the volume corresponding to the volume name is located, and the first snapshot identifier is used to indicate the identifier of the snapshot situation of the branch of the relationship tree where the volume corresponding to the volume name is located. The snapshot tree identifier of the parent volume includes a second tree identifier, a second branch identifier, and a second snapshot identifier. Among them, the second tree identifier is used to indicate the identifier of the relationship tree where the parent volume of the volume corresponding to the volume name is located, the second branch identifier is used to indicate the identifier of the branch of the relationship tree where the parent volume of the volume corresponding to the volume name is located, and the second snapshot identifier is used to indicate the identifier of the snapshot situation of the branch of the relationship tree where the parent volume of the volume corresponding to the volume name is located. Figure 8 Taking the relationship tree shown in the figure as an example, the second metadata may be as shown in Table 1:

[0086] Table 1 Second metadata

[0087] Volume Name Snapshot tree ID of this volume Snapshot tree ID of the parent volume Mother roll t=1,b=0,s=0 NULL Clone Volume A t=1,b=0,s=1 t=1,b=0,s=0 Clone Volume B t=1,b=1,s=0 t=1,b=0,s=0 Clone Volume B1 t=1,b=1,s=1 t=1,b=1,s=0 Clone Volume B2 t=1, b=2, s=0 t=1,b=1,s=0 Snapshot C t=1, b=3, s=0 t=1,b=0,s=0 <![CDATA[Clone Volume C1]]> t=1, b=3, s=1 t=1, b=3, s=0

[0088] It can be understood that the above description is only based on the example of the volume corresponding to the system disk being the clone volume C1. Figure 8 Taking the relationship tree shown as an example, the parent volume, clone volume A, clone volume B, clone volume B1, clone volume B2 and snapshot C are similar to clone volume C1 and will not be described in detail here.

[0089] Clone volume A, clone volume B, clone volume B1, clone volume B2, snapshot C and clone volume C1 are different volumes on the same relationship tree, therefore, the sizes of the sub-data areas of clone volume A, clone volume B, clone volume B1, clone volume B2, snapshot C and clone volume C1 are the same, and, under the premise that the data is not modified, the data contents of the sub-data areas of clone volume A, clone volume B, clone volume B1, clone volume B2, snapshot C and clone volume C1 are also the same. Specifically, the data area of ​​clone volume A is divided into a plurality of sub-data areas including sub-data area 1, sub-data area 2, ..., sub-data area n, the data area of ​​clone volume B is divided into a plurality of sub-data areas including sub-data area 1, sub-data area 2, ..., sub-data area n, ..., and the data area of ​​clone volume C1 is divided into a plurality of sub-data areas including sub-data area 1, sub-data area 2, ..., sub-data area n. The sizes of the sub-data areas 1 of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are the same, and, under the premise that the data is not modified, the data contents of the sub-data areas 1 of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are also the same; the sizes of the sub-data areas 2 of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are the same, and, under the premise that the data is not modified, the data contents of the sub-data areas 2 of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are also the same; …; the sizes of the sub-data areas n of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are the same, and, under the premise that the data is not modified, the data contents of the sub-data areas n of the clone volume A, the clone volume B, the clone volume B1, the clone volume B2, the snapshot C and the clone volume C1 are also the same.

[0090] In a specific embodiment of the present application, the process of reading target data in the system disk is as follows: Taking the volume corresponding to the system disk as the clone volume C1 as an example, assuming that the target data that the application needs to access is located in the sub-data area 1 of the system disk, such as Fig.10As shown, the computing node first searches for metadata 1 of the first metadata in the system disk. If metadata 1 of the first metadata in the system disk indicates that data is stored in sub-data area 1 of the system disk, the computing node reads the target data from sub-data area 1 of the system disk. If metadata 1 of the first metadata in the system disk indicates that data is not stored in sub-data area 1 of the system disk 310, the computing node determines that the parent volume of clone volume C1 is snapshot C according to the snapshot tree identifier of the parent volume of clone volume C1 in the second metadata in the system disk as shown in Table 1. The computing node searches for metadata 1 of the first metadata of snapshot C. If metadata 1 of the first metadata in snapshot C indicates that data is stored in sub-data area 1 of snapshot C, the computing node reads the target data from sub-data area 1 of snapshot C. If metadata 1 of the first metadata in snapshot C indicates that data is not stored in sub-data area 1 of snapshot C, the computing node determines that the parent volume of snapshot C is the parent volume according to the snapshot tree identifier of the parent volume of snapshot C in the second metadata in snapshot C as shown in Table 1. The computing node first searches for metadata 1 of the first metadata in the parent volume. If metadata 1 of the first metadata in the parent volume indicates that data is stored in sub-data area 1 of the parent volume, the computing node reads the target data from sub-data area 1 of the parent volume. If metadata 1 of the first metadata of the parent volume indicates that data is not stored in sub-data area 1 of the parent volume, the computing node determines that the parent volume of the parent volume is non-existent based on the snapshot tree identifier of the parent volume of the parent volume in the second metadata in the parent volume such as in Table 1, and returns that no data was found.

[0091] In a specific embodiment of the present application, based on the process of reading target data from the VM system disk, it can be known that deleting the operating system in the system disk of the virtual machine includes: (1) modifying the first metadata of the system disk and (2) modifying the second metadata of the system disk. Figure 8 The clone volume C1 in the example is used for detailed description.

[0092] (1) The process of modifying the first metadata of the system disk is specifically as follows: VM first detects whether metadata 1 in the first metadata of clone volume C1 is 0. If metadata 1 in the first metadata of clone volume C1 is not 0, metadata 1 in the first metadata of clone volume C1 is set to 0. If metadata 1 in the first metadata of clone volume C1 is 0, continue to detect whether metadata 2 in the first metadata of clone volume C1 is 0. If metadata 2 in the first metadata of clone volume C1 is not 0, metadata 2 in the first metadata of clone volume C1 is set to 0. If metadata 1 in the first metadata of clone volume C1 is 0, continue to detect whether metadata 3 in the first metadata of clone volume C1 is 0, and so on, until the detection of metadata n in the first metadata of clone volume C1 is completed. That is, metadata 1 to metadata n of the first metadata of clone volume C1 are all set to 0. It can be understood that if there is a copy of the metadata in the first metadata for the sub-data area, the copy needs to be released, which is not specifically limited here.

[0093] The following will be combined Fig.11 and Fig.12 How to modify the metadata corresponding to the data K1 in the clone volume C is described in detail.

[0094] by Fig.11 As shown in the example, assume that the parent volume has data M1, M2 and M3, snapshot C has data S1 and S2, clone volume C has data K1, K2, K3, K4 and K5, and other volumes have data o. The distributed storage area includes disk 1, disk 2 and disk 3, where disk 1 includes data area 1 to data area 15 from left to right and from top to bottom; disk 2 includes data area 1 to data area 15 from left to right and from top to bottom; and disk 3 includes data area 1 to data area 15 from left to right and from top to bottom.

[0095] The data M1 is stored in the data area 11 in the disk 1 , and a copy is stored in the data area 11 in the disk 2 and the data area 11 in the disk 3 .

[0096] The data M2 is stored in the data area 12 in the disk 2 , and a copy is stored in the data area 12 in the disk 1 and the data area 12 in the disk 3 .

[0097] The data M3 is stored in the data area 15 in the disk 3 , and a copy is stored in the data area 15 in the disk 1 and the data area 15 in the disk 2 .

[0098] Data S1 is stored in data area 6 in disk 1 , and copies are stored in data area 12 in disk 2 and data area 8 in disk 3 .

[0099] The data S2 is stored in the data area 9 in the disk 2 , and a copy is stored in the data area 10 in the disk 1 and the data area 10 in the disk 3 .

[0100] Data K1 is stored in data area 1 in disk 1 , and copies are stored in data area 2 in disk 2 and data area 6 in disk 3 .

[0101] Data K2 is stored in data area 7 in disk 2 , and copies are stored in data area 8 in disk 1 and data area 7 in disk 3 .

[0102] Data K3 is stored in data area 3 in disk 3 , and copies are stored in data area 3 in disk 1 and data area 1 in disk 2 .

[0103] Data K4 is stored in data area 7 in disk 1 , and copies are stored in data area 10 in disk 2 and data area 5 in disk 3 .

[0104] Data K5 is stored in data area 4 in disk 2 , and copies are stored in data area 4 in disk 1 and data area 2 in disk 3 .

[0105] Data o is stored in data area 9 in disk 1 , and copies are stored in data area 8 in disk 2 and data area 9 in disk 3 .

[0106] So the metadata for disk 1 is 101101111111001, the metadata for disk 2 is 110101111111001, and the metadata for disk 3 is 011010111111001.

[0107] like Fig.12 As shown, when it is necessary to delete data K1 in clone volume C, it can be determined that data K1 is stored in data area 1 in disk 1, so the metadata of disk 1 can be 1 01101111111001 is changed to 0 01101111111001, the copy 1 of data K1 is stored in the data area 2 of disk 2, so the metadata of disk 2 can be set to 1 1 0101111111001 is changed to 1 0 0101111111001, the copy 2 of data K3 is stored in the data area 6 of disk 3, so the metadata of disk 2 can be 01101 1 111111001 is changed to 01101 0 111111001.

[0108] It should be understood that the above only illustrates the process of modifying the metadata corresponding to the data K1 in the clone volume C. In actual applications, the process of modifying the metadata corresponding to other data is similar, and no further examples are given here.

[0109] (2) The process of modifying the second metadata of the first system disk 310 is specifically as follows: the VM searches for the snapshot tree identifier t=1, b=3, s=0 of the parent volume of the clone volume C1 in the second metadata as shown in Table 1, and modifies the snapshot tree identifier t=1, b=3, s=0 of the parent volume of the clone volume C1 to NULL, and then modifies the snapshot tree identifier t=1, b=3, s=1 of the clone volume C1 in the second metadata to t=2, b=3, s=0. The modified second metadata is shown in Table 2:

[0110] Table 2 Modified second metadata

[0111] Volume Name Snapshot tree ID of this volume Snapshot tree ID of the parent volume Mother roll t=1,b=0,s=0 NULL Clone Volume A t=1,b=0,s=1 t=1,b=0,s=0 Clone Volume B t=1,b=1,s=0 t=1,b=0,s=0 Clone Volume B1 t=1,b=1,s=1 t=1,b=1,s=0 Clone Volume B2 t=1, b=2, s=0 t=1,b=1,s=0 Snapshot C t=1, b=3, s=0 t=1,b=0,s=0 <![CDATA[Clone volume C1]]> t=2, b=0, s=0 NULL

[0112] That is to say, Fig.10 As shown, the VM will clone volume C1 from Figure 7 The relationship tree shown is disconnected, and a new relationship tree is created for the clone volume C1. The snapshot tree identifier of the clone volume C1 in the new relationship tree is t=2, b=0, s=0, and the snapshot tree identifier of the parent volume is NULL.

[0113] In a specific embodiment of the present application, the VM reinstalls the image of the operating system in the system disk. Here, reinstalling the image of the operating system in the system disk can be the same as Figure 8 The method for installing the operating system in the parent volume in the relationship tree shown is similar and will not be described in detail here.

[0114] Continue to see Figure 2 , Figure 2 2 is a schematic diagram of a cloud system provided by the present application. The cloud system includes a physical host, a computing node, an object storage device, and a distributed storage system. The physical host 210, the computing node 220, the distributed storage system 230, and the object storage device 250 are connected via a network 240.

[0115] See also Fig.13 The physical host 210 may include a first processor 610 , a first memory 620 , a smart network card 630 , and a bus 640 .

[0116] The first processor 610 may be one or more general-purpose processors, wherein the general-purpose processor may be any type of device capable of processing electronic instructions, including a central processing unit (CPU), a microprocessor, a microcontroller, a main processor, a controller, and an application-specific integrated circuit (ASIC), etc. The first processor 610 executes various types of digital storage instructions, such as software or firmware programs stored in the first memory 620. In a specific embodiment, the first processor 610 may be an x86 processor, etc. The first processor 610 sends commands to the first memory 620 through a physical interface to complete storage-related tasks. For example, the commands that the first processor 610 may provide include read commands, write commands, copy commands, and erase commands, etc. The commands may specify operations related to specific pages and blocks of the first memory 620. An operating system may be installed in the first processor 610, and a cloud management platform may be installed on the operating system.

[0117] The cloud management platform can be AWS (Amazon Web Service), OpenStack, CloudStack, Hadoop, ApacheMesos, Docker-based kubernetes, swarm, etc., which are not specifically limited here. The cloud management platform 211 can include computing services, storage services, and network services, wherein the computing service can be Nova, the storage service can be swift, the network service can be Neutron, etc. Of course, the cloud management platform 211 can also include other services, such as authentication services, image services, monitoring services, cluster services, database services, front-end services, etc., wherein the authentication service can be Keystone, the image service can be Glance, the monitoring service can be Ceilometer, the cluster service can be Heat, the database service can be Trove, the front-end service can be Horizon, etc., which are not given one by one here.

[0118] The first memory 620 may include a random access memory (Random Access Memory, RAM), a flash memory (Flash Memory), etc., or it may be a RAM, a read-only memory (Read-Only Memory, ROM) or a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD).

[0119] Smart NIC 630 is also called a network interface controller, a network interface card or a local area network (LAN) adapter. Each smart NIC 630 has a unique MAC address, which is burned into the read-only memory chip by the smart NIC 630 manufacturer during production. Smart NIC 630 includes a second processor 631, a second memory 632 and a transceiver 633. The second processor 631 is similar to the first processor 610, but the performance requirements of the second processor 631 may be lower than the performance requirements of the first processor 610. In a specific embodiment, the second processor 631 may be an ARM processor or the like. The second memory 632 may also be a flash memory, an HDD or an SDD, and the storage capacity of the second memory 632 may be less than the storage capacity of the first memory 620. The transceiver 633 may be used to receive and send messages, and upload the received messages to the second processor 631 for processing. Smart NIC 630 may also include multiple ports, and the ports may be any one or more of the three interface types of a thick cable interface, a thin cable interface and a twisted pair interface.

[0120] See also Fig.14 The computing node 220 may generally include a first processor 710 , a first memory 720 , a smart network card 730 , and a bus 740 .

[0121] The first processor 710 may be one or more general-purpose processors, wherein the general-purpose processor may be any type of device capable of processing electronic instructions, including a central processing unit (CPU), a microprocessor, a microcontroller, a main processor, a controller, and an application-specific integrated circuit (ASIC), etc. The first processor 710 executes various types of digital storage instructions, such as software or firmware programs stored in the first memory 720. In a specific embodiment, the first processor 710 may be an x86 processor, etc. The first processor 710 sends commands to the first memory 720 through a physical interface to complete storage-related tasks. For example, the commands that the first processor 710 may provide include read commands, write commands, copy commands, and erase commands, etc. The commands may specify operations related to specific pages and blocks of the first memory 720. As an example, a command may request that data be written to a specific physical page, or another command may request that a specific physical block be erased. Multiple virtual machines may be virtualized within the first processor 710, and a corresponding operating system may be installed on each virtual machine.

[0122] The first memory 720 may include a random access memory (Random Access Memory, RAM), a flash memory (Flash Memory), etc., or it may be a RAM, a read-only memory (Read-Only Memory, ROM) or a hard disk (Hard Disk Drive, HDD) or a solid-state drive (Solid-State Drive, SSD).

[0123] Smart NIC 730 is also called a network interface controller, a network interface card or a local area network (LAN) adapter. Each smart NIC 730 has a unique MAC address, which is burned into the read-only memory chip by the smart NIC 730 manufacturer during production. Smart NIC 730 includes a second processor 731, a second memory 732 and a transceiver 733. The second processor 731 is similar to the first processor 710, but the performance requirements of the second processor 731 may be lower than the performance requirements of the first processor 710. In a specific embodiment, the second processor 731 may be an ARM processor or the like. The second memory 732 may also be a flash memory, an HDD or an SDD, and the storage capacity of the second memory 732 may be less than the storage capacity of the first memory 720. The transceiver 733 may be used to receive and send messages, and upload the received messages to the second processor 731 for processing. Smart NIC 730 may also include multiple ports, and the ports may be any one or more of the three interface types of a thick cable interface, a thin cable interface and a twisted pair interface.

[0124] See also Fig.15 The object storage device 250 includes a processor 810 , a storage array 820 , a smart network card 830 , and a bus 840 .

[0125] The processor 810 may be one or more general-purpose processors, wherein the general-purpose processor may be any type of device capable of processing electronic instructions, including a central processing unit (CPU), a microprocessor, a microcontroller, a main processor, a controller, and an application-specific integrated circuit (ASIC), etc. The processor 810 executes various types of digital storage instructions. In a specific embodiment, the processor 810 may be an x86 processor, etc.

[0126] The storage array 820 may include a random access memory (RAM), a flash memory, etc., or may be a RAM, a read-only memory (ROM), a hard disk (HDD), or a solid-state drive (SSD). The storage array 820 may include multiple memories, each of which may store one or more objects. Here, the object may be a mirror image of an operating system.

[0127] Smart NIC 830 is also called a network interface controller, a network interface card or a local area network (LAN) adapter. Each Smart NIC 830 has a unique MAC address, which is burned into the read-only memory chip by the Smart NIC 830 manufacturer during production. Smart NIC 830 may also include multiple ports, which may be any one or more of the three interface types: thick cable interface, thin cable interface and twisted pair interface.

[0128] See also Fig.16 The distributed storage system 230 includes a processor 910, a storage array 920, an intelligent network card 930 and a bus 940.

[0129] The processor 910 may be one or more general-purpose processors, wherein the general-purpose processor may be any type of device capable of processing electronic instructions, including a central processing unit (CPU), a microprocessor, a microcontroller, a main processor, a controller, and an application-specific integrated circuit (ASIC), etc. The processor 910 executes various types of digital storage instructions. In a specific embodiment, the processor 910 may be an x86 processor, etc.

[0130] The storage array 920 may include a random access memory (RAM), a flash memory, etc., or may be a RAM, a read-only memory (ROM), a hard disk (HDD), or a solid-state drive (SSD). The storage array 920 may include multiple memories, each of which may store one or more data blocks, for example, data blocks of an operating system in a system disk.

[0131] Smart NIC 930 is also called a network interface controller, a network interface card or a local area network (LAN) adapter. Each Smart NIC 930 has a unique MAC address, which is burned into the read-only memory chip by the Smart NIC 930 manufacturer during production. Smart NIC 930 may also include multiple ports, which may be any one or more of the three interface types: thick cable interface, thin cable interface and twisted pair interface.

[0132] The physical host 210, computing node 220, distributed storage system 230 and object storage device 250 cooperate with each other to complete Figure 7 For details, see the method for reinstalling the operating system of the virtual machine shown in Figure 7 And related descriptions, which will not be described in detail here.

[0133] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a storage disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state storage disk Solid State Disk (SSD)), etc.

Claims

1. A method for reinstalling an operating system of a virtual machine, characterized in that: include: The computing service receives an operating system reinstallation command for the virtual machine; The computing service sends a first notification message to the storage service in response to the operating system reinstallation command; The storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message; The storage service obtains the operating system image to be installed; The storage service writes the operating system image to the system disk, and sends a second notification message to the computing service, where the second notification message is used to notify the computing service that the reinstallation of the operating system of the virtual machine is complete; The storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message, including: The storage service confirms the storage node corresponding to the system disk in the distributed storage system; The storage service erases metadata corresponding to the distributed storage system on the system disk in the storage nodes respectively; The storage service deletes the operating system in the system disk of the virtual machine in response to the first notification message, further comprising: The storage service searches for snapshot tree information of the volume corresponding to the system disk, modifies the snapshot tree identifier of the parent volume of the volume to empty in the snapshot tree information, and modifies the tree identifier of the volume in the snapshot tree identifier of the volume to a newly allocated tree identifier.

2. The method according to claim 1, characterized in that The storage service obtains the operating system image to be installed, including: The storage service downloads the operating system image from the object storage device to the system disk.

3. A cloud system, characterized in that: include: Computing services and storage services, The computing service is used to receive an operating system reinstallation command for a virtual machine; The computing service is used to send a first notification message to the storage service in response to the operating system reinstallation command; The storage service is used to delete the operating system in the system disk of the virtual machine in response to the first notification message; The storage service is used to obtain the operating system image to be installed; The storage service is used to write the operating system image to the system disk, and send a second notification message to the computing service, where the second notification message is used to notify the computing service that the reinstallation of the operating system of the virtual machine is complete; The storage service is used to confirm the storage node corresponding to the system disk in the distributed storage system; The storage service is used to erase metadata corresponding to the distributed storage system on the system disk in the storage nodes respectively; The storage service is used to search for snapshot tree information of the volume corresponding to the system disk, modify the snapshot tree identifier of the parent volume of the volume to empty in the snapshot tree information, and modify the tree identifier of the volume in the snapshot tree identifier of the volume to a newly allocated tree identifier.

4. The system according to claim 3, characterized in that The storage service is used to download the operating system image from the object storage device to the system disk.

5. A computing device, characterized in that: The system comprises a memory and a processor, wherein the processor executes a program in the memory to run a computing service and a storage service, thereby performing the method according to any one of claims 1 to 2.

6. A readable storage medium, characterized in that: The method comprises instructions, which, when executed on a computing node, cause the computing node to execute the method according to any one of claims 1 to 2.