WO2016165472A1 - 一种创建虚拟机的方法和装置 - Google Patents

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

Info

Publication number
WO2016165472A1
WO2016165472A1 PCT/CN2016/074019 CN2016074019W WO2016165472A1 WO 2016165472 A1 WO2016165472 A1 WO 2016165472A1 CN 2016074019 W CN2016074019 W CN 2016074019W WO 2016165472 A1 WO2016165472 A1 WO 2016165472A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
uuid
mirror
image file
server
Prior art date
Application number
PCT/CN2016/074019
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 WO2016165472A1 publication Critical patent/WO2016165472A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers

Definitions

  • This article covers the technical field of creating virtual machines, especially a method and apparatus for creating virtual machines.
  • SDN Software Defined Network
  • NFV Network Function Virtualization
  • SFC Service Function Chaining
  • the new converged communication (new call, new message) service modules are mainly embodied in the form of virtual machines (VMs), and one virtual machine has virtual computing resources such as virtual CPUs. vCPU, Virtual CPU), virtual storage resources such as virtual memory, virtual disks, and virtual network resources such as virtual network cards.
  • Virtual machines can be described by different specifications, virtual machine specifications are described by resource templates, and virtual machine specifications can be configured and managed.
  • Related methods for creating virtual machines generally include:
  • the server generates an image file of each operating system in advance.
  • the server receives the virtual machine creation request from the user, the server creates a cloud disk on the magnetic array, and calculates a Universal Unique Identifier (UUID) according to the virtual machine creation request. Copy the image file corresponding to the mirrored UUID to the cloud disk and create a VM based on the image file in the cloud disk.
  • UUID Universal Unique Identifier
  • the present invention provides a method and apparatus for creating a virtual machine, which is capable of Reduce creation time.
  • a method of creating a virtual machine including:
  • the server When the server receives the virtual machine creation request, the server creates a cloud hard disk on the magnetic array;
  • the server calculates a mirrored universal unique identifier UUID according to the virtual machine creation request, and determines that an image file corresponding to the mirrored UUID exists on the magnetic array, and an image file corresponding to the mirrored UUID in the magnetic array is determined. Copy to the cloud drive;
  • the server creates a virtual machine according to the image file in the cloud hard disk.
  • the method further includes :
  • the server divides the disk space on the magnetic array
  • the server copies an image file corresponding to the mirror UUID to the disk space from an image file of a pre-generated operating system
  • the server copies the image file in the disk space to the cloud hard disk.
  • the step of the server determining that the image file corresponding to the mirror UUID does not exist on the magnetic array includes:
  • the server does not find the mirror source volume ID corresponding to the mirror UUID in the first correspondence between the mirror UUID and the mirror source volume identifier ID;
  • the method further includes: the server recording the first correspondence between the mirror UUID and a mirror source volume ID corresponding to the disk space.
  • the step of determining that the image file corresponding to the mirror UUID exists on the magnetic array comprises: searching for the mirror source corresponding to the mirror UUID in the first correspondence between the mirror UUID and the mirror source volume identifier ID Volume ID
  • the step of the server copying the image file corresponding to the mirrored UUID in the magnetic array to the cloud hard disk includes: the server copying the image file corresponding to the mirror source volume ID found in the magnetic array to the cloud hard disk.
  • the method further includes:
  • the server records a second correspondence between the virtual machine identifier and the mirror source volume ID in the virtual machine creation request.
  • the method further includes:
  • the server searches for the virtual machine identifier corresponding to the mirror source volume ID corresponding to the deleted virtual machine in the second correspondence, and deletes the found virtual machine identifier and a second correspondence between the mirror source volume IDs corresponding to the deleted virtual machines.
  • the method further includes:
  • the server determines that the found virtual machine identifier is only one and is the deleted virtual machine identifier, the server deletes the mirror source volume ID corresponding to the deleted virtual machine in the magnetic array. file.
  • An apparatus for creating a virtual machine comprising a first creation module, a calculation module, a copy module, and a second creation module, wherein
  • the first creating module is configured to: when receiving a virtual machine creation request from a user, create a cloud hard disk on the magnetic array;
  • the calculating module is configured to: calculate a mirrored universal unique identifier UUID according to the virtual machine creation request;
  • the copying module is configured to: determine that the image file corresponding to the mirrored UUID exists on the magnetic array, and copy the image file corresponding to the mirrored UUID in the magnetic array to the cloud hard disk;
  • the second creating module is configured to: create a virtual machine according to an image file in the cloud hard disk.
  • the copy module is further configured to:
  • the notification message is sent to the first creation module; and the image file corresponding to the mirror UUID is copied from the image file of the pre-generated operating system. Going to the disk space; copying the image file in the disk space to the cloud hard disk;
  • the first creating module is further configured to: receive the notification message, and divide the magnetic array disk space.
  • the copying module is configured to determine that the image file corresponding to the mirrored UUID does not exist on the magnetic array: the first correspondence between the mirrored UUID and the mirrored source volume identifier ID is not found. a mirror source volume ID corresponding to the mirror UUID;
  • the copy module is further configured to: record a first correspondence between the mirror UUID and a mirror source volume ID corresponding to the disk space.
  • the copying module is configured to determine, according to the manner, that the image file corresponding to the mirrored UUID exists on the magnetic array: in the first correspondence between the mirrored UUID and the mirror source volume identifier ID, the Mirror the source volume ID of the UUID.
  • the copy module is further configured to:
  • the copy module is further configured to:
  • the virtual machine identifier corresponding to the mirrored source volume ID corresponding to the deleted virtual machine is searched for in the second corresponding relationship, and the found virtual machine identifier and the virtual machine corresponding to the deleted virtual machine are deleted.
  • the copy module is further configured to:
  • a computer program comprising program instructions that, when executed by a computer, cause the computer to perform any of the methods described above for creating a virtual machine.
  • the technical solution of the present invention includes: when the server receives the virtual machine creation request from the user, the server creates a cloud hard disk on the magnetic array; the server calculates the mirrored UUID according to the virtual machine creation request, and determines the magnetic array. An image file corresponding to the calculated mirror UUID exists, and the image file corresponding to the calculated mirror UUID in the magnetic array is copied to the cloud hard disk; Create a virtual machine based on the image file in the cloud drive.
  • the server copies the image file corresponding to the calculated mirror UUID in the magnetic array to the cloud hard disk, and does not need to copy the image file from the server to the cloud hard disk, thereby shortening the creation time.
  • FIG. 1 is a flowchart of a method for creating a virtual machine according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of an apparatus for creating a virtual machine according to an embodiment of the present invention.
  • an embodiment of the present invention provides a method for creating a virtual machine, where a server pre-generates an image file of each operating system.
  • the method also includes:
  • Step 100 When the server receives the virtual machine creation request from the user, the server creates a cloud hard disk on the magnetic array.
  • the validity of the parameters in the virtual machine creation request may be determined. How to determine the well-known technologies of the present invention is not limited to the scope of protection of the present invention. .
  • the virtual machine creation request includes a virtual machine identifier and the like.
  • Step 101 The server calculates the mirror UUID according to the virtual machine creation request, determines that the mirror file corresponding to the calculated mirror UUID exists on the magnetic array, and copies the image file corresponding to the calculated mirror UUID in the magnetic array to the cloud hard disk.
  • the calculated mirror UUID is found in the first correspondence between the mirror UUID and the mirror source identifier (ID, Identifier). Corresponding mirror source volume ID.
  • the server may use an algorithm such as the message digest algorithm 5 (MD5) to calculate the mirror UUID.
  • MD5 message digest algorithm 5
  • the specific implementation of the technology is not limited to the scope of protection of the present invention. Let me repeat.
  • the server may copy the image file corresponding to the mirror source volume ID found in the magnetic array to the cloud hard disk by sending an instruction to the magnetic array.
  • the command includes a mirror source volume ID and a cloud disk identifier.
  • the image file corresponding to the mirrored UUID calculated in the magnetic array is in the Qcow2 format, and the image file needs to be converted into the Raw format before being copied to the cloud hard disk.
  • the well-known technology is not intended to limit the scope of the present invention, and is not described herein again.
  • the mirror source volume ID may be a location where the image file is stored in the magnetic array.
  • the cloud disk identifier may be the location of the cloud disk in the magnetic array.
  • Step 102 The server creates a virtual machine according to the image file in the cloud hard disk.
  • the server determines that the image file corresponding to the calculated mirror UUID does not exist on the disk array, the server further includes:
  • the server divides the disk space on the magnetic array; the server copies the image file corresponding to the calculated mirror UUID to the disk space from the image files of the pre-generated operating systems; the server copies the image file in the disk space to the cloud disk. .
  • the server determines that there is no mirror image corresponding to the calculated mirror UUID on the magnetic array.
  • the device includes: in the first correspondence between the mirror UUID and the mirror source volume identifier ID, the mirror source volume ID corresponding to the calculated mirror UUID is not found;
  • the method further includes: recording a first correspondence between the calculated mirror UUID and the mirror source volume ID corresponding to the disk space.
  • the server copies the image file corresponding to the mirror source volume ID found in the magnetic array to the cloud hard disk, and does not need to copy the image file from the server to the cloud hard disk, thereby shortening the creation time.
  • the method further includes:
  • the server records a second correspondence between the virtual machine ID and the mirror source volume ID in the virtual machine creation request.
  • the method further includes: when the server deletes the virtual machine, the method further includes:
  • the server searches for the virtual machine identifier corresponding to the mirror source volume ID corresponding to the deleted virtual machine in the second correspondence, and deletes the second correspondence between the found virtual machine identifier and the mirror source volume ID corresponding to the deleted virtual machine. relationship.
  • the method further includes: when the server determines that only one virtual machine identifier is found and is a deleted virtual machine identifier, the method further includes:
  • the server deletes the mirror source file corresponding to the mirrored source volume corresponding to the deleted virtual machine in the magnetic array.
  • the server may delete the mirror source volume ID corresponding to the virtual machine deleted in the magnetic array by using an instruction to send the data to the magnetic array.
  • the instruction includes the mirror source volume ID corresponding to the deleted virtual machine.
  • an embodiment of the present invention further provides an apparatus for creating a virtual machine, including at least:
  • the first creating module 201 is configured to: when receiving the virtual machine creation request, create a cloud hard disk on the magnetic array;
  • the virtual machine creation request may be from a user or may be self-designed by the system.
  • the calculating module 202 is configured to: calculate a mirrored universal unique identifier UUID according to the virtual machine creation request;
  • the copying module 203 is configured to: determine that an image file corresponding to the mirrored UUID exists on the magnetic array, and copy the image file corresponding to the mirrored UUID in the magnetic array to the cloud hard disk;
  • the second creating module 204 is configured to: create a virtual machine according to the image file in the cloud hard disk.
  • the copy module 203 is further configured to:
  • the first creation module 201 is further configured to:
  • the copying module 203 is configured to determine that the image file corresponding to the mirror UUID does not exist on the magnetic array as follows:
  • the mirror source volume ID corresponding to the mirror UUID is not found in the first correspondence between the mirror UUID and the mirror source volume identifier.
  • the copy module 203 is further configured to: record a first correspondence between the mirror UUID and the mirror source volume ID corresponding to the disk space.
  • the copying module 203 is configured to determine, according to the following manner, that an image file corresponding to the mirrored UUID exists on the magnetic array:
  • the mirror source volume ID corresponding to the mirror UUID is found.
  • the copy module 203 is further configured to:
  • the copy module 203 is further configured to:
  • the copy module 203 is further configured to:
  • the embodiment of the invention also discloses a computer program, comprising program instructions, when the program instruction is executed by a computer, so that the computer can execute any of the above methods for creating a virtual machine.
  • the embodiment of the invention also discloses a carrier carrying the computer program.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve. Thus, the invention is not limited to any specific combination of hardware and software.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • each device/function module/functional unit in the above embodiment When each device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the technical solution of the present invention includes: when the server receives the virtual machine creation request from the user, the server creates a cloud hard disk on the magnetic array; the server calculates the mirrored UUID according to the virtual machine creation request, and determines the magnetic array. An image file corresponding to the calculated mirror UUID is generated, and the image file corresponding to the calculated mirror UUID in the magnetic array is copied to the cloud hard disk; the server creates a virtual machine according to the image file in the cloud hard disk.
  • the server copies the image file corresponding to the calculated mirror UUID in the magnetic array to the cloud hard disk, and does not need to copy the image file from the server to the cloud hard disk, thereby shortening the creation time. Therefore, the present invention has strong industrial applicability.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Processing Or Creating Images (AREA)

