CN115268950A - Mirror image file importing method and device - Google Patents
Mirror image file importing method and device Download PDFInfo
- Publication number
- CN115268950A CN115268950A CN202210867984.8A CN202210867984A CN115268950A CN 115268950 A CN115268950 A CN 115268950A CN 202210867984 A CN202210867984 A CN 202210867984A CN 115268950 A CN115268950 A CN 115268950A
- Authority
- CN
- China
- Prior art keywords
- image file
- format
- resource pool
- storage resource
- cloud platform
- 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 45
- 230000008676 import Effects 0.000 claims abstract description 52
- 230000015654 memory Effects 0.000 claims description 28
- 238000007726 management method Methods 0.000 description 16
- 238000013461 design Methods 0.000 description 13
- 238000004590 computer program Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 239000004020 conductor Substances 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/60—Software deployment
- G06F8/61—Installation
- G06F8/63—Image based installation; Cloning; Build to order
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45583—Memory management, e.g. access or allocation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45595—Network integration; Enabling network access in virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5011—Pool
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请公开了一种镜像文件导入方法及装置,该方法包括:获取镜像文件和镜像文件的格式信息;将镜像文件存储至云平台的对象存储资源池;根据镜像文件的格式信息,确定镜像文件的格式属于允许导入块存储资源池的镜像文件格式;将镜像文件从对象存储资源池导入云平台的块存储资源池。该方法能够支持用户导入多种格式的镜像文件,提高获取镜像文件的灵活性。
The present application discloses a method and device for importing an image file. The method includes: acquiring an image file and format information of the image file; storing the image file in an object storage resource pool of a cloud platform; and determining the image file according to the format information of the image file The format belongs to the image file format that allows the import of block storage resource pools; the image file is imported from the object storage resource pool to the block storage resource pool of the cloud platform. The method can support users to import image files in various formats, and improve the flexibility of obtaining image files.
Description
技术领域technical field
本申请实施例涉及云平台领域,尤其涉及一种镜像文件导入方法及装置。The embodiments of the present application relate to the field of cloud platforms, and in particular to a method and device for importing an image file.
背景技术Background technique
镜像管理服务包含管理开通虚机所用的镜像模板,具体包括公有镜像和私有镜像。当用户需要从其他云平台导入并使用镜像文件时,现有的镜像管理服务不能支持用户从其他云平台导入镜像文件至用户所使用的云平台。The image management service includes image templates for managing and activating virtual machines, including public images and private images. When users need to import and use image files from other cloud platforms, the existing image management service cannot support users to import image files from other cloud platforms to the cloud platform used by users.
因此只能由用户在云平台生成镜像文件,而不能向云平台导入镜像文件,存在镜像文件获取方式单一的问题。Therefore, the image file can only be generated by the user on the cloud platform, but cannot be imported to the cloud platform, and there is a problem that the image file is acquired in a single way.
发明内容Contents of the invention
本申请实施例提供一种镜像文件导入方法及装置,所述导入方法可减少镜像管理组件所在的物理机存储所需空间资源,提高获取镜像文件的灵活性。Embodiments of the present application provide a method and device for importing an image file. The import method can reduce space resources required for storage of a physical machine where the image management component is located, and improve flexibility in obtaining the image file.
第一方面,本申请实施例提供的一种镜像文件导入方法,包括:In the first aspect, a method for importing an image file provided in an embodiment of the present application includes:
获取镜像文件和所述镜像文件的格式信息;将所述镜像文件存储至云平台的对象存储资源池;根据所述镜像文件的格式信息,确定所述镜像文件的格式属于允许导入块存储资源池的镜像文件格式;将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池,所述镜像文件用于在所述云平台的块存储资源池中开通虚拟机。Obtaining the image file and the format information of the image file; storing the image file to the object storage resource pool of the cloud platform; according to the format information of the image file, determining that the format of the image file belongs to the block storage resource pool that allows import The image file format; the image file is imported from the object storage resource pool into the block storage resource pool of the cloud platform, and the image file is used to enable a virtual machine in the block storage resource pool of the cloud platform.
根据该方法,可支持用户根据云平台的镜像管理服务导入多种格式的镜像文件。该方法解决了现有的镜像管理服务不能支持用户从其他云平台导入镜像文件的问题,提高获取镜像文件的灵活性。According to the method, the user can be supported to import image files in various formats according to the image management service of the cloud platform. The method solves the problem that the existing image management service cannot support users to import image files from other cloud platforms, and improves the flexibility of obtaining image files.
在一种可能的设计中,镜像文件在kvm云平台、vmware云平台或hyperv云平台生成。所述允许导入块存储资源池的镜像文件格式为raw格式、qcow2格式、vhd格式或vhdx格式。In a possible design, the image file is generated on the kvm cloud platform, vmware cloud platform or hyperv cloud platform. The format of the image file allowed to be imported into the block storage resource pool is raw format, qcow2 format, vhd format or vhdx format.
根据该设计,可以支持从多种云平台获取多种格式的镜像文件,进一步提高获取镜像文件的灵活性。According to the design, it can support obtaining image files in various formats from various cloud platforms, further improving the flexibility of obtaining image files.
在一种可能的设计中,所述方法还包括:在将所述镜像文件存储至云平台的对象存储资源池后,获得所述镜像文件对应的存储地址;所述将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池,包括:根据所述存储地址,将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池。In a possible design, the method further includes: after storing the image file in the object storage resource pool of the cloud platform, obtaining a storage address corresponding to the image file; Importing the object storage resource pool into the block storage resource pool of the cloud platform includes: importing the image file from the object storage resource pool into the block storage resource pool of the cloud platform according to the storage address.
根据该设计,可以根据存储地址从所述对象存储资源池中准确获得所述镜像文件,提高镜像文件导入效率。According to this design, the image file can be accurately obtained from the object storage resource pool according to the storage address, thereby improving the import efficiency of the image file.
在一种可能的设计中,所述镜像文件的格式信息用于指示所述镜像文件的格式为第一格式,所述第一格式与第二格式不同,所述第二格式为所述云平台支持的镜像文件的格式,所述方法还包括:将所述镜像文件的格式修改为所述第二格式;其中,所述第一格式与所述第二格式属于所述允许导入块存储资源池的镜像文件格式。In a possible design, the format information of the image file is used to indicate that the format of the image file is a first format, the first format is different from the second format, and the second format is the cloud platform The format of the supported image file, the method further includes: modifying the format of the image file to the second format; wherein, the first format and the second format belong to the allowed import block storage resource pool image file format.
根据该设计,可以进一步支持云平台获取多种格式的镜像文件,进一步提高获取镜像文件的灵活性。According to this design, it can further support the cloud platform to obtain image files in multiple formats, and further improve the flexibility of obtaining image files.
第二方面,本申请实施例提供的一种镜像文件导入装置,包括:In a second aspect, an image file importing device provided in an embodiment of the present application includes:
存储模块,用于获取镜像文件和所述镜像文件的格式信息;A storage module, configured to acquire the image file and the format information of the image file;
所述存储模块,还用于将所述镜像文件存储至云平台的对象存储资源池;The storage module is also used to store the image file in the object storage resource pool of the cloud platform;
确定模块,用于根据所述镜像文件的格式信息,确定所述镜像文件的格式属于允许导入块存储资源池的镜像文件格式;A determining module, configured to determine, according to the format information of the image file, that the format of the image file belongs to an image file format that allows importing into a block storage resource pool;
导入模块,用于将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池。An import module, configured to import the image file from the object storage resource pool into the block storage resource pool of the cloud platform.
在一种可能的设计中,所述镜像文件在kvm云平台、vmware云平台或hyperv云平台生成;所述允许导入块存储资源池的镜像文件格式为raw格式、qcow2格式、vhd格式或vhdx格式。In a possible design, the image file is generated on the kvm cloud platform, vmware cloud platform or hyperv cloud platform; the format of the image file allowed to import block storage resource pool is raw format, qcow2 format, vhd format or vhdx format .
在一种可能的设计中,所述存储模块还用于:In a possible design, the storage module is also used for:
在将所述镜像文件存储至云平台的对象存储资源池后,获得所述镜像文件对应的存储地址;所述导入模块具体用于:根据所述存储地址,将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池。After the image file is stored in the object storage resource pool of the cloud platform, the storage address corresponding to the image file is obtained; the import module is specifically used to: according to the storage address, transfer the image file from the object The storage resource pool is imported into the block storage resource pool of the cloud platform.
在一种可能的设计中,所述镜像文件的格式信息用于指示所述镜像文件的格式为第一格式,所述第一格式与第二格式不同,所述第二格式为所述云平台支持的镜像文件的格式,所述导入模块还用于:将所述镜像文件的格式修改为所述第二格式;其中,所述第一格式与所述第二格式属于所述允许导入块存储资源池的镜像文件格式。In a possible design, the format information of the image file is used to indicate that the format of the image file is a first format, the first format is different from the second format, and the second format is the cloud platform The format of the image file supported, the import module is also used to: modify the format of the image file to the second format; wherein, the first format and the second format belong to the allowed import block storage The image file format of the resource pool.
第三方面,本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序,所述计算机程序被处理器执行时,实现第一方面及其任意一种设计的方法。In the third aspect, the embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the first aspect and any one thereof can be realized. a design method.
第四方面,本申请实施例还提供了一种电子设备,包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,当所述计算机程序被所述处理器执行时,使得所述处理器实现第一方面及其任意一种设计的方法。In the fourth aspect, the embodiment of the present application also provides an electronic device, including a memory and a processor, the memory stores a computer program that can run on the processor, when the computer program is executed by the processor When executed, the processor is made to implement the method of the first aspect and any one of the designs thereof.
第二方面至第四方面及其任意一种设计所带来的技术效果可参见第一方面中对应的设计所带来的技术效果,此处不再赘述。For the technical effects brought by the second aspect to the fourth aspect and any one of the designs thereof, please refer to the technical effects brought about by the corresponding designs in the first aspect, which will not be repeated here.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without making creative efforts.
图1为本申请实施例提供的一种镜像文件导入方法的流程示意图;Fig. 1 is a schematic flow diagram of a method for importing an image file provided in the embodiment of the present application;
图2为本申请实施例提供的一种镜像文件导入方法的总导入任务流示意图;FIG. 2 is a schematic diagram of a total import task flow of a method for importing an image file provided in an embodiment of the present application;
图3为本申请实施例提供的一种镜像文件导入方法的导入子任务流示意图;FIG. 3 is a schematic diagram of an import subtask flow of an image file import method provided in an embodiment of the present application;
图4为本申请实施例提供的一种装置结构示意图;FIG. 4 is a schematic structural diagram of a device provided in an embodiment of the present application;
图5为本申请实施例提供的另一种装置结构示意图。FIG. 5 is a schematic structural diagram of another device provided by the embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作可选的详细描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。应理解,下面所介绍的方法实施例中的具体操作方法也可以应用于装置实施例或系统实施例中。In order to make the purpose, technical solutions and advantages of the application clearer, the application will be described in detail below in conjunction with the accompanying drawings. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application. It should be understood that the specific operation methods in the method embodiments described below may also be applied in the device embodiments or system embodiments.
现有的镜像管理服务包含管理开通虚机所用的镜像文件,具体包括公有镜像文件和私有镜像文件。其中,公有镜像文件是指在当前云平台中生成的镜像文件。例如,公有镜像可为一种操作系统模板。公有镜像可面向不特定的用户使用,其可用于根据所述用户需求开通虚机。相应的,私有镜像文件是指在当前云平台以外的其他平台中生成的镜像文件。当用户需要将私有镜像文件导入至云平台,并根据该私有镜像文件开通虚机时,现有的镜像管理服务不能支持用户从其他云平台导入镜像文件,只能由用户在当前云平台重新创建镜像文件。例如,私有镜像可包括从其他云平台导入的私有镜像和/或根据公共镜像生成的私有镜像。私有镜像可面向部分用户或单个用户使用。The existing image management service includes the image files used to manage and activate virtual machines, including public image files and private image files. Wherein, the public image file refers to the image file generated in the current cloud platform. For example, a public image can be a type of operating system template. The public image can be used by unspecific users, and it can be used to provision virtual machines according to the user's needs. Correspondingly, a private image file refers to an image file generated on a platform other than the current cloud platform. When a user needs to import a private image file to the cloud platform and activate a virtual machine based on the private image file, the existing image management service cannot support the user to import image files from other cloud platforms, and can only be recreated by the user on the current cloud platform mirror file. For example, private images may include private images imported from other cloud platforms and/or private images generated based on public images. Private images can be used by some users or a single user.
以下除特殊说明,本申请中的镜像文件是指私有镜像文件。Unless otherwise specified below, the image files in this application refer to private image files.
为了解决上述问题,在本申请提供了一种镜像文件导入方法,用于满足用户进行云平台镜像文件导入的需求,提高获取镜像文件的灵活性。In order to solve the above problems, the present application provides a method for importing image files, which is used to meet the needs of users for importing image files on cloud platforms and improve the flexibility of obtaining image files.
在本申请实施例中,获取镜像文件和所述镜像文件的格式信息。将所述镜像文件存储至云平台的对象存储资源池。根据所述镜像文件的格式信息,确定所述镜像文件的格式属于允许导入块存储资源池的镜像文件格式。将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池,所述镜像文件可用于在所述云平台的块存储资源池中开通虚拟机。该方法能够满足用户进行云平台镜像文件导入的需求,提高获取镜像文件的灵活性。In the embodiment of the present application, the image file and the format information of the image file are obtained. The image file is stored in the object storage resource pool of the cloud platform. According to the format information of the image file, it is determined that the format of the image file belongs to an image file format that allows importing into the block storage resource pool. The image file is imported from the object storage resource pool to the block storage resource pool of the cloud platform, and the image file can be used to provision a virtual machine in the block storage resource pool of the cloud platform. The method can meet the user's requirement for importing the image file of the cloud platform, and improves the flexibility of obtaining the image file.
可以理解,本申请提供的一种镜像文件导入方法可由镜像文件导入装置(以下简称为导入装置)执行。例如,该装置可以是用户接入云平台所使用的设备或设备中的组件,或者,可以是能够与该设备进行通信的设备(如云平台服务器)或设备中的组件。例如,该装置可以是服务器、处理器、芯片或智能终端等具备数据分析和处理能力的装置。It can be understood that a method for importing an image file provided in the present application may be executed by an image file importing device (hereinafter referred to as the importing device for short). For example, the apparatus may be a device or a component in the device used by the user to access the cloud platform, or may be a device capable of communicating with the device (such as a cloud platform server) or a component in the device. For example, the device may be a server, a processor, a chip, or an intelligent terminal and other devices capable of data analysis and processing.
如图1所示,在本申请实施例中提供的导入方法具体步骤包括:As shown in Figure 1, the specific steps of the import method provided in the embodiment of this application include:
步骤101,获取镜像文件和所述镜像文件的格式信息。Step 101, acquire an image file and format information of the image file.
可选的,步骤101包括:用户可通过云平台的前端操作系统,向导入装置导入镜像文件。相应的,导入装置可通过前端操作系统获得镜像文件。从生成镜像文件的云平台或存储镜像文件的存储设备获取镜像文件,并根据镜像文件提取其格式信息。Optionally, step 101 includes: the user can import the image file to the importing device through the front-end operating system of the cloud platform. Correspondingly, the importing device can obtain the image file through the front-end operating system. Obtain the image file from the cloud platform that generates the image file or the storage device that stores the image file, and extract its format information according to the image file.
示例性的,前端操作系统可包括yacos系统。因此,用户可操作yacos系统,选中需要导入的镜像文件,相应的,yacos系统可提取该镜像文件的格式信息。Exemplarily, the front-end operating system may include the yacos system. Therefore, the user can operate the yacos system to select the image file to be imported, and correspondingly, the yacos system can extract the format information of the image file.
示例性的,生成镜像文件的云平台可包括kvm平台、vmware平台或hyperv平台等。其中,kvm平台是一种支持全虚拟化的云平台,vmware平台是一种提供服务器和/或桌面虚拟化的云平台,hyperv平台是一种提供硬件虚拟化的云平台等。例如,导入装置从kvm平台中获取在kvm云平台生成的镜像文件。具体的,所述云平台中包括:一种用于获取镜像文件和所述镜像文件的格式信息的所述前端操作系统。Exemplarily, the cloud platform for generating the image file may include a kvm platform, a vmware platform, or a hyperv platform. Among them, the kvm platform is a cloud platform that supports full virtualization, the vmware platform is a cloud platform that provides server and/or desktop virtualization, and the hyperv platform is a cloud platform that provides hardware virtualization. For example, the importing device obtains the image file generated on the kvm cloud platform from the kvm platform. Specifically, the cloud platform includes: a front-end operating system for acquiring image files and format information of the image files.
存储镜像文件的存储设备具体可以是硬盘等存储介质,也可以是包含存储介质的设备,如用户接入云平台所使用的设备,不具体限定。The storage device storing the image file may specifically be a storage medium such as a hard disk, or may be a device including a storage medium, such as a device used by a user to access the cloud platform, without specific limitation.
示例性的,所述镜像文件的格式信息可包括raw镜像文件格式、qcow2镜像文件格式、vhd镜像文件格式、vhdx镜像文件格式或vmdk镜像文件格式。其中,raw镜像文件格式是一种图像镜像文件格式,qcow2镜像文件格式是一种磁盘镜像文件格式,vhd镜像文件格式是一种磁盘镜像文件格式,vhdx镜像文件格式是一种磁盘镜像文件格式,vmdk镜像文件格式是一种磁盘镜像文件格式。Exemplarily, the format information of the image file may include raw image file format, qcow2 image file format, vhd image file format, vhdx image file format or vmdk image file format. Wherein, the raw image file format is an image image file format, the qcow2 image file format is a disk image file format, the vhd image file format is a disk image file format, and the vhdx image file format is a disk image file format, The vmdk image file format is a disk image file format.
可以理解,本申请中不限制镜像文件的获取来源。It can be understood that the source of the image file is not limited in this application.
步骤102,将所述镜像文件存储至云平台的对象存储资源池。Step 102, storing the image file in the object storage resource pool of the cloud platform.
所述对象存储资源池可以是云平台资源池中的一种用于存储文件的存储资源池。对象存储资源池仅具有存储文件的功能,不具有处理文件的功能。对象存储资源池中的存储文件的功能包括:存储所述存储文件至任一所述对象存储资源池中的存储桶,根据所述存储提供所述存储文件对应所述存储桶中的存储地址。The object storage resource pool may be a storage resource pool used to store files in the cloud platform resource pool. The object storage resource pool only has the function of storing files, but not the function of processing files. The function of storing files in the object storage resource pool includes: storing the storage file in any storage bucket in the object storage resource pool, and providing the storage address corresponding to the storage file in the storage bucket according to the storage.
此外,与对象存储资源池相区别,云平台资源池还可包括块存储资源池。可以理解,对象存储资源池与块存储资源池是云平台资源池中不同的存储区域。块资源存储池可以是可提供存储功能,并可以划分存储区域给虚拟机单独使用。其中,用户导入到云平台的文件一般存储在对象存储资源池中。而镜像文件一般需要存储到块存储资源池中,并在块存储资源池中实现虚拟机。例如,块存储资源池可用来创建云硬盘(包括系统盘和数据盘),所述云硬盘可用来开通虚机资源和/或挂载至某台虚机上使用。In addition, different from the object storage resource pool, the cloud platform resource pool may also include a block storage resource pool. It can be understood that the object storage resource pool and the block storage resource pool are different storage areas in the cloud platform resource pool. The block resource storage pool can provide storage functions, and can divide storage areas for virtual machines to use independently. Wherein, the files imported by the user to the cloud platform are generally stored in the object storage resource pool. The image file generally needs to be stored in the block storage resource pool, and the virtual machine is realized in the block storage resource pool. For example, block storage resource pools can be used to create cloud hard disks (including system disks and data disks), and the cloud hard disks can be used to activate virtual machine resources and/or be mounted to a virtual machine for use.
可选的,导入装置可以将镜像文件存储至对象存储资源池的存储桶,获得所述镜像文件对应的存储地址。进一步可选的,到如装置还可通过前端操作系统向用户展示镜像文件相应的存储地址。例如,存储地址为统一资源代码(Uniform Resource Locator,URL)。URL可用于指示所述存储桶地址和/或所述存储文件地址。Optionally, the importing device may store the image file in a storage bucket of the object storage resource pool, and obtain a storage address corresponding to the image file. Further optionally, the device can also display the corresponding storage address of the image file to the user through the front-end operating system. For example, the storage address is a uniform resource code (Uniform Resource Locator, URL). The URL may be used to indicate the storage bucket address and/or the storage file address.
步骤103,根据所述镜像文件的格式信息,确定所述镜像文件的格式属于允许导入块存储资源池的镜像文件格式。Step 103, according to the format information of the image file, determine that the format of the image file belongs to the image file format that allows importing into the block storage resource pool.
可选的,导入装置可根据云平台中的镜像管理组件在云平台中创建镜像文件对应的数据库条目。其中,镜像管理组件可以是用于执行镜像文件导入的云平台服务组件。例如,导入装置通过镜像管理组件执行_CreateImage命令,用于在云平台中创建数据库条目。Optionally, the importing device may create a database entry corresponding to the image file in the cloud platform according to the image management component in the cloud platform. Wherein, the image management component may be a cloud platform service component for executing image file import. For example, the importing device executes the _CreateImage command through the image management component to create a database entry in the cloud platform.
示例性的,在步骤103中,导入装置可以根据所述镜像文件对应的存储地址提取所述镜像文件的格式信息。Exemplarily, in step 103, the importing device may extract the format information of the image file according to the storage address corresponding to the image file.
可选的,导入装置可以调用镜像管理组件中的命令,查看所述镜像文件的格式信息。例如,导入装置可通过qemu-img info命令查看镜像文件的格式信息。Optionally, the importing device may call a command in the image management component to check the format information of the image file. For example, the importing device can view the format information of the image file through the qemu-img info command.
可选的,导入装置根据所述允许导入块存储资源池的镜像文件格式确定允许导入的所述镜像文件。Optionally, the importing device determines the image file allowed to be imported according to the image file format allowed to be imported into the block storage resource pool.
允许导入块存储资源池的镜像文件格式可以存储为列表,因此导入装置可根据待导入的镜像文件的格式信息查表,确定待导入的镜像文件的格式是否属于允许导入该格式的镜像文件的格式,避免导入格式错误或具有云平台不支持的格式的镜像文件。例如,允许导入的镜像文件的格式包括raw格式、qcow2格式、vhd格式、vhdx格式和vmdk格式,并且,待导入的镜像文件的格式为raw格式,则该待导入的镜像文件的格式属于允许导入该格式的镜像文件的格式,导入装置可确定允许导入该镜像文件。The image file formats that are allowed to be imported into the block storage resource pool can be stored as a list, so the importing device can look up the table according to the format information of the image file to be imported to determine whether the format of the image file to be imported belongs to the format of the image file that is allowed to be imported in this format , to avoid importing image files with wrong formats or formats not supported by the cloud platform. For example, the formats of image files that are allowed to be imported include raw format, qcow2 format, vhd format, vhdx format, and vmdk format, and if the format of the image file to be imported is raw format, then the format of the image file to be imported belongs to the allowed import format. For the format of the image file in this format, the importing device can determine that the image file is allowed to be imported.
可选的,允许导入块存储资源池的镜像文件格式(或该列表)可以是预先设置好的。比如,可以是云平台的内部配置,可以由云平台运维人员设置或更新,本申请不作具体要求。Optionally, the image file format (or the list) allowed to be imported into the block storage resource pool may be preset. For example, it can be the internal configuration of the cloud platform, which can be set or updated by the operation and maintenance personnel of the cloud platform, and this application does not make specific requirements.
可选的,如果导入装置根据所述允许导入块存储资源池的镜像文件格式列表确定不允许导入的所述镜像文件,例如镜像文件的格式不属于导入块存储资源池的镜像文件格式,则导入装置可删除之前创建的数据库条目。Optionally, if the importing device determines that the image file is not allowed to be imported according to the list of image file formats allowed to be imported into the block storage resource pool, for example, the format of the image file does not belong to the image file format of the imported block storage resource pool, then import The device may delete previously created database entries.
这里通过举例对步骤103的实现过程进行说明。在步骤103中,导入装置可以根据所述URL存储地址从存储桶中提取URL对应的一个镜像文件。如果导入装置确定所述镜像文件为qcow2格式,且根据所述允许导入块存储资源池的镜像文件格式列表确定所述qcow2格式属于所述允许导入块存储资源池的镜像文件格式,则导入装置可以确定所述镜像文件为允许导入的镜像文件。Here, the implementation process of step 103 is described by taking an example. In step 103, the importing device may extract an image file corresponding to the URL from the storage bucket according to the URL storage address. If the importing device determines that the image file is in qcow2 format, and determines that the qcow2 format belongs to the image file format allowed to import block storage resource pools according to the list of image file formats allowed to be imported into the block storage resource pool, then the importing device may It is determined that the image file is an image file allowed to be imported.
步骤104,将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池,所述镜像文件用于在所述云平台的块存储资源池中开通虚拟机。Step 104, import the image file from the object storage resource pool into the block storage resource pool of the cloud platform, and the image file is used to provision a virtual machine in the block storage resource pool of the cloud platform.
可选的,导入装置可以向对待导入的镜像文件的格式进行转换,再将格式转换后的镜像文件导入块存储资源池,或者,在将待导入的镜像文件导入块存储资源池,再进行格式转换。Optionally, the importing device can convert the format of the image file to be imported, and then import the converted image file into the block storage resource pool, or, after importing the image file to be imported into the block storage resource pool, perform format convert.
例如,待导入的镜像文件的格式为第一格式,即镜像文件的格式信息指示格式为第一格式,转换后的镜像文件的格式记为第二格式,该第二格式可以是云平台支持的镜像文件的格式。例如,在当前云平台生成的镜像文件的格式为第二格式。可以理解,这里的第一格式和第二格式,均属于允许导入块存储资源池的镜像文件格式。For example, the format of the image file to be imported is the first format, that is, the format information of the image file indicates that the format is the first format, and the format of the converted image file is recorded as the second format, which can be supported by the cloud platform. The format of the image file. For example, the format of the image file generated on the current cloud platform is the second format. It can be understood that the first format and the second format here belong to the image file format that allows importing the block storage resource pool.
例如,第一格式为qcow2格式,第二格式为raw格式,允许导入块存储资源池的镜像文件格式包括raw格式、qcow2格式、vhd格式、vhdx格式和vmdk格式,则导入装置可以将镜像文件的格式转为raw格式,再将镜像文件导入块存储资源池。For example, the first format is qcow2 format, and the second format is raw format. The image file formats allowed to import block storage resource pools include raw format, qcow2 format, vhd format, vhdx format, and vmdk format. Convert the format to raw format, and then import the image file into the block storage resource pool.
可选的,在执行格式转换时,导入装置可通过镜像管理组件调用qemu-imgconvert命令,将所述第一格式的所述镜像文件转换为所述第二格式镜像文件。Optionally, when performing format conversion, the importing device may invoke the qemu-imgconvert command through the image management component to convert the image file in the first format into the image file in the second format.
此外,如果第一格式与第二格式相同,则导入装置可以将该镜像文件导入块存储资源池而不需要进行格式转换。In addition, if the first format is the same as the second format, the importing device can import the image file into the block storage resource pool without format conversion.
例如,如图2所示,用户可通过前端管理系统启动镜像文件导入流程,并将镜像文件上传至云平台的资源池中的对象存储资源池。在镜像文件导入流程中,导入装置通过镜像管理组件,将对象存储资源池中的镜像文件导入块存储资源池中,以实现以上步骤101至步骤104。For example, as shown in FIG. 2 , the user can start the image file import process through the front-end management system, and upload the image file to the object storage resource pool in the resource pool of the cloud platform. In the process of importing the image file, the importing device imports the image file in the object storage resource pool into the block storage resource pool through the image management component, so as to realize the above steps 101 to 104.
例如,如图3所示,导入装置可通过镜像管理组件调用_CreateImage命令、_ImportToStore命令、和qemu-img convert命令、_SaveImage命令和_CompleteTask命令中的至少一项,以实现以上步骤103至步骤104,该过程可称为镜像导入子任务流。For example, as shown in Figure 3, the importing device can call at least one of the _CreateImage command, _ImportToStore command, and qemu-img convert command, _SaveImage command and _CompleteTask command through the image management component, to achieve the above steps 103 to 104 , this process may be referred to as an image import subtask flow.
基于图2所示流程,本申请实施例提供一种镜像文件导入方法,能够提高镜像文件获取方式的灵活性,以满足用户需求。Based on the process shown in FIG. 2 , the embodiment of the present application provides a method for importing an image file, which can improve the flexibility of an image file acquisition method to meet user needs.
此外,导入过程采用文件流的方式,使用qemu-img等工具将对象存储中的镜像文件导入到云平台的块存储池中,不会占用镜像管理组件所在的物理机存储空间资源。In addition, the import process adopts the method of file flow, and uses tools such as qemu-img to import the image file in the object storage into the block storage pool of the cloud platform, which will not occupy the storage space resources of the physical machine where the image management component is located.
基于相同的技术构思,本申请示例性的提供了一种镜像文件导入装置架构示意图,如图4所示,该装置包括:Based on the same technical idea, the present application provides an exemplary architecture diagram of an image file importing device, as shown in Figure 4, the device includes:
存储模块401,用于获取镜像文件和所述镜像文件的格式信息;A
所述存储模块401,还用于将所述镜像文件存储至云平台的对象存储资源池;The
确定模块402,用于根据所述镜像文件的格式信息,确定所述镜像文件的格式属于允许导入块存储资源池的镜像文件格式;A
导入模块403,用于将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池。The
可选的,所述存储模块401,还用于在将所述镜像文件存储至云平台的对象存储资源池后,获得所述镜像文件对应的存储地址;Optionally, the
所述导入模块403,具体用于根据所述存储地址,将所述镜像文件从所述对象存储资源池导入所述云平台的块存储资源池。The
可选的,所述镜像文件的格式信息用于指示所述镜像文件的格式为第一格式,所述第一格式与第二格式不同,所述第二格式为所述云平台支持的镜像文件的格式,所述导入模块403还用于:Optionally, the format information of the image file is used to indicate that the format of the image file is a first format, the first format is different from the second format, and the second format is an image file supported by the cloud platform format, the
将所述镜像文件的格式修改为所述第二格式;modifying the format of the image file to the second format;
其中,所述第一格式与所述第二格式属于所述允许导入块存储资源池的镜像文件格式。Wherein, the first format and the second format belong to the image file format allowed to be imported into the block storage resource pool.
与上述方法实施例基于同一发明构思,本申请实施例中还提供了一种电子设备。该电子设备可以用于执行以上方法实施例所述的动作。在该实施例中,电子设备的结构可以如图5所示,包括存储器501以及一个或多个处理器502。Based on the same inventive concept as the foregoing method embodiments, an electronic device is also provided in the embodiments of the present application. The electronic device may be used to perform the actions described in the above method embodiments. In this embodiment, the structure of the electronic device may be as shown in FIG. 5 , including a
存储器501,用于存储处理器502执行的计算机程序。存储器501可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统,以及运行即时通讯功能所需的程序等;存储数据区可存储各种即时通讯信息和操作指令集等。The
存储器501可以是易失性存储器(volatile memory),例如随机存取存储器(random-access memory,RAM);存储器501也可以是非易失性存储器(non-volatilememory),例如只读存储器,快闪存储器(flash memory),硬盘(hard disk drive,HDD)或固态硬盘(solid-state drive,SSD)、或者存储器801是能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器501可以是上述存储器的组合。The
处理器502,可以包括一个或多个中央处理单元(central processing unit,CPU)或者为数字处理单元等。处理器502,用于调用存储器501中存储的计算机程序时实现上述方法。The
本申请实施例中不限定上述存储器501和处理器502之间的具体连接介质。作为一种示例,本申请实施例在图5中以存储器501和处理器502之间通过总线503连接,总线503在图5中以粗线表示,其它部件之间的连接方式,仅是进行示意性说明,并不引以为限。总线503可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The specific connection medium between the
可选的,处理器502可用于执行以上由存储模块401、确定模块402和导入模块403中任意一项或多项执行的动作。Optionally, the
根据本申请的一个方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行上述实施例中的方法。According to an aspect of the present application there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods in the above embodiments.
程序产品可以采用一个或多个可读介质的任意组合。可读介质可以是可读信号介质或者可读存储介质。可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。可读存储介质的更具体的例子(非穷举的列表)包括:具有一个或多个导线的电连接、便携式盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。A program product may take the form of any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: electrical connection with one or more conductors, portable disk, hard disk, random access memory (RAM), read only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。The above is only a specific implementation of the application, but the scope of protection of the application is not limited thereto. Anyone familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the application. Should be covered within the protection scope of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210867984.8A CN115268950A (en) | 2022-07-22 | 2022-07-22 | Mirror image file importing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210867984.8A CN115268950A (en) | 2022-07-22 | 2022-07-22 | Mirror image file importing method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115268950A true CN115268950A (en) | 2022-11-01 |
Family
ID=83770649
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210867984.8A Pending CN115268950A (en) | 2022-07-22 | 2022-07-22 | Mirror image file importing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115268950A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116302210A (en) * | 2023-05-17 | 2023-06-23 | 阿里云计算有限公司 | Image file importing method and device, electronic equipment and storage medium |
-
2022
- 2022-07-22 CN CN202210867984.8A patent/CN115268950A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116302210A (en) * | 2023-05-17 | 2023-06-23 | 阿里云计算有限公司 | Image file importing method and device, electronic equipment and storage medium |
CN116302210B (en) * | 2023-05-17 | 2023-08-04 | 阿里云计算有限公司 | Image file importing method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101650660B (en) | Booting a computer system from central storage | |
US10579404B2 (en) | Provisioning virtual desktops with stub virtual disks | |
CN103795759B (en) | The dispatching method and system of a kind of virtual machine image file | |
KR20140065837A (en) | Apparatus and system for providing software service using software virtualization and method thereof | |
CN103077034B (en) | hybrid virtualization platform JAVA application migration method and system | |
CN110083399B (en) | Mini program running method, computer device and storage medium | |
JP2014235501A (en) | Control method of storage device, storage device and information processing device | |
CN111679911B (en) | Management method, device, equipment and medium of GPU card in cloud environment | |
US8719480B2 (en) | Automated network configuration in a dynamic virtual environment | |
CN114124739B (en) | Method and device for deploying FreeWITCH service, electronic equipment and storage medium | |
CN109388475A (en) | A kind of dispositions method, device, electronic equipment and the storage medium of physics bare machine | |
EP3910877A2 (en) | Evm-based transaction processing method and apparatus, device, program and medium | |
CN106648838B (en) | Resource pool management configuration method and device | |
CN103207805A (en) | Virtualization-based hard disk reuse system | |
CN112286633A (en) | Virtual machine creating method, device, equipment and storage medium based on CloudStack platform | |
CN115268950A (en) | Mirror image file importing method and device | |
US20180203726A1 (en) | Virtual machine migration method and apparatus | |
US20180088982A1 (en) | Providing highly available and scalable access to a restricted access service through a restful interface | |
WO2017097114A1 (en) | Shared file access method, system and related device | |
CN109240803A (en) | A kind of virtual machine migration method, device, server and storage medium | |
US10565202B2 (en) | Data write/import performance in a database through distributed memory | |
CN116521181B (en) | Script data processing method, device, equipment and medium based on game system | |
CN115774701B (en) | Data sharing method and device, electronic equipment and storage medium | |
CN113448995A (en) | Database operation method, device and system, electronic equipment and storage medium | |
CN115309491A (en) | Logic algorithm of platform system |
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 |