CN110532061A - A method of migrating virtual machine under cloudy environment - Google Patents
A method of migrating virtual machine under cloudy environment Download PDFInfo
- Publication number
- CN110532061A CN110532061A CN201910743328.5A CN201910743328A CN110532061A CN 110532061 A CN110532061 A CN 110532061A CN 201910743328 A CN201910743328 A CN 201910743328A CN 110532061 A CN110532061 A CN 110532061A
- Authority
- CN
- China
- Prior art keywords
- block
- file
- virtual machine
- refcount
- data
- 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.)
- Withdrawn
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/06—Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/4557—Distribution of virtual machine instances; Migration and load balancing
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present invention relates to field of cloud computer technology, and in particular to a method of virtual machine is migrated under cloudy environment.Method of the present invention is to carry out snapshot to magnetic disk of virtual machine, and snapshots to virtual machine A;Virtual machine A reads the block device of snapshot, generates qcow2 meta data file and Data Identification file;Qcow2 file block in logic is uploaded to the object storage of cloud platform;The qcow2 file that object stores is registered as virtual machine image file, virtual machine is re-created according to image file.The present invention solves the problems, such as that block device is directly changed into caused by image file when virtual machine (vm) migration under cloudy environment;It can be used under cloudy environment migrating virtual machine.
Description
Technical field
The present invention relates to cloud computer technical fields, and in particular to a method of virtual machine is migrated under cloudy environment.
Background technique
Virtual machine (vm) migration is that the application system mirror drive for carrying virtual machine is moved to from a cloud platform under cloudy environment
Another cloud platform;Both it can be locked to avoid cloud manufacturer, and crucial virtual machine can also be allowed to apply unavailable or possible in main cloud
It is unavailable to have a backup at any time, reduce bigger loss.
At present public cloud manufacturer all provide virtual machine (vm) migration to oneself cloud platform method;Its method uses qemu- substantially
Virtual machine system block device is converted into image file by img tool, and then the object that image file uploads to cloud platform is stored;
Then object store in file be converted into virtual machine image file, finally create corresponding virtual machine.Qcow2 mirror-image format
It is a kind of generic diskette mirror-image format, public cloud manufacturer all supports qcow2 format to create virtual machine.Qcow2 format is with raw format
Mirror image, which is compared, has smaller file size, supports Copy on write and supports the characteristics such as snapshot.
But the prior art is in the presence of generally there are following defects:
1) migration pattern that cloud platform manufacturer provides needs virtual machine system block device to be first converted to virtual machine image text
Part, usually used order is:
Qemu-img convert-O qow2 magnetic disk of virtual machine block device target qcow2 file
It needs to be additionally provided storage by the way of above to save qcow2 image file, provides extra storage publicly-owned
It needs to collect the charges under cloud environment, increases the cost of migration.
2) cloud platform manufacturer only provides virtual machine (vm) migration to the tool of oneself environment, and migration pattern complex steps need hand
Dynamic to execute, O&M difficulty is high.
Summary of the invention
The method that the technical problem to be solved by the present invention is to provide a kind of to migrate virtual machine under cloudy environment, without setting block
It is standby to be converted into image file, storage and flow bandwidth are saved, simplifies migration step, reduces the difficulty of O&M.
The technical solution that the present invention solves aforementioned technical problem is:
The method the following steps are included:
S10, snapshot is carried out to magnetic disk of virtual machine, and snapshots to virtual machine A;
S20, virtual machine A read the block device of snapshot, generate qcow2 meta data file and Data Identification file;
S30, the object storage for qcow2 file block in logic being uploaded to cloud platform;
S40, the qcow2 file that object stores is registered as virtual machine image file, is re-created according to image file
Virtual machine.
The metadata includes: qcow2 header file, L1 table, L2 table, refcount table and refcount_block table;
It is stored in file head data block;Metadata does not distribute snapshot table;
For the L1 table and L2 table for realizing second level lookup, L1 list item is directed toward L2 table, and L2 list item direction contains data
Data block;
Refcount table and refcount_block table are a second level look-up tables;Refcount list item is directed toward
Refcount_block table, refcount_block table record the reference count of each data block;
Data block refers to that qcow2 is operated as unit of data block, and the size of the data block of default is 65536 bytes;
Data Identification file is the block device magnetic disk of virtual machine as unit of data block size, identifies magnetic disk of virtual machine block
Equipment whether there is data.
The step S20 specifically includes the following steps:
S21, default data block size read magnetic disk of virtual machine block device in order;
Otherwise plus 0 S22, data block is judged with the presence or absence of data, add 1 if there is so mark end-of-file,;
S23, initialization qcow2 header file;
S24 initializes L1 table, L2 table, refcount table and refcount_block table according to mark file.
The initialization qcow2 header file step is:
S231, the size for obtaining disk block device, the size of L1 table is calculated according to the size of disk and block size;
S232, the quantity that refcount table is calculated according to the total block number of qcow2 file;
S233, initialization L1 table start address and refcount table start address.
The step S24 specifically includes the following steps:
S241, the refount table direction address refcount_block is updated;
S242, block disk block device address is traversed as unit of the size of data block;
S243, ident value is read in mark file according to current address;
If S245, ident value are 1, then updating L1 table and L2 table;
S246, the update address refcount_block has been traversed.
The step S30 specifically includes the following steps:
S31, the step S20 qcow2 meta data file generated is added to multithreading upload task;
S32, block disk block device address is traversed as unit of the size of data block;
S33, ident value is read from mark file according to current address;
If S34, ident value are 1, current read address access is according to the reading data of block size into caching;
S35, cache size, which are equal to, uploads fragment size, then being added in upload task;
S36, traversal complete upload task.
Method of the invention is directly stored magnetic disk of virtual machine equipment with the object that qcow2 format uploads to cloud platform;It can
With effective saving storage and flow bandwidth, migration step is simplified;Effectively reduce the difficulty of O&M.
Detailed description of the invention
The following further describes the present invention with reference to the drawings:
Fig. 1 is flow chart of the present invention;
Fig. 2 is present invention initialization qcow2 metadata flow chart;
Fig. 3 is the flow chart that magnetic disk of virtual machine block device is uploaded to the storage of public cloud object by the present invention.
Specific embodiment
As shown in Figure 1, the present invention realizes that the basic procedure for migrating virtual machine under cloudy environment is as follows:
S10, snapshot is carried out to magnetic disk of virtual machine, and snapshots to virtual machine A
S20, virtual machine A read the block device of snapshot, generate qcow2 meta data file and Data Identification file.
Qcow2 is a kind of general virtual machine image format, and the solution of the present invention does not directly exist disk mirroring file
Locally it is converted into qcow2 file.
Metadata includes: qcow2 header file, L1 table, L2 table, refcount table and refcount_block table;It is stored in
In file head data block.Since there is no snapshot, then not needing distribution snapshot table.
For realizing second level lookup, L1 list item is directed toward L2 table for L1 table and L2 table, and L2 list item is directed toward the data block containing data.
Refcount table and refcount_block table and a second level look-up table;Refcount list item is directed toward
Refcount_block table, refcount_block table record the reference count of each data block.
Data block refers to that qcow2 is operated as unit of data block, and the size of the data block of default is 65536 bytes.
Data Identification file is the block device magnetic disk of virtual machine as unit of data block size, identifies magnetic disk of virtual machine block
Equipment whether there is data.
As shown in Figure 2, in the present invention, meta data file and the Data Identification Files step for generating qcow2 are as follows:
S21, default data block size read magnetic disk of virtual machine block device in order;
Otherwise plus 0 S22, data block is judged with the presence or absence of data, add 1 if there is so mark end-of-file,;
S23, initialization qcow2 header file.
It is as follows that qcow2 header file process is initialized in step S23:
S231, the size for obtaining disk block device, the size of L1 table is calculated according to the size of disk and block size;
S232, the quantity that refcount table is calculated according to the total block number of qcow2 file;
S233, initialization L1 table start address and refcount table start address;
S24 initializes L1 table, L2 table, refcount table and refcount_block table according to mark file.It initialized
Journey is as follows:
S241, the refount table direction address refcount_block is updated;
S242, block disk block device address is traversed as unit of the size of data block;
S243, ident value is read in mark file according to current address;
If S245, ident value are 1, then updating L1 table and L2 table;
S246, the update address refcount_block has been traversed.
S30, the object storage for qcow2 file block in logic being uploaded to cloud platform.
In the present invention, disk block device is not directly changed into qcow2 file, but literary by the metadata that S20 is generated
Part and according to mark file carry out piecemeal upload to object storage, finally object storage on formed a qcow2 formatted file.
Object storage above-mentioned is the object storage of cloud platform.Object storage does not provide the function of Document Editing, therefore, adopts
It is realized with process as shown in Figure 3:
S31, first S20 generate qcow2 meta data file be added to multithreading upload task;
S32, block disk block device address is traversed as unit of the size of data block;
S33, ident value is read from mark file according to current address;
If S34, ident value are 1, current read address access is according to the reading data of block size into caching;
S35, cache size, which are equal to, uploads fragment size, then being added in upload task;
S36, traversal complete upload task.
S40, the qcow2 file that object stores is registered as virtual machine image file, is re-created according to image file
Virtual machine.
By calling the registration mirror image interface of cloud platform and creating the interface of virtual machine, the migration of virtual machine is completed.
Claims (7)
1. a kind of method for migrating virtual machine under cloudy environment, it is characterised in that: the method the following steps are included:
S10, snapshot is carried out to magnetic disk of virtual machine, and snapshots to virtual machine A;
S20, virtual machine A read the block device of snapshot, generate qcow2 meta data file and Data Identification file;
S30, the object storage for qcow2 file block in logic being uploaded to cloud platform;
S40, the qcow2 file that object stores is registered as virtual machine image file, is re-created virtually according to image file
Machine.
2. according to the method described in claim 1, it is characterized by: the metadata includes: qcow2 header file, L1 table, L2
Table, refcount table and refcount_block table;It is stored in file head data block;Metadata does not distribute snapshot
Table;
For the L1 table and L2 table for realizing second level lookup, L1 list item is directed toward L2 table, and L2 list item is directed toward the data containing data
Block;
Refcount table and refcount_block table are a second level look-up tables;Refcount list item is directed toward refcount_
Block table, refcount_block table record the reference count of each data block;
Data block refers to that qcow2 is operated as unit of data block, and the size of the data block of default is 65536 bytes;
Data Identification file is the block device magnetic disk of virtual machine as unit of data block size, identifies magnetic disk of virtual machine block device
With the presence or absence of data.
3. according to the method described in claim 2, it is characterized by:
The step S20 specifically includes the following steps:
S21, default data block size read magnetic disk of virtual machine block device in order;
Otherwise plus 0 S22, data block is judged with the presence or absence of data, add 1 if there is so mark end-of-file,;
S23, initialization qcow2 header file;
S24 initializes L1 table, L2 table, refcount table and refcount_block table according to mark file.
4. according to the method described in claim 3, it is characterized by: the initialization qcow2 header file step is:
S231, the size for obtaining disk block device, the size of L1 table is calculated according to the size of disk and block size;
S232, the quantity that refcount table is calculated according to the total block number of qcow2 file;
S233, initialization L1 table start address and refcount table start address.
5. according to the method described in claim 3, it is characterized by: the step S24 specifically includes the following steps:
S241, the refount table direction address refcount_block is updated;
S242, block disk block device address is traversed as unit of the size of data block;
S243, ident value is read in mark file according to current address;
If S245, ident value are 1, then updating L1 table and L2 table;
S246, the update address refcount_block has been traversed.
6. according to the method described in claim 4, it is characterized by: the step S24 specifically includes the following steps:
S241, the refount table direction address refcount_block is updated;
S242, block disk block device address is traversed as unit of the size of data block;
S243, ident value is read in mark file according to current address;
If S245, ident value are 1, then updating L1 table and L2 table;
S246, the update address refcount_block has been traversed.
7. method according to any one of claims 1 to 6, it is characterised in that: the step S30 specifically includes following step
It is rapid:
S31, the step S20 qcow2 meta data file generated is added to multithreading upload task;
S32, block disk block device address is traversed as unit of the size of data block;
S33, ident value is read from mark file according to current address;
If S34, ident value are 1, current read address access is according to the reading data of block size into caching;
S35, cache size, which are equal to, uploads fragment size, then being added in upload task;
S36, traversal complete upload task.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910743328.5A CN110532061A (en) | 2019-08-13 | 2019-08-13 | A method of migrating virtual machine under cloudy environment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910743328.5A CN110532061A (en) | 2019-08-13 | 2019-08-13 | A method of migrating virtual machine under cloudy environment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110532061A true CN110532061A (en) | 2019-12-03 |
Family
ID=68662931
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910743328.5A Withdrawn CN110532061A (en) | 2019-08-13 | 2019-08-13 | A method of migrating virtual machine under cloudy environment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110532061A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111124615A (en) * | 2019-12-22 | 2020-05-08 | 北京浪潮数据技术有限公司 | Virtual machine migration method, device, equipment and computer readable storage medium |
CN114296868A (en) * | 2021-12-17 | 2022-04-08 | ***数智科技有限公司 | Virtual machine automatic migration decision method based on user experience in multi-cloud environment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106406979A (en) * | 2016-09-04 | 2017-02-15 | 国云科技股份有限公司 | Method of migrating virtual machine of XenServer platform to KVM virtual platform |
CN108255574A (en) * | 2017-12-05 | 2018-07-06 | 顺丰科技有限公司 | A kind of virtual machine migration method and device |
US20180212896A1 (en) * | 2017-01-26 | 2018-07-26 | Cisco Technology, Inc. | Distributed hybrid cloud orchestration model |
CN109522088A (en) * | 2018-09-30 | 2019-03-26 | 华为技术有限公司 | A kind of virtual machine migration method and device |
-
2019
- 2019-08-13 CN CN201910743328.5A patent/CN110532061A/en not_active Withdrawn
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106406979A (en) * | 2016-09-04 | 2017-02-15 | 国云科技股份有限公司 | Method of migrating virtual machine of XenServer platform to KVM virtual platform |
US20180212896A1 (en) * | 2017-01-26 | 2018-07-26 | Cisco Technology, Inc. | Distributed hybrid cloud orchestration model |
CN108255574A (en) * | 2017-12-05 | 2018-07-06 | 顺丰科技有限公司 | A kind of virtual machine migration method and device |
CN109522088A (en) * | 2018-09-30 | 2019-03-26 | 华为技术有限公司 | A kind of virtual machine migration method and device |
Non-Patent Citations (1)
Title |
---|
ROY LUO: "qcow2原理详解", 《网页》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111124615A (en) * | 2019-12-22 | 2020-05-08 | 北京浪潮数据技术有限公司 | Virtual machine migration method, device, equipment and computer readable storage medium |
CN114296868A (en) * | 2021-12-17 | 2022-04-08 | ***数智科技有限公司 | Virtual machine automatic migration decision method based on user experience in multi-cloud environment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8504529B1 (en) | System and method for restoring data to a storage device based on a backup image | |
US8392685B2 (en) | Arrangements for managing metadata of an integrated logical unit including differing types of storage media | |
US9501241B2 (en) | Storage system and object management method | |
US8694469B2 (en) | Cloud synthetic backups | |
US9009443B2 (en) | System and method for optimized reclamation processing in a virtual tape library system | |
JP5400889B2 (en) | File server apparatus, storage system management method, and program | |
US20120191675A1 (en) | Device and method for eliminating file duplication in a distributed storage system | |
CN106407040A (en) | Remote data copy method and system | |
US20180205791A1 (en) | Object storage in cloud with reference counting using versions | |
CN104216801B (en) | The data copy method and system of a kind of Virtual environment | |
KR101709118B1 (en) | Method and appratus for managing file in hybrid storage system | |
CN102331957B (en) | File backup method and device | |
CN107111531A (en) | Use the data recovery of distribution diagram | |
JP2004302505A (en) | Data migration support system, program, device, removable storage device, and discrimination method of storage medium in which data migration has been completed | |
CN103713941B (en) | Virtual machine image cloning process and system based on qcow2 forms | |
US10169345B2 (en) | Moving data from linear tape file system storage to cloud storage | |
CN110532061A (en) | A method of migrating virtual machine under cloudy environment | |
JP4755244B2 (en) | Information generation method, information generation program, and information generation apparatus | |
CN104092726A (en) | Automatic replacing method and apparatus of same-name file | |
CN105100149A (en) | Method and system for file management | |
JP2016066285A (en) | Storage system, control method for storage system, and virtual tape device control program | |
JP2012008854A (en) | Storage virtualization device | |
WO2009088007A1 (en) | Content management device, content management system, content management method, and program | |
US20170286442A1 (en) | File system support for file-level ghosting | |
JP6845470B2 (en) | Storage system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20191203 |
|
WW01 | Invention patent application withdrawn after publication |