CN107766385B - Method and equipment for converting file format of virtual disk - Google Patents

Method and equipment for converting file format of virtual disk Download PDF

Info

Publication number
CN107766385B
CN107766385B CN201610703227.1A CN201610703227A CN107766385B CN 107766385 B CN107766385 B CN 107766385B CN 201610703227 A CN201610703227 A CN 201610703227A CN 107766385 B CN107766385 B CN 107766385B
Authority
CN
China
Prior art keywords
data
target
virtual disk
disk file
format
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.)
Active
Application number
CN201610703227.1A
Other languages
Chinese (zh)
Other versions
CN107766385A (en
Inventor
陈伟才
彭磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610703227.1A priority Critical patent/CN107766385B/en
Publication of CN107766385A publication Critical patent/CN107766385A/en
Application granted granted Critical
Publication of CN107766385B publication Critical patent/CN107766385B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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

Abstract

The application aims to provide a method and equipment for converting a virtual disk file format. Compared with the prior art, the method and the device have the advantages that the processing request of the virtual machine on the target data in the target virtual disk file is obtained, then, whether the target data has the format data to be converted is detected, if the target data has the format data to be converted, the data corresponding to the source position information in the source virtual disk file is written into the target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, so that the format of the virtual disk file is converted on line, seamlessly and in real time, the processing request is executed on the target data, and the user can use the virtual machine or the disk of the virtual machine without waiting for any time.

Description

Method and equipment for converting file format of virtual disk
Technical Field
The application relates to the field of computers, in particular to a technology for converting a virtual disk file format.
Background
In the elastic computing cloud, the disk of the virtual machine is implemented based on a virtual disk file, and all data of the virtual machine is stored in the file. Different virtualization platforms can design and realize a set of virtual disk file formats to efficiently organize and manage the disk space of the virtual machine. Common disk file formats for virtual machines are: VHD for XEN platform, Qcow2 for KVM & QEMU platform, vmwar's vmdk, and native raw format, etc. The problem caused by the coexistence of the files in various disk formats is also obvious. Cloud computing vendors generally support only a certain disk format, for example, AWS supports only VHD, Azure supports only VHD, ucloud supports only Qcow2, and the like. At present, cloud service manufacturers in the industry do not realize online conversion among different virtual disk file formats, and all adopt an offline mode in advance to convert a virtual disk from one format to a target format, and can use the virtual disk file in the converted target format on a self-owned platform.
Obviously, the prior art solution is an off-line operation, and it is generally necessary for a user to wait for several minutes for an off-line conversion work to be completed before starting the virtual machine (if the disk is a system disk of the virtual machine) or using data of the disk (if the disk is a data disk of the virtual machine). If the disk is a large-capacity disk, such as 16TB, and the converted BPS is 60MB/s, the time for offline conversion needs to exceed 3 days, obviously, the service quality is hard to meet the user's requirement, and the requirement of the elastic computing cloud for rapid resource delivery is also not met.
Disclosure of Invention
An object of the present application is to provide a method and an apparatus for converting a virtual disk file format, so as to solve the problem of converting a virtual disk file format online, seamlessly, and in real time.
According to one aspect of the present application, a method for converting a virtual disk file format is provided, wherein the method includes:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
detecting whether the target data has format data to be converted or not;
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
According to another aspect of the present application, there is provided a method for converting a virtual disk file format, wherein the method includes:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
writing data corresponding to source position information in a source virtual disk file into target position information of the target data in a target virtual disk file to serve as the target data, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
According to another aspect of the present application, there is provided an apparatus for converting a virtual disk file format, wherein the apparatus includes:
the acquisition device is used for acquiring a processing request of the virtual machine on target data in the target virtual disk file;
the detection device is used for detecting whether format data to be converted exists in the target data;
the conversion device is used for writing data corresponding to source position information in a source virtual disk file into target position information of the data in the target virtual disk file in the format to be converted as the data in the format to be converted if the data in the format to be converted exists in the target data, wherein the source position information corresponds to the target position information;
and the execution device is used for executing the processing request on the target data.
According to another aspect of the present application, there is provided an apparatus for converting a virtual disk file format, wherein the apparatus includes:
the acquisition device is used for acquiring a processing request of the virtual machine on target data in the target virtual disk file;
the conversion device is used for writing data corresponding to source position information in a source virtual disk file into destination position information of the target data in the target virtual disk file to serve as the target data, wherein the source position information corresponds to the destination position information;
and the execution device is used for executing the processing request on the target data.
According to another aspect of the present application, there is also provided an apparatus for converting a virtual disk file format, where the apparatus includes:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
detecting whether the target data has format data to be converted or not;
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
According to another aspect of the present application, there is also provided an apparatus for converting a virtual disk file format, where the apparatus includes:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
writing data corresponding to source position information in a source virtual disk file into target position information of the target data in a target virtual disk file to serve as the target data, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
Compared with the prior art, the method and the device have the advantages that the processing request of the virtual machine on the target data in the target virtual disk file is obtained, then, whether the target data has the format data to be converted is detected, if the target data has the format data to be converted, the data corresponding to the source position information in the source virtual disk file is written into the target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, so that the format of the virtual disk file is converted on line, seamlessly and in real time, the processing request is executed on the target data, and the user can use the virtual machine or the disk of the virtual machine without waiting for any time. Furthermore, the data to be converted in the target virtual disk file is determined by traversing the conversion identification bitmap, and the data which is not accessed by the virtual machine is autonomously converted into the target virtual disk file from the corresponding source virtual disk file, so that the conversion work of the virtual disk file format can be completed within a certain time, and the conversion work is performed in real time in the running process of the virtual machine, and the running state of the virtual machine is not influenced.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 illustrates a flow diagram of a method of converting a virtual disk file format in accordance with an aspect of the subject application;
FIG. 2 illustrates a flow diagram of a method of converting a virtual disk file format in accordance with another aspect of the subject application;
FIG. 3 illustrates a schematic diagram of an apparatus for converting a virtual disk file format in accordance with yet another aspect of the subject application;
FIG. 4 illustrates a schematic diagram of an apparatus for converting a virtual disk file format in accordance with another aspect of the subject application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
The present application is described in further detail below with reference to the attached figures.
In a typical configuration of the present application, the terminal, the device serving the network, and the trusted party each include one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
FIG. 1 illustrates a flowchart of a method of converting a virtual disk file format, the method including step S11, step S12, step S13, and step S14, according to an aspect of the subject application.
Specifically, in step S11, device 1 acquires a processing request of the virtual machine with respect to the target data in the target virtual disk file; in step S12, the device 1 detects whether there is format data to be converted in the target data; in step S13, if there is format data to be converted in the target data, the device 1 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, where the source location information corresponds to the destination location information; in step S14, the device 1 executes the processing request on the target data.
Here, the device 1 includes, but is not limited to, a user device, a network device, or a device formed by integrating a user device and a network device through a network. The user equipment includes, but is not limited to, any mobile electronic product, such as a smart phone, a tablet computer, and the like, which can perform human-computer interaction with a user through a touch panel, and the mobile electronic product may employ any operating system, such as an android operating system, an iOS operating system, and the like. The network device includes an electronic device capable of automatically performing numerical calculation and information processing according to preset or stored instructions, and the hardware includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. The network device comprises but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud formed by a plurality of servers; here, the Cloud is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual supercomputer consisting of a collection of loosely coupled computers. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, the device 1 may also be a script program running on the user device, the network device, or a device formed by integrating the user device and the network device, the touch terminal, or the network device and the touch terminal through a network. Of course, those skilled in the art will appreciate that the above-described apparatus 1 is merely exemplary, and that other existing or future existing apparatus 1, as may be suitable for use in the present application, are also intended to be encompassed within the scope of the present application and are hereby incorporated by reference.
In step S11, the device 1 acquires a processing request of the virtual machine for the target data in the target virtual disk file.
Here, the processing request includes a read request or a write request of the virtual machine. For example, a virtual machine may generate read and write requests during a process of starting, loading a data disk, and the like, and it is necessary to perform read operation or write operation on target data in the target virtual disk file.
In step S12, the device 1 detects whether there is format data to be converted in the target data.
For example, if there is no format data to be converted in the target data, that is, the target data has been format-converted and stored in the target virtual disk file, the processing request may be directly executed on the target data without format conversion.
Preferably, in step S12, the device 1 detects whether format data to be converted exists in the target data according to format conversion identification information corresponding to the target data in the conversion identification bitmap.
For example, suppose that each bit (bit) in the conversion identification bitmap (bitmap) corresponds to a 512-byte data block, and the initial value of the bit in the bitmap is 0; and if the format conversion of the data block corresponding to a bit is finished and the data block is stored in the target virtual disk file, setting the bit to be 1. If the values of a plurality of bits corresponding to the target data in the bitmap are all set to be 1, indicating that format data to be converted does not exist in the target data; if the target data still has a value of 0 in a plurality of bits corresponding to the bitmap, it is indicated that the target data has format data to be converted, and the format data to be converted in the target data can be determined according to the setting conditions of the plurality of bits corresponding to the target data in the bitmap.
In step S13, if there is format data to be converted in the target data, the device 1 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, where the source location information corresponds to the destination location information.
For example, if there is format data to be converted in the target data, it may be that a part of the data in the target data is in a format to be converted, or it may be that all the data in the target data are in a format to be converted, and it is necessary to write the format data to be converted in the target data into the destination location information of the target virtual disk file before executing the processing request on the target data. Assuming that destination position information of the format data to be converted in the target virtual disk file is [ Dst Offset, Dst Offset + Length ], wherein Offset represents a position Offset of the target data in the target virtual disk file, and Length represents a Length of the format data to be converted; assuming that the source position information of the data corresponding to the format data to be converted in the source virtual disk file is [ Src Offset, Src Offset + Length ]; the source location information corresponds to the destination location information.
Preferably, in step S13, if there is format data to be converted in the target data, the device 1 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, where the source location information corresponds to the destination location information; and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
For example, when the format conversion of the format data to be converted is completed and the format data to be converted is stored in the target virtual disk file, the values of a plurality of bits corresponding to the format data to be converted in the bitmap are updated, that is, the plurality of bits corresponding to the format data to be converted in the bitmap are set.
More preferably, in step S13, device 1 traverses the conversion identifier bitmap, and determines format data to be converted in the target virtual disk file according to format conversion identifier information corresponding to the conversion identifier bitmap; writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted; and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
For example, in the above example, bit map is traversed bit by bit, and if the bit is set, which indicates that the 512-byte data block corresponding to the bit in the target virtual disk file has completed format conversion, the process returns to continue to determine whether the next bit is set. If the value of the bit is 0, the data block of 512 bytes corresponding to the bit in the target virtual disk file is represented as the format data to be converted; assuming that destination position information of the format data to be converted in the target virtual disk file is [ Dst Offset1, Dst Offset1+512], calculating source position information in a corresponding source virtual disk file as [ Src Offset1, Src Offset1+512] by using a formula Src Offset ═ ConvertFun < Dst format, Src format > (Dst Offset); reading data from the region [ Src Offset1, Src Offset1+512] in the corresponding source virtual disk file and writing back to the region [ Dst Offset1, Dst Offset1+512] in the target virtual disk file, then the data at the position [ Dst Offset1, Dst Offset1+512] in the target virtual disk file is the format data to be converted, and the format conversion is completed; then, updating the value of the bit corresponding to the format data to be converted in the bitmap, namely setting the bit corresponding to the format data to be converted in the bitmap; and then, continuously judging whether the next bit is set or not until all the data in the corresponding virtual disk file are converted into the target virtual disk file.
Preferably, the determining format data to be converted in the target virtual disk file according to the format conversion identification information corresponding to the conversion identification bitmap includes: and calculating the target position information of the format data to be converted in the target virtual disk file according to the format conversion identification information.
For example, each bit in the bitmap corresponds to a 512-byte data block in the target virtual disk file, and the destination position information of the format data to be converted in the target virtual disk file can be calculated according to the corresponding relationship between the bit and the data block.
In step S14, the device 1 executes the processing request on the target data.
For example, if the processing request is a read request, the read target data is returned to the virtual machine, and if the processing request is a write request, the corresponding write operation is performed on the target data.
Fig. 2 is a flowchart illustrating a method of converting a virtual disk file format according to another aspect of the present application, the method including step S21, step S22, and step S23.
Specifically, in step S21, the device 2 acquires a processing request of the virtual machine with respect to the target data in the target virtual disk file; in step S22, the device 2 writes data corresponding to source location information in a source virtual disk file into destination location information of the target data in the target virtual disk file as the target data, where the source location information corresponds to the destination location information; in step S23, the device 2 executes the processing request on the target data.
Here, the device 2 includes, but is not limited to, a user device, a network device, or a device formed by integrating a user device and a network device through a network. The user equipment includes, but is not limited to, any mobile electronic product, such as a smart phone, a tablet computer, and the like, which can perform human-computer interaction with a user through a touch panel, and the mobile electronic product may employ any operating system, such as an android operating system, an iOS operating system, and the like. The network device includes an electronic device capable of automatically performing numerical calculation and information processing according to preset or stored instructions, and the hardware includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. The network device comprises but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud formed by a plurality of servers; here, the Cloud is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual supercomputer consisting of a collection of loosely coupled computers. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, the device 2 may also be a script program running on the user device, the network device, or a device formed by integrating the user device and the network device, the touch terminal, or the network device and the touch terminal through a network. Of course, those skilled in the art will appreciate that the above-described apparatus 2 is merely exemplary, and that other existing or future existing apparatus 2, as may be suitable for use in the present application, are also intended to be encompassed within the scope of the present application and are hereby incorporated by reference.
In step S21, the device 2 acquires a processing request of the virtual machine for the target data in the target virtual disk file.
Here, the processing request includes a read request or a write request of the virtual machine. For example, a virtual machine may generate read and write requests during a process of starting, loading a data disk, and the like, and it is necessary to perform read operation or write operation on target data in the target virtual disk file.
In step S22, the device 2 writes, as the target data, data corresponding to source location information in a source virtual disk file, where the source location information corresponds to the destination location information, into destination location information in the target virtual disk file of the target data.
For example, it is assumed that destination location information of the target data in the target virtual disk file is [ Dst Offset, Dst Offset + Length ], where Offset represents a location Offset of the target data in the target virtual disk file, and Length represents a Length of the target data; assuming that the source position information of the corresponding data of the target data in the source virtual disk file is [ Src Offset, Src Offset + Length ]; the source location information corresponds to the destination location information.
Preferably, in step S22, the device 2 reads data from source location information in a corresponding source virtual disk file, where the source location information corresponds to destination location information of the target data in the target virtual disk file; and writing the read data into the destination position information in the target virtual disk file to serve as the target data.
For example, data is read from the region [ Src Offset, Src Offset + Length ] in the corresponding source virtual disk file and written back to the region [ Dst Offset, Dst Offset + Length ] in the destination virtual disk file, and then the data located at the position [ Dst Offset, Dst Offset + Length ] in the destination virtual disk file is the destination data.
Preferably, in step S22, the device 2 determines, according to destination location information of the target data in the target virtual disk file, source location information of data corresponding to the target data in the source virtual disk file; and writing data corresponding to the source position information in the source virtual disk file into the target position information of the target data in the target virtual disk file to serve as the target data.
For example, the calculation may be performed by a formula Src Offset (ConvertFun < Dst format, Src format >), wherein the ConvertFun function is responsible for calculating Src Offset in the source virtual disk file according to Dst Offset of the target data in the target virtual disk file, so as to locate the position of the target data in the source virtual disk file. Different virtual disk file formats have unique data organization modes, and the formula can be deduced according to specifications of different virtual disk file formats.
In step S23, the device 2 executes the processing request on the target data.
For example, if the processing request is a read request, the read target data is returned to the virtual machine, and if the processing request is a write request, the corresponding write operation is performed on the target data.
Fig. 3 shows an apparatus 1 for converting a virtual disk file format according to yet another aspect of the present application, the apparatus 1 comprising obtaining means 11, detecting means 12, converting means 13 and executing means 14.
Specifically, the obtaining device 11 obtains a processing request of the virtual machine for the target data in the target virtual disk file; the detection device 12 detects whether format data to be converted exists in the target data; if the target data contains format data to be converted, the conversion device 13 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, wherein the source location information corresponds to the destination location information; the executing device 14 executes the processing request on the target data.
Here, the device 1 includes, but is not limited to, a user device, a network device, or a device formed by integrating a user device and a network device through a network. The user equipment includes, but is not limited to, any mobile electronic product, such as a smart phone, a tablet computer, and the like, which can perform human-computer interaction with a user through a touch panel, and the mobile electronic product may employ any operating system, such as an android operating system, an iOS operating system, and the like. The network device includes an electronic device capable of automatically performing numerical calculation and information processing according to preset or stored instructions, and the hardware includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. The network device comprises but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud formed by a plurality of servers; here, the Cloud is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual supercomputer consisting of a collection of loosely coupled computers. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, the device 1 may also be a script program running on the user device, the network device, or a device formed by integrating the user device and the network device, the touch terminal, or the network device and the touch terminal through a network. Of course, those skilled in the art will appreciate that the above-described apparatus 1 is merely exemplary, and that other existing or future existing apparatus 1, as may be suitable for use in the present application, are also intended to be encompassed within the scope of the present application and are hereby incorporated by reference.
The acquiring means 11 acquires a processing request of the virtual machine with respect to the target data in the target virtual disk file.
Here, the processing request includes a read request or a write request of the virtual machine. For example, a virtual machine may generate read and write requests during a process of starting, loading a data disk, and the like, and it is necessary to perform read operation or write operation on target data in the target virtual disk file.
The detection device 12 detects whether format data to be converted exists in the target data.
For example, if there is no format data to be converted in the target data, that is, the target data has been format-converted and stored in the target virtual disk file, the processing request may be directly executed on the target data without format conversion.
Preferably, the detecting device 12 detects whether format data to be converted exists in the target data according to format conversion identification information corresponding to the target data in a conversion identification bitmap.
For example, suppose that each bit (bit) in the conversion identification bitmap (bitmap) corresponds to a 512-byte data block, and the initial value of the bit in the bitmap is 0; and if the format conversion of the data block corresponding to a bit is finished and the data block is stored in the target virtual disk file, setting the bit to be 1. If the values of a plurality of bits corresponding to the target data in the bitmap are all set to be 1, indicating that format data to be converted does not exist in the target data; if the target data still has a value of 0 in a plurality of bits corresponding to the bitmap, it is indicated that the target data has format data to be converted, and the format data to be converted in the target data can be determined according to the setting conditions of the plurality of bits corresponding to the target data in the bitmap.
If there is format data to be converted in the target data, the conversion device 13 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, where the source location information corresponds to the destination location information.
For example, if there is format data to be converted in the target data, it may be that a part of the data in the target data is in a format to be converted, or it may be that all the data in the target data are in a format to be converted, and it is necessary to write the format data to be converted in the target data into the destination location information of the target virtual disk file before executing the processing request on the target data. Assuming that destination position information of the format data to be converted in the target virtual disk file is [ Dst Offset, Dst Offset + Length ], wherein Offset represents a position Offset of the target data in the target virtual disk file, and Length represents a Length of the format data to be converted; assuming that the source position information of the data corresponding to the format data to be converted in the source virtual disk file is [ Src Offset, Src Offset + Length ]; the source location information corresponds to the destination location information.
Preferably, if there is format data to be converted in the target data, the conversion device 13 writes data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, where the source location information corresponds to the destination location information; and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
For example, when the format conversion of the format data to be converted is completed and the format data to be converted is stored in the target virtual disk file, the values of a plurality of bits corresponding to the format data to be converted in the bitmap are updated, that is, the plurality of bits corresponding to the format data to be converted in the bitmap are set.
More preferably, the conversion device 13 traverses the conversion identification bitmap, and determines format data to be converted in the target virtual disk file according to corresponding format conversion identification information in the conversion identification bitmap; writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted; and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
For example, in the above example, bit map is traversed bit by bit, and if the bit is set, which indicates that the 512-byte data block corresponding to the bit in the target virtual disk file has completed format conversion, the process returns to continue to determine whether the next bit is set. If the value of the bit is 0, the data block of 512 bytes corresponding to the bit in the target virtual disk file is represented as the format data to be converted; assuming that destination position information of the format data to be converted in the target virtual disk file is [ Dst Offset1, Dst Offset1+512], calculating source position information in a corresponding source virtual disk file as [ Src Offset1, Src Offset1+512] by using a formula Src Offset ═ ConvertFun < Dst format, Src format > (Dst Offset); reading data from the region [ Src Offset1, Src Offset1+512] in the corresponding source virtual disk file and writing back to the region [ Dst Offset1, Dst Offset1+512] in the target virtual disk file, then the data at the position [ Dst Offset1, Dst Offset1+512] in the target virtual disk file is the format data to be converted, and the format conversion is completed; then, updating the value of the bit corresponding to the format data to be converted in the bitmap, namely setting the bit corresponding to the format data to be converted in the bitmap; and then, continuously judging whether the next bit is set or not until all the data in the corresponding virtual disk file are converted into the target virtual disk file.
Preferably, the determining format data to be converted in the target virtual disk file according to the format conversion identification information corresponding to the conversion identification bitmap includes: and calculating the target position information of the format data to be converted in the target virtual disk file according to the format conversion identification information.
For example, each bit in the bitmap corresponds to a 512-byte data block in the target virtual disk file, and the destination position information of the format data to be converted in the target virtual disk file can be calculated according to the corresponding relationship between the bit and the data block.
The executing device 14 executes the processing request on the target data.
For example, if the processing request is a read request, the read target data is returned to the virtual machine, and if the processing request is a write request, the corresponding write operation is performed on the target data.
Fig. 4 shows an apparatus 2 for converting a virtual disk file format according to another aspect of the present application, where the apparatus 2 includes an obtaining device 21, a converting device 22, and an executing device 23.
Specifically, the acquiring device 21 acquires a processing request of the virtual machine for the target data in the target virtual disk file; the conversion device 22 writes data corresponding to source location information in a source virtual disk file into destination location information of the target data in the target virtual disk file as the target data, wherein the source location information corresponds to the destination location information; the executing device 23 executes the processing request on the target data.
Here, the device 2 includes, but is not limited to, a user device, a network device, or a device formed by integrating a user device and a network device through a network. The user equipment includes, but is not limited to, any mobile electronic product, such as a smart phone, a tablet computer, and the like, which can perform human-computer interaction with a user through a touch panel, and the mobile electronic product may employ any operating system, such as an android operating system, an iOS operating system, and the like. The network device includes an electronic device capable of automatically performing numerical calculation and information processing according to preset or stored instructions, and the hardware includes but is not limited to a microprocessor, an Application Specific Integrated Circuit (ASIC), a programmable gate array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like. The network device comprises but is not limited to a computer, a network host, a single network server, a plurality of network server sets or a cloud formed by a plurality of servers; here, the Cloud is composed of a large number of computers or web servers based on Cloud Computing (Cloud Computing), which is a kind of distributed Computing, one virtual supercomputer consisting of a collection of loosely coupled computers. Including, but not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, a wireless Ad Hoc network (Ad Hoc network), etc. Preferably, the device 2 may also be a script program running on the user device, the network device, or a device formed by integrating the user device and the network device, the touch terminal, or the network device and the touch terminal through a network. Of course, those skilled in the art will appreciate that the above-described apparatus 2 is merely exemplary, and that other existing or future existing apparatus 2, as may be suitable for use in the present application, are also intended to be encompassed within the scope of the present application and are hereby incorporated by reference.
The acquiring means 21 acquires a processing request of the virtual machine with respect to the target data in the target virtual disk file.
Here, the processing request includes a read request or a write request of the virtual machine. For example, a virtual machine may generate read and write requests during a process of starting, loading a data disk, and the like, and it is necessary to perform read operation or write operation on target data in the target virtual disk file.
The conversion device 22 writes data corresponding to source location information in a source virtual disk file into destination location information of the target data in the target virtual disk file as the target data, wherein the source location information corresponds to the destination location information.
For example, it is assumed that destination location information of the target data in the target virtual disk file is [ Dst Offset, Dst Offset + Length ], where Offset represents a location Offset of the target data in the target virtual disk file, and Length represents a Length of the target data; assuming that the source position information of the corresponding data of the target data in the source virtual disk file is [ Src Offset, Src Offset + Length ]; the source location information corresponds to the destination location information.
Preferably, the conversion device 22 reads data from source location information in a corresponding source virtual disk file, where the source location information corresponds to destination location information of the target data in the target virtual disk file; and writing the read data into the destination position information in the target virtual disk file to serve as the target data.
For example, data is read from the region [ Src Offset, Src Offset + Length ] in the corresponding source virtual disk file and written back to the region [ Dst Offset, Dst Offset + Length ] in the destination virtual disk file, and then the data located at the position [ Dst Offset, Dst Offset + Length ] in the destination virtual disk file is the destination data.
Preferably, the conversion device 22 determines, according to destination location information of the target data in the target virtual disk file, source location information of data corresponding to the target data in the source virtual disk file; and writing data corresponding to the source position information in the source virtual disk file into the target position information of the target data in the target virtual disk file to serve as the target data.
For example, the calculation may be performed by a formula Src Offset (ConvertFun < Dst format, Src format >), wherein the ConvertFun function is responsible for calculating Src Offset in the source virtual disk file according to Dst Offset of the target data in the target virtual disk file, so as to locate the position of the target data in the source virtual disk file. Different virtual disk file formats have unique data organization modes, and the formula can be deduced according to specifications of different virtual disk file formats.
The executing device 23 executes the processing request on the target data.
For example, if the processing request is a read request, the read target data is returned to the virtual machine, and if the processing request is a write request, the corresponding write operation is performed on the target data.
According to another aspect of the present application, there is also provided an apparatus for converting a virtual disk file format, where the apparatus includes:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
detecting whether the target data has format data to be converted or not;
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
According to another aspect of the present application, there is also provided an apparatus for converting a virtual disk file format, where the apparatus includes:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
writing data corresponding to source position information in a source virtual disk file into target position information of the target data in a target virtual disk file to serve as the target data, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
Compared with the prior art, the method and the device have the advantages that the processing request of the virtual machine on the target data in the target virtual disk file is obtained, then, whether the target data has the format data to be converted is detected, if the target data has the format data to be converted, the data corresponding to the source position information in the source virtual disk file is written into the target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, so that the format of the virtual disk file is converted on line, seamlessly and in real time, the processing request is executed on the target data, and the user can use the virtual machine or the disk of the virtual machine without waiting for any time. Furthermore, the data to be converted in the target virtual disk file is determined by traversing the conversion identification bitmap, and the data which is not accessed by the virtual machine is autonomously converted into the target virtual disk file from the corresponding source virtual disk file, so that the conversion work of the virtual disk file format can be completed within a certain time, and the conversion work is performed in real time in the running process of the virtual machine, and the running state of the virtual machine is not influenced.
It should be noted that the present application may be implemented in software and/or a combination of software and hardware, for example, implemented using Application Specific Integrated Circuits (ASICs), general purpose computers or any other similar hardware devices. In one embodiment, the software programs of the present application may be executed by a processor to implement the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functions of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the apparatus claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.

Claims (18)

1. A method for converting a virtual disk file format, wherein the method comprises:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
detecting whether the target data has format data to be converted or not;
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, and completing format conversion of the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
2. The method of claim 1, wherein the detecting whether format data to be converted exists in the target data comprises:
and detecting whether format data to be converted exists in the target data or not according to the format conversion identification information corresponding to the target data in the conversion identification bitmap.
3. The method of claim 2, wherein the
If the target data has format data to be converted, writing data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, including:
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, wherein the source position information corresponds to the target position information;
and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
4. The method according to claim 2, wherein, if there is format data to be converted in the target data, writing data corresponding to source location information in a source virtual disk file into destination location information of the format data to be converted in the target virtual disk file as the format data to be converted, includes:
traversing the conversion identification bitmap, and determining format data to be converted in the target virtual disk file according to corresponding format conversion identification information in the conversion identification bitmap;
writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted;
and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
5. The method according to claim 4, wherein the determining format data to be converted in the target virtual disk file according to the corresponding format conversion identification information in the conversion identification bitmap comprises:
and calculating the target position information of the format data to be converted in the target virtual disk file according to the format conversion identification information.
6. A method for converting a virtual disk file format, wherein the method comprises:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
writing data corresponding to source position information in a source virtual disk file into target position information of target data in a target virtual disk file to serve as format data to be converted, and completing format conversion of the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
7. The method of claim 6, wherein the writing data corresponding to source location information in a source virtual disk file into destination location information of the target data in the target virtual disk file as the target data comprises:
reading data from source position information in a corresponding source virtual disk file, wherein the source position information corresponds to target position information of the target data in the target virtual disk file;
and writing the read data into the destination position information in the target virtual disk file to serve as the target data.
8. The method of claim 6, wherein the writing data corresponding to source location information in a source virtual disk file into destination location information of the target data in the target virtual disk file as the target data comprises:
determining source position information of corresponding data of the target data in the source virtual disk file according to the target position information of the target data in the target virtual disk file;
and writing data corresponding to the source position information in the source virtual disk file into the target position information of the target data in the target virtual disk file to serve as the target data.
9. An apparatus for converting a virtual disk file format, wherein the apparatus comprises:
the acquisition device is used for acquiring a processing request of the virtual machine on target data in the target virtual disk file;
the detection device is used for detecting whether format data to be converted exists in the target data;
the conversion device is used for writing data corresponding to source position information in a source virtual disk file into target position information of the data in the target virtual disk file of the format to be converted to be used as the data in the format to be converted if the data in the format to be converted exists in the target data, and completing format conversion on the data in the format to be converted, wherein the source position information corresponds to the target position information;
and the execution device is used for executing the processing request on the target data.
10. The apparatus of claim 9, wherein the detection device is to:
and detecting whether format data to be converted exists in the target data or not according to the format conversion identification information corresponding to the target data in the conversion identification bitmap.
11. The apparatus of claim 10, wherein the conversion means is to:
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, wherein the source position information corresponds to the target position information;
and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
12. The apparatus of claim 10, wherein the conversion means is to:
traversing the conversion identification bitmap, and determining format data to be converted in the target virtual disk file according to corresponding format conversion identification information in the conversion identification bitmap;
writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted;
and updating format conversion identification information corresponding to the format data to be converted in the conversion identification bitmap.
13. The apparatus according to claim 12, wherein the determining, according to the format conversion identification information corresponding to the conversion identification bitmap, format data to be converted in the target virtual disk file includes:
and calculating the target position information of the format data to be converted in the target virtual disk file according to the format conversion identification information.
14. An apparatus for converting a virtual disk file format, wherein the apparatus comprises:
the acquisition device is used for acquiring a processing request of the virtual machine on target data in the target virtual disk file;
the conversion device is used for writing data corresponding to source position information in a source virtual disk file into target position information of the target data in the target virtual disk file to be used as format data to be converted, and completing format conversion on the format data to be converted, wherein the source position information corresponds to the target position information;
and the execution device is used for executing the processing request on the target data.
15. The apparatus of claim 14, wherein the conversion means is to:
reading data from source position information in a corresponding source virtual disk file, wherein the source position information corresponds to target position information of the target data in the target virtual disk file;
and writing the read data into the destination position information in the target virtual disk file to serve as the target data.
16. The apparatus of claim 14, wherein the conversion means is to:
determining source position information of corresponding data of the target data in the source virtual disk file according to the target position information of the target data in the target virtual disk file;
and writing data corresponding to the source position information in the source virtual disk file into the target position information of the target data in the target virtual disk file to serve as the target data.
17. An apparatus for converting a virtual disk file format, wherein the apparatus comprises:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
detecting whether the target data has format data to be converted or not;
if the target data has format data to be converted, writing data corresponding to source position information in a source virtual disk file into target position information of the format data to be converted in the target virtual disk file to serve as the format data to be converted, and completing format conversion of the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
18. An apparatus for converting a virtual disk file format, wherein the apparatus comprises:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to:
acquiring a processing request of a virtual machine for target data in a target virtual disk file;
writing data corresponding to source position information in a source virtual disk file into target position information of target data in a target virtual disk file to serve as format data to be converted, and completing format conversion of the format data to be converted, wherein the source position information corresponds to the target position information;
executing the processing request on the target data.
CN201610703227.1A 2016-08-22 2016-08-22 Method and equipment for converting file format of virtual disk Active CN107766385B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610703227.1A CN107766385B (en) 2016-08-22 2016-08-22 Method and equipment for converting file format of virtual disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610703227.1A CN107766385B (en) 2016-08-22 2016-08-22 Method and equipment for converting file format of virtual disk

Publications (2)

Publication Number Publication Date
CN107766385A CN107766385A (en) 2018-03-06
CN107766385B true CN107766385B (en) 2021-09-03

Family

ID=61264516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610703227.1A Active CN107766385B (en) 2016-08-22 2016-08-22 Method and equipment for converting file format of virtual disk

Country Status (1)

Country Link
CN (1) CN107766385B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612750A (en) * 2020-12-15 2021-04-06 北京天融信网络安全技术有限公司 File content processing method and device, electronic equipment and readable storage medium
CN112988077B (en) * 2021-04-27 2021-07-23 云宏信息科技股份有限公司 Virtual disk copying method and computer readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464812A (en) * 2009-01-06 2009-06-24 北京航空航天大学 Virtual machine migration method
CN101506805A (en) * 2006-08-28 2009-08-12 汤姆森特许公司 Method and apparatus for multi-format data exchange
CN102486773A (en) * 2009-12-30 2012-06-06 联想(北京)有限公司 Virtual disk content updating method and virtual disk device as well as terminal equipment and system
US8631423B1 (en) * 2011-10-04 2014-01-14 Symantec Corporation Translating input/output calls in a mixed virtualization environment
CN103885830A (en) * 2014-04-16 2014-06-25 中国科学院软件研究所 Data processing method used in cross-data-center live migration process of virtual machine
CN105786608A (en) * 2016-03-24 2016-07-20 深圳市华成峰实业有限公司 Remote deduplication migration method and system for virtual machine

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101506805A (en) * 2006-08-28 2009-08-12 汤姆森特许公司 Method and apparatus for multi-format data exchange
CN101464812A (en) * 2009-01-06 2009-06-24 北京航空航天大学 Virtual machine migration method
CN102486773A (en) * 2009-12-30 2012-06-06 联想(北京)有限公司 Virtual disk content updating method and virtual disk device as well as terminal equipment and system
US8631423B1 (en) * 2011-10-04 2014-01-14 Symantec Corporation Translating input/output calls in a mixed virtualization environment
CN103885830A (en) * 2014-04-16 2014-06-25 中国科学院软件研究所 Data processing method used in cross-data-center live migration process of virtual machine
CN105786608A (en) * 2016-03-24 2016-07-20 深圳市华成峰实业有限公司 Remote deduplication migration method and system for virtual machine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于混合迁移的OpenStack虚拟机在线迁移改进方案;何玫峻,金连文,李磊;《系统工程理论与实践》;20140630;全文 *

Also Published As

Publication number Publication date
CN107766385A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
US9921939B2 (en) Creating a software performance testing environment on a virtual machine system
CN107544871B (en) Virtual machine disk backup method and device
US8195619B2 (en) Extent reference count update system and method
JP6799652B2 (en) Methods and devices for processing information
US9015695B2 (en) Information processing apparatus and information processing method
CN107807839B (en) Method and device for modifying memory data of virtual machine and electronic equipment
CN106919494B (en) Method and device for realizing android application log
JP2014513338A5 (en) Method, computer readable storage medium and system for optimal compression of a virtual disk
CN111414231B (en) Method and equipment for mutual conversion between virtual machine mirror image and container mirror image
WO2014190806A1 (en) Application backup and restore
WO2016123908A1 (en) Memory overflow detection method and apparatus
CN107861691B (en) Load balancing method and device of multi-control storage system
CN112765084B (en) Computer device, virtualization acceleration device, data transmission method, and storage medium
CN111736945A (en) Virtual machine thermal migration method, device, equipment and medium based on intelligent network card
KR101636878B1 (en) Method and driver for processing data in virtualization
CN107766385B (en) Method and equipment for converting file format of virtual disk
US11263082B2 (en) Data recovery of guest virtual machines
US9824005B1 (en) Process level memory allocation by memory type
CN108268369B (en) Test data acquisition method and device
CN114780208A (en) Method, system, device and storage medium for verifying backup validity of multi-platform virtual machine
CN101751283A (en) Virtual machine monitor, virtual machine system and client operation system state acquiring method
CN107404397B (en) Method and equipment for determining user service state information
CN111370049B (en) eMMC chip testing method and device
CN111651177A (en) Android platform-based number writing method and device and computer readable medium
CN107370785B (en) Method and equipment for processing user service state information

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
GR01 Patent grant
GR01 Patent grant