WO2018090290A1 - 镜像文件转换方法及装置 - Google Patents

镜像文件转换方法及装置 Download PDF

Info

Publication number
WO2018090290A1
WO2018090290A1 PCT/CN2016/106262 CN2016106262W WO2018090290A1 WO 2018090290 A1 WO2018090290 A1 WO 2018090290A1 CN 2016106262 W CN2016106262 W CN 2016106262W WO 2018090290 A1 WO2018090290 A1 WO 2018090290A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
image file
target
original image
original
Prior art date
Application number
PCT/CN2016/106262
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 华为技术有限公司
Priority to EP20209495.9A priority Critical patent/EP3842930A1/en
Priority to PCT/CN2016/106262 priority patent/WO2018090290A1/zh
Priority to CN201680003656.6A priority patent/CN107004032B/zh
Priority to EP16909067.7A priority patent/EP3425501B1/en
Priority to US15/921,929 priority patent/US11243792B2/en
Publication of WO2018090290A1 publication Critical patent/WO2018090290A1/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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion
    • 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
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Definitions

  • Embodiments of the present disclosure relate to the field of virtualization technologies, and in particular, to an image file conversion method and apparatus.
  • the image file is imported into the target platform, and the virtual machine in the target platform is created in batches using the imported image file.
  • the image file of the virtual machine is a template for creating a virtual machine.
  • the original image file exported from the original platform cannot be used normally in the target platform because the original platform and the target platform use different drivers, and/or the original and target platforms support different file formats.
  • the driver of the original virtual machine is manually uninstalled, the driver of the target platform is written to the original virtual machine, and the original virtual machine is used as the original platform.
  • the file format is exported to the original image file; then the software engineer converts the file format of the original image file into the target file format through the image file format conversion tool, and creates a virtual machine in the target platform using the original image file with the target file format, in the virtual
  • the target driver that has been written is installed in the machine to obtain the target virtual machine in the target platform.
  • the target virtual machine is exported as a target image file, and the target virtual machine is created in batches in the target platform by using the target image file.
  • the original image file Since the original image file is converted to the target image file when it is converted to the target image file, it needs to be completed when the original image file is started as a virtual machine, which consumes more resources and has lower conversion efficiency.
  • an image file conversion method is provided in order to solve the problem that the original image file needs to be converted into a virtual machine, and the image file conversion efficiency is low and the hardware resources are consumed. And equipment.
  • the technical solution is as follows:
  • an image file conversion method comprising: obtaining a virtual machine in an original The original image file in the initial platform; detecting whether the original image file has the first file feature and the second file feature corresponding to the target platform, and the first file feature includes: a target driver used when the virtual machine runs in the target platform, The second file feature includes: a target file format supported by the target platform; when the original image file does not have at least one of the first file feature and the second file feature, the original image file is modified by calling a predetermined interface to obtain a virtual The target image file in the target platform, the target image file has the first file feature and the second file feature.
  • the conversion server when the conversion server detects that the original image file does not have at least one file feature corresponding to the target platform, it indicates that the original image file cannot be directly used in the target platform, and the conversion server directly directly calls the predetermined interface.
  • the target image file of the virtual machine in the target platform can be converted, so that the virtual machine runs normally on the target platform, and the original image file is not required to be modified into a virtual machine, which saves resources. , improve the efficiency of image file conversion.
  • the original image file when the original image file does not have at least one of the first file feature and the second file feature, the original image file is modified by calling a predetermined interface, including :
  • a predetermined interface including :
  • the original driver in the original image file is replaced with the target driver by calling the first predetermined interface.
  • the original driver in the original image file is replaced with the target driver by calling the first predetermined interface, including: Determining the driver directory in the original image file according to the operating system type of the operating system in the original image file, the driver directory is the default directory where the driver of the operating system type operating system is located; by calling the first predetermined interface, the driver directory is Replace the original driver with the target driver.
  • the conversion server automatically modifies the original image file according to the target driver when it detects that the original driver in the original image file is not the target driver used by the virtual machine when running in the target platform.
  • Drivers without the need to manually modify the original driver by a dedicated engineer, improve the efficiency of image file conversion, and reduce the chance of errors during manual operations.
  • the third possible implementation of the first aspect Detecting whether the original image file has the first file feature corresponding to the target platform, including: accessing the original image file by calling the first predetermined interface to determine an operating system in the original image file Operating system type; determine the target driver corresponding to the operating system type and target platform; detect whether the original driver is the same as the target driver; when the original driver is different from the target driver, determine that the original image file does not have the first file feature .
  • the conversion server automatically identifies the operating system type of the operating system in the original image file, and does not need to manually input the operating system type by the user, thereby preventing the user from manually inputting an operating system type error and causing image file conversion. error.
  • the original image file when the original image file does not have at least one of the first file feature and the second file feature, the original image is invoked by calling a predetermined interface.
  • the file is modified, including: when the original image file does not have the second file feature, the original file format of the original image file is modified to the target file format by calling the second predetermined interface.
  • the conversion server automatically modifies the original file format of the original image file according to the target file format, without The engineer manually modified the original file format, which improved the efficiency of image file conversion and reduced the chance of errors during manual operation.
  • the detecting whether the original image file has the second file feature corresponding to the target platform includes: determining that the target platform supports The target file format; whether the original file format is the same as the target file format; when the original file format is different from the target file format, it is determined that the original image file does not have the second file feature.
  • the obtaining the original image file of the virtual machine in the original platform includes: obtaining the original image file from the image library, where the image database is used for storing the user uploaded Image file.
  • an image file conversion apparatus comprising at least one unit, and at least one unit of the apparatus is configured to implement the image file conversion method provided by the first aspect.
  • a conversion server comprising: a processor, and a memory coupled to the processor.
  • the memory is for storing one or more instructions that are instructed to be executed by a processor for implementing the image file conversion method provided by the first aspect above.
  • FIG. 1 is a schematic structural diagram of an image file conversion system according to an exemplary embodiment of the present invention.
  • FIG. 2 is a schematic structural diagram of an image file conversion system according to another exemplary embodiment of the present invention.
  • FIG. 3 is a flowchart of a method for converting an image file according to an exemplary embodiment of the present invention
  • FIG. 4 is a flowchart of a method for converting an image file according to another exemplary embodiment of the present invention.
  • FIG. 5 is a flowchart of a method for converting an image file according to another exemplary embodiment of the present invention.
  • FIG. 6 is a flowchart of a method for converting an image file according to another exemplary embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of a conversion server according to an exemplary embodiment of the present invention.
  • FIG. 8 is a block diagram of an image file conversion apparatus according to an exemplary embodiment of the present invention.
  • Multiple as referred to herein means two or more. "and/or”, describing the association relationship of the associated objects, indicating that there may be three relationships, for example, A and/or B, which may indicate that there are three cases where A exists separately, A and B exist at the same time, and B exists separately.
  • the symbol “/” generally indicates that the contextual object is an "or" relationship.
  • FIG. 1 is a schematic structural diagram of an image file conversion system according to an exemplary embodiment of the present invention.
  • the system includes: a terminal device 120 and a conversion server 140.
  • the terminal device 120 is such as a mobile phone, a tablet computer, an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), and an MP4 (Moving Picture Experts Group Audio Layer IV). Compress standard audio layers 4) Electronic devices such as players, desktop computers and portable computers.
  • the terminal device 120 establishes a communication connection with the conversion server 140 via a wireless network method or a wired network method.
  • the terminal device 120 is configured to send an image file conversion request to the conversion server 140, request the conversion server 140 to convert the image file, and the conversion server 140 is configured to perform a conversion operation on the image file according to the image file conversion request, and return the converted image file.
  • the conversion server 140 is a server, or a server cluster composed of several servers, or a cloud computing service center. In actual implementation, the conversion server 140 is a physical machine, a virtual machine, a physical machine cluster, or a virtual machine cluster.
  • the system further includes: the communication server 160, as shown in FIG. 2 Shown.
  • the communication server 160 is configured to receive an image file conversion request of the terminal device 120 and forward the image file conversion request to the conversion server 140.
  • the communication server 160 is a server, or a server cluster composed of several servers, or a cloud computing service center. In actual implementation, the communication server 160 is a physical machine, a virtual machine, a physical machine cluster, or a virtual machine cluster.
  • the communication server 160 establishes a communication connection with the conversion server 140 via a wireless network method or a wired network method.
  • the image file that the terminal device 120 requests to convert to the conversion server 140 is not sent to the conversion server 140 in real time.
  • the system further includes: a mirror library 180, as shown in FIG. .
  • the image library 180 is used to store the image file uploaded by the user.
  • the conversion server 140 needs to directly convert the image file from the image library 180, the conversion server 140 returns the converted image file to the mirror file 180.
  • the terminal device 120 is either returned to the mirror library 180.
  • the image library 180 is optionally a device with strong storage capacity and storage reliability. Alternatively, the image library 180 is based on an object storage service (Object Storage Service).
  • the device optionally, the mirror library 180 is an object storage system (Object Storage System), and the mirror library 180 establishes a communication connection with the conversion server 140 by way of a wired network or a wireless network.
  • the mirror library 180 includes a large number of storage units for storing data. In the object storage system, the storage unit is an object 181, and the object 181 is used to store an image file.
  • the image library 180 can be implemented as a file storage-based storage device.
  • the image library 180 is a network attached storage (NAS), and the image library 180 is connected to the conversion server 140 through an Ethernet.
  • the storage unit in the NAS is a storage medium such as a disk and a disk array.
  • the mirror library 180 may be instead implemented as the local storage of the conversion server 140, and the mirror library 180 and the conversion server 140 are connected through an input/output (I/O) interface.
  • the storage unit in the local storage is a storage medium such as a disk and a disk array.
  • the mirror library 180 can be implemented as a storage area network (SAN) for the shared block storage, and the mirror library 180 and the conversion server 140 are connected by a Fibre Channel (FC).
  • the storage unit in the SAN is a storage medium such as a disk and a disk array.
  • FIG. 3 illustrates an image file conversion method provided by an exemplary embodiment of the present disclosure.
  • the flowchart of the embodiment is applied to the conversion server shown in FIG. 1 or FIG. 2, and the method includes:
  • step 301 the conversion server obtains the original image file of the virtual machine in the original platform.
  • a virtual machine is a virtual computer system with complete hardware system functions simulated by software.
  • the virtual machine runs on a platform.
  • the platform is a computer system for providing a running environment and running resources for the virtual machine.
  • the platform is provided for the virtual machine.
  • Running resources include instances and memory.
  • the platform includes at least one of a data center and a cloud platform, where the cloud platform includes at least one of a public cloud platform and a private cloud platform.
  • a virtual machine runs on the Hadoop cloud platform.
  • the image file of the virtual machine includes the operating system of the virtual machine, various types of applications, and configuration information necessary for the running of the virtual machine.
  • the configuration information includes a driver used when the virtual machine runs in the platform.
  • the configuration information in the original image file includes the drivers used by the virtual machine when it runs in the original platform.
  • Step 302 The conversion server detects whether the original image file has the first file feature and the second file feature corresponding to the target platform.
  • the first file feature includes: a target driver used when the virtual machine runs in the target platform
  • the second file feature includes: a target file format supported by the target platform.
  • Step 303 When the original image file does not have at least one of the first file feature and the second file feature, the conversion server modifies the original image file by calling a predetermined interface to obtain a target image of the virtual machine in the target platform.
  • the file, the target image file has a first file feature and a second file feature.
  • the original platform and the target platform are different cloud platforms. Specifically, the same virtual machine uses different drivers when running on the original platform and the target platform, and/or the original platform and the target platform support different file formats.
  • the original platform is a traditional data center
  • the target platform is a cloud platform such as a public cloud platform and a private cloud platform; or the original platform and the target platform are different cloud platforms.
  • the original platform and the target platform are different cloud platforms, including: the original platform and the target platform belong to different types of cloud platforms, for example, the original platform is a private cloud platform, the target platform is a public cloud platform; or the original platform and the target platform are the same
  • the cloud platform developed by different types of merchants for example, the original platform is a public cloud platform developed by the merchant A, and the target platform is a public cloud platform developed by the merchant B.
  • the image file conversion method when the conversion server detects that the original image file does not have at least one file feature corresponding to the target platform, represents the original image.
  • the file cannot be directly used in the target platform.
  • the conversion server can directly convert the original image file by calling the predetermined interface, and then the target image file of the virtual machine in the target platform can be converted, so that the virtual machine runs normally in the target platform.
  • the original image file does not need to be modified after being started as a virtual machine, which saves resources and improves the efficiency of image file conversion.
  • FIG. 4 is a flowchart of an image file conversion method provided by an exemplary embodiment of the present disclosure.
  • the embodiment is applied to the conversion server shown in FIG. 1 or FIG. 2, and the original image file is used in this embodiment.
  • the first file feature and the second file feature are not provided.
  • the method includes:
  • Step 401 The conversion server receives an image file conversion request sent by the terminal device.
  • the conversion server directly receives the image file conversion request sent by the terminal device, as shown in FIG. 1; or receives the image file conversion request forwarded by the communication server, as shown in FIG. 2 .
  • Step 402 The conversion server acquires the original image file of the virtual machine in the original platform according to the image file conversion request.
  • the image file conversion request includes an original image file
  • the conversion server obtains the original image file in the image file conversion request.
  • the image file conversion request includes the file identifier of the original image file
  • the conversion server obtains the original image file from the image library according to the file identifier.
  • the file identifier is a file name of the original image file, and the corresponding relationship between the file name and the image file is stored in the image library.
  • the file identifier may optionally include a user identifier corresponding to the original image file, and the user identifier is a user identifier of the user who stores the original image file to the image library.
  • the mirror library stores the correspondence between the file name, the user ID, and the image file.
  • the user ID is a user account.
  • the image library stores the file name of the user account + original image file and the original image file. Relationship: When the user requests to convert the original image file, the user logs in to the user account and sends an image file conversion request to the conversion server.
  • the image file conversion request carries the user account that the user logs in, and the original image file that the user requests to convert. File name.
  • the user logs in the user account A in the terminal device, and pre-stores the original image file M of the file name B in the image library through the terminal device, and the image library stores "user account A+file name B" and the original image file.
  • the correspondence of M when the user logs in to user account A and requests the file name B
  • the image file conversion request received by the conversion server includes the user account A and the file name B, and the conversion server obtains the original image file M from the image library.
  • Step 403 The conversion server accesses the original image file by calling the first predetermined interface to determine an operating system type of the operating system in the original image file.
  • the operating system type in the embodiment of the present invention is used to indicate an operating system series to which the operating system belongs, for example, the operating system type is Windows.
  • the operating system types of the operating systems of different system versions in the same operating system series are the same.
  • the operating system types corresponding to the Windows 7 operating system and the Window 10 operating system are all Windows.
  • the operating system type in the embodiment of the present invention is used to indicate an operating system series and a system version to which the operating system belongs.
  • the operating system type is Linux SUSE.
  • the operating system types of the different operating system versions of the same operating system are different.
  • the operating system type corresponding to the Linux SUSE operating system is different.
  • the operating system type of Linux Ubuntu operating system is Linux Ubuntu, and the two operating system types are different.
  • the embodiment of the present invention is described by using an operating system type as an example to indicate an operating system series to which the operating system belongs.
  • the operating system information of the same type of operating system is stored in the same default directory.
  • the default directories used to store operating system information in different types of operating systems are different.
  • the operating system information is stored in /etc/release; in the Windows series operating system, the operating system information is stored in the Windows system registry HKEY_LOCAL_MACHINE ⁇ SOFTWARE ⁇ Microsoft ⁇ Windows NT ⁇ CurrentVersion, and The /etc/release directory is not included in the Windows family of operating systems.
  • the conversion server directly accesses the content in the original image file to determine the operating system type by calling the first predetermined interface without starting the image file as a virtual machine.
  • the libguestfs toolset is installed in the conversion server, and the first predetermined interface includes an interface corresponding to the tool included in the libguestfs tool set.
  • the libguestfs toolset is a set of application programming interfaces (APIs).
  • the tools included in the toolset are virt-cat, virt-df, virt-ls, virt-copy-in, virt-copy- Out, virt-edit, guestfs, guestmount, virt-list-filesystems, and virt-list-partitions.
  • the first predetermined interface further includes an interface corresponding to the chntpw tool, and the chntpw tool is configured to modify a system password of the operating system of the Windows series to read the registry of the operating system.
  • the conversion server first mounts the original image file to the conversion server by calling the interface corresponding to the guestmount tool before determining the operating system type, so that the conversion server accesses and processes the original image file.
  • the conversion server stores a correspondence between an operating system type and an operating system directory, where the operating system directory is a default directory for storing operating system information.
  • the conversion server determines the operating system type by accessing the original image file by calling the first predetermined interface, the following two implementation manners are included:
  • the conversion server scans each directory in the original image file by calling the first predetermined interface, and when the scan to the original image file includes an operating system directory corresponding to an operating system type, determining The operating system type is the operating system type that corresponds to the operating system directory.
  • the conversion server stores the correspondence between the operating system type Linux and the operating system directory /etc/release, and stores the correspondence between the operating system type Windows and the operating system directory HKEY_LOCAL_MACHINE ⁇ SOFTWARE ⁇ Microsoft ⁇ Windows NT ⁇ CurrentVersion. Then, when the conversion server scans the original image file by calling the first predetermined interface to include /etc/release, it is determined that the operating system type of the operating system in the original image file is Linux.
  • the first predetermined interface is the guestfs tool. Corresponding interface.
  • the conversion server scans the original image file by calling the first predetermined interface to include HKEY_LOCAL_MACHINE ⁇ SOFTWARE ⁇ Microsoft ⁇ Windows NT ⁇ CurrentVersion, it is determined that the operating system type of the operating system in the original image file is Windows, in this example, the first The predetermined interface is the interface corresponding to the chntpw tool.
  • the conversion server scans each directory in the original image file by calling the first predetermined interface, and reads the operating system directory corresponding to an operating system type when the original image file is scanned.
  • the operating system information stored in the operating system directory determines the type of the operating system included in the operating system information.
  • the operating system information also includes the version number of the operating system and the number of operating systems, which are not described in this embodiment.
  • the conversion server when the scan server includes the /etc/release in the original image file, the conversion server reads the operating system information in the directory, and the operating system information includes the operating system type as Linux.
  • step 404 the conversion server determines a target driver corresponding to the operating system type and the target platform.
  • the target drivers used by the at least two virtual machines running in the target platform are different; for at least two virtual machines adopting the same operating system type, The target drivers used by virtual machines to run on different target platforms are also different.
  • the conversion server receives the target platform identifier sent by the terminal device; or the image file conversion request received by the conversion server includes a target platform identifier, where the target platform identifier is used to uniquely in each platform. Identify the target platform.
  • the mapping server stores the correspondence between the operating system type, the target platform identifier, and the target driver, and the conversion server queries the target system identifier after identifying the operating system type and determining the target file identifier in the image file conversion request.
  • the target driver corresponding to the target platform and operating system type.
  • the correspondence between the operating system type, the target platform identifier, and the target driver stored in the conversion server is as follows:
  • Target platform identifier Target driver Linux Platform identification 1 Driver 1 Windows Platform identification 1 Driver 2 Linux Platform identification 2 Driver 3
  • the target driver is determined to be driver 1.
  • the content and form shown in Table 1 are exemplary. In a practical embodiment, for a set of operating system types and target platform identifiers, there are usually multiple target drivers, and each target driver corresponds to one or a type of hardware device.
  • the correspondence between the operating system type, the target platform identifier, and the target driver stored in the conversion server may be as shown in Table 2 below:
  • the conversion server determines that the target driver is driver 1.
  • the content and form shown in Table 2 are exemplary.
  • the conversion server is a conversion server corresponding to a default target platform, and the conversion server is configured to convert the original image file into an image file in the default target platform.
  • the mapping server since the target platform is determined, stores the correspondence between the operating system type and the target driver, and the conversion server queries the target driver corresponding to the obtained operating system type.
  • step 405 the conversion server detects whether the original driver is the same as the target driver.
  • drivers for different types of operating systems are stored in different driver directories, while drivers for the same type of operating system are stored in the same driver directory, and the driver directory is the driver for the operating system type.
  • the driver directory for storing drivers in the Linux family of operating systems is /opt/pvdriver; and the driver directory for storing drivers in the Windows family of operating systems is C: ⁇ Program Files.
  • the mapping between the operating system type and the driver directory is stored in the conversion server.
  • the conversion server determines the driver directory in the original image file according to the operating system type of the operating system in the original image file. After determining the operating system type of the operating system included in the original image file, the conversion server queries the correspondence to determine a driver directory corresponding to the operating system type, and the file stored in the driver directory in the original image file is the original driver. The conversion server detects if the original driver was obtained the same as the determined target driver. For example, when the conversion server determines that the operating system type is Windows type, it is determined that the driver directory is C: ⁇ Program Files, and the file in the driver directory is the original driver.
  • Step 406 When the original driver is different from the target driver, the conversion server determines that the original image file does not have the first file feature.
  • Step 407 When the original image file does not have the first file feature, the conversion server replaces the original driver in the original image file with the target driver by calling the first predetermined interface.
  • Step 407 includes the following steps, as shown in FIG. 5:
  • Step 501 the conversion server is determined according to the operating system type of the operating system in the original image file.
  • the driver directory in the original image file is determined according to the operating system type of the operating system in the original image file.
  • the conversion server needs to determine the driver directory in the original image file when detecting whether the original driver and the target driver are the same in the above step 405, the step and the step of determining the driver directory in the above step 405 are performed. Implementation becomes the same step.
  • Step 502 The conversion server replaces the original driver under the driver directory with the target driver by calling the first predetermined interface.
  • the conversion server calls the first predetermined interface to delete the original driver in the driver directory, and writes the target driver in the driver directory.
  • the meaning of the first predetermined interface is the same as that in step 403 above. This will not be repeated here.
  • the conversion server may also perform operations such as reading and/or deleting other files in the original image file by calling the first predetermined interface, which is not limited in this implementation.
  • the conversion server optionally does not modify the original driver by determining the driver directory, but performs modification according to the index file.
  • the index file includes the offset and occupied bytes of each file in the original image file, where the offset refers to the position of the starting byte position of the file in the entire original image file.
  • the index file includes the original driver offset of 1000, and the occupied byte number is 2000, which means that the original driver starts at the 1000th byte in the original image file and takes up 2000 bytes.
  • the conversion server deletes the file of the 1000-2999 bytes according to the index file, and then writes the target driver to the 1000th. -2999 bytes, the original driver is replaced with the target driver.
  • the conversion server determines that the original image file has the first file feature. In a possible implementation, the conversion server directly performs the following steps 408, which is not limited by the embodiment of the present invention. .
  • step 408 the conversion server determines the target file format supported by the target platform.
  • the file formats supported by different platforms are different.
  • the file formats of common image files are Raw (Raw image) format, QCOW (Quick Emulator) Copy-On-Write format, QCOW2 format, and VMDK ( Virtual Machine Disk) format.
  • the conversion server is configured to convert the image file into an image file in a plurality of different platforms, and the optional conversion server stores the correspondence between the target platform identifier and the target file format.
  • the target platform storing the target platform identifier A identifier supports the Raw format.
  • the target platform identified by the target platform identifier B stores the QCOW2 format.
  • the conversion server queries the correspondence between the target platform identifier and the target file format to determine a target file format corresponding to the received target platform identifier.
  • the conversion server is a conversion server corresponding to a default platform.
  • the target file format is preset, that is, the file format supported by the default platform, and the conversion is performed.
  • the server directly determines the preset target file format.
  • step 409 the conversion server detects whether the original file format of the original image file is the same as the target file format.
  • Step 410 When the original file format is different from the target file format, the conversion server determines that the original image file does not have the second file feature.
  • Step 411 When the original image file does not have the second file feature, the conversion server modifies the original file format of the original image file to the target file format by calling the second predetermined interface, and obtains the target image file of the virtual machine in the target platform.
  • the QEMU-IMG command line tool is installed in the conversion server, and the second predetermined interface is an interface corresponding to the QEMU-IMG command line tool.
  • the QEMU-IMG command line tool is a disk management tool of the fast virtual machine (QEMU).
  • the conversion server uses the convert command in the QEMU-IMG command line tool to modify the original file format of the original image file to the target file format.
  • the interface of the second predetermined interface is also an interface corresponding to the image copy tool.
  • the embodiment of the present invention is described by taking the interface corresponding to the QEMU-IMG command line tool as an example.
  • the command behavior commonly used by the conversion server to modify the original file format by calling the second predetermined interface convert[-c][-f fmt][-O output_fmt][-o options]filename[filename2[...]]output_filename, the command
  • the line indicates that the image file whose original file format is fmt format is modified to an image file whose target file format is output_fmt format.
  • the -c command in the command line indicates that the modified image file with the target file format is compressed;
  • the parameter filename represents the file name of the image file having the original file format;
  • the parameter output_filename represents the file name of the image file having the target file format;
  • the parameter options indicates other parameters used in modifying the original file format, which will not be described in this embodiment.
  • the conversion server directly determines that the original image file including the target driver is the target image file of the virtual machine in the target platform, which is in the embodiment of the present invention. This is not limited.
  • the conversion server when the original image file does not have the first file feature and the second file feature, in other words, when the conversion server needs to modify the original file format of the original image file and the original file format of the original image file, in order to avoid the original file format modification of the original image file, the driver directory in the original image file cannot be correctly found. Therefore, in actual implementation, the conversion server usually first modifies the original driver and then modifies the original file format.
  • the conversion server modifies the original driver of the original image file and/or modifies the original file format, and also modifies the system configuration information in the original image file, for example, the registry startup item. Modifications; normally, the system configuration information required for a virtual machine with the same type of operating system to run on the same platform is the same, and the conversion server stores the operating system type, target platform ID, and system configuration. Corresponding relationship of the information, the conversion server queries the target system configuration information corresponding to the operating system type and the target platform identifier, and modifies the system configuration information to be the same as the target system configuration information.
  • FIG. 6 the communication diagram of the image file conversion method provided in this embodiment is shown in FIG. 6.
  • the image file conversion method provided by the embodiment of the present invention, when the conversion server detects that the original image file does not have at least one file feature corresponding to the target platform, indicates that the original image file cannot be directly used in the target platform. At this time, the conversion server directly converts the original image file by calling the predetermined interface, and can convert the target image file of the virtual machine in the target platform, so that the virtual machine runs normally in the target platform without starting the original image file as The virtual machine is modified later, which saves resources and improves the efficiency of image file conversion.
  • the conversion server determines the file characteristics corresponding to the target platform, and automatically modifies the driver in the original image file according to the target driver used by the target platform, and/or automatically supports the target platform.
  • the target file format modifies the original file format of the original image file, without the need to manually modify the original driver and the original file format by a dedicated engineer, which improves the efficiency of image file conversion and reduces the chance of error during manual operation.
  • the conversion server automatically recognizes the operating system type of the operating system in the original image file, and does not need to manually input the operating system type by the user, thereby avoiding an error in the operating system type manually input by the user. Image file conversion error.
  • the conversion image is returned to the terminal device, or is returned to the image library.
  • the conversion server obtains the original image file in the image file conversion request sent by the terminal device.
  • the conversion server temporarily stores the terminal.
  • the conversion server returns the target image file to the terminal device according to the device identifier.
  • the device identifier includes an International Mobile Equipment Identity (IMEI), a Media Access Control (MAC) address, an Internet Protocol (IP) address, and an international mobile client identity of the terminal device. At least one of an International Mobile Subscriber Identification Number (IMSI).
  • IMEI International Mobile Equipment Identity
  • MAC Media Access Control
  • IP Internet Protocol
  • IMSI International Mobile Subscriber Identification Number
  • the conversion server obtains the original image file from the image library according to the file identifier in the image file conversion request.
  • the conversion server obtains the original image file from the image library according to the file identifier.
  • the conversion server sends the file identifier and the target image file to the image library, and the original image file corresponding to the file identifier stored in the image library is replaced by the target image file; or the conversion server generates The new file identifier corresponding to the target image file is sent to the image library, and the corresponding relationship between the new file identifier and the target image file is stored in the image library.
  • the new file identifier includes a new file name that is different from the file name of the original image file, but usually the new file identifier includes the same user ID as the user ID in the file identifier corresponding to the original image file.
  • the conversion server may also directly return the target image file to the terminal device that sends the image file conversion request.
  • the implementation manner refer to the first possible implementation manner. Let me repeat.
  • FIG. 7 is a schematic structural diagram of a conversion server provided by an exemplary embodiment of the present invention.
  • the conversion server includes a processor 710, a memory 720, and a bus 730.
  • the processor 710 includes one or more processing cores, and the processor 710 executes various functional applications and information processing by running software programs and modules.
  • the memory 720 is coupled to the processor 710 via a bus 730 for storing instructions, and the processor 710 implements the image file conversion method described above by executing instructions stored in the memory 720.
  • memory 720 is implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Disk or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Disk Disk
  • Optical Disk any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Disk or Optical Disk
  • the conversion server further includes a receiver 740 and a transmitter 750, both of which are connected to the server 710, and the receiver 740 and the transmitter 750 are implemented as communication components.
  • the communication component includes a network port, and the conversion server establishes a communication connection with the terminal device, the communication server, and other devices by using the wired network.
  • the conversion server includes at least two network ports.
  • the communication component includes a communication chip, and the communication chip includes a receiving module, a transmitting module, a modem module, and the like, configured to perform modulation and demodulation on the information, and receive or transmit information through the wireless signal, and the conversion server passes the communication.
  • the chip establishes a communication connection with the terminal device using a wireless network.
  • FIG. 8 is a block diagram of an image file conversion apparatus according to an embodiment of the present invention.
  • the image file conversion apparatus is implemented as a whole or a part of a conversion server by software, hardware, or a combination of the two.
  • the device includes:
  • the obtaining unit 810 is configured to perform the foregoing steps 301, 401, and 402.
  • the detecting unit 820 is configured to perform the foregoing steps 302, 403, 404, 405, 406, 408, 409, and 410.
  • the processing unit 830 is configured to perform the foregoing steps 303, 407, 501, 502, and 411.
  • the conversion server shown in FIG. 8 is used to implement the image file conversion method provided by the foregoing embodiments.
  • the conversion server may be implemented by the obtaining unit 810; when the conversion server performs the detection operation, Both can be implemented by the above detecting unit 820; the conversion server can be implemented by the processing unit 830 described above when performing the processing operation.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种镜像文件转换方法及装置,涉及虚拟化技术领域,所述方法包括:转换服务器获取虚拟机在原始平台中的原始镜像文件(301);转换服务器检测原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征(302),当原始镜像文件不具备第一文件特征和第二文件特征中的至少一种文件特征时,通过调用预定接口将原始镜像文件修改为虚拟机在目标平台中的目标镜像文件,目标镜像文件具备第一文件特征和第二文件特征(303);由于转换服务器通过调用预定接口直接对原始镜像文件进行修改,就能转换得到虚拟机在目标平台中的目标镜像文件,而不需要将原始镜像文件启动为虚拟机后再进行修改,节约了资源,提高了镜像文件转换时的效率。

