WO2016065956A1 - 一种创建虚拟机的方法及装置 - Google Patents

一种创建虚拟机的方法及装置 Download PDF

Info

Publication number
WO2016065956A1
WO2016065956A1 PCT/CN2015/084352 CN2015084352W WO2016065956A1 WO 2016065956 A1 WO2016065956 A1 WO 2016065956A1 CN 2015084352 W CN2015084352 W CN 2015084352W WO 2016065956 A1 WO2016065956 A1 WO 2016065956A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
disk
data
template
service data
Prior art date
Application number
PCT/CN2015/084352
Other languages
English (en)
French (fr)
Inventor
王海新
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016065956A1 publication Critical patent/WO2016065956A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • This paper relates to the field of communications, and in particular to a method and apparatus for creating a virtual machine.
  • the embodiment of the invention provides a method and a device for creating a virtual machine, so as to solve the technical problem that the related technology cannot synchronize the service data continuously updated on the existing network in real time when the virtual machine is created by using the template.
  • An embodiment of the present invention provides a method for creating a virtual machine, including: creating a first virtual machine according to a service model, where service data corresponding to the service model is separately stored on a predetermined disk mounted by the first virtual machine; The virtual machine is converted into a template virtual machine, and a second virtual machine is generated according to the template virtual machine; the business data is copied online from the predetermined disk to the newly created disk, and the newly created disk is mounted on the second virtual machine.
  • creating the first virtual machine according to the service model includes: a virtual disk format (VHD) based differential disk management technology, using the parent node as a parent image, and setting a virtual machine specification according to the service model,
  • VHD virtual disk format
  • a child node is generated as a first virtual machine for the parent node
  • basic data is installed for the first virtual machine, where the basic data includes a system, a patch, a plug-in, and common software
  • the service data is separately stored in the predetermined disk.
  • Upper assign an identification (ID) to the predetermined disk, and store the ID and the base data in a database or configuration file of the first virtual machine.
  • ID identification
  • generating the second virtual machine according to the template virtual machine includes: using the template virtual machine as a template, using the parent node as a parent image, and generating a new child node as a second virtual machine for the parent node.
  • copying the service data online from the predetermined disk to the newly created disk includes: reading an ID from the database, searching for location information of the predetermined disk according to the ID; and using the location information to perform online copying of the service data from the predetermined disk, and Assign the new disk to the business data of the real-time storage copy.
  • the virtual machine specifications include: central processing unit (CPU) information, memory information, and network card information.
  • CPU central processing unit
  • the types of the predetermined disk and the newly created disk include: a disk under the Windows system or a disk under the Linux system;
  • the service data includes: short message data, multimedia message data, or intelligent network service data.
  • the embodiment of the present invention further provides a virtual machine creation apparatus, including: a creation module, configured to create a first virtual machine according to a service model, wherein the service data corresponding to the service model is separately stored in a reservation of the first virtual machine. a first processing module configured to convert the first virtual machine into a template virtual machine and generate a second virtual machine according to the template virtual machine; and a second processing module configured to copy the service data online from the predetermined disk to Create a new disk and mount the new disk on the second virtual machine.
  • a creation module configured to create a first virtual machine according to a service model, wherein the service data corresponding to the service model is separately stored in a reservation of the first virtual machine.
  • a first processing module configured to convert the first virtual machine into a template virtual machine and generate a second virtual machine according to the template virtual machine; and a second processing module configured to copy the service data online from the predetermined disk to Create a new disk and mount the new disk on the second virtual machine.
  • the creating module includes: a first processing unit, configured as a differential disk management technology based on a virtual hard disk format (VHD), using the parent node as a parent image, setting a virtual machine specification according to the service model, and according to the virtual machine specification, The parent node generates a child node as the first virtual machine; the installation unit is configured to install the basic data for the first virtual machine, wherein the basic data includes a system, a patch, a plug-in, and common software; and the second processing unit is configured to set the service
  • the data is stored separately on a predetermined disk, an ID is assigned to the predetermined disk, and the ID and base data are stored in the database of the first virtual machine or In the profile.
  • the first processing module includes: a generating unit, configured to use the template virtual machine as a template, the parent node as a parent image, and the parent node to generate a new child node as the second virtual machine.
  • a generating unit configured to use the template virtual machine as a template, the parent node as a parent image, and the parent node to generate a new child node as the second virtual machine.
  • the second processing module includes: a third processing unit configured to read the ID identifier from the database, search for location information of the predetermined disk according to the ID identifier; and a fourth processing unit configured to use the location information from the predetermined disk Online copying of business data and assigning new disk settings to store data for real-time copying.
  • the embodiment of the invention further provides a computer readable storage medium storing program instructions, which can be implemented when the program instructions are executed.
  • the virtual machine creation method and apparatus of the embodiment of the present invention have the following technical effects:
  • the service data can be separately saved in the service data disk mounted by the template virtual machine, so that after the new virtual machine is created, the continuously updated business data can be copied to the new one in real time.
  • the service data disk mounted on the virtual machine can ensure the data consistency of the created virtual machine at the operating system level, and achieve the effect that the business data of the virtual machine can be seamlessly connected.
  • FIG. 1 is a flowchart of a virtual machine creation method according to an embodiment of the present invention.
  • FIG. 2 is a schematic structural diagram of a virtual machine and a disk in a case where a new virtual machine is created by using a template virtual machine according to an embodiment of the present invention
  • FIG. 3 is a flow chart of converting a virtual machine into a virtual machine template according to an embodiment of the present invention
  • FIG. 4 is a flow chart of creating a new virtual machine using a virtual machine template according to an embodiment of the present invention
  • FIG. 5 is a structural block diagram of a virtual machine creation apparatus according to an embodiment of the present invention.
  • FIG. 6 is a schematic diagram of a virtual machine creation apparatus according to an embodiment of the present invention.
  • the embodiment of the present invention mainly provides a virtual machine creation method and device, so that when the virtual machine is created by using the template, the service data that is continuously updated on the existing network can be synchronized in real time.
  • the embodiment of the present invention mainly proposes a virtual machine creation scheme based on online services from three aspects: First, design a virtual machine business model according to the characteristics of the online service, for example, when the virtual machine is created, the business data that will not change is put as much as possible. Go to a separately mounted disk and file system. The second is to use VHD's differential disk management technology (a chained disk technology). In this case, only the parent node can access and view the data. Only the last child node can complete the operation and management of the data. The corresponding service data disk is mounted on the corresponding virtual machine to process a large amount of service data.
  • VHD's differential disk management technology a chained disk technology
  • the third is to create a business virtual machine according to the template, first share the parent image (that is, the parent node), and then regenerate the child node to complete the virtual machine creation, and then copy the business data disk mounted by the virtual machine online.
  • the virtual machine is created (saving hard disk resources), and the frequently changing business data disk can be mounted on the newly created virtual machine, which basically solves the problem of creating a virtual machine by using a template in related technologies. It can only deal with the problem of static data (that is, it cannot synchronize the business data that is constantly updated on the live network in real time), and can synchronize online services in real time.
  • the virtual machine creation solution provided by the embodiment of the present invention is particularly applicable to a virtual machine-based distributed system, or a disaster recovery system of some online services.
  • FIG. 1 is a flowchart of a method for creating a virtual machine according to an embodiment of the present invention. As shown in FIG. 1 , the process includes the following steps (step S102 - step S106 ):
  • Step S102 creating a first virtual machine according to the service model, where the service data corresponding to the service model is separately stored on a predetermined disk mounted by the first virtual machine;
  • Step S104 converting the first virtual machine into a template virtual machine, and generating a second virtual machine according to the template virtual machine;
  • step S106 the service data is copied online from the predetermined disk to the newly created disk, and the newly created disk is mounted on the second virtual machine.
  • the updated service data can be copied and saved in a new disk in real time, and the new disk is mounted to the newly created virtual machine (ie, the second virtual machine mentioned above). )on.
  • the foregoing step S102 may be implemented in the following manner: First, based on the differential disk management technology of the VHD, the parent node is used as a parent image, and the virtual machine specification is set according to the service model. According to the virtual machine specification, a child node is generated as a virtual machine for the parent node, and then the basic data is installed for the virtual machine (where the basic data can include systems, patches, plug-ins, and common software), and finally, the business data is separately stored in the virtual machine. On the predetermined disk, an ID (identification) is assigned to the predetermined disk, and the ID and the base data are stored in the database or configuration file of the first virtual machine.
  • ID identification
  • the service data is stored separately on the predetermined disk, it is not mixed with other data, so that there is no mutual interference when the business data and other data are operated differently.
  • step S104 may be implemented in the following manner: using the template virtual machine as a template, using the parent node as a parent image, and generating a new child node as a parent node as a second virtual machine.
  • the second virtual machine is created by using the first virtual machine as a template, and the second virtual machine and the first virtual machine are both child nodes of the parent node.
  • the service data is copied online from the predetermined disk to the newly created disk, and the method may be: first reading the ID from the database, and searching according to the ID.
  • the location information of the disk is reserved, and then the location information is used to perform online copying of the service data from the predetermined disk, and the new disk is set to store the business data of the copy in real time.
  • the continuously updated service data can be copied from the predetermined disk dedicated to the service data stored by the first virtual machine, and saved to a newly created disk that can be mounted on the first virtual machine, thereby ensuring Seamless integration of current business data.
  • the virtual machine specification may include: central processing unit (CPU) information, memory information, and network card information.
  • CPU central processing unit
  • the types of the predetermined disk and the newly created disk may include: a disk under the Windows system, or a disk under the Linux system, for example, a D disk, an E disk, or the like under the Windows system.
  • the service data may include: SMS data, MMS data, or intelligent network service data.
  • the service data in the actual application is not limited thereto, and may include, for example, video, voice data, and the like.
  • the virtual machine creation method provided by the embodiment of the present invention can share the parent image and ensure the consistency of the source file when the virtual machine is created by using the template (for example, only the related software of the image file needs to be updated when the operation patch is upgraded). It is also possible to copy the business data running online in real time, thereby completing the seamless connection of the online business.
  • a virtual machine that is, the first virtual machine described above
  • corresponding software is installed on the virtual machine.
  • the most important thing is to put the corresponding service data in the disk mounted by the virtual machine.
  • the service data is stored in a separate disk, that is, the above-mentioned predetermined disk), and the disk mounted on the virtual machine is specially identified (that is, the above ID).
  • the data about the virtual machine can be stored in In the database or configuration file, the ID identifier can also be stored in the database or configuration file of the created virtual machine (that is, the first virtual machine described above).
  • the virtual machine the first virtual machine
  • the virtual machine can be converted into a template virtual machine.
  • the parent image can be shared when a new virtual machine is created by using the converted virtual machine template, and a new child node is generated according to the parent image.
  • the basic use template creation has been completed. The flow of the virtual machine.
  • the related service data can be copied online to the new mount disk according to the related configuration information, and the mount disk is mounted on the newly created virtual machine, thereby completing the copy work of the entire service disk.
  • FIG. 2 is a schematic diagram of a virtual machine and a disk in a case where a new virtual machine is created by using a template virtual machine according to the embodiment.
  • the parent node in FIG. 2 is a parent image (that is, all the files are created according to the template).
  • the data disk used by the virtual machine when a virtual machine is created by using the parent node, a newly generated child node, a parent node can mount multiple child nodes, and the child node is a space in which the virtual machine runs independently, wherein each child Nodes (that is, each virtual machine) can mount their own disks (for example, D disks, E disks, etc.
  • the function of the bearer disk to undertake the service node includes operations on all data. For example, the disk space corresponding to the data of the database opening and deleting operations needs to be performed on the mounted disk.
  • the corresponding disk can be identified by the database and the configuration file. After the virtual machine is created through the template, all the data can be copied online through the identifier.
  • the parent node can provide shared master data, and the data cannot be easily modified. This way, data space can be saved, and data consistency at the operating system level can be ensured.
  • the template can be converted into a virtual machine, and then related plug-ins, patches, etc. can be upgraded, and can be used by all the child nodes at the same time after the upgrade.
  • FIG. 3 is a flowchart of converting a virtual machine into a virtual machine template according to the embodiment. As shown in FIG. 3, the flow generally includes the following steps:
  • Step S302 creating a normal virtual machine
  • Step S304 installing basic data such as an operating system, a patch, and common software for the virtual machine;
  • Step S306 mounting a service disk for the virtual machine and identifying the service disk in the database and the configuration file;
  • Step S308 loading service data in the service disk
  • step S310 the virtual machine is converted into a template.
  • virtual machine specifications for example, 4-core CPU, 4G memory, network card and other related information
  • the created virtual machine and then install the corresponding patch package, plug-ins and commonly used tools and software.
  • the virtual machine basic data processing process is completed.
  • the corresponding service data can be mounted on the disk mounted on the virtual machine.
  • the virtual machine can be used as a normal server or client.
  • the virtual machine is converted into a template, in addition to retaining the configuration file and storage information corresponding to the virtual machine, the ID and location information of the corresponding disk of the virtual machine need to be retained.
  • FIG. 4 is a flowchart of creating a new virtual machine by using a virtual machine template according to the embodiment. As shown in FIG. 4, the flow generally includes the following steps:
  • Step S402 creating a new child node as a new virtual machine on the mirror node of the virtual machine that has been created;
  • Step S404 reading disk configuration information from the database
  • Step S406 the service data in the disk is completely copied to the new disk by using a snapshot or the like;
  • Step S408 mounting a new disk on the new virtual machine
  • Step S410 starting a new virtual machine.
  • this process is a process of creating a virtual machine for a normal template
  • the embodiment of the present invention further provides a virtual machine creation apparatus.
  • the virtual machine creation apparatus mainly includes: a creation module 10, configured to create a first virtual machine according to a service model, where The business model's business data is stored separately in the first virtual machine mounted reservation On the disk; the first processing module 20 is configured to convert the first virtual machine into a template virtual machine, and generate a second virtual machine according to the template virtual machine; and the second processing module 30 is configured to set the service data online from the predetermined disk Copy to the new disk and mount the new disk on the second virtual machine.
  • a creation module 10 configured to create a first virtual machine according to a service model, where The business model's business data is stored separately in the first virtual machine mounted reservation On the disk
  • the first processing module 20 is configured to convert the first virtual machine into a template virtual machine, and generate a second virtual machine according to the template virtual machine
  • the second processing module 30 is configured to set the service data online from the predetermined disk Copy to the new disk and mount the new disk on the second virtual machine.
  • an optional embodiment of the present invention further provides a virtual machine creation device.
  • FIG. 6 is a schematic diagram of a virtual machine creation apparatus according to the present embodiment, as shown in FIG. 6, in the virtual machine creation apparatus:
  • the creating module 10 may include: a first processing unit 12 configured to use a differential disk management technology based on a virtual hard disk format (VHD), using a parent node as a parent image, setting a virtual machine specification according to a service model, and being a parent according to a virtual machine specification
  • the node generates a child node as a virtual machine
  • the installation unit 14 is configured to install basic data for the virtual machine, wherein the basic data includes a system, a patch, a plug-in, and common software
  • the second processing unit 16 is configured to separately store the service data.
  • an ID is assigned to the predetermined disk, and the ID and the base data are stored in the database of the first virtual machine.
  • the first processing module 20 may include: a generating unit 22 configured to use the template virtual machine as a template, the parent node as a parent image, and the parent node to generate a new child node as a second virtual machine.
  • the second processing module 30 may include: a third processing unit 32 configured to read an ID from a database, to find location information of a predetermined disk according to the ID; and a fourth processing unit 34 configured to use the location information to perform a service from the predetermined disk
  • the data is copied online and the new disk is assigned to store the business data of the copy in real time.
  • the consistency of the basic data of the virtual machine at the system level can be ensured, and at the same time, the single point upgrade (without affecting other data) can be performed for the current network service data when the synchronization upgrade is required.
  • the virtual machine creation method provided by the embodiment of the present invention can satisfactorily meet the requirements of the user to create a service virtual machine by using the template virtual machine, as a result of the actual performance test and the user feedback.
  • the service data can be separately saved in the service data disk mounted by the template virtual machine, so that after the new virtual machine is created, the continuously updated business data can be copied to the new one in real time.
  • the service data disk mounted on the virtual machine can ensure the data consistency of the created virtual machine at the operating system level, and achieve the effect that the business data of the virtual machine can be seamlessly connected.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

本发明实施例提供了一种创建虚拟机的方法及装置。所述方法包括:根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。

Description

一种创建虚拟机的方法及装置 技术领域
本文涉及通信领域,尤其是涉及一种创建虚拟机的方法及装置。
背景技术
目前,很多虚拟机是基于XEN、KVM等底层虚拟化技术创建的,在创建完虚拟机之后,需要为虚拟机安装对应的操作系统、常用的办公软件和业务软件等,例如部署Web服务、Oracle数据库或者Sybase数据库等。由于在一些商用的系统中,很多用户和业务数据都是动态的(即不断变化的),因此,即使在虚拟机转成虚拟机模版后,再利用此虚拟机模版创建新的虚拟机仍然是对静态数据进行拷贝。也就是说,相关技术在利用创建好的虚拟机作为虚拟机模版再次创建虚拟机的时候,缺少对现网不断更新的业务数据进行同步处理的操作。
因此,相关技术在利用模板创建虚拟机时,无法实时地同步现网不断更新的业务数据。
发明内容
本发明实施例提供一种虚拟机创建方法及装置,以达到解决相关技术在利用模板创建虚拟机时,无法实时地同步现网不断更新的业务数据的技术问题的目的。
本发明实施例提供了一种虚拟机创建方法,包括:根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。
可选地,根据业务模型创建第一虚拟机包括:基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格, 并根据虚拟机规格,为父节点生成一个子节点作为第一虚拟机;为第一虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;将业务数据单独存储在预定磁盘上,为预定磁盘分配标识(ID),并将ID和基础数据存储在第一虚拟机的数据库或者配置文件中。
可选地,根据模板虚拟机生成第二虚拟机包括:将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。
可选地,将业务数据从预定磁盘上在线拷贝到新建磁盘中包括:从数据库中读取ID,根据ID查找预定磁盘的位置信息;使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘设置为实时存储拷贝的业务数据。
可选地,虚拟机规格包括:中央处理器(CPU)信息、内存信息以及网卡信息。
可选地,预定磁盘和新建磁盘的类型包括:Windows系统下的磁盘、或者Linux系统下的磁盘;业务数据包括:短信数据、彩信数据、或者智能网业务数据。
本发明实施例还提供了一种虚拟机创建装置,包括:创建模块,设置为根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;第一处理模块,设置为将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;以及第二处理模块,设置为将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。
可选地,创建模块包括:第一处理单元,设置为基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为第一虚拟机;安装单元,设置为为第一虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;以及第二处理单元,设置为将业务数据单独存储在预定磁盘上,为预定磁盘分配ID,并将ID和基础数据存储在第一虚拟机的数据库或 者配置文件中。
可选地,第一处理模块包括:生成单元,设置为将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。
可选地,第二处理模块包括:第三处理单元,设置为从数据库中读取ID标识,根据ID标识查找预定磁盘的位置信息;以及第四处理单元,设置为使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘设置为实时存储拷贝的业务数据。
本发明实施例还提供一种计算机可读存储介质,存储有程序指令,当该程序指令被执行时可实现上述方法。
与相关技术相比,本发明实施例的虚拟机创建方法及装置具有如下技术效果:
在利用模板创建虚拟机的时候,可以单独将业务数据保存在模板虚拟机挂载的业务数据磁盘中,这样在新的虚拟机创建完成后,可以实时地将不断更新的业务数据拷贝到新的虚拟机挂载的业务数据磁盘中,从而可以保证创建的虚拟机在操作系统层面的数据一致性,达到了虚拟机的业务数据可以无缝衔接的效果。
附图概述
图1是根据本发明实施例的虚拟机创建方法流程图;
图2是根据本发明实施例的利用模板虚拟机创建新虚拟机情况下的虚拟机和磁盘的架构示意图;
图3是根据本发明实施例的虚拟机转换成虚拟机模版的流程图;
图4是根据本发明实施例的利用虚拟机模版创建新虚拟机的流程图;
图5是根据本发明实施例的虚拟机创建装置的结构框图;
图6是根据本发明实施例的虚拟机创建装置的示意图。
本发明的实施方式
需要说明的是,在不冲突的情况下,本发明实施例以及实施例中的特征可以相互组合。
本发明实施例主要提供一种虚拟机创建方法及装置,以使能够在利用模板创建虚拟机时,可以实时地同步现网不断更新的业务数据。
本发明实施例主要是从三个方面着手提出基于在线业务的虚拟机创建方案:一是根据在线业务的特点设计虚拟机的业务模型,例如在创建虚拟机时将不会变化的业务数据尽量放到单独挂载的磁盘和文件系统中。二是采用VHD的差分磁盘管理技术(一种链式的磁盘技术),这种情况下在父节点只能访问和查看数据,只有在最后的子节点才可以完成对数据的操作和管理,通过在对应的虚拟机上挂载对应的业务数据盘的方式来处理大量的业务数据。三是在根据模版创建业务虚拟机时,首先共享母镜像(也就是父节点),再重新生成子节点,从而完成虚拟机的创建,然后全量在线拷贝虚拟机挂载的业务数据盘,在此过程中,既完成了虚拟机的创建(节省了硬盘资源),同时又能够将经常变化的业务数据盘挂载到了新创建的虚拟机上,基本上解决了相关技术中利用模版创建虚拟机时只能处理静态数据(即无法实时地同步现网不断更新的业务数据)的问题,可以实时同步在线业务。而且,本发明实施例提供的虚拟机创建方案特别适用于基于虚拟机的分布式系统,或者一些在线业务的灾备系统等。
本发明实施例提供了一种虚拟机创建方法。图1是根据本发明实施例的虚拟机创建方法流程图,如图1所示,该流程包括主要包括以下步骤(步骤S102-步骤S106):
步骤S102,根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定磁盘上;
步骤S104,将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;
步骤S106,将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。
通过上述步骤,由于业务数据是与其它数据分开保存的,这样的情况下, 如果现网不断产生新的业务数据,就可以实时地对这些更新的业务数据进行拷贝并保存在一个新的磁盘中,并将该新磁盘挂载到新建的虚拟机(即上述第二虚拟机)上。
在本发明实施例的一个可选实施方式中,上述步骤S102可以采用这样的方式来实现:首先,可以基于VHD的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为虚拟机,然后,为虚拟机安装基础数据(其中,基础数据可以包括系统、补丁、插件以及常用软件),最后,将业务数据单独存储在预定磁盘上,为预定磁盘分配ID(标识),并将ID和基础数据存储在第一虚拟机的数据库或者配置文件中。
由于业务数据是单独存储在预定磁盘上的,这样就不会与其它数据混同,以便于在对业务数据和其它数据进行不同的操作时,不会产生相互干扰。
在本发明实施例的一个可选实施方式中,上述步骤S104可以采用这样的方式来实现:将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。
也就是说,第二虚拟机是以第一虚拟机为模板创建的,第二虚拟机和第一虚拟机都是父节点的子节点。
在本发明实施例的一个可选实施方式中,在上述步骤S106中,将业务数据从预定磁盘上在线拷贝到新建磁盘中,可以采用这样的方式:先从数据库中读取ID,根据ID查找预定磁盘的位置信息,再使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘设置为实时存储拷贝的业务数据。
通过这样的方式,可以将第一虚拟机挂载的专用于保存业务数据的预定磁盘中拷贝出不断更新的业务数据,并保存到可以挂载到第一虚拟机的新建磁盘中,从而保证了现网业务数据的无缝衔接。
在本发明实施例中,虚拟机规格可以包括:中央处理器(CPU)信息、内存信息以及网卡信息。当然,并不局限于此,在实际应用中,虚拟机的规格还可以包括其它信息,例如存储磁盘信息等。
在本发明实施例中,预定磁盘和新建磁盘的类型可以包括:Windows系统下的磁盘、或者Linux系统下的磁盘,例如Windows系统下的D盘、E盘等。另外,业务数据可以包括:短信数据、彩信数据、或者智能网业务数据,当然,在实际应用中的业务数据完全不局限于此,可以包括诸如视频、语音数据等。
通过本发明实施例提供的上述虚拟机创建方法,能够在使用模版创建虚拟机的时候既可以共享母镜像、保证源文件的一致性(例如,升级操作补丁时只需要更新镜像文件的相关软件),还可以实时地对在线运行的业务数据进行拷贝,从而完成在线业务的无缝对接。
为了更好地理解上述实施例,以下结合图2至图4以及一实施例对上述实施例的实现方式进行更加详细的描述和说明。实施过程主要如下:
首先,根据业务模型创建虚拟机(即上述第一虚拟机),并在该虚拟机上面安装对应的软件等,其中比较重要的是要将对应的业务数据全部放在该虚拟机挂载的磁盘上(尽量保证业务数据存放在独立的磁盘中,即上述预定磁盘),并对该虚拟机挂载的磁盘进行特殊的标识(即上述ID),一般情况下,有关虚拟机的数据可以存放在数据库或者配置文件中,因此可以将该ID标识也存放在创建的虚拟机(即上述第一虚拟机)的数据库或配置文件中。在完成虚拟机创建之后,就可以将该虚拟机(第一虚拟机)转换成模版虚拟机。
然后,利用VHD的差分磁盘管理技术,在利用转换成的虚拟机模版进行新的虚拟机创建时可以共享母镜像,同时根据母镜像生成新的子节点,至此,已经完成了基本的利用模版创建虚拟机的流程。
在这之后,可以根据相关的配置信息,在线拷贝相关的业务数据到新的挂载盘中,并将此挂载盘挂载到新创建的虚拟机上,从而完成了整个业务盘的拷贝工作。
最后,启动新创建的虚拟机,也就完成了整个基于在线业务的虚拟机的创建和运行过程。
请参考图2,图2是根据本实施例的利用模板虚拟机创建新虚拟机情况下的虚拟机和磁盘的架构示意图,图2中的父节点为母镜像(也就是所有的根据该模版创建虚拟机所用的数据盘),在利用该父亲节点创建虚拟机时都会新生成的一个子节点,一个父节点下面可以挂载多个子节点,子节点为虚拟机独立运行的空间,其中,每个子节点(即每个虚拟机)可以挂载自己的磁盘(例如,Windows系统的D盘、E盘等),在这些虚拟机挂载的数据盘上面可以装载自己的业务(例如,短信、彩信等)。挂载盘承担业务节点的功能包括对所有数据的操作,例如,数据库开户新增和删除的操作的数据所对应的磁盘空间都需要在挂载的磁盘上进行。
同时,还可以通过数据库和配置文件都可以为对应的磁盘做标识,之后在通过模版创建虚拟机的时候,可以通过该标识在线全盘拷贝全部数据。
由此可见,该架构的最大优点是:父节点可以提供共享母盘数据,而且数据不能轻易修改,这种方式即能节省数据空间,又能够保证操作系统等层面的数据一致性。同时,在操作系统等需要升级的时候,也能够将该模版转成虚拟机,然后升级相关的插件、补丁等,升级后可以同时被所有的子节点使用。
图3是根据本实施例的虚拟机转换成虚拟机模版的流程图,如图3所示,该流程大致包括以下步骤:
步骤S302,创建普通虚拟机;
步骤S304,为虚拟机安装操作系统、补丁、常用软件等基本数据;
步骤S306,为虚拟机挂载业务盘并在数据库和配置文件中对业务盘标识;
步骤S308,在业务盘中加载业务数据;
步骤S310,将虚拟机转为模版。
其中,虚拟机转换成模板虚拟机的流程可以这样实现:
首先,根据业务设置虚拟机规格(例如,4核CPU、4G内存、网卡等相关信息),创建完的虚拟机再安装对应的补丁包、插件以及常用的工具软件等。此时,也就完成了虚拟机基础数据的处理过程。
然后,在此基础上为创建好的虚拟机挂载相关的虚拟机磁盘,并将该磁 盘对应ID唯一标识的数据保存在数据库或者配置文件中,以便在数据恢复过程中使用。
最后,在该虚拟机挂载的磁盘中可以挂载对应的业务数据,启动业务数据后就可以将该虚拟机作为正常的服务器或者客户机使用。同时,在该虚拟机转换成模版时,除了需要保留该虚拟机对应的配置文件和存储信息外,还需要保留该虚拟机对应挂载磁盘的ID和位置信息。
图4是根据本实施例的利用虚拟机模版创建新虚拟机的流程图,如图4所示,该流程大致包括以下步骤:
步骤S402,在已经创建的虚拟机的镜像节点上创建新的子节点作为新的虚拟机;
步骤S404,从数据库中读取磁盘配置信息;
步骤S406,将磁盘中的业务数据通过快照等方式全量拷贝到新的磁盘中;
步骤S408,将新磁盘挂载新的虚拟机上;
步骤S410,启动新的虚拟机。
其中,利用虚拟机模版创建新虚拟机的流程可以这样实现:
首先,在原来的虚拟机母节点上拉出新的子节点,同时根据母节点的虚拟机配置文件等生成新的虚拟机(此过程为正常的模版创建虚拟机的流程);
然后,根据数据库中相关磁盘挂载的ID等数据,找到之前虚拟机在线运行的磁盘位置,据此进行在线的全部数据拷贝等操作;
最后,在新拷贝的磁盘完成之后,将该磁盘挂载到新创建的虚拟机上,进而完成整个模版创建虚拟机的过程。
对应于上述实施例提供的虚拟机创建方法,本发明实施例还提供了一种虚拟机创建装置。
图5是根据本发明实施例的虚拟机创建装置的结构框图,如图5所示,该虚拟机创建装置主要包括:创建模块10,设置为根据业务模型创建第一虚拟机,其中,对应于业务模型的业务数据单独存储在第一虚拟机挂载的预定 磁盘上;第一处理模块20,设置为将第一虚拟机转换成模板虚拟机,并根据模板虚拟机生成第二虚拟机;以及第二处理模块30,设置为将业务数据从预定磁盘上在线拷贝到新建磁盘中,并将新建磁盘挂载在第二虚拟机上。
在图5所示的虚拟机创建装置的基础上,本发明可选实施例还提供了一种虚拟机创建装置。
图6是根据本实施例的虚拟机创建装置的示意图,如图6所示,在该虚拟机创建装置中:
创建模块10可以包括:第一处理单元12,设置为基于虚拟硬盘格式(VHD)的差分磁盘管理技术,将父节点作为母镜像,根据业务模型设置虚拟机规格,并根据虚拟机规格,为父节点生成一个子节点作为虚拟机;以及安装单元14,设置为为虚拟机安装基础数据,其中,基础数据包括系统、补丁、插件以及常用软件;第二处理单元16,设置为将业务数据单独存储在预定磁盘上,为预定磁盘分配ID,并将ID和基础数据存储在第一虚拟机的数据库中。
第一处理模块20可以包括:生成单元22,设置为将模板虚拟机作为模板,将父节点作为母镜像,为父节点生成一个新的子节点作为第二虚拟机。
第二处理模块30可以包括:第三处理单元32,设置为从数据库中读取ID,根据ID查找预定磁盘的位置信息;以及第四处理单元34,设置为使用位置信息从预定磁盘中对业务数据进行在线拷贝,并分配新建磁盘设置为实时存储拷贝的业务数据。
通过上述实施例,既可以保证虚拟机在系统等层面的基本数据的一致性,同时又可以保证在需要进行同步升级的时候能够针对现网业务数据做到单点升级(不影响其它数据),可以适用于所有其它在线业务节点。而且,通过实际的性能测试和用户反馈的结果来看,本发明实施例提供的虚拟机创建方法,能够很好地满足用户的利用模板虚拟机创建业务虚拟机的要求。
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件完成,上述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本发明实施例不限制于任何特定形式的硬件和软件的结合。
工业实用性
在利用模板创建虚拟机的时候,可以单独将业务数据保存在模板虚拟机挂载的业务数据磁盘中,这样在新的虚拟机创建完成后,可以实时地将不断更新的业务数据拷贝到新的虚拟机挂载的业务数据磁盘中,从而可以保证创建的虚拟机在操作系统层面的数据一致性,达到了虚拟机的业务数据可以无缝衔接的效果。

Claims (11)

  1. 一种虚拟机创建方法,包括:
    根据业务模型创建第一虚拟机,其中,对应于所述业务模型的业务数据单独存储在所述第一虚拟机挂载的预定磁盘上;
    将所述第一虚拟机转换成模板虚拟机,并根据所述模板虚拟机生成第二虚拟机;
    将所述业务数据从所述预定磁盘上在线拷贝到新建磁盘中,并将所述新建磁盘挂载在所述第二虚拟机上。
  2. 根据权利要求1所述的方法,其中,所述根据业务模型创建第一虚拟机包括:
    基于虚拟硬盘格式VHD的差分磁盘管理技术,将父节点作为母镜像,根据所述业务模型设置虚拟机规格,并根据所述虚拟机规格,为所述父节点生成一个子节点作为所述第一虚拟机;
    为所述第一虚拟机安装基础数据,其中,所述基础数据包括系统、补丁、插件以及常用软件;
    将所述业务数据单独存储在所述预定磁盘上,为所述预定磁盘分配标识ID,并将所述ID和所述基础数据存储在所述第一虚拟机的数据库或者配置文件中。
  3. 根据权利要求2所述的方法,其中,所述根据所述模板虚拟机生成第二虚拟机包括:
    将所述模板虚拟机作为模板,将所述父节点作为母镜像,为所述父节点生成一个新的子节点作为所述第二虚拟机。
  4. 根据权利要求3所述的方法,其中,所述将所述业务数据从所述预定磁盘上在线拷贝到新建磁盘中包括:
    从所述数据库中读取所述ID,根据所述ID查找所述预定磁盘的位置信息;
    使用所述位置信息从所述预定磁盘中对所述业务数据进行在线拷贝,并 分配所述新建磁盘设置为实时存储拷贝的业务数据。
  5. 根据权利要求2至4中任一项所述的方法,其中,所述虚拟机规格包括:中央处理器CPU信息、内存信息以及网卡信息。
  6. 根据权利要求1至4中任一项所述的方法,其中,
    所述预定磁盘和所述新建磁盘的类型包括:Windows系统下的磁盘、或者Linux系统下的磁盘;
    所述业务数据包括:短信数据、彩信数据、或者智能网业务数据。
  7. 一种虚拟机创建装置,包括:
    创建模块,设置为根据业务模型创建第一虚拟机,其中,对应于所述业务模型的业务数据单独存储在所述第一虚拟机挂载的预定磁盘上;
    第一处理模块,设置为将所述第一虚拟机转换成模板虚拟机,并根据所述模板虚拟机生成第二虚拟机;以及
    第二处理模块,设置为将所述业务数据从所述预定磁盘上在线拷贝到新建磁盘中,并将所述新建磁盘挂载在所述第二虚拟机上。
  8. 根据权利要求7所述的装置,其中,所述创建模块包括:
    第一处理单元,设置为基于虚拟硬盘格式VHD的差分磁盘管理技术,将父节点作为母镜像,根据所述业务模型设置虚拟机规格,并根据所述虚拟机规格,为所述父节点生成一个子节点作为所述第一虚拟机;
    安装单元,设置为为所述第一虚拟机安装基础数据,其中,所述基础数据包括系统、补丁、插件以及常用软件;以及
    第二处理单元,设置为将所述业务数据单独存储在所述预定磁盘上,为所述预定磁盘分配标识ID,并将所述ID和所述基础数据存储在所述第一虚拟机的数据库或者配置文件中。
  9. 根据权利要求8所述的装置,其中,所述第一处理模块包括:
    生成单元,设置为将所述模板虚拟机作为模板,将所述父节点作为母镜像,为所述父节点生成一个新的子节点作为所述第二虚拟机。
  10. 根据权利要求9所述的装置,其中,所述第二处理模块包括:
    第三处理单元,设置为从所述数据库中读取所述ID,根据所述ID查找所述预定磁盘的位置信息;以及
    第四处理单元,设置为使用所述位置信息从所述预定磁盘中对所述业务数据进行在线拷贝,并分配所述新建磁盘设置为实时存储拷贝的业务数据。
  11. 一种计算机可读存储介质,存储有程序指令,当该程序指令被执行时可实现权利要求1-6任一项所述的方法。
PCT/CN2015/084352 2014-10-31 2015-07-17 一种创建虚拟机的方法及装置 WO2016065956A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410608522.X 2014-10-31
CN201410608522.XA CN105630571A (zh) 2014-10-31 2014-10-31 一种创建虚拟机的方法及装置

Publications (1)

Publication Number Publication Date
WO2016065956A1 true WO2016065956A1 (zh) 2016-05-06

Family

ID=55856565

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/084352 WO2016065956A1 (zh) 2014-10-31 2015-07-17 一种创建虚拟机的方法及装置

Country Status (2)

Country Link
CN (1) CN105630571A (zh)
WO (1) WO2016065956A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775946A (zh) * 2016-12-16 2017-05-31 无锡华云数据技术服务有限公司 一种虚拟机快速创建方法

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106201654A (zh) * 2016-06-30 2016-12-07 国云科技股份有限公司 一种虚拟机系统的拯救方法
CN107807840B (zh) * 2016-09-09 2022-01-25 阿里巴巴集团控股有限公司 一种应用于虚拟机网络的设备直通方法以及装置
CN106528263B (zh) * 2016-10-21 2019-08-02 郑州云海信息技术有限公司 虚拟化环境中向虚拟机注入元信息并进行初始化的方法
CN106610864A (zh) * 2017-01-01 2017-05-03 国云科技股份有限公司 一种虚拟机克隆完整性的检测方法
CN106934554A (zh) * 2017-03-20 2017-07-07 广东电网有限责任公司电力调度控制中心 一种智能调度自动化系统中镜像系统的实现方法及装置
CN107643941A (zh) * 2017-10-12 2018-01-30 郑州云海信息技术有限公司 云数据系统中管理虚拟机的方法和装置
CN107995319B (zh) * 2018-01-08 2021-05-18 迈普通信技术股份有限公司 虚拟设备配置方法及网络设备
CN111767114B (zh) * 2019-12-10 2024-04-05 北京京东尚科信息技术有限公司 创建云主机的方法和装置、计算机系统和可读存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130198718A1 (en) * 2012-01-31 2013-08-01 Red Hat Inc. Automated configuration of an application in a computing platform
CN103605570A (zh) * 2013-11-18 2014-02-26 浪潮(北京)电子信息产业有限公司 一种基于虚拟机模板自动部署应用的方法及系统
CN103761168A (zh) * 2014-01-26 2014-04-30 上海爱数软件有限公司 一种基于nfs卷挂载备份虚拟机的方法

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103685408A (zh) * 2012-09-18 2014-03-26 英业达科技有限公司 以存储区域网络提供读取基础镜像的服务器、主机及方法
CN103051687B (zh) * 2012-12-10 2016-05-25 浪潮(北京)电子信息产业有限公司 一种将应用业务部署到云存储虚拟机的系统及方法
CN103309763A (zh) * 2013-07-04 2013-09-18 曙光信息产业(北京)有限公司 虚拟机的容错机制的保护方法和装置
CN103970908A (zh) * 2014-05-28 2014-08-06 浪潮电子信息产业股份有限公司 一种虚拟机模板ivf存储方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130198718A1 (en) * 2012-01-31 2013-08-01 Red Hat Inc. Automated configuration of an application in a computing platform
CN103605570A (zh) * 2013-11-18 2014-02-26 浪潮(北京)电子信息产业有限公司 一种基于虚拟机模板自动部署应用的方法及系统
CN103761168A (zh) * 2014-01-26 2014-04-30 上海爱数软件有限公司 一种基于nfs卷挂载备份虚拟机的方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775946A (zh) * 2016-12-16 2017-05-31 无锡华云数据技术服务有限公司 一种虚拟机快速创建方法

Also Published As

Publication number Publication date
CN105630571A (zh) 2016-06-01

Similar Documents

Publication Publication Date Title
WO2016065956A1 (zh) 一种创建虚拟机的方法及装置
CN108809722B (zh) 一种部署Kubernetes集群的方法、装置和存储介质
CN109542611B (zh) 数据库即服务系统、数据库调度方法、设备及存储介质
CN104572274A (zh) 跨云点迁移系统及方法
EP3564835B1 (en) Data redistribution method and apparatus, and database cluster
CN107122267B (zh) 一种Windows操作系统挂载恢复方法
CN106339177A (zh) 一种创建虚拟机的方法和装置
CN103218248A (zh) 一种虚拟机镜像的更新方法、服务器和桌面云系统
JP2016508349A (ja) クラスタ境界にわたるサービス移行
CN105095317A (zh) 分布式数据库服务管理系统
CN105635311A (zh) 一种云管理平台中资源池信息同步的方法
CN103905232A (zh) 虚拟机管理系统及方法
JP2014109900A (ja) データセンタ,データセンタでのシステムの複写サービスの提供方法及びデータセンタでのシステムの複写プログラム
CN104407890A (zh) 一种从OTG设备启动Android系统的方法
JP2015180991A (ja) 画像形成装置、画像形成装置の制御方法およびプログラム
US11307934B1 (en) Virtual backup and restore of virtual machines
CN103207805A (zh) 基于虚拟化的硬盘复用系统
KR102035071B1 (ko) 주문형 가상 클러스터 구축 시스템 및 방법
US9160705B2 (en) Identifier management
US20160191620A1 (en) System backup device and backup method
CN108170514A (zh) 一种容器运行方法及装置
WO2015192583A1 (zh) 一种互联网协议ip地址分配方法、装置、服务器和终端
CN106209445A (zh) 一种通过网络部署的虚拟化数据中心
CN114500549B (zh) 在公共云中为用户部署k8s托管集群的方法、设备和介质
US9485308B2 (en) Zero copy volume reconstruction

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15855603

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15855603

Country of ref document: EP

Kind code of ref document: A1