CN107643941A - The method and apparatus that virtual machine is managed in cloud data system - Google Patents
The method and apparatus that virtual machine is managed in cloud data system Download PDFInfo
- Publication number
- CN107643941A CN107643941A CN201710946916.XA CN201710946916A CN107643941A CN 107643941 A CN107643941 A CN 107643941A CN 201710946916 A CN201710946916 A CN 201710946916A CN 107643941 A CN107643941 A CN 107643941A
- Authority
- CN
- China
- Prior art keywords
- virtual machine
- disk
- template
- virtual
- disk data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000010586 diagram Methods 0.000 claims description 28
- 230000004044 response Effects 0.000 claims description 11
- 230000008520 organization Effects 0.000 description 8
- 238000010367 cloning Methods 0.000 description 5
- 238000005457 optimization Methods 0.000 description 5
- 238000004590 computer program Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000000926 separation method Methods 0.000 description 2
- 238000004140 cleaning Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及信息处理领域,尤指一种云数据系统中管理虚拟机的方法和装置。The invention relates to the field of information processing, in particular to a method and device for managing virtual machines in a cloud data system.
背景技术Background technique
服务器虚拟化是云计算的主要支撑技术之一,有关虚拟机磁盘的组织方式是实现服务器虚拟化系统的核心技术。虚拟机的一系列高级操作,如基于模板快速创建虚拟机、克隆虚拟机、虚拟机快照与恢复等,都对虚拟机洗盘的组织方式引入了实现约束。为了满足各种高级操作的需要,目前产生了一系列的实现方法,如在文件系统层面或者虚拟磁盘层面实现,但还没有一套完整的虚拟机磁盘组织方法,同时适用于网络接入存储(Network-Attached Storage,NAS)、存储区域网络(StorageArea Network,SAN)和iSCSI(:互联网小型计算机系统接口)等常见存储,来系统性地解决上述问题。Server virtualization is one of the main supporting technologies of cloud computing, and the organization of virtual machine disks is the core technology for implementing server virtualization systems. A series of advanced operations on virtual machines, such as quickly creating a virtual machine based on a template, cloning a virtual machine, snapshotting and restoring a virtual machine, etc., all introduce implementation constraints on the organization of virtual machine disk cleaning. In order to meet the needs of various advanced operations, a series of implementation methods have been produced, such as at the file system level or virtual disk level, but there is no complete set of virtual machine disk organization methods, which are also applicable to network access storage ( Common storage such as Network-Attached Storage, NAS), storage area network (StorageArea Network, SAN) and iSCSI (: Internet Small Computer System Interface), to systematically solve the above problems.
发明内容Contents of the invention
为了解决上述技术问题,本发明提供了一种云数据系统中管理虚拟机的方法和装置,能够提高虚拟机的管理效率。In order to solve the above technical problems, the present invention provides a method and device for managing virtual machines in a cloud data system, which can improve the management efficiency of virtual machines.
为了达到本发明目的,本发明提供了一种种云数据系统中管理虚拟机的方法,包括:In order to achieve the purpose of the present invention, the present invention provides a method for managing virtual machines in a cloud data system, including:
获取以同一虚拟机创建的多个虚拟机的模板文件对应的磁盘数据;Obtain the disk data corresponding to the template files of multiple virtual machines created with the same virtual machine;
根据所述虚拟机的创建顺序以及所述创建使用的模板,确定所述虚拟机的模板文件的关联关系;Determine the association relationship of the template files of the virtual machines according to the creation sequence of the virtual machines and the template used for the creation;
利用所述模板文件的关联关系,建立所述多个虚拟机的模板文件的磁盘数据的关联关系;Establishing the association relationship of the disk data of the template files of the plurality of virtual machines by using the association relationship of the template files;
利用所述磁盘数据的关联关系,响应对所述多个虚拟机的管理操作。Using the association relationship of the disk data, respond to the management operations on the multiple virtual machines.
其中,所述方法还具有如下特点:所述根据所述虚拟机的创建顺序以及所述创建使用的模板,确定所述虚拟机的模板文件的关联关系,包括:Wherein, the method also has the following characteristics: the determining the association relationship of the template file of the virtual machine according to the creation sequence of the virtual machine and the template used for the creation includes:
获取所述多个虚拟机中虚拟机的创建关系;Obtain the creation relationship of virtual machines among the plurality of virtual machines;
根据所述虚拟机的创建关系,创建树形结构的磁盘关系图记录所述虚拟机的磁盘数据的关联关系,其中当利用第一虚拟机的模板文件执行快照后生成的第二虚拟机时,第二虚拟机为树形结构中所述第一虚拟机的叶子节点。According to the creation relationship of the virtual machine, create a tree-structured disk relationship diagram to record the association relationship of the disk data of the virtual machine, wherein when the template file of the first virtual machine is used to execute the second virtual machine generated after the snapshot, The second virtual machine is a leaf node of the first virtual machine in the tree structure.
其中,所述方法还具有如下特点:所述创建树形结构的磁盘关系图记录所述磁盘数据的关联关系之后,所述方法还包括:Wherein, the method also has the following characteristics: after the creation of the tree-structured disk relationship diagram records the association relationship of the disk data, the method further includes:
判断所述磁盘关系图中的层数否大于等于预先设置的阈值;Judging whether the number of layers in the disk relationship graph is greater than or equal to a preset threshold;
如果大于所述阈值,则存储当前层磁盘数据与上一层磁盘数据中存在区别的数据。If it is greater than the threshold, store data that is different between the disk data of the current layer and the disk data of the previous layer.
其中,所述方法还具有如下特点:所述利用所述磁盘数据的关联关系,响应对所述多个虚拟机的管理操作,包括:Wherein, the method also has the following characteristics: the use of the association relationship of the disk data to respond to the management operations on the plurality of virtual machines includes:
在接收到虚拟机管理请求时,判断所述虚拟机管理请求是否为通过虚拟机模板进行虚拟机的管理操作;When a virtual machine management request is received, determine whether the virtual machine management request is a virtual machine management operation through a virtual machine template;
如果是,则获取所述虚拟机的模板文件的磁盘数据;If yes, then obtain the disk data of the template file of the virtual machine;
利用所述虚拟机的磁盘数据,响应所述虚拟机的管理请求。Using the disk data of the virtual machine to respond to the management request of the virtual machine.
其中,所述方法还具有如下特点:所述利用所述虚拟机的磁盘数据,响应所述虚拟机的管理请求,包括:Wherein, the method also has the following characteristics: the use of the disk data of the virtual machine to respond to the management request of the virtual machine includes:
当接收到的管理请求为创建至少两个虚拟机时,创建所述虚拟机的磁盘文件进行快照操作,得到所述虚拟机的模板文件;When the received management request is to create at least two virtual machines, create a disk file of the virtual machine and perform a snapshot operation to obtain a template file of the virtual machine;
对所述虚拟机的模板文件执行快照,输出所述至少两个虚拟机对应的磁盘文件。A snapshot is performed on the template file of the virtual machine, and disk files corresponding to the at least two virtual machines are output.
一种云数据系统中管理虚拟机的装置,包括:A device for managing virtual machines in a cloud data system, comprising:
获取模块,用于获取以同一虚拟机创建的多个虚拟机的模板文件对应的磁盘数据;An acquisition module, configured to acquire disk data corresponding to template files of multiple virtual machines created with the same virtual machine;
确定模块,用于根据所述虚拟机的创建顺序以及所述创建使用的模板,确定所述虚拟机的模板文件的关联关系;A determining module, configured to determine the association relationship of the template files of the virtual machine according to the creation sequence of the virtual machine and the template used for the creation;
建立模块,用于利用所述模板文件的关联关系,建立所述多个虚拟机的模板文件的磁盘数据的关联关系;An establishment module, configured to use the association relationship of the template files to establish the association relationship of the disk data of the template files of the plurality of virtual machines;
响应模块,用于利用所述磁盘数据的关联关系,响应对所述多个虚拟机的管理操作。A response module, configured to respond to management operations on the plurality of virtual machines by using the association relationship of the disk data.
其中,所述装置还具有如下特点:所述确定模块包括:Wherein, the device also has the following characteristics: the determination module includes:
获取单元,用于获取所述多个虚拟机中虚拟机的创建关系;an obtaining unit, configured to obtain the creation relationship of virtual machines among the plurality of virtual machines;
创建单元,用于根据所述虚拟机的创建关系,创建树形结构的磁盘关系图记录所述虚拟机的磁盘数据的关联关系,其中当利用第一虚拟机的模板文件执行快照后生成的第二虚拟机时,第二虚拟机为树形结构中所述第一虚拟机的叶子节点。The creating unit is configured to create a tree-structured disk relationship diagram to record the association relationship of the disk data of the virtual machine according to the creation relationship of the virtual machine, wherein the first virtual machine generated after the snapshot is executed using the template file of the first virtual machine When there are two virtual machines, the second virtual machine is a leaf node of the first virtual machine in the tree structure.
其中,所述装置还具有如下特点:所述装置还包括:Wherein, the device also has the following characteristics: the device also includes:
判断模块,用于在创建树形结构的磁盘关系图记录所述磁盘数据的关联关系之后,判断所述磁盘关系图中的层数否大于等于预先设置的阈值;A judging module, configured to determine whether the number of layers in the disk relationship diagram is greater than or equal to a preset threshold after creating a tree-structured disk relationship diagram to record the association relationship of the disk data;
存储模块,用于如果大于所述阈值,则存储当前层磁盘数据与上一层磁盘数据中存在区别的数据。The storage module is configured to store data that is different between the disk data of the current layer and the disk data of the previous layer if the value is greater than the threshold.
其中,所述装置还具有如下特点:所述响应模块包括:Wherein, the device also has the following characteristics: the response module includes:
判断单元,用于在接收到虚拟机管理请求时,判断所述虚拟机管理请求是否为通过虚拟机模板进行虚拟机的管理操作;A judging unit, configured to, when receiving a virtual machine management request, judge whether the virtual machine management request is a virtual machine management operation through a virtual machine template;
获取单元,用于如果是,则获取所述虚拟机的模板文件的磁盘数据;An acquisition unit, configured to, if yes, acquire the disk data of the template file of the virtual machine;
响应单元,用于利用所述虚拟机的磁盘数据,响应所述虚拟机的管理请求。The response unit is configured to use the disk data of the virtual machine to respond to the management request of the virtual machine.
其中,所述装置还具有如下特点:所述响应单元包括:Wherein, the device also has the following characteristics: the response unit includes:
创建子单元,用于当接收到的管理请求为创建至少两个虚拟机时,创建所述虚拟机的磁盘文件进行快照操作,得到所述虚拟机的模板文件;Create a subunit, used to create a disk file of the virtual machine to perform a snapshot operation when the received management request is to create at least two virtual machines, and obtain a template file of the virtual machine;
输出子单元,用于对所述虚拟机的模板文件执行快照,输出所述至少两个虚拟机对应的磁盘文件。The output subunit is configured to perform a snapshot on the template file of the virtual machine, and output disk files corresponding to the at least two virtual machines.
本发明提供的实施例,以虚拟机的模板文件的磁盘数据为基础,记录虚拟机的磁盘数据关联关系,对虚拟机的模板文件进行管理,方便后续利用虚拟机的模板文件进行管理,不受存储设备的磁盘特性的限制,克服对磁盘特性对虚拟机管理的限制,提高虚拟机的管理效率。The embodiment provided by the present invention is based on the disk data of the template file of the virtual machine, records the association relationship of the disk data of the virtual machine, manages the template file of the virtual machine, facilitates subsequent management by using the template file of the virtual machine, and is not affected by The limitation of the disk characteristic of the storage device overcomes the limitation of the disk characteristic on the management of the virtual machine, and improves the management efficiency of the virtual machine.
本发明的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本发明而了解。本发明的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the invention will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
附图说明Description of drawings
附图用来提供对本发明技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本发明的技术方案,并不构成对本发明技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solution of the present invention, and constitute a part of the description, and are used together with the embodiments of the application to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the present invention.
图1为本发明提供的云数据系统中管理虚拟机的方法的流程图;Fig. 1 is a flowchart of a method for managing a virtual machine in a cloud data system provided by the present invention;
图2为本发明提供的qcow2外部快照的实现示意图;Fig. 2 is the realization sketch map of the qcow2 external snapshot provided by the present invention;
图3为本发明提供的创建虚拟机模板的实现示意图;FIG. 3 is a schematic diagram of the implementation of creating a virtual machine template provided by the present invention;
图4为本发明提供的基于模板批量创建虚拟机的实现示意图;FIG. 4 is a schematic diagram of the implementation of batch creation of virtual machines based on templates provided by the present invention;
图5为本发明提供的克隆虚拟机的实现示意图;FIG. 5 is a schematic diagram of the implementation of the cloned virtual machine provided by the present invention;
图6为本发明提供的创建虚拟机快照的实现示意图;FIG. 6 is a schematic diagram of an implementation of creating a virtual machine snapshot provided by the present invention;
图7为本发明提供的恢复虚拟机快照的实现示意图;FIG. 7 is a schematic diagram of an implementation of restoring a virtual machine snapshot provided by the present invention;
图8为本发明提供的云数据系统中管理虚拟机的装置的结构图。FIG. 8 is a structural diagram of a device for managing virtual machines in the cloud data system provided by the present invention.
具体实施方式detailed description
为使本发明的目的、技术方案和优点更加清楚明白,下文中将结合附图对本发明的实施例进行详细说明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互任意组合。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined arbitrarily with each other.
在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps shown in the flowcharts of the figures may be performed in a computer system, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that shown or described herein.
图1为本发明提供的云数据系统中管理虚拟机的方法的流程图。图1所示方法包括:FIG. 1 is a flowchart of a method for managing a virtual machine in a cloud data system provided by the present invention. The methods shown in Figure 1 include:
步骤101、获取以同一虚拟机创建的多个虚拟机的模板文件对应的磁盘数据;Step 101, obtaining disk data corresponding to template files of multiple virtual machines created with the same virtual machine;
其中,以虚拟机1为模板建立的虚拟机2,再由虚拟机2创建的虚拟机3,依次类推,都可以理解为虚拟机1、虚拟机2、虚拟机3都是以同一虚拟机创建的多个虚拟机;Among them, virtual machine 2 created by using virtual machine 1 as a template, and then virtual machine 3 created by virtual machine 2, and so on, can be understood as virtual machine 1, virtual machine 2, and virtual machine 3 are all created by the same virtual machine multiple virtual machines;
步骤102、根据所述虚拟机的创建顺序以及所述创建使用的模板,确定所述虚拟机的模板文件的关联关系;Step 102, according to the creation sequence of the virtual machine and the template used for the creation, determine the association relationship of the template files of the virtual machine;
以上例说明,虚拟机3依赖虚拟机2建立,虚拟机2依赖虚拟机1建立,上述的关联关系就是虚拟机3关联虚拟机2,虚拟机2关联虚拟机1;The above example shows that virtual machine 3 depends on virtual machine 2, and virtual machine 2 depends on virtual machine 1. The above association relationship is that virtual machine 3 is associated with virtual machine 2, and virtual machine 2 is associated with virtual machine 1;
步骤103、利用所述模板文件的关联关系,建立所述多个虚拟机的模板文件的磁盘数据的关联关系;Step 103, using the association relationship of the template files to establish the association relationship of the disk data of the template files of the plurality of virtual machines;
具体的,获取该模板文件的磁盘数据,建立上述磁盘数据的关联关系,从而方便利用模板文件进行虚拟机管理。Specifically, the disk data of the template file is acquired, and the association relationship of the above disk data is established, so as to facilitate virtual machine management by using the template file.
为了更加高效的进行磁盘数据的管理,可以通过建立磁盘数据的树形结构进行管理,具体实现方式如下:In order to manage disk data more efficiently, you can manage it by establishing a tree structure of disk data. The specific implementation method is as follows:
获取所述多个虚拟机中虚拟机的创建关系;Obtain the creation relationship of virtual machines among the plurality of virtual machines;
根据所述虚拟机的创建关系,创建树形结构的磁盘关系图记录所述虚拟机的磁盘数据的关联关系,其中当利用第一虚拟机的模板文件执行快照后生成的第二虚拟机时,第二虚拟机为树形结构中所述第一虚拟机的叶子节点。According to the creation relationship of the virtual machine, create a tree-structured disk relationship diagram to record the association relationship of the disk data of the virtual machine, wherein when the template file of the first virtual machine is used to execute the second virtual machine generated after the snapshot, The second virtual machine is a leaf node of the first virtual machine in the tree structure.
以上文的例子进行说明,虚拟机1为第一层节点,虚拟机2为第二层节点,虚拟机3为第三层节点;Using the above example to illustrate, virtual machine 1 is the first layer node, virtual machine 2 is the second layer node, and virtual machine 3 is the third layer node;
步骤104、利用所述磁盘数据的关联关系,响应对所述多个虚拟机的管理操作。Step 104: Respond to management operations on the multiple virtual machines by using the association relationship of the disk data.
具体来说,在接收到虚拟机管理请求时,判断所述虚拟机管理请求是否为通过虚拟机模板进行虚拟机的管理操作Specifically, when a virtual machine management request is received, it is judged whether the virtual machine management request is a virtual machine management operation through a virtual machine template
如果是,则获取所述虚拟机的模板文件的磁盘数据;If yes, then obtain the disk data of the template file of the virtual machine;
利用所述虚拟机的磁盘数据,响应所述虚拟机的管理请求。Using the disk data of the virtual machine to respond to the management request of the virtual machine.
其中,所述管理操作可以为创建虚拟机、克隆虚拟机或恢复虚拟机的操作。Wherein, the management operation may be an operation of creating a virtual machine, cloning a virtual machine, or restoring a virtual machine.
本发明提供的方法实施例,以虚拟机的模板文件的磁盘数据为基础,记录虚拟机的磁盘数据关联关系,对虚拟机的模板文件进行管理,方便后续利用虚拟机的模板文件进行管理,不受存储设备的磁盘特性的限制,克服对磁盘特性对虚拟机管理的限制,提高虚拟机的管理效率。The method embodiment provided by the present invention is based on the disk data of the template file of the virtual machine, records the disk data association relationship of the virtual machine, manages the template file of the virtual machine, and facilitates subsequent management by using the template file of the virtual machine, without Restricted by the characteristics of the disk of the storage device, it overcomes the limitation of the characteristics of the disk on the management of the virtual machine, and improves the management efficiency of the virtual machine.
基于上述问题,本发明提出了一种基于qcow2的虚拟机磁盘组织方法,以qcow2外部文件快照为基础,设计了一套虚拟机磁盘操作方法,可以适配NAS、SAN和iSCSI等主流存储设备,有效支撑虚拟机的常见高级操作。Based on the above problems, the present invention proposes a virtual machine disk organization method based on qcow2. Based on qcow2 external file snapshots, a set of virtual machine disk operation methods is designed, which can be adapted to mainstream storage devices such as NAS, SAN, and iSCSI. Common advanced operations that effectively support virtual machines.
本发明提出了一种基于qcow2(qemu copy on write v2)的虚拟机磁盘组织方法。The invention proposes a virtual machine disk organization method based on qcow2 (qemu copy on write v2).
本发明提供的方法中,以qcow2外部文件快照为基础,构建可适配NAS、SAN和iSCSI等主流存储设备的磁盘组织方法,通过虚拟磁盘树的构建与维护,支持包括基于模板快速创建虚拟机、克隆虚拟机、虚拟机快照与恢复等在内的虚拟机高级操作。In the method provided by the present invention, based on the qcow2 external file snapshot, a disk organization method that can adapt to mainstream storage devices such as NAS, SAN, and iSCSI is constructed, and through the construction and maintenance of a virtual disk tree, support includes rapid creation of virtual machines based on templates Advanced virtual machine operations including virtual machine cloning, virtual machine snapshot and restoration.
图2为本发明提供的qcow2外部快照的实现示意图。qcow2支持内部快照和外部快照,所谓外部快照,就是通过磁盘文件堆叠的方式实现,此时新生成一个qcow2文件,与原磁盘文件形成分层的文件树。Fig. 2 is a schematic diagram of the implementation of the qcow2 external snapshot provided by the present invention. qcow2 supports internal snapshots and external snapshots. The so-called external snapshots are implemented by stacking disk files. At this time, a new qcow2 file is generated to form a hierarchical file tree with the original disk files.
值得注意的是,一是qcow2文件可以直接存储在块设备或者文件系统上,因此不会受限于NAS、SAN和iSCSI存储;二是只有active层是可写的,其他层都是只读的;三是可以在线创建,不会影响虚拟机业务。由上图可以看出随着快照的创建,一个虚拟磁盘的若干qcow2文件会形成树状结构不断延伸。由于主要操作集中在树的叶子节点,后文忽略树状结构的非关键节点细节,并以一块磁盘为例进行陈述,多块磁盘具体实施方法相同。It is worth noting that first, qcow2 files can be directly stored on block devices or file systems, so they are not limited to NAS, SAN and iSCSI storage; second, only the active layer is writable, and other layers are read-only ; Third, it can be created online without affecting the virtual machine business. It can be seen from the above figure that as the snapshot is created, several qcow2 files of a virtual disk will form a tree structure and continue to extend. Since the main operations are concentrated on the leaf nodes of the tree, the details of the non-key nodes of the tree structure will be ignored in the following, and a disk will be used as an example to describe. The specific implementation methods of multiple disks are the same.
图3为本发明提供的创建虚拟机模板的实现示意图。虚拟机模板是一种只读的虚拟机,它保留了虚拟机在某一时刻的状态,并为后续虚拟机创建提供数据基础,这与虚拟机快照类似,因此可以采用创建快照的方式来制作虚拟机模板,如下图所示:FIG. 3 is a schematic diagram of an implementation of creating a virtual machine template provided by the present invention. A virtual machine template is a read-only virtual machine that retains the state of the virtual machine at a certain moment and provides a data basis for subsequent virtual machine creation. This is similar to a virtual machine snapshot, so it can be created by creating a snapshot Virtual machine template, as shown in the following figure:
图4为本发明提供的基于模板批量创建虚拟机的实现示意图。由于模板是只读的虚拟机,创建虚拟机的同时不能破坏模板,因此可以基于模板对应的磁盘文件(图4模板箭头所指)作为后端来创建新的qcow2active层,实现基于模板(批量)创建虚拟机。不含数据的active层的创建非常迅速,因此批量创建虚拟机也会在极短的时间内完成。FIG. 4 is a schematic diagram of the implementation of batch creation of virtual machines based on templates provided by the present invention. Since the template is a read-only virtual machine, the template cannot be destroyed while creating the virtual machine, so a new qcow2active layer can be created based on the disk file corresponding to the template (as indicated by the template arrow in Figure 4) as the backend, and the template-based (batch) Create a virtual machine. The creation of the active layer without data is very fast, so the batch creation of virtual machines will also be completed in a very short time.
具体来说,当接收到的管理请求为创建至少两个虚拟机时,创建所述虚拟机的磁盘文件进行快照操作,得到所述虚拟机的模板文件;对所述虚拟机的模板文件执行快照,输出所述至少两个虚拟机对应的磁盘文件。Specifically, when the received management request is to create at least two virtual machines, create a disk file of the virtual machine and perform a snapshot operation to obtain a template file of the virtual machine; perform a snapshot on the template file of the virtual machine to output the disk files corresponding to the at least two virtual machines.
图5为本发明提供的克隆虚拟机的实现示意图。克隆虚拟机是对正在运行的虚拟机进行复制,以创建出来另外一个新的虚拟机。因此克隆虚拟机的过程分为两步,首先采用快照的方式创建克隆base文件,然后基于base文件创建克隆虚拟机。FIG. 5 is a schematic diagram of the implementation of the cloned virtual machine provided by the present invention. Cloning a virtual machine is to copy a running virtual machine to create another new virtual machine. Therefore, the process of cloning a virtual machine is divided into two steps. First, a snapshot is used to create a clone base file, and then a clone virtual machine is created based on the base file.
图6为本发明提供的创建虚拟机快照的实现示意图。图6所示的创建快照的方法与图2所示方法原理相似,此处不再赘述。FIG. 6 is a schematic diagram of an implementation of creating a virtual machine snapshot provided by the present invention. The method for creating a snapshot shown in FIG. 6 is similar in principle to the method shown in FIG. 2 , and will not be repeated here.
图7为本发明提供的恢复虚拟机快照的实现示意图。由于快照指向的qcow2文件是只读的,参见图6,因此可以基于快照base文件创建新的active层,从而实现恢复虚拟机快照。FIG. 7 is a schematic diagram of an implementation of restoring a virtual machine snapshot provided by the present invention. Since the qcow2 file pointed to by the snapshot is read-only, see Figure 6, a new active layer can be created based on the snapshot base file, so as to restore the virtual machine snapshot.
从以上操作可以看出,随着操作的不断进行,磁盘树的深度会不断加深,影响虚拟机的性能,因此需要进行深度优化,主要从以下三个方面阐述:From the above operations, it can be seen that as the operation continues, the depth of the disk tree will continue to deepen, which will affect the performance of the virtual machine. Therefore, in-depth optimization is required, mainly from the following three aspects:
深度优化触发条件:新建叶节点到根节点的深度超过某个阈值(例如5,可以根据实际情况进行配置),就可以进行深度优化。Depth optimization trigger condition: depth optimization can be performed when the depth from the newly created leaf node to the root node exceeds a certain threshold (for example, 5, which can be configured according to the actual situation).
其中,深度优化触发时机,包括:Among them, in-depth optimization trigger timing includes:
在创建一个虚拟磁盘树叶子节点时;在启动虚拟机时;手工触发。When creating a virtual disk tree leaf node; when starting a virtual machine; manually triggered.
在深度优化方法中,基于qemu的block-stream实现,将非叶子节点的数据拷贝至叶子节点,实现叶子节点与磁盘树的分离,从而降低磁盘树深度。In the deep optimization method, based on the block-stream implementation of qemu, the data of non-leaf nodes is copied to the leaf nodes, and the separation of the leaf nodes and the disk tree is realized, thereby reducing the depth of the disk tree.
具体来说,所述创建树形结构的磁盘关系图记录所述磁盘数据的关联关系之后,所述方法还包括:Specifically, after creating a tree-structured disk relationship diagram to record the association relationship of the disk data, the method further includes:
判断所述磁盘关系图中的层数否大于等于预先设置的阈值;Judging whether the number of layers in the disk relationship graph is greater than or equal to a preset threshold;
如果大于所述阈值,则存储当前层磁盘数据与上一层磁盘数据中存在区别的数据。If it is greater than the threshold, store data that is different between the disk data of the current layer and the disk data of the previous layer.
通过将区别数据进行存储,可以对叶子节点间的数据的差别进行记录,从而实现叶子节点与磁盘树的分离,从而降低磁盘树深度。By storing the difference data, the data difference between the leaf nodes can be recorded, so as to realize the separation of the leaf nodes and the disk tree, thereby reducing the depth of the disk tree.
本发明提出了一种基于qcow2的虚拟机磁盘组织方法,以qcow2外部文件快照为基础,设计了一套虚拟机磁盘操作方法,可以适配NAS、SAN和iSCSI等主流存储设备,有效支撑虚拟机的常见高级操作,系统性的解决了虚拟机的磁盘组织问题。通过以qcow2快照为基础,设计合理磁盘操作方法,得以支持虚拟机高级操作,屏蔽NAS、iSCSI和SAN带来的存储池差异。The present invention proposes a virtual machine disk organization method based on qcow2, and designs a set of virtual machine disk operation methods based on qcow2 external file snapshots, which can adapt to mainstream storage devices such as NAS, SAN, and iSCSI, and effectively support virtual machines Common advanced operations, systematically solve the problem of virtual machine disk organization. Based on qcow2 snapshots, a reasonable disk operation method is designed to support advanced virtual machine operations and shield storage pool differences caused by NAS, iSCSI and SAN.
图8为本发明提供的云数据系统中管理虚拟机的装置的结构图。图8所示装置包括:FIG. 8 is a structural diagram of a device for managing virtual machines in the cloud data system provided by the present invention. The device shown in Figure 8 includes:
获取模块801,用于获取以同一虚拟机创建的多个虚拟机的模板文件对应的磁盘数据;An acquisition module 801, configured to acquire disk data corresponding to template files of multiple virtual machines created with the same virtual machine;
确定模块802,用于根据所述虚拟机的创建顺序以及所述创建使用的模板,确定所述虚拟机的模板文件的关联关系;A determining module 802, configured to determine the association relationship of the template files of the virtual machine according to the creation sequence of the virtual machine and the template used for the creation;
建立模块803,用于利用所述模板文件的关联关系,建立所述多个虚拟机的模板文件的磁盘数据的关联关系;An establishment module 803, configured to use the association relationship of the template files to establish the association relationship of the disk data of the template files of the plurality of virtual machines;
响应模块804,用于利用所述磁盘数据的关联关系,响应对所述多个虚拟机的管理操作。The responding module 804 is configured to use the association relationship of the disk data to respond to the management operations on the plurality of virtual machines.
在本发明提供的装置实施例中,所述确定模块802包括:In the device embodiment provided by the present invention, the determining module 802 includes:
获取单元,用于获取所述多个虚拟机中虚拟机的创建关系;an obtaining unit, configured to obtain the creation relationship of virtual machines among the plurality of virtual machines;
创建单元,用于根据所述虚拟机的创建关系,创建树形结构的磁盘关系图记录所述虚拟机的磁盘数据的关联关系,其中当利用第一虚拟机的模板文件执行快照后生成的第二虚拟机时,第二虚拟机为树形结构中所述第一虚拟机的叶子节点。The creating unit is configured to create a tree-structured disk relationship diagram to record the association relationship of the disk data of the virtual machine according to the creation relationship of the virtual machine, wherein the first virtual machine generated after the snapshot is executed using the template file of the first virtual machine When there are two virtual machines, the second virtual machine is a leaf node of the first virtual machine in the tree structure.
在本发明提供的装置实施例中,所述装置还包括:In the device embodiment provided by the present invention, the device further includes:
判断模块,用于在创建树形结构的磁盘关系图记录所述磁盘数据的关联关系之后,判断所述磁盘关系图中的层数否大于等于预先设置的阈值;A judging module, configured to determine whether the number of layers in the disk relationship diagram is greater than or equal to a preset threshold after creating a tree-structured disk relationship diagram to record the association relationship of the disk data;
存储模块,用于如果大于所述阈值,则存储当前层磁盘数据与上一层磁盘数据中存在区别的数据。The storage module is configured to store data that is different between the disk data of the current layer and the disk data of the previous layer if the value is greater than the threshold.
在本发明提供的装置实施例中,所述响应模块包括:In the device embodiment provided by the present invention, the response module includes:
判断单元,用于在接收到虚拟机管理请求时,判断所述虚拟机管理请求是否为通过虚拟机模板进行虚拟机的管理操作;A judging unit, configured to, when receiving a virtual machine management request, judge whether the virtual machine management request is a virtual machine management operation through a virtual machine template;
获取单元,用于如果是,则获取所述虚拟机的模板文件的磁盘数据;An obtaining unit, configured to obtain the disk data of the template file of the virtual machine if yes;
响应单元,用于利用所述虚拟机的磁盘数据,响应所述虚拟机的管理请求。The response unit is configured to use the disk data of the virtual machine to respond to the management request of the virtual machine.
在本发明提供的装置实施例中,所述响应单元包括:In the device embodiment provided by the present invention, the response unit includes:
创建子单元,用于当接收到的管理请求为创建至少两个虚拟机时,创建所述虚拟机的磁盘文件进行快照操作,得到所述虚拟机的模板文件;Create a subunit, used to create a disk file of the virtual machine to perform a snapshot operation when the received management request is to create at least two virtual machines, and obtain a template file of the virtual machine;
输出子单元,用于对所述虚拟机的模板文件执行快照,输出所述至少两个虚拟机对应的磁盘文件。The output subunit is configured to perform a snapshot on the template file of the virtual machine, and output disk files corresponding to the at least two virtual machines.
本发明提供的装置实施例,以虚拟机的模板文件的磁盘数据为基础,记录虚拟机的磁盘数据关联关系,对虚拟机的模板文件进行管理,方便后续利用虚拟机的模板文件进行管理,不受存储设备的磁盘特性的限制,克服对磁盘特性对虚拟机管理的限制,提高虚拟机的管理效率。The device embodiment provided by the present invention is based on the disk data of the template file of the virtual machine, records the disk data association relationship of the virtual machine, manages the template file of the virtual machine, and facilitates subsequent management by using the template file of the virtual machine, without Restricted by the characteristics of the disk of the storage device, it overcomes the limitation of the characteristics of the disk on the management of the virtual machine, and improves the management efficiency of the virtual machine.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be implemented using a computer program flow, the computer program can be stored in a computer-readable storage medium, and the computer program can be run on a corresponding hardware platform (such as system, device, device, device, etc.), and when executed, includes one or a combination of the steps of the method embodiment.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。Optionally, all or part of the steps in the above embodiments can also be implemented using integrated circuits, and these steps can be fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module accomplish. As such, the present invention is not limited to any specific combination of hardware and software.
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/functional modules/functional units in the above embodiments can be realized by general-purpose computing devices, and they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices.
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When each device/functional module/functional unit in the above-mentioned embodiments is realized in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, and the like.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope described in the claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710946916.XA CN107643941A (en) | 2017-10-12 | 2017-10-12 | The method and apparatus that virtual machine is managed in cloud data system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710946916.XA CN107643941A (en) | 2017-10-12 | 2017-10-12 | The method and apparatus that virtual machine is managed in cloud data system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107643941A true CN107643941A (en) | 2018-01-30 |
Family
ID=61113584
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710946916.XA Pending CN107643941A (en) | 2017-10-12 | 2017-10-12 | The method and apparatus that virtual machine is managed in cloud data system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107643941A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117093332A (en) * | 2023-10-20 | 2023-11-21 | 杭州优云科技有限公司 | Method and device for realizing cloning of virtual machine |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20080244028A1 (en) * | 2007-03-29 | 2008-10-02 | Vmware, Inc. | Synchronization and Customization of a Clone Computer |
| CN102799464A (en) * | 2012-06-25 | 2012-11-28 | 北京奇虎科技有限公司 | Virtual machine creation method, virtual machine creation system, virtual machine resetting method and virtual machine resetting system |
| CN103019802A (en) * | 2012-11-20 | 2013-04-03 | 中标软件有限公司 | Virtual machine management method and virtual machine management platform |
| US20150169355A1 (en) * | 2006-04-24 | 2015-06-18 | Vmware, Inc. | Virtual machine image management using delta trees |
| CN105630571A (en) * | 2014-10-31 | 2016-06-01 | 中兴通讯股份有限公司 | Virtual machine creating method and device |
-
2017
- 2017-10-12 CN CN201710946916.XA patent/CN107643941A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20150169355A1 (en) * | 2006-04-24 | 2015-06-18 | Vmware, Inc. | Virtual machine image management using delta trees |
| US20080244028A1 (en) * | 2007-03-29 | 2008-10-02 | Vmware, Inc. | Synchronization and Customization of a Clone Computer |
| CN102799464A (en) * | 2012-06-25 | 2012-11-28 | 北京奇虎科技有限公司 | Virtual machine creation method, virtual machine creation system, virtual machine resetting method and virtual machine resetting system |
| CN103019802A (en) * | 2012-11-20 | 2013-04-03 | 中标软件有限公司 | Virtual machine management method and virtual machine management platform |
| CN105630571A (en) * | 2014-10-31 | 2016-06-01 | 中兴通讯股份有限公司 | Virtual machine creating method and device |
Non-Patent Citations (1)
| Title |
|---|
| 刑静宇: "《KVM虚拟化技术基础与实践》", 31 December 2015 * |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117093332A (en) * | 2023-10-20 | 2023-11-21 | 杭州优云科技有限公司 | Method and device for realizing cloning of virtual machine |
| CN117093332B (en) * | 2023-10-20 | 2024-02-27 | 杭州优云科技有限公司 | Method and device for realizing cloning of virtual machine |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11093162B2 (en) | Method and apparatus for deleting cascaded snapshot | |
| CN105718217B (en) | A kind of method and device of simplify configuration storage pool data sign processing | |
| US8983899B1 (en) | Systems and methods for archiving files in distributed replication environments | |
| CN107656797A (en) | The method and apparatus of across virtual platform migration virtual machine | |
| CN107656705B (en) | A computer storage medium and a data migration method, device and system | |
| US12487893B2 (en) | Techniques for using data backup and disaster recovery configurations for application management | |
| CN106294018B (en) | A kind of virtual machine restoration methods and device | |
| US9485308B2 (en) | Zero copy volume reconstruction | |
| US20250363079A1 (en) | Techniques for handling schema mismatch when migrating databases | |
| WO2017113861A1 (en) | Data access method and device | |
| CN107273246A (en) | A kind of server system backup method and device | |
| CN107643941A (en) | The method and apparatus that virtual machine is managed in cloud data system | |
| CN115657969B (en) | A method, device, equipment and medium for acquiring file system difference data | |
| CN117931528A (en) | Data backup method, device, computer equipment and storage medium | |
| CN117130830A (en) | Object data recovery method and device, computer equipment and storage medium | |
| US12189626B1 (en) | Automatic query optimization | |
| US20250370648A1 (en) | Seamless data transfer between storage entities | |
| US12321328B2 (en) | Autonomous table partition management | |
| CN112286626A (en) | Method, system, device and medium for fast and secure cloning of cross-storage disks | |
| US20250370883A1 (en) | Techniques to enhance failure tolerance during file synchronization | |
| US12517872B2 (en) | Techniques for block-order traversal of files | |
| US12524315B2 (en) | Backup management of non-relational databases | |
| US12530317B2 (en) | Storage and retrieval of filesystem metadata | |
| US12399910B2 (en) | Workload inspired input selection of databases for resharding | |
| US12541565B1 (en) | Techniques for navigation history generation |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180130 |
|
| RJ01 | Rejection of invention patent application after publication |