Description

镜像文件转换方法及装置 技术领域
本公开实施例涉及虚拟化技术领域,特别涉及一种镜像文件转换方法及装置。
背景技术
当虚拟机在两个不同的平台中批量迁移时,比如在将虚拟机从原始平台批量迁移至目标平台时,需要将一台已经在原始平台中部署好的虚拟机导出为镜像文件,再将该镜像文件导入至目标平台中,从而使用导入的镜像文件批量创建目标平台中的虚拟机。其中,虚拟机的镜像文件是创建虚拟机的模板。
通常情况下,由于原始平台和目标平台使用的驱动程序不同,和/或,原始平台和目标平台所支持的文件格式不同,从原始平台导出的原始镜像文件并不能在目标平台中正常使用。在现有技术中,需要在将原始镜像文件启动为原始虚拟机的情况下,手动卸载原始虚拟机的驱动程序,将目标平台的驱动程序写入原始虚拟机,将原始虚拟机以原始平台的文件格式导出为原始镜像文件;然后软件工程师通过镜像文件格式转换工具将原始镜像文件的文件格式转换为目标文件格式,使用具有目标文件格式的原始镜像文件在目标平台中创建虚拟机,在该虚拟机中对已经写入的目标驱动程序进行安装,从而得到目标平台中的目标虚拟机。进一步的,将该目标虚拟机导出为目标镜像文件,使用该目标镜像文件在目标平台中批量创建目标虚拟机。
由于在将原始镜像文件转换为目标镜像文件时,需要在将原始镜像文件启动为虚拟机的情况下完成,消耗的资源较多且转换效率较低。
发明内容
为了解决在对原始镜像文件进行转换时,需要将原始镜像文件启动为虚拟机而导致的镜像文件转换效率较低以及消耗硬件资源较多的问题,本发明实施例提供了一种镜像文件转换方法及装置。所述技术方案如下:
第一方面,提供了一种镜像文件转换方法,该方法包括:获取虚拟机在原 始平台中的原始镜像文件;检测原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征,第一文件特征包括:虚拟机在目标平台中运行时使用的目标驱动程序,第二文件特征包括:目标平台支持的目标文件格式;当原始镜像文件不具备第一文件特征和第二文件特征中的至少一种文件特征时,通过调用预定接口对原始镜像文件进行修改,得到虚拟机在目标平台中的目标镜像文件,目标镜像文件具备第一文件特征和第二文件特征。
在该实施方式中,转换服务器在检测到原始镜像文件不具备与目标平台对应的至少一个文件特征时,表示该原始镜像文件无法直接在目标平台中使用,此时转换服务器通过调用预定接口直接对原始镜像文件进行修改,就能转换得到虚拟机在目标平台中的目标镜像文件,使虚拟机在目标平台中正常运行,而不需要将原始镜像文件启动为虚拟机后再进行修改,节约了资源,提高了镜像文件转换时的效率。
在第一方面的第一种可能的实施方式中,当原始镜像文件不具备第一文件特征和第二文件特征中的至少一种文件特征时,通过调用预定接口对原始镜像文件进行修改,包括:当原始镜像文件不具备第一文件特征时,通过调用第一预定接口将原始镜像文件中的原始驱动程序替换为目标驱动程序。
结合第一方面的第一种可能的实施方式,在第一方面的第二种可能的实施方式中,通过调用第一预定接口将原始镜像文件中的原始驱动程序替换为目标驱动程序,包括:根据原始镜像文件中的操作系统的操作系统类型确定原始镜像文件中的驱动目录,驱动目录是具有操作系统类型的操作系统的驱动程序所在的默认目录;通过调用第一预定接口将驱动目录下的原始驱动程序替换为目标驱动程序。
在该可选的实施方式中,转换服务器在检测到原始镜像文件中的原始驱动程序不是虚拟机在目标平台中运行时使用的目标驱动程序时,自动根据目标驱动程序修改原始镜像文件中的原始驱动程序,而不需要由专门的工程师手动修改原始驱动程序,提高了镜像文件转换时的效率,也减少了人工操作过程中出错的机会。
结合第一方面、第一方面的第一种可能的实施方式以及第一方面的第二种可能的实施方式中的任意一种可能的实施方式,在第一方面的第三种可能的实施方式中,检测原始镜像文件是否具备与目标平台对应的第一文件特征,包括:通过调用第一预定接口访问原始镜像文件确定原始镜像文件中的操作系统的 操作系统类型;确定与操作系统类型和目标平台对应的目标驱动程序;检测原始驱动程序是否与目标驱动程序相同;当原始驱动程序与目标驱动程序不同时,确定原始镜像文件不具备第一文件特征。
在该可选的实施方式中,转换服务器自动识别原始镜像文件中的操作系统的操作系统类型,而不需要由用户手动输入操作系统类型,避免用户手动输入的操作系统类型错误而导致镜像文件转换错误。
结合第一方面,在第一方面的第四种可能的实施方式中,当原始镜像文件不具备第一文件特征和第二文件特征中的至少一种文件特征时,通过调用预定接口对原始镜像文件进行修改,包括:当原始镜像文件不具备第二文件特征时,通过调用第二预定接口将原始镜像文件的原始文件格式修改为目标文件格式。
在该可选的实施方式中,转换服务器在检测到原始镜像文件的原始文件格式不是目标平台支持的目标文件格式时,自动根据目标文件格式修改原始镜像文件的原始文件格式,而不需要由专门的工程师手动修改原始文件格式,提高了镜像文件转换时的效率,也减少了人工操作过程中出错的机会。
结合第一方面的第四种可能的实施方式,在第一方面的第五种可能的实施方式中,检测原始镜像文件是否具备与目标平台对应的第二文件特征,包括:确定目标平台支持的目标文件格式;检测原始文件格式是否与目标文件格式相同;当原始文件格式与目标文件格式不同时,确定原始镜像文件不具备第二文件特征。
结合第一方面,在第一方面的第六种可能的实施方式中,获取虚拟机在原始平台中的原始镜像文件,包括:从镜像库中获取原始镜像文件,镜像库用于存储用户上传的镜像文件。
第二方面,提供一种镜像文件转换装置,该装置包括至少一个单元,该装置中的至少一个单元用于实现上述第一方面所提供的镜像文件转换方法。
第三方面,提供一种转换服务器,该转换服务器包括:处理器,以及与处理器相连的存储器。存储器用于存储一个或者一个以上的指令,该指令被指示为由处理器执行,处理器用于实现上述第一方面所提供的镜像文件转换方法。
附图说明
图1是本发明一个示例性实施例提供的镜像文件转换系统的结构示意图;
图2是本发明另一个示例性实施例提供的镜像文件转换系统的结构示意图;
图3是本发明一个示例性实施例提供的镜像文件转换方法的流程图;
图4是本发明另一个示例性实施例提供的镜像文件转换方法的流程图;
图5是本发明另一个示例性实施例提供的镜像文件转换方法的流程图;
图6是本发明另一个示例性实施例提供的镜像文件转换方法的流程图;
图7是本发明一个示例性实施例提供的转换服务器的结构示意图;
图8是本发明一个示例性实施例提供的镜像文件转换装置的框图。
具体实施方式
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。
在本文中提及的“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。符号“/”一般表示前后关联对象是一种“或”的关系。
请参考图1,其示出了本发明一示例性实施例提供的镜像文件转换系统的结构示意图,该系统包括:终端设备120和转换服务器140。
终端设备120是诸如手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、台式计算机和便携式计算机之类的电子设备。
终端设备120通过无线网络方式或者有线网络方式与转换服务器140建立通信连接。
终端设备120用于向转换服务器140发送镜像文件转换请求,请求转换服务器140对镜像文件进行转换,转换服务器140用于根据镜像文件转换请求对镜像文件执行转换操作,并将转换后的镜像文件返回给终端设备120。转换服务器140是一台服务器,或者是由若干台服务器组成的服务器集群,或者是一个云计算服务中心。在实际实现时,转换服务器140是物理机、虚拟机、物理机集群或者虚拟机集群。
由于转换服务器140对镜像文件进行转换所需的时间较长,为了更好地响应终端设备120的请求,则可选的,该系统还包括:通信服务器160,如图2 所示。
通信服务器160用于接收终端设备120的镜像文件转换请求,并将镜像文件转换请求转发至转换服务器140。通信服务器160是一台服务器,或者是由若干台服务器组成的服务器集群,或者是一个云计算服务中心。在实际实现时,通信服务器160是物理机、虚拟机、物理机集群或者虚拟机集群。通信服务器160通过无线网络方式或者有线网络方式与转换服务器140建立通信连接。
在实际实现时,通常情况下终端设备120向转换服务器140请求转换的镜像文件不会是实时发送至转换服务器140的,可选的,该系统中还包括:镜像库180,如图2所示。镜像库180用于存储用户上传的镜像文件,则转换服务器140在需要对某一镜像文件进行转换时,直接从镜像库180中获取该镜像文件,则转换服务器140将转换后的镜像文件返回给终端设备120或者返回至镜像库180中。
由于镜像文件的文件大小通常较大,可选地,镜像库180是具有较强的存储能力和存储可靠性的设备,可选的,镜像库180是基于对象存储服务(Object Storage Service)的存储设备,可选的,镜像库180是对象存储系统(Object Storage System),则镜像库180通过有线网络或者无线网络的方式与转换服务器140建立通信连接。镜像库180中包括大量用于存储数据的存储单元,在对象存储系统中,存储单元为对象(Object)181,对象181用于存储镜像文件。
可选的,镜像库180可被替代实现为基于文件存储的存储设备,可选的,镜像库180是网络附属存储(Network Attached Storage,NAS),则镜像库180通过以太网与转换服务器140相连。NAS中的存储单元为诸如磁盘和磁盘阵列之类的存储介质。
可选的,镜像库180可被替代实现为转换服务器140的本地存储,则镜像库180与转换服务器140之间通过输入/输出(I/O)接口相连。本地存储中的存储单元为诸如磁盘和磁盘阵列之类的存储介质。
可选的,镜像库180可被替代实现为针对共享块存储的存储区域网络(Storage Area Network,SAN),则镜像库180与转换服务器140之间通过光纤通道(Fibre Channel,FC)相连。SAN中的存储单元为诸如磁盘和磁盘阵列之类的存储介质。
请参考图3,其示出了本公开一个示例性实施例提供的镜像文件转换方法 的流程图,本实施例以该方法应用于图1或图2所示的转换服务器中进行举例说明,该方法包括:
步骤301,转换服务器获取虚拟机在原始平台中的原始镜像文件。
虚拟机是通过软件模拟的具有完整硬件系统功能的虚拟的计算机系统,虚拟机运行在某一个平台中,平台是用于为虚拟机提供运行环境和运行资源的计算机系统,平台为虚拟机提供的运行资源包括实例和内存等。可选的,平台包括数据中心和云平台中的至少一种,云平台包括公有云平台和私有云平台中的至少一种。比如,虚拟机运行于Hadoop云平台。
虚拟机的镜像文件中包括虚拟机的操作系统、各类应用程序以及虚拟机运行时必要的配置信息,在本发明实施例中,配置信息包括虚拟机在该平台中运行时使用的驱动程序,则原始镜像文件中的配置信息包括的是虚拟机在原始平台中运行时使用的驱动程序。
步骤302,转换服务器检测原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征。
其中,第一文件特征包括:虚拟机在目标平台中运行时使用的目标驱动程序,第二文件特征包括:目标平台支持的目标文件格式。
步骤303,当原始镜像文件不具备第一文件特征和第二文件特征中的至少一种文件特征时,转换服务器通过调用预定接口对原始镜像文件进行修改,得到虚拟机在目标平台中的目标镜像文件,目标镜像文件具备第一文件特征和第二文件特征。
原始平台和目标平台是不同的云平台,具体的,同一个虚拟机在原始平台和目标平台中运行时使用的驱动程序不同,和/或,原始平台和目标平台支持的文件格式不同。在本发明各个实施例中,原始平台是传统的数据中心,目标平台是诸如公有云平台和私有云平台之类的云平台;或者,原始平台和目标平台是不同的云平台。原始平台和目标平台是不同的云平台包括:原始平台和目标平台所属的云平台的类型不同,比如,原始平台是私有云平台,目标平台是公有云平台;或者,原始平台和目标平台是同一类型的不同商家开发的云平台,比如,原始平台是商家A开发的公有云平台,目标平台是商家B开发的公有云平台。
综上所述,本发明实施例提供的镜像文件转换方法,转换服务器在检测到原始镜像文件不具备与目标平台对应的至少一个文件特征时,表示该原始镜像 文件无法直接在目标平台中使用,此时转换服务器通过调用预定接口直接对原始镜像文件进行修改,就能转换得到虚拟机在目标平台中的目标镜像文件,使虚拟机在目标平台中正常运行,而不需要将原始镜像文件启动为虚拟机后再进行修改,节约了资源,提高了镜像文件转换时的效率。
请参考图4,其示出了本公开一个示例性实施例提供的镜像文件转换方法的流程图,本实施例以该方法应用于图1或图2所示的转换服务器中,且原始镜像文件不具备第一文件特征和第二文件特征为例进行举例说明,该方法包括:
步骤401,转换服务器接收终端设备发送的镜像文件转换请求。
可选的,转换服务器直接接收终端设备发送的镜像文件转换请求,如图1所示;或者,接收通信服务器转发的镜像文件转换请求,如图2所示。
步骤402,转换服务器根据镜像文件转换请求获取虚拟机在原始平台中的原始镜像文件。
当该方法应用于图1或图2所示的系统中时,可选的,镜像文件转换请求中包括原始镜像文件,转换服务器获取镜像文件转换请求中的原始镜像文件。
当该方法应用于图2所示的系统中时,可选的,镜像文件转换请求中包括原始镜像文件的文件标识,转换服务器根据文件标识从镜像库中获取原始镜像文件。
可选的,文件标识是原始镜像文件的文件名,则镜像库中存储有文件名与镜像文件的对应关系。考虑到在实际实现时,镜像文件的文件名可能存在重复,因此,文件标识还可选包括与原始镜像文件对应的用户标识,用户标识是将该原始镜像文件存储至镜像库的用户的用户标识,则镜像库中存储有文件名、用户标识与镜像文件的对应关系。可选的,用户标识是用户帐号。
在实际实现时,用户在终端设备中登录用户帐号后,通过终端设备将原始镜像文件存储至镜像库,则镜像库中存储有“用户帐号+原始镜像文件的文件名”与原始镜像文件的对应关系;当用户请求对该原始镜像文件进行转换时,用户登录用户帐号,并向转换服务器发送镜像文件转换请求,镜像文件转换请求中携带有用户登录的用户帐号,以及用户请求转换的原始镜像文件的文件名。
比如,用户在终端设备中登录用户帐号A,并通过终端设备预先将文件名B的原始镜像文件M存储至镜像库中,则镜像库中存储有“用户帐号A+文件名B”与原始镜像文件M的对应关系;当用户登录用户帐号A并请求对文件名B 的镜像文件进行转换时,转换服务器接收到的镜像文件转换请求中包括有用户帐号A和文件名B,则转换服务器从镜像库中获取原始镜像文件M。
步骤403,转换服务器通过调用第一预定接口访问原始镜像文件确定原始镜像文件中的操作系统的操作系统类型。
可选的,本发明实施例中的操作系统类型用于指示操作系统所属的操作系统系列,比如,操作系统类型是Windows。则可选的,同一个操作系统系列中的不同系统版本的操作系统对应的操作系统类型相同,比如,Windows 7操作系统和Window 10操作系统对应的操作系统类型都为Windows。
可选的,本发明实施例中的操作系统类型用于指示操作系统所属的操作系统系列和系统版本,比如,操作系统类型是Linux SUSE。则可选的,同一个操作系统系列中的不同系统版本的操作系统具有各自对应的操作系统类型,不同系统版本的操作系统对应的操作系统类型不同,比如,Linux SUSE操作系统对应的操作系统类型为Linux SUSE,Linux Ubuntu操作系统对应的操作系统类型为Linux Ubuntu,两个操作系统类型不同。
本发明实施例以操作系统类型用于指示操作系统所属的操作系统系列为例进行说明。
通常情况下,相同类型的操作系统的操作系统信息都是存储在相同的默认目录下,不同类型的操作系统中用于存储操作系统信息的默认目录不同。
比如,Linux系列的操作系统中,操作系统信息存储在/etc/release下;Windows系列的操作系统中,操作系统信息存储在Windows系统的注册表HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion下,且Windows系列的操作系统中不包括/etc/release这一目录。
转换服务器通过调用第一预定接口在不将镜像文件启动为虚拟机的情况下,直接访问原始镜像文件中的内容,确定操作系统类型。可选的,转换服务器中安装有libguestfs工具集,第一预定接口包括libguestfs工具集中包含的工具对应的接口。其中,libguestfs工具集是一组应用程序编程接口(Application Programming Interface,API),该工具集内包含的工具有virt-cat、virt-df、virt-ls、virt-copy-in、virt-copy-out、virt-edit、guestfs、guestmount、virt-list-filesystems和virt-list-partitions等。可选的,第一预定接口还包括chntpw工具对应的接口,chntpw工具用于修改Windows系列的操作系统的系统密码以读取操作系统的注册表。
在实际实现时,转换服务器在确定操作系统类型之前,先通过调用guestmount工具对应的接口将原始镜像文件挂载到转换服务器上,以便转换服务器对原始镜像文件进行访问和处理。
可选的,转换服务器中存储有操作系统类型与操作系统目录的对应关系,操作系统目录是用于存储操作系统信息的默认目录。转换服务器在通过调用第一预定接口访问原始镜像文件确定操作系统类型时,包括如下两种实现方式:
在第一种可能的实现方式中,转换服务器通过调用第一预定接口扫描原始镜像文件中的各个目录,当扫描到原始镜像文件中包括与某一种操作系统类型对应的操作系统目录时,确定操作系统类型是与该操作系统目录对应的操作系统类型。
比如,转换服务器中存储有操作系统类型Linux与操作系统目录/etc/release的对应关系,以及存储有操作系统类型Windows与操作系统目录HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion的对应关系。则当转换服务器通过调用第一预定接口扫描到原始镜像文件中包括/etc/release时,确定原始镜像文件中的操作系统的操作系统类型是Linux,在该例子中,第一预定接口是guestfs工具对应的接口。当转换服务器通过调用第一预定接口扫描到原始镜像文件中包括HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion时,确定原始镜像文件中的操作系统的操作系统类型是Windows,在该例子中,第一预定接口是chntpw工具对应的接口。
在第二种实现方式中,转换服务器通过调用第一预定接口扫描原始镜像文件中的各个目录,当扫描到原始镜像文件中包括与某一种操作系统类型对应的操作系统目录时,读取该操作系统目录下存储的操作系统信息,确定操作系统信息中包括的操作系统类型,操作系统信息还包括操作系统的版本号和操作系统位数等,本实施例对此不做赘述。
比如,在上述示例性的例子中,转换服务器在扫描到原始镜像文件中包括/etc/release时,读取该目录下的操作系统信息,该操作系统信息中包括操作系统类型为Linux。
步骤404,转换服务器确定与操作系统类型和目标平台对应的目标驱动程序。
可选的,对于在同一个目标平台中运行的至少两个虚拟机,当至少两个虚 拟机各自采用的操作系统的操作系统类型不同时,该至少两个虚拟机在该目标平台中运行时使用的目标驱动程序不同;对于采用相同的操作系统类型的至少两个虚拟机来讲,虚拟机在不同的目标平台中运行时使用的目标驱动程序也不同。
在一种可能的实现方式中,转换服务器接收终端设备发送的目标平台标识;或者,转换服务器接收到的镜像文件转换请求中包括目标平台标识,该目标平台标识用于在各个平台中唯一性地标识目标平台。
在该实现方式中,转换服务器中存储有操作系统类型、目标平台标识和目标驱动程序的对应关系,则转换服务器在识别得到操作系统类型,以及确定镜像文件转换请求中的目标平台标识后,查询与目标平台和操作系统类型对应的目标驱动程序。
比如,当操作系统类型用于指示操作系统所属的操作系统系时,转换服务器中存储的操作系统类型、目标平台标识和目标驱动程序的对应关系如下表一所示:
表一
操作系统类型 目标平台标识 目标驱动程序
Linux 平台标识1 驱动程序1
Windows 平台标识1 驱动程序2
Linux 平台标识2 驱动程序3
在该示例性的例子中,当转换服务器确定的原始镜像文件的操作系统类型为Linux,目标平台标识为平台标识1时,确定目标驱动程序为驱动程序1。表一所示的内容和形式都是示例性的。在实际的实施例中,对于一组操作系统类型和目标平台标识来讲,目标驱动程序通常为多个,每个目标驱动程序对应一个或一类型的硬件设备。
再比如,当操作系统类型用于指示操作系统所属的操作系统系列和系统版本时,转换服务器中存储的操作系统类型、目标平台标识和目标驱动程序的对应关系可以如下表二所示:
表二
操作系统类型 目标平台标识 目标驱动程序
Linux SUSE 平台标识1 驱动程序1
Windows 平台标识1 驱动程序2
Linux Ubuntu 平台标识1 驱动程序3
在该示例性的例子中,当转换服务器确定的原始镜像文件的操作系统类型为Linux SUSE,目标平台标识为平台标识1时,转换服务器确定目标驱动程序为驱动程序1。表二所示的内容和形式都是示例性的。
在另一种可能的实现方式中,转换服务器是与某一个默认的目标平台对应的转换服务器,则转换服务器用于将原始镜像文件转换为该默认的目标平台中的镜像文件。在该实现方式中,由于目标平台是确定的,则转换服务器中存储操作系统类型与目标驱动程序的对应关系,转换服务器查询确定得到的操作系统类型对应的目标驱动程序。
步骤405,转换服务器检测原始驱动程序是否与目标驱动程序相同。
通常情况下,不同类型的操作系统的驱动程序存储在不同的驱动目录下,而相同类型的操作系统的驱动程序存储在相同的驱动目录下,驱动目录是具有操作系统类型的操作系统的驱动程序所在的默认目录。比如,Linux系列的操作系统中用于存储驱动程序的驱动目录为/opt/pvdriver;而Windows系列的操作系统中用于存储驱动程序的驱动目录为C:\Program Files。
转换服务器中存储有操作系统类型与驱动目录的对应关系,则可选的,转换服务器根据原始镜像文件中的操作系统的操作系统类型确定原始镜像文件中的驱动目录。转换服务器在确定原始镜像文件中包括的操作系统的操作系统类型后,查询该对应关系确定与操作系统类型对应的驱动目录,原始镜像文件中存储在该驱动目录下的文件即为原始驱动程序,转换服务器检测获取到原始驱动程序与确定得到的目标驱动程序是否相同。比如,当转换服务器确定操作系统类型是Windows类型时,确定驱动目录是C:\Program Files,获取该驱动目录下的文件即为原始驱动程序。
步骤406,当原始驱动程序与目标驱动程序不同时,转换服务器确定原始镜像文件不具备第一文件特征。
步骤407,当原始镜像文件不具备第一文件特征时,转换服务器通过调用第一预定接口将原始镜像文件中的原始驱动程序替换为目标驱动程序。
步骤407包括如下几个步骤,如图5所示:
步骤501,转换服务器根据原始镜像文件中的操作系统的操作系统类型确 定原始镜像文件中的驱动目录。
在实际实现时,由于上述步骤405中,转换服务器在检测原始驱动程序与目标驱动程序是否相同时,也需要确定原始镜像文件中的驱动目录,则该步骤与上述步骤405中确定驱动目录的步骤实现成为同一个步骤。
步骤502,转换服务器通过调用第一预定接口将驱动目录下的原始驱动程序替换为目标驱动程序。
具体的,转换服务器调用第一预定接口将驱动目录下的原始驱动程序删除,并在该驱动目录下写入目标驱动程序,该第一预定接口的含义与上述步骤403中相同,本实施例对此不再赘述。
在实际实现时,转换服务器还可选的通过调用第一预定接口对原始镜像文件中的其他文件进行读取和/或删减等操作,本实施对此不做限定。
另外,在其他可选的实施方式中,若原始镜像文件中包括索引文件,转换服务器可选的不通过确定驱动目录的方式修改原始驱动程序,而是根据索引文件进行修改。索引文件中包括原始镜像文件中的各个文件的偏移量和占用字节数,其中偏移量指的是该文件的起始字节位置在整个原始镜像文件中的位置。比如,索引文件中包括原始驱动程序的偏移量为1000,占用字节数为2000,则表示原始驱动程序在原始镜像文件中的第1000个字节开始的位置,占用2000个字节长度,也即原始镜像文件中的第1000-2999字节之间的文件为原始驱动程序,则转换服务器根据索引文件将第1000-2999字节的文件进行删除,再将目标驱动程序写入至第1000-2999字节处,即实现了将原始驱动程序替换为目标驱动程序。
当原始驱动程序与目标驱动程序相同,转换服务器确定原始镜像文件具备第一文件特征,此时在一种可能的实现方式中,转换服务器直接执行下列步骤408,本发明实施例对此不做限定。
步骤408,转换服务器确定目标平台支持的目标文件格式。
通常情况下,不同的平台支持的文件格式是不同的,常见的镜像文件的文件格式有Raw(Raw image)格式、QCOW(QEMU(Quick Emulator)Copy-On-Write)格式、QCOW2格式和VMDK(Virtual Machine Disk)格式。
在一种可能的实现方式中,转换服务器用于将镜像文件转换为多个不同的平台中的镜像文件,则可选的转换服务器中存储有目标平台标识与目标文件格式的对应关系。比如,存储有目标平台标识A标识的目标平台支持Raw格式, 目标平台标识B标识的目标平台存储QCOW2格式。则转换服务器查询目标平台标识与目标文件格式的对应关系确定与接收到的目标平台标识对应的目标文件格式。
在另一种可能的实现方式中,转换服务器是与某一个默认的平台对应的转换服务器,则通常情况下目标文件格式是预先设定好的,即为该默认的平台支持的文件格式,转换服务器直接确定预先设定好的目标文件格式。
步骤409,转换服务器检测原始镜像文件的原始文件格式是否与目标文件格式相同。
步骤410,当原始文件格式与目标文件格式不同时,转换服务器确定原始镜像文件不具备第二文件特征。
步骤411,当原始镜像文件不具备第二文件特征时,转换服务器通过调用第二预定接口将原始镜像文件的原始文件格式修改为目标文件格式,得到虚拟机在目标平台中的目标镜像文件。
可选的,转换服务器中安装有QEMU-IMG命令行工具,第二预定接口是QEMU-IMG命令行工具对应的接口。其中,QEMU-IMG命令行工具是快速虚拟机(QEMU)的磁盘管理工具,转换服务器通过QEMU-IMG命令行工具中的convert命令将原始镜像文件的原始文件格式修改为目标文件格式。第二预定接口还可选的是Image Copy工具对应的接口,本发明实施例仅以第二预定接口是QEMU-IMG命令行工具对应的接口为例进行说明。
转换服务器在通过调用第二预定接口修改原始文件格式时常用的命令行为:convert[-c][-f fmt][-O output_fmt][-o options]filename[filename2[…]]output_filename,该命令行表示将原始文件格式为fmt格式的镜像文件修改为目标文件格式为output_fmt格式的镜像文件。该命令行中的-c命令表示对修改后的具有目标文件格式的镜像文件压缩;参数filename表示具有原始文件格式的镜像文件的文件名;参数output_filename表示具有目标文件格式的镜像文件的文件名;参数options表示在修改原始文件格式时所使用的其他参数,本实施例对此不作赘述。
当原始文件格式与目标文件格式相同时,在一种可能的实现方式中,转换服务器直接确定包括目标驱动程序的原始镜像文件即为虚拟机在目标平台中的目标镜像文件,本发明实施例对此不做限定。
需要说明的是,当原始镜像文件不具备第一文件特征和第二文件特征时, 也即转换服务器需要对原始镜像文件中的原始驱动程序以及原始镜像文件的原始文件格式进行修改时,为了避免对原始镜像文件的原始文件格式修改后,无法正确找到原始镜像文件中的驱动目录,因此在实际实现时,转换服务器通常是先对原始驱动程序进行修改,再对原始文件格式进行修改。
在实际实现时,转换服务器除了对原始镜像文件的原始驱动程序进行修改和/或对原始文件格式进行修改之外,还对原始镜像文件中的系统配置信息进行修改,比如,对注册表启动项进行修改;而通常情况下,具有相同类型的操作系统的虚拟机在同一个平台中运行时所需的系统配置信息是相同的,则转化服务器中存储有操作系统类型、目标平台标识和系统配置信息的对应关系,转换服务器查询与操作系统类型和目标平台标识对应的目标系统配置信息,将系统配置信息修改为与目标系统配置信息相同。
以图2所示的系统为例,则本实施例提供的镜像文件转换方法的通信示意图如图6所示。
综上所述,本发明实施例提供的镜像文件转换方法,转换服务器在检测到原始镜像文件不具备与目标平台对应的至少一个文件特征时,表示该原始镜像文件无法直接在目标平台中使用,此时转换服务器通过调用预定接口直接对原始镜像文件进行修改,就能转换得到虚拟机在目标平台中的目标镜像文件,使虚拟机在目标平台中正常运行,而不需要将原始镜像文件启动为虚拟机后再进行修改,节约了资源,提高了镜像文件转换时的效率。
本发明实施例提供的镜像文件转换方法,由转换服务器确定目标平台对应的文件特征,并自动根据目标平台使用的目标驱动程序修改原始镜像文件中的驱动程序,和/或自动根据目标平台支持的目标文件格式修改原始镜像文件的原始文件格式,而不需要由专门的工程师手动修改原始驱动程序和原始文件格式,提高了镜像文件转换时的效率,也减少了人工操作过程中出错的机会。
本发明实施例提供的镜像文件转换方法,由转换服务器自动识别原始镜像文件中的操作系统的操作系统类型,而不需要由用户手动输入操作系统类型,避免用户手动输入的操作系统类型错误而导致镜像文件转换错误。
可选的,转换服务器在通过上述图3-图5任一实施例提供的镜像文件转换方法得到目标镜像文件后,将原始镜像文件返回给终端设备,或者,返回至镜像库。
在第一种可能的实现方式中,转换服务器获取终端设备发送的镜像文件转换请求中的原始镜像文件,则可选的,转换服务器在接收到终端设备发送的原始镜像文件后,还暂存终端设备的设备标识与原始镜像文件的对应关系,转换服务器在转换得到目标镜像文件后,根据设备标识将目标镜像文件返回给终端设备。可选的,设备标识包括终端设备的国际移动设备标识(International Mobile Equipment Identity,IMEI)、媒体访问控制(Media Access Control,MAC)地址、互联网协议(Intemet Protocol,IP)地址,以及国际移动客户识别码(International Mobile Subscriber Identification Number,IMSI)中的至少一种。
在第二种可能的实现方式中,转换服务器根据镜像文件转换请求中的文件标识从镜像库中获取原始镜像文件,则可选的,转换服务器在根据文件标识从镜像库中获取原始镜像文件,并将原始镜像文件转换为目标镜像文件后,转换服务器将文件标识与目标镜像文件发送至镜像库,由目标镜像文件替换镜像库中存储的与文件标识对应的原始镜像文件;或者,转换服务器生成与目标镜像文件对应的新的文件标识,将新的文件标识和目标镜像文件的对应关系发送至镜像库,在镜像库中存储新的文件标识与目标镜像文件的对应关系;在实际实现时,新的文件标识包括的新的文件名与原始镜像文件的文件名不同,但通常情况下新的文件标识包括的用户标识与原始镜像文件对应的文件标识中的用户标识相同。在该可能的实现方式中,转换服务器还可选的直接将目标镜像文件返回给发送镜像文件转换请求的终端设备,其实现方式请参考上述第一种可能的实现方式,本实施例对此不再赘述。
请参考图7,其示出了本发明一个示例性实施例提供的转换服务器的结构示意图,该转换服务器包括:处理器710、存储器720和总线730。
处理器710包括一个或者一个以上处理核心,处理器710通过运行软件程序以及模块,从而执行各种功能应用以及信息处理。
存储器720通过总线730与处理器710相连,存储器720用于存储指令,处理器710通过执行存储器720中存储的指令实现上述镜像文件转换方法。
此外,存储器720由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随时存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
可选的,该转换服务器还包括接收器740和发射器750,接收器740和发射器750均与服务器710相连,接收器740和发射器750实现为通信组件。可选的,该通信组件包括网络端口,转换服务器通过该网络端口使用有线网络方式与终端设备、通信服务器以及其他设备建立通信连接,可选的,转换服务器中包括至少两个网络端口。可选的,该通信组件包括通信芯片,通信芯片中包括接收模块、发射模块和调制解调模块等,用于对信息进行调制解调,并通过无线信号接收或发送信息,转换服务器通过该通信芯片使用无线网络方式与终端设备建立通信连接。
请参考图8,其示出了本发明一个实施例提供的镜像文件转换装置的框图,该镜像文件转换装置通过软件、硬件或者两者的结合实现成为转换服务器的全部或者一部分,该镜像文件转换装置包括:
获取单元810,用于执行上述步骤301、步骤401、步骤402。
检测单元820,用于执行上述步骤302、步骤403、步骤404、步骤405、步骤406、步骤408、步骤409以及步骤410。
处理单元830,用于执行上述步骤303、步骤407、步骤501、步骤502以及步骤411。
在实际实现时,图8所示的转换服务器用于实现上述各个实施例提供的镜像文件转换方法,转换服务器在获取信息时,都可以由上述获取单元810实现;转换服务器在执行检测操作时,都可以由上述检测单元820实现;转换服务器在执行处理操作时,都可以由上述处理单元830实现。
应当理解的是,在本文中使用的“和/或”是指包括一个或者一个以上相关联地列出的项目的任意和所有可能组合。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的 保护范围之内。