Abstract

一种创建虚拟机的方法和装置,该方法包括:当服务器接收到来自用户的虚拟机创建请求时,服务器在磁阵上创建云硬盘;服务器根据虚拟机创建请求计算镜像通用唯一识别码(UUID),判断出磁阵上存在计算得到的镜像UUID对应的镜像文件,将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘;服务器根据云硬盘中的镜像文件创建虚拟机。通过本发明的方案,服务器将磁阵中计算得到的镜像UUID对应的镜像文件拷贝到云硬盘,而不需要从服务器中将镜像文件拷贝到云硬盘中,从而缩短了创建时间。

Description

一种创建虚拟机的方法和装置 技术领域
本文涉及创建虚拟机的技术领域,尤指一种创建虚拟机的方法和装置。
背景技术
随着软件定义网络(SDN,Software Defined Network)和网络功能虚拟化(NFV,Network Function Virtualization)架构和相关技术的发展和推动,服务功能链(SFC,Service Function Chaining)将成为虚拟化数据中心提供服务的理想方案,数据中心虚拟化是先数据中心面向服务的基本趋势,虚拟化数据中心具备同样服务器、运维灵活性、节省电力、节省时间、节省空间、高可用性等诸多优势。
基于以上趋势下提出新型融合通信的数据中心,新型融合通信(新通话、新消息)业务各模块资源主要体现形式为虚拟机(VM,Virtual Machine),一个虚拟机有虚拟计算资源如虚拟CPU(vCPU,Virtual CPU),虚拟存储资源如虚拟内存、虚拟磁盘,以及虚拟网络资源如虚拟网卡等。虚拟机可以由不同规格,虚拟机规格由资源模板描述,虚拟机规格可配置、可管理。
相关的创建虚拟机的方法大致包括:
服务器预先生成各操作***的镜像文件,当服务器接收到来自用户的虚拟机创建请求时,在磁阵上创建云硬盘,根据虚拟机创建请求计算镜像通用唯一识别码(UUID,Universally Unique Identifier),将计算得到的镜像UUID对应的镜像文件拷贝到云硬盘,根据云硬盘中的镜像文件创建虚拟机。
相关的创建虚拟机的方法中,由于每次创建过程中都要将镜像文件从服务器拷贝到磁阵上,因此,如果镜像文件比较大,则创建虚拟机的过程会耗费非常长的时间。
发明内容
为了解决上述问题,本发明提出了一种创建虚拟机的方法和装置,能够 缩短创建时间。
为了达到上述目的,采用如下技术方案:
一种创建虚拟机的方法,包括:
当服务器接收到虚拟机创建请求时,所述服务器在磁阵上创建云硬盘;
所述服务器根据所述虚拟机创建请求计算镜像通用唯一识别码UUID,判断出所述磁阵上存在所述镜像UUID对应的镜像文件,将所述磁阵中与所述镜像UUID对应的镜像文件拷贝到云硬盘;
所述服务器根据所述云硬盘中的镜像文件创建虚拟机。
可选地,当所述服务器判断出所述磁阵上不存在所述镜像UUID对应的镜像文件时,所述服务器根据所述云硬盘中的镜像文件创建虚拟机的步骤之前,该方法还包括:
所述服务器在述磁阵上划分磁盘空间;
所述服务器从预先生成的操作***的镜像文件中,将与所述镜像UUID对应的镜像文件拷贝到所述磁盘空间;
所述服务器将所述磁盘空间中的镜像文件拷贝到所述云硬盘。
可选地,所述服务器判断出所述磁阵上不存在镜像UUID对应的镜像文件的步骤包括:
所述服务器在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到所述镜像UUID对应的镜像源卷ID;
该方法还包括:所述服务器记录所述镜像UUID和所述磁盘空间对应的镜像源卷ID之间的所述第一对应关系。
可选地,所述判断出磁阵上存在镜像UUID对应的镜像文件的步骤包括:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找到所述镜像UUID对应的镜像源卷ID;
所述服务器将磁阵中镜像UUID对应的镜像文件拷贝到所述云硬盘的步骤包括:所述服务器将磁阵中查找到的镜像源卷ID对应的镜像文件拷贝到云硬盘。
可选地,该方法还包括:
所述服务器记录所述虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
可选地,该方法还包括:
当所述服务器删除所述虚拟机时,所述服务器在所述第二对应关系中查找与所述删除的虚拟机对应的镜像源卷ID对应的虚拟机标识,删除查找到的虚拟机标识和与所述删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
可选地,该方法还包括:
当所述服务器判断出查找到的虚拟机标识只有一个,且为所述删除的虚拟机标识时,所述服务器删除所述磁阵中与所述删除的虚拟机对应的镜像源卷ID对应镜像文件。
一种创建虚拟机的装置,包括第一创建模块、计算模块、拷贝模块和第二创建模块,其中
所述第一创建模块,设置成:当接收到来自用户的虚拟机创建请求时,在磁阵上创建云硬盘;
所述计算模块,设置成:根据虚拟机创建请求计算镜像通用唯一识别码UUID;
所述拷贝模块,设置成:判断出所述磁阵上存在所述镜像UUID对应的镜像文件,将所述磁阵中与所述镜像UUID对应的镜像文件拷贝到云硬盘;
所述第二创建模块,设置成:根据云硬盘中的镜像文件创建虚拟机。
可选地,所述拷贝模块还设置成:
判断出磁阵上不存在所述镜像UUID对应的镜像文件,则向所述第一创建模块发送通知消息;从预先生成的操作***的镜像文件中,将与所述镜像UUID对应的镜像文件拷贝到所述磁盘空间;将所述磁盘空间中的镜像文件拷贝到所述云硬盘;
所述第一创建模块还设置成:接收到所述通知消息,在所述磁阵上划分 磁盘空间。
可选地,所述拷贝模块设置成按照如下方式判断出所述磁阵上不存在镜像UUID对应的镜像文件:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到所述镜像UUID对应的镜像源卷ID;
所述拷贝模块还设置成:记录所述镜像UUID和所述磁盘空间对应的镜像源卷ID之间的第一对应关系。
可选地,所述拷贝模块设置成按照如下方式判断出所述磁阵上存在镜像UUID对应的镜像文件:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找到所述镜像UUID对应的镜像源卷ID。
可选地,所述拷贝模块还设置成:
记录所述虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
可选地,所述拷贝模块还设置成:
删除虚拟机时,在所述第二对应关系中查找与所述删除的虚拟机对应的镜像源卷ID对应的虚拟机标识,删除查找到的虚拟机标识和与所述删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
可选地,所述拷贝模块还设置成:
判断出查找到的虚拟机标识只有一个,且为所述删除的虚拟机标识,删除所述磁阵中与所述删除的虚拟机对应的镜像源卷ID对应镜像文件。
一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行上述任意的创建虚拟机的方法。
与相关技术相比,本发明的技术方案包括:当服务器接收到来自用户的虚拟机创建请求时,服务器在磁阵上创建云硬盘;服务器根据虚拟机创建请求计算镜像UUID,判断出磁阵上存在计算得到的镜像UUID对应的镜像文件,将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘;服务 器根据云硬盘中的镜像文件创建虚拟机。通过本发明的方案,服务器将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘,而不需要从服务器中将镜像文件拷贝到云硬盘中,从而缩短了创建时间。
附图概述
下面对本发明实施例中的附图进行说明,实施例中的附图是用于对本发明的进一步理解,与说明书一起用于解释本发明,并不构成对本发明保护范围的限制。
图1为本发明实施例创建虚拟机的方法的流程图;
图2为本发明实施例创建虚拟机的装置的结构组成示意图。
本发明的较佳实施方式
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
下面结合附图对本发明作进一步的描述,并不能用来限制本发明的保护范围。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的各种方式可以相互组合。
参见图1,本发明实施例提出了一种创建虚拟机的方法,服务器预先生成各操作***的镜像文件。
该方法还包括:
步骤100、当服务器接收到来自用户的虚拟机创建请求时,服务器在磁阵上创建云硬盘。
本步骤中,服务器创建云硬盘之前还可以先判断虚拟机创建请求中的参数的合法性,具体如何判断属于本领域技术人员的公知技术,并不用于限定本发明的保护范围,这里不再赘述。
本步骤中,虚拟机创建请求中包含有虚拟机标识等。
本步骤中,服务器如何在磁阵上创建云硬盘属于本领域技术人员的公知 技术,并不用于限定本发明的保护范围,这里不再赘述。
步骤101、服务器根据虚拟机创建请求计算镜像UUID,判断出磁阵上存在计算得到的镜像UUID对应的镜像文件,将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘。
本步骤中,判断出磁阵上存在计算得到的镜像UUID对应的镜像文件包括:在镜像UUID和镜像源卷标识(ID,Identifier)之间的第一对应关系中,查找到计算得到的镜像UUID对应的镜像源卷ID。
本步骤中,服务器可以采用信息摘要算法5(MD5,Message-Digest Algorithm 5)等算法来计算镜像UUID,具体实现属于本领域技术人员的公知技术,并不用于限定本发明的保护范围,这里不再赘述。
本步骤中,服务器可以采用向磁阵发送指令的方式将磁阵中查找到的镜像源卷ID对应的镜像文件拷贝到云硬盘。其中,指令中包含有镜像源卷ID和云硬盘标识。
本步骤中,由于磁阵中计算得到的镜像UUID对应的镜像文件为Qcow2格式,在将该镜像文件拷贝到云硬盘之前需要将该镜像文件转换成Raw格式,具体如何转换属于本领域技术人员的公知技术,并不用于限定本发明的保护范围,这里不再赘述。
其中,镜像源卷ID可以是镜像文件在磁阵中存储的位置等。
其中,云硬盘标识可以是云硬盘在磁阵中的位置等。
步骤102、服务器根据云硬盘中的镜像文件创建虚拟机。
本步骤中,服务器如何根据云硬盘中的镜像文件创建虚拟机属于本领域技术人员的公知技术,并不用于限定本发明的保护范围,这里不再赘述。
当服务器判断出磁阵上不存在计算得到的镜像UUID对应的镜像文件时,服务器根据云硬盘中的镜像文件创建虚拟机之前还包括:
服务器在磁阵上划分磁盘空间;服务器从预先生成的各操作***的镜像文件中,将与计算得到的镜像UUID对应的镜像文件拷贝到磁盘空间;服务器将磁盘空间中的镜像文件拷贝到云硬盘。
其中,服务器判断出磁阵上不存在计算得到的镜像UUID对应的镜像文 件包括:服务器在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到计算得到的镜像UUID对应的镜像源卷ID;
该方法还包括:记录计算得到的镜像UUID和磁盘空间对应的镜像源卷ID之间的第一对应关系。
其中,服务器如何到磁阵上划分磁盘空间属于本领域技术人员的公知技术,并不用于限定本发明的保护范围,这里不再赘述。
通过本发明的方案,服务器将磁阵中查找到的镜像源卷ID对应的镜像文件拷贝到云硬盘,而不需要从服务器中将镜像文件拷贝到云硬盘中,从而缩短了创建时间。
进一步地,该方法还包括:
服务器记录虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
其中,当所述服务器删除虚拟机时,该方法还包括:
服务器在第二对应关系中查找与删除的虚拟机对应的镜像源卷ID对应的虚拟机标识,删除查找到的虚拟机标识和与删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
其中,当所述服务器判断出查找到的虚拟机标识只有一个,且为删除的虚拟机标识,该方法还包括:
服务器删除磁阵中与删除的虚拟机对应的镜像源卷ID对应镜像文件。
其中,服务器可以采用向磁阵发送指令的方式将磁阵中删除的虚拟机对应的镜像源卷ID对应镜像文件删除。其中,指令中包含有删除的虚拟机对应的镜像源卷ID。
这样,将不需要的镜像文件删除,从而为磁阵节约空间。
参见图2,本发明实施例还提出了一种创建虚拟机的装置,至少包括:
第一创建模块201,设置成:当接收到虚拟机创建请求时,在磁阵上创建云硬盘;
可选地,该虚拟机创建请求可以来自用户,也可以是***自设的。
计算模块202,设置成:根据虚拟机创建请求计算镜像通用唯一识别码UUID;
拷贝模块203,设置成:判断出磁阵上存在镜像UUID对应的镜像文件,将磁阵中与镜像UUID对应的镜像文件拷贝到云硬盘;
第二创建模块204,设置成:根据云硬盘中的镜像文件创建虚拟机。
本发明实施例的装置中,所述拷贝模块203还设置成:
判断出磁阵上不存在镜像UUID对应的镜像文件,向第一创建模块发送通知消息;从预先生成的各操作***的镜像文件中,将与镜像UUID对应的镜像文件拷贝到所述磁盘空间;将所述磁盘空间中的镜像文件拷贝到所述云硬盘;
第一创建模块201还设置成:
接收到通知消息,在磁阵上划分磁盘空间。
本发明实施例的装置中,拷贝模块203设置成按照如下方式判断出磁阵上不存在镜像UUID对应的镜像文件:
在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到镜像UUID对应的镜像源卷ID;
拷贝模块203还设置成:记录镜像UUID和磁盘空间对应的镜像源卷ID之间的第一对应关系。
本发明实施例的装置中,拷贝模块203设置成按照如下方式判断出磁阵上存在镜像UUID对应的镜像文件:
在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找到镜像UUID对应的镜像源卷ID。
本发明实施例的装置中,拷贝模块203还设置成:
记录虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
本发明实施例的装置中,拷贝模块203还设置成:
删除虚拟机时,在第二对应关系中查找与删除的虚拟机对应的镜像源卷 ID对应的虚拟机标识,删除查找到的虚拟机标识和与删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
本发明实施例的装置中,拷贝模块203还设置成:
判断出查找到的虚拟机标识只有一个,且为删除的虚拟机标识,删除磁阵中与删除的虚拟机对应的镜像源卷ID对应镜像文件。
本发明实施例还公开了一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行上述任意的创建虚拟机的方法。
本发明实施例还公开了一种载有所述的计算机程序的载体。
在阅读并理解了附图和详细描述后,可以明白其他方面。
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如***、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明不限制于任何特定的硬件和软件结合。
上述实施例中的各装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。
上述实施例中的各装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。
任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以权利要求所述的保护范围为准。
工业实用性
与相关技术相比,本发明的技术方案包括:当服务器接收到来自用户的虚拟机创建请求时,服务器在磁阵上创建云硬盘;服务器根据虚拟机创建请求计算镜像UUID,判断出磁阵上存在计算得到的镜像UUID对应的镜像文件,将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘;服务器根据云硬盘中的镜像文件创建虚拟机。通过本发明的方案,服务器将磁阵中与计算得到的镜像UUID对应的镜像文件拷贝到云硬盘,而不需要从服务器中将镜像文件拷贝到云硬盘中,从而缩短了创建时间。因此本发明具有很强的工业实用性。

Claims (15)

  1. 一种创建虚拟机的方法,包括:
    当服务器接收到虚拟机创建请求时,所述服务器在磁阵上创建云硬盘;
    所述服务器根据所述虚拟机创建请求计算镜像通用唯一识别码UUID,判断出所述磁阵上存在所述镜像UUID对应的镜像文件,将所述磁阵中与所述镜像UUID对应的镜像文件拷贝到云硬盘;
    所述服务器根据所述云硬盘中的镜像文件创建虚拟机。
  2. 根据权利要求1所述的创建虚拟机的方法,其中,当所述服务器判断出所述磁阵上不存在所述镜像UUID对应的镜像文件时,所述服务器根据所述云硬盘中的镜像文件创建虚拟机的步骤之前,该方法还包括:
    所述服务器在述磁阵上划分磁盘空间;
    所述服务器从预先生成的操作***的镜像文件中,将与所述镜像UUID对应的镜像文件拷贝到所述磁盘空间;
    所述服务器将所述磁盘空间中的镜像文件拷贝到所述云硬盘。
  3. 根据权利要求2所述的创建虚拟机的方法,其中,所述服务器判断出所述磁阵上不存在镜像UUID对应的镜像文件的步骤包括:
    所述服务器在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到所述镜像UUID对应的镜像源卷ID;
    该方法还包括:所述服务器记录所述镜像UUID和所述磁盘空间对应的镜像源卷ID之间的所述第一对应关系。
  4. 根据权利要求1或2所述的创建虚拟机的方法,其中,
    所述判断出磁阵上存在镜像UUID对应的镜像文件的步骤包括:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找到所述镜像UUID对应的镜像源卷ID;
    所述服务器将磁阵中镜像UUID对应的镜像文件拷贝到所述云硬盘的步骤包括:所述服务器将磁阵中查找到的镜像源卷ID对应的镜像文件拷贝到云硬盘。
  5. 根据权利要求1或2所述的创建虚拟机的方法,该方法还包括:
    所述服务器记录所述虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
  6. 根据权利要求5所述的创建虚拟机的方法,该方法还包括:
    当所述服务器删除所述虚拟机时,所述服务器在所述第二对应关系中查找与所述删除的虚拟机对应的镜像源卷ID对应的虚拟机标识,删除查找到的虚拟机标识和与所述删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
  7. 根据权利要求6所述的创建虚拟机的方法,该方法还包括:
    当所述服务器判断出查找到的虚拟机标识只有一个,且为所述删除的虚拟机标识时,所述服务器删除所述磁阵中与所述删除的虚拟机对应的镜像源卷ID对应镜像文件。
  8. 一种创建虚拟机的装置,包括第一创建模块、计算模块、拷贝模块和第二创建模块,其中
    所述第一创建模块设置成:当接收到来自用户的虚拟机创建请求时,在磁阵上创建云硬盘;
    所述计算模块设置成:根据虚拟机创建请求计算镜像通用唯一识别码UUID;
    所述拷贝模块设置成:判断出所述磁阵上存在所述镜像UUID对应的镜像文件,将所述磁阵中与所述镜像UUID对应的镜像文件拷贝到云硬盘;
    所述第二创建模块设置成:根据云硬盘中的镜像文件创建虚拟机。
  9. 根据权利要求8所述的创建虚拟机的装置,其中,所述拷贝模块还设置成:
    判断出磁阵上不存在所述镜像UUID对应的镜像文件,则向所述第一创建模块发送通知消息;从预先生成的操作***的镜像文件中,将与所述镜像UUID对应的镜像文件拷贝到所述磁盘空间;将所述磁盘空间中的镜像文件拷贝到所述云硬盘;
    所述第一创建模块还设置成:接收到所述通知消息,在所述磁阵上划分 磁盘空间。
  10. 根据权利要求9所述的创建虚拟机的装置,其中
    所述拷贝模块设置成按照如下方式判断出所述磁阵上不存在镜像UUID对应的镜像文件:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找不到所述镜像UUID对应的镜像源卷ID;
    所述拷贝模块还设置成:记录所述镜像UUID和所述磁盘空间对应的镜像源卷ID之间的第一对应关系。
  11. 根据权利要求8或9所述的创建虚拟机的装置,其中
    所述拷贝模块设置成按照如下方式判断出所述磁阵上存在镜像UUID对应的镜像文件:在镜像UUID和镜像源卷标识ID之间的第一对应关系中,查找到所述镜像UUID对应的镜像源卷ID。
  12. 根据权利要求8或9所述的创建虚拟机的装置,其中,所述拷贝模块还设置成:
    记录所述虚拟机创建请求中的虚拟机标识和镜像源卷ID之间的第二对应关系。
  13. 根据权利要求12所述的创建虚拟机的装置,其中,所述拷贝模块还设置成:
    删除虚拟机时,在所述第二对应关系中查找与所述删除的虚拟机对应的镜像源卷ID对应的虚拟机标识,删除查找到的虚拟机标识和与所述删除的虚拟机对应的镜像源卷ID之间的第二对应关系。
  14. 根据权利要求13所述的创建虚拟机的装置,其中,所述拷贝模块还设置成:
    判断出查找到的虚拟机标识只有一个,且为所述删除的虚拟机标识,删除所述磁阵中与所述删除的虚拟机对应的镜像源卷ID对应镜像文件。
  15. 一种计算机程序,包括程序指令,当该程序指令被计算机执行时,使得该计算机可执行如权利要求1-7中任一项所述的创建虚拟机的方法。
PCT/CN2016/074019 2015-07-13 2016-02-18 一种创建虚拟机的方法和装置 WO2016165472A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510409675.6A CN106339177A (zh) 2015-07-13 2015-07-13 一种创建虚拟机的方法和装置
CN201510409675.6 2015-07-13

Publications (1)

Publication Number Publication Date
WO2016165472A1 true WO2016165472A1 (zh) 2016-10-20

Family

ID=57126070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/074019 WO2016165472A1 (zh) 2015-07-13 2016-02-18 一种创建虚拟机的方法和装置

Country Status (2)

Country Link
CN (1) CN106339177A (zh)
WO (1) WO2016165472A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874214A (zh) * 2017-02-15 2017-06-20 腾讯科技(深圳)有限公司 云硬盘资源的回收方法及相关装置
CN110795029A (zh) * 2019-10-08 2020-02-14 济南浪潮数据技术有限公司 一种云硬盘管理方法、装置、服务器及介质
CN110968399A (zh) * 2019-12-18 2020-04-07 腾讯科技(深圳)有限公司 一种虚拟机重装方法、装置和计算机可读存储介质
CN112181387A (zh) * 2020-09-09 2021-01-05 上海微亿智造科技有限公司 一种web多人协同开发过程中模块管理方法
CN112433811A (zh) * 2020-11-19 2021-03-02 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、***及可读存储介质
CN113626137A (zh) * 2021-06-30 2021-11-09 济南浪潮数据技术有限公司 一种支持多格式镜像的实现方法、装置、设备和介质
CN113645057A (zh) * 2021-06-25 2021-11-12 济南浪潮数据技术有限公司 一种云平台支持添加网卡模型的方法、装置
CN114237830A (zh) * 2022-02-24 2022-03-25 南京赛宁信息技术有限公司 靶场中虚拟机快速启动的调度与物理机扩容方法及***
CN114756290A (zh) * 2022-04-30 2022-07-15 苏州浪潮智能科技有限公司 一种操作***安装方法、设备及可读存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108196943B (zh) * 2018-02-06 2019-10-08 北京百度网讯科技有限公司 虚拟机管理方法和装置
CN109033430A (zh) * 2018-08-13 2018-12-18 郑州云海信息技术有限公司 一种虚拟机镜像文件存储方法及装置
CN112181278B (zh) * 2019-07-04 2023-04-07 中移(苏州)软件技术有限公司 在云计算***中创建***盘的方法、装置、设备及存储介质
CN110489209B (zh) * 2019-07-24 2023-03-24 联想(北京)有限公司 一种信息处理方法及设备
CN110737506A (zh) * 2019-09-10 2020-01-31 江苏中云科技有限公司 一种虚拟机镜像版本管理的方法
CN111767114B (zh) * 2019-12-10 2024-04-05 北京京东尚科信息技术有限公司 创建云主机的方法和装置、计算机***和可读存储介质

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103607429A (zh) * 2013-10-30 2014-02-26 中兴通讯股份有限公司 云计算业务实现方法和***
CN104468734A (zh) * 2014-11-18 2015-03-25 国云科技股份有限公司 一种基于克隆的虚拟集群扩展方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103067425B (zh) * 2011-10-20 2016-04-27 ***通信集团公司 虚拟机创建方法、虚拟机管理***及相关设备
CN103514222B (zh) * 2012-06-29 2017-09-19 无锡江南计算技术研究所 虚拟机映像的存储方法、管理方法、存储管理装置及***

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103607429A (zh) * 2013-10-30 2014-02-26 中兴通讯股份有限公司 云计算业务实现方法和***
CN104468734A (zh) * 2014-11-18 2015-03-25 国云科技股份有限公司 一种基于克隆的虚拟集群扩展方法

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874214A (zh) * 2017-02-15 2017-06-20 腾讯科技(深圳)有限公司 云硬盘资源的回收方法及相关装置
CN110795029B (zh) * 2019-10-08 2022-06-17 济南浪潮数据技术有限公司 一种云硬盘管理方法、装置、服务器及介质
CN110795029A (zh) * 2019-10-08 2020-02-14 济南浪潮数据技术有限公司 一种云硬盘管理方法、装置、服务器及介质
CN110968399A (zh) * 2019-12-18 2020-04-07 腾讯科技(深圳)有限公司 一种虚拟机重装方法、装置和计算机可读存储介质
CN110968399B (zh) * 2019-12-18 2023-09-22 腾讯科技(深圳)有限公司 一种虚拟机重装方法、装置和计算机可读存储介质
CN112181387A (zh) * 2020-09-09 2021-01-05 上海微亿智造科技有限公司 一种web多人协同开发过程中模块管理方法
CN112433811A (zh) * 2020-11-19 2021-03-02 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、***及可读存储介质
CN112433811B (zh) * 2020-11-19 2023-12-22 北京浪潮数据技术有限公司 虚拟硬盘更换方法、装置、设备、***及可读存储介质
CN113645057A (zh) * 2021-06-25 2021-11-12 济南浪潮数据技术有限公司 一种云平台支持添加网卡模型的方法、装置
CN113626137A (zh) * 2021-06-30 2021-11-09 济南浪潮数据技术有限公司 一种支持多格式镜像的实现方法、装置、设备和介质
CN113626137B (zh) * 2021-06-30 2023-12-29 济南浪潮数据技术有限公司 一种支持多格式镜像的实现方法、装置、设备和介质
CN114237830A (zh) * 2022-02-24 2022-03-25 南京赛宁信息技术有限公司 靶场中虚拟机快速启动的调度与物理机扩容方法及***
CN114756290A (zh) * 2022-04-30 2022-07-15 苏州浪潮智能科技有限公司 一种操作***安装方法、设备及可读存储介质
CN114756290B (zh) * 2022-04-30 2023-08-25 苏州浪潮智能科技有限公司 一种操作***安装方法、设备及可读存储介质

Also Published As

Publication number Publication date
CN106339177A (zh) 2017-01-18

Similar Documents

Publication Publication Date Title
WO2016165472A1 (zh) 一种创建虚拟机的方法和装置
US11119678B2 (en) Transactional operations in multi-master distributed data management systems
US10999234B1 (en) Message processing using messaging services
US11347855B2 (en) Data lineage management
WO2017129106A1 (zh) 数据请求处理的方法、服务器及***
US10324754B2 (en) Managing virtual machine patterns
US9983863B2 (en) Method to optimize provisioning time with dynamically generated virtual disk contents
WO2014200541A1 (en) App package deployment
JP2008033483A (ja) 計算機システム、計算機および計算機動作環境の移動方法
WO2019085780A1 (zh) 一种云存储***及用于云存储***中实现自定义数据处理的方法
US20230115261A1 (en) Migrating stateful workloads between container clusters with different storage backends
US9569138B2 (en) Copying virtual machine flat tires from a source to target computing device based on matching disk layout
US11080079B2 (en) Autonomously reproducing and destructing virtual machines
US10417254B2 (en) Intelligent content synchronization between content libraries
US10015248B1 (en) Syncronizing changes to stored data among multiple client devices
US20180341717A1 (en) Providing instant preview of cloud based file
US11194758B1 (en) Data archiving using a compute efficient format in a service provider environment
US20200371849A1 (en) Systems and methods for efficient management of advanced functions in software defined storage systems
WO2024148855A1 (zh) 一种代码管理方法及相关***
US11709845B2 (en) Federation of data during query time in computing systems
CN112286626B (zh) 跨存储的磁盘快速安全克隆的方法、***、设备和介质
US9229641B2 (en) Identifying redundant data for disk image streaming
US11861421B1 (en) Controlling timing of event data transmissions in an event architecture
US11836545B1 (en) Integration of cloud entities in an event architecture
US11941385B1 (en) Transforming data between cloud entities in an event architecture

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: 16779447

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: 16779447

Country of ref document: EP

Kind code of ref document: A1