Claims (21)

  1. 一种镜像文件转换方法,其特征在于,所述方法包括:
    获取虚拟机在原始平台中的原始镜像文件;
    检测所述原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征,所述第一文件特征包括:所述虚拟机在所述目标平台中运行时使用的目标驱动程序,所述第二文件特征包括:所述目标平台支持的目标文件格式;
    当所述原始镜像文件不具备所述第一文件特征和所述第二文件特征中的至少一种文件特征时,通过调用预定接口对所述原始镜像文件进行修改,得到所述虚拟机在所述目标平台中的目标镜像文件,所述目标镜像文件具备所述第一文件特征和所述第二文件特征。
  2. 根据权利要求1所述的方法,其特征在于,所述当所述原始镜像文件不具备所述第一文件特征和所述第二文件特征中的至少一种文件特征时,通过调用预定接口对所述原始镜像文件进行修改,包括:
    当所述原始镜像文件不具备所述第一文件特征时,通过调用第一预定接口将所述原始镜像文件中的原始驱动程序替换为所述目标驱动程序。
  3. 根据权利要求2所述的方法,其特征在于,所述通过调用第一预定接口将所述原始镜像文件中的原始驱动程序替换为所述目标驱动程序,包括:
    根据所述原始镜像文件中的操作系统的操作系统类型确定所述原始镜像文件中的驱动目录,所述驱动目录是具有所述操作系统类型的操作系统的驱动程序所在的默认目录;
    通过调用所述第一预定接口将所述驱动目录下的所述原始驱动程序替换为所述目标驱动程序。
  4. 根据权利要求1至3任一所述的方法,其特征在于,所述检测所述原始镜像文件是否具备与目标平台对应的第一文件特征,包括:
    通过调用第一预定接口访问所述原始镜像文件确定所述原始镜像文件中的操作系统的操作系统类型;
    确定与所述操作系统类型和所述目标平台对应的所述目标驱动程序;
    检测所述原始驱动程序是否与所述目标驱动程序相同;
    当所述原始驱动程序与所述目标驱动程序不同时,确定所述原始镜像文件不具备所述第一文件特征。
  5. 根据权利要求1所述的方法,其特征在于,所述当所述原始镜像文件不具备所述第一文件特征和所述第二文件特征中的至少一种文件特征时,通过调用预定接口对所述原始镜像文件进行修改,包括:
    当所述原始镜像文件不具备所述第二文件特征时,通过调用第二预定接口将所述原始镜像文件的原始文件格式修改为所述目标文件格式。
  6. 根据权利要求5所述的方法,其特征在于,所述检测所述原始镜像文件是否具备与所述目标平台对应的第二文件特征,包括:
    确定所述目标平台支持的所述目标文件格式;
    检测所述原始文件格式是否与所述目标文件格式相同;
    当所述原始文件格式与所述目标文件格式不同时,确定所述原始镜像文件不具备所述第二文件特征。
  7. 根据权利要求1所述的方法,其特征在于,所述获取虚拟机在原始平台中的原始镜像文件,包括:
    从镜像库中获取所述原始镜像文件,所述镜像库用于存储用户上传的镜像文件。
  8. 一种镜像文件转换装置,其特征在于,所述装置包括:
    获取单元,用于获取虚拟机在原始平台中的原始镜像文件;
    检测单元,用于检测所述原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征,所述第一文件特征包括:所述虚拟机在所述目标平台中运行时使用的目标驱动程序,所述第二文件特征包括:所述目标平台支持的目标文件格式;
    处理单元,用于当所述原始镜像文件不具备所述第一文件特征和所述第二文件特征中的至少一种文件特征时,通过调用预定接口对所述原始镜像文件进行修改,得到所述虚拟机在所述目标平台中的目标镜像文件,所述目标镜像文 件具备所述第一文件特征和所述第二文件特征。
  9. 根据权利要求8所述的装置,其特征在于,所述处理单元,还用于:
    当所述原始镜像文件不具备所述第一文件特征时,通过调用第一预定接口将所述原始镜像文件中的原始驱动程序替换为所述目标驱动程序。
  10. 根据权利要求9所述的装置,其特征在于,所述处理单元,还用于:
    根据所述原始镜像文件中的操作系统的操作系统类型确定所述原始镜像文件中的驱动目录,所述驱动目录是具有所述操作系统类型的操作系统的驱动程序所在的默认目录;
    通过调用所述第一预定接口将所述驱动目录下的所述原始驱动程序替换为所述目标驱动程序。
  11. 根据权利要求8至10任一所述的装置,其特征在于,所述检测单元,还用于:
    通过调用第一预定接口访问所述原始镜像文件确定所述原始镜像文件中的操作系统的操作系统类型;
    确定与所述操作系统类型和所述目标平台对应的所述目标驱动程序;
    检测所述原始驱动程序是否与所述目标驱动程序相同;
    当所述原始驱动程序与所述目标驱动程序不同时,确定所述原始镜像文件不具备所述第一文件特征。
  12. 根据权利要求8所述的装置,其特征在于,所述处理单元,还用于:
    当所述原始镜像文件不具备所述第二文件特征时,通过调用第二预定接口将所述原始镜像文件的原始文件格式修改为所述目标文件格式。
  13. 根据权利要求12所述的装置,其特征在于,所述检测单元,还用于:
    确定所述目标平台支持的所述目标文件格式;
    检测所述原始文件格式是否与所述目标文件格式相同;
    当所述原始文件格式与所述目标文件格式不同时,确定所述原始镜像文件不具备所述第二文件特征。
  14. 根据权利要求8所述的装置,其特征在于,
    所述获取单元,用于从镜像库中获取所述原始镜像文件,所述镜像库用于存储用户上传的镜像文件。
  15. 一种转换服务器,其特征在于,所述转换服务器包括:处理器,以及与处理器相连的存储器,所述存储器用于存储一个或者一个以上的指令,所述指令被配置为由所述处理器执行:
    所述处理器,用于获取虚拟机在原始平台中的原始镜像文件;
    所述处理器,还用于检测所述原始镜像文件是否具备与目标平台对应的第一文件特征和第二文件特征,所述第一文件特征包括:所述虚拟机在所述目标平台中运行时使用的目标驱动程序,所述第二文件特征包括:所述目标平台支持的目标文件格式;
    所述处理器,还用于当所述原始镜像文件不具备所述第一文件特征和所述第二文件特征中的至少一种文件特征时,通过调用预定接口对所述原始镜像文件进行修改,得到所述虚拟机在所述目标平台中的目标镜像文件,所述目标镜像文件具备所述第一文件特征和所述第二文件特征。
  16. 根据权利要求15所述的转换服务器,其特征在于,所述处理器,还用于:
    当所述原始镜像文件不具备所述第一文件特征时,通过调用第一预定接口将所述原始镜像文件中的原始驱动程序替换为所述目标驱动程序。
  17. 根据权利要求16所述的转换服务器,其特征在于,所述处理器,还用于:
    根据所述原始镜像文件中的操作系统的操作系统类型确定所述原始镜像文件中的驱动目录,所述驱动目录是具有所述操作系统类型的操作系统的驱动程序所在的默认目录;
    通过调用所述第一预定接口将所述驱动目录下的所述原始驱动程序替换为所述目标驱动程序。
  18. 根据权利要求15至17任一所述的转换服务器,其特征在于,所述处理器,还用于:
    通过调用第一预定接口访问所述原始镜像文件确定所述原始镜像文件中的操作系统的操作系统类型;
    确定与所述操作系统类型和所述目标平台对应的所述目标驱动程序;
    检测所述原始驱动程序是否与所述目标驱动程序相同;
    当所述原始驱动程序与所述目标驱动程序不同时,确定所述原始镜像文件不具备所述第一文件特征。
  19. 根据权利要求15所述的转换服务器,其特征在于,所述处理器,还用于:
    当所述原始镜像文件不具备所述第二文件特征时,通过调用第二预定接口将所述原始镜像文件的原始文件格式修改为所述目标文件格式。
  20. 根据权利要求19所述的转换服务器,其特征在于,所述处理器,还用于:
    确定所述目标平台支持的所述目标文件格式;
    检测所述原始文件格式是否与所述目标文件格式相同;
    当所述原始文件格式与所述目标文件格式不同时,确定所述原始镜像文件不具备所述第二文件特征。
  21. 根据权利要求15所述的转换服务器,其特征在于,
    所述处理器,还用于从镜像库中获取所述原始镜像文件,所述镜像库用于存储用户上传的镜像文件。
PCT/CN2016/106262 2016-11-17 2016-11-17 镜像文件转换方法及装置 WO2018090290A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
EP20209495.9A EP3842930A1 (en) 2016-11-17 2016-11-17 Image file conversion method and apparatus
PCT/CN2016/106262 WO2018090290A1 (zh) 2016-11-17 2016-11-17 镜像文件转换方法及装置
CN201680003656.6A CN107004032B (zh) 2016-11-17 2016-11-17 镜像文件转换方法及装置
EP16909067.7A EP3425501B1 (en) 2016-11-17 2016-11-17 Mirror image file conversion method and apparatus
US15/921,929 US11243792B2 (en) 2016-11-17 2018-03-15 Image file conversion method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/106262 WO2018090290A1 (zh) 2016-11-17 2016-11-17 镜像文件转换方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/921,929 Continuation US11243792B2 (en) 2016-11-17 2018-03-15 Image file conversion method and apparatus

Publications (1)

Publication Number Publication Date
WO2018090290A1 true WO2018090290A1 (zh) 2018-05-24

Family

ID=59431584

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/106262 WO2018090290A1 (zh) 2016-11-17 2016-11-17 镜像文件转换方法及装置

Country Status (4)

Country Link
US (1) US11243792B2 (zh)
EP (2) EP3842930A1 (zh)
CN (1) CN107004032B (zh)
WO (1) WO2018090290A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111859630A (zh) * 2020-06-30 2020-10-30 山东云海国创云计算装备产业创新中心有限公司 一种图像压缩仿真验证方法、装置、设备及可读存储介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019042546A1 (en) * 2017-08-30 2019-03-07 Huawei Technologies Co., Ltd. METHOD FOR IMPROVING THE ROBUSTNESS OF A MICROPROGRAM UPDATE IN PLACE
WO2019110510A1 (en) * 2017-12-04 2019-06-13 British Telecommunications Public Limited Company Portable virtual machine image
CN108108229B (zh) * 2018-01-05 2021-08-06 京东方科技集团股份有限公司 虚拟主机迁移系统、方法、计算机设备、可读存储介质
CN109325012A (zh) * 2018-08-08 2019-02-12 国云科技股份有限公司 一种修改虚拟机镜像分区的方法
CN109298894B (zh) * 2018-09-26 2022-03-04 四川巧夺天工信息安全智能设备有限公司 一种提取qcow镜像文件的方法
CN109522088A (zh) * 2018-09-30 2019-03-26 华为技术有限公司 一种虚拟机迁移方法及装置
US11231953B2 (en) * 2019-08-21 2022-01-25 Red Hat, Inc. Minimizing downtime when importing virtual machines from other platforms
CN110704148B (zh) * 2019-09-20 2023-09-05 广州虎牙科技有限公司 设备页面元素的获取方法、装置、服务器及存储介质
CN113407294A (zh) * 2020-03-16 2021-09-17 华为技术有限公司 一种虚拟机迁移方法及相关设备
US11875172B2 (en) * 2020-09-28 2024-01-16 VMware LLC Bare metal computer for booting copies of VM images on multiple computing devices using a smart NIC
CN112631737B (zh) * 2021-01-08 2023-11-17 重庆紫光华山智安科技有限公司 容器镜像构建方法、装置、电子设备及存储介质
CN113434139A (zh) * 2021-06-23 2021-09-24 平安普惠企业管理有限公司 一种图像打包的处理方法、装置、服务器及存储介质
US11445009B1 (en) * 2021-10-13 2022-09-13 International Business Machines Corporation Managing proprietary structured objects
US11899594B2 (en) 2022-06-21 2024-02-13 VMware LLC Maintenance of data message classification cache on smart NIC
US11928367B2 (en) 2022-06-21 2024-03-12 VMware LLC Logical memory addressing for network devices

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100174943A1 (en) * 2009-01-07 2010-07-08 Lenovo (Beijing) Limited Method for restoring client operating system-based system, virtual machine manager and system using the same
CN103530144A (zh) * 2013-09-04 2014-01-22 国云科技股份有限公司 一种从遗留系统生成虚拟机镜像的方法
CN105159760A (zh) * 2014-05-27 2015-12-16 中国电信股份有限公司 云资源迁移方法和统一的跨平台云资源迁移能力开放接口
CN105260226A (zh) * 2015-09-23 2016-01-20 浙江网新恒天软件有限公司 一种基于云平台自动迁移虚拟机的方法
CN105573830A (zh) * 2014-10-09 2016-05-11 中国银联股份有限公司 一种虚拟机迁移方法

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209680B1 (en) * 2003-04-11 2012-06-26 Vmware, Inc. System and method for disk imaging on diverse computers
US7334157B1 (en) * 2004-02-26 2008-02-19 Symantec Operating Corporation Restore of data to a computer system having different hardware
US7330967B1 (en) * 2004-12-03 2008-02-12 Symantec Operating Corporation System and method for injecting drivers and setup information into pre-created images for image-based provisioning
US8069341B2 (en) * 2007-06-29 2011-11-29 Microsoft Corporation Unified provisioning of physical and virtual images
US7383327B1 (en) * 2007-10-11 2008-06-03 Swsoft Holdings, Ltd. Management of virtual and physical servers using graphic control panels
CN101465770B (zh) 2009-01-06 2011-04-06 北京航空航天大学 入侵检测系统部署方法
US8301874B1 (en) 2009-10-20 2012-10-30 Wanova Technologies, Ltd. Atomic switching of images in desktop streaming over wide area networks
US8352415B2 (en) * 2010-06-15 2013-01-08 International Business Machines Corporation Converting images in virtual environments
US9326001B2 (en) * 2011-03-22 2016-04-26 International Business Machines Corporation Scalable image distribution in virtualized server environments
CN102521063B (zh) * 2011-11-30 2013-12-25 广东电子工业研究院有限公司 一种适用于虚拟机迁移和容错的共享存储方法
TWI515658B (zh) 2011-12-07 2016-01-01 萬國商業機器公司 用於創建虛擬裝置之方法及系統
US8990804B1 (en) * 2011-12-07 2015-03-24 Amazon Technologies, Inc. Converting virtual machine images from source to destination virtualization environments
US9201704B2 (en) * 2012-04-05 2015-12-01 Cisco Technology, Inc. System and method for migrating application virtual machines in a network environment
CN103092650B (zh) 2013-01-09 2015-11-18 华中科技大学 云环境下基于软件预安装的虚拟机镜像生成方法和系统
CN103491144B (zh) 2013-09-09 2016-08-10 中国科学院计算技术研究所 一种广域网虚拟平台的构建方法
US10013491B2 (en) * 2014-08-29 2018-07-03 Aditya Vasudevan Methods and systems of workload mobility across divergent platforms
US10725771B2 (en) * 2018-02-21 2020-07-28 Verizon Patent And Licensing, Inc. Artifact transformation in network devices

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100174943A1 (en) * 2009-01-07 2010-07-08 Lenovo (Beijing) Limited Method for restoring client operating system-based system, virtual machine manager and system using the same
CN103530144A (zh) * 2013-09-04 2014-01-22 国云科技股份有限公司 一种从遗留系统生成虚拟机镜像的方法
CN105159760A (zh) * 2014-05-27 2015-12-16 中国电信股份有限公司 云资源迁移方法和统一的跨平台云资源迁移能力开放接口
CN105573830A (zh) * 2014-10-09 2016-05-11 中国银联股份有限公司 一种虚拟机迁移方法
CN105260226A (zh) * 2015-09-23 2016-01-20 浙江网新恒天软件有限公司 一种基于云平台自动迁移虚拟机的方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111859630A (zh) * 2020-06-30 2020-10-30 山东云海国创云计算装备产业创新中心有限公司 一种图像压缩仿真验证方法、装置、设备及可读存储介质
CN111859630B (zh) * 2020-06-30 2022-06-17 山东云海国创云计算装备产业创新中心有限公司 一种图像压缩仿真验证方法、装置、设备及可读存储介质

Also Published As

Publication number Publication date
CN107004032A (zh) 2017-08-01
EP3842930A1 (en) 2021-06-30
EP3425501A4 (en) 2019-07-03
EP3425501B1 (en) 2021-01-13
EP3425501A1 (en) 2019-01-09
US20180203719A1 (en) 2018-07-19
CN107004032B (zh) 2023-12-08
US11243792B2 (en) 2022-02-08

Similar Documents

Publication Publication Date Title
WO2018090290A1 (zh) 镜像文件转换方法及装置
US9348631B2 (en) File mapping and converting for dynamic disk personalization for multiple platforms
WO2018188437A1 (zh) 一种多租户数据隔离方法、装置及系统
WO2019015288A1 (zh) 数据持久化处理的方法、装置、系统及可读存储介质
US20180129520A1 (en) Method and apparatus for starting virtual machine
US9424058B1 (en) File deduplication and scan reduction in a virtualization environment
US10310945B2 (en) Data management of UNIX file systems
US9817592B1 (en) Using an intermediate virtual disk format for virtual disk conversion
US11269663B2 (en) Method and apparatus for adapting handle device to third-party application, and storage medium
US8813071B2 (en) Storage reclamation systems and methods
US10021148B2 (en) Selective copying of track data through peer-to-peer remote copy
CN111782318A (zh) 远程挂载本地磁盘到云桌面虚拟机中共享访问系统及方法
WO2017101761A1 (zh) 一种加载驱动程序的方法和服务器
US11372811B1 (en) Optimizing disk volume scanning using snapshot metadata
CN112328366B (zh) 一种高效的云平台主机保护方法及系统
JP2018530817A (ja) プロダクションデータへのアクセスの最適化
WO2019037521A1 (zh) 安全检测的方法、装置、系统以及服务器
WO2021254214A1 (zh) 安卓应用程序迁移的方法和装置
US9130994B1 (en) Techniques for avoiding dynamic domain name system (DNS) collisions
WO2021226822A1 (zh) 日志写入方法、装置、电子设备以及存储介质
CN103019847A (zh) 对虚拟机数据进行迁移的方法及系统
US11073996B2 (en) Host rescan for logical volume migration
CN115442083B (zh) 设备接入方法、数据交换方法、装置、设备及存储介质
WO2022127583A1 (zh) 虚拟机控制方法、云管理设备及存储介质
CN109739615B (zh) 一种虚拟硬盘的映射方法、设备和云计算平台

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201680003656.6

Country of ref document: CN

WWE Wipo information: entry into national phase

Ref document number: 2016909067

Country of ref document: EP

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

Ref document number: 16909067

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE