CN107870802B - Virtual machine migration method and device - Google Patents

Virtual machine migration method and device Download PDF

Info

Publication number
CN107870802B
CN107870802B CN201610856234.5A CN201610856234A CN107870802B CN 107870802 B CN107870802 B CN 107870802B CN 201610856234 A CN201610856234 A CN 201610856234A CN 107870802 B CN107870802 B CN 107870802B
Authority
CN
China
Prior art keywords
disk
virtual machine
cluster
data
physical machine
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
CN201610856234.5A
Other languages
Chinese (zh)
Other versions
CN107870802A (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 Cloud Computing 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 CN201610856234.5A priority Critical patent/CN107870802B/en
Publication of CN107870802A publication Critical patent/CN107870802A/en
Application granted granted Critical
Publication of CN107870802B publication Critical patent/CN107870802B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0667Virtualisation aspects at data level, e.g. file, record or object virtualisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Abstract

The embodiment of the application provides a virtual machine migration method, which comprises the following steps: determining a virtual machine on a first cluster; stopping the virtual machine; determining a first physical machine in a second cluster, and migrating the virtual machine from the first cluster to the first physical machine; acquiring disk information of a first disk associated with a virtual machine; and creating a second disk according to the disk information, and mounting the second disk on the virtual machine of the first physical machine. In the embodiment of the application, the virtual machine in the old cluster is migrated to the new cluster, and the new disk is created and associated with the migrated virtual machine based on the disk information of the old disk associated with the virtual machine. And after the migrated virtual machine is associated with the new disk, starting the virtual machine. In the embodiment of the application, when the virtual machine is migrated, all disk data does not need to be migrated, so that the data transmission time is reduced, the virtual machine downtime is reduced, and the virtual machine is migrated rapidly.

Description

Virtual machine migration method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a virtual machine migration method and a virtual machine migration apparatus.
Background
For a cloud service provider, periodically improving the performance of a cloud server is an important means for improving competitiveness. The cloud server is actually a server constituted by a Virtual Machine (Virtual Machine). The virtual machine is a system virtual machine, i.e. a complete computer system which can be simulated, has the function of a complete hardware system and runs in a completely isolated environment.
The virtual machine system is installed on a physical machine to run, and a cloud service provider generally establishes the physical machine as a cluster. One of the main means for improving the performance of the cloud server by the cloud service provider is to migrate the cloud server from the current physical machine cluster to a physical machine cluster with better hardware performance.
In an existing cloud server migration scheme, a virtual machine can be restarted only after all data (including memory data used by the virtual machine and disk data associated with the virtual machine) used by a cloud server are migrated to a new cluster. Such a migration method requires a lot of data to be migrated, which consumes a lot of time and increases the downtime of the virtual machine.
Disclosure of Invention
In view of the above problems, embodiments of the present application are proposed to provide a virtual machine migration method and a corresponding virtual machine migration apparatus, which overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present application discloses a virtual machine migration method, including:
determining a virtual machine on a first cluster;
stopping the virtual machine;
determining a first physical machine in a second cluster, and migrating the virtual machine from the first cluster to the first physical machine;
acquiring disk information of a first disk associated with the virtual machine;
and creating a second disk according to the disk information, and mounting the second disk on the virtual machine of the first physical machine.
Preferably, the step of determining the first physical machine in the second cluster includes:
acquiring installation specification information of the virtual machine;
and determining the physical machine which meets the installation specification information of the virtual machine as a first physical machine in the second cluster.
Preferably, the step of creating the second disk according to the disk information includes:
creating a second disk on the first physical machine according to the disk information;
or determining a second physical machine in a third cluster, and creating a second disk on the second physical machine according to the disk information.
Preferably, the disk information includes: the number and size of the first disks; the step of creating a second disk on the first physical machine according to the disk information includes:
creating second disks, the number and the size of which are the same as those of the first disks, on the first physical machine;
the step of creating a second disk on the second physical machine according to the disk information includes:
and creating second disks with the same number and size as the first disks on the second physical machine.
Preferably, the method further comprises the following steps:
before the virtual machine is started, acquiring network traffic on the first cluster;
directing the network traffic to the second cluster.
Preferably, the method further comprises the following steps:
when the virtual machine reads data, obtaining metadata of the second disk, where the metadata includes: data location information;
determining whether the data to be read is in the first disk or the second disk according to the data position information;
and if the data to be read is in the first disk, copying the data to be read into the second disk, and reading the data to be read from the second disk by the virtual machine.
Preferably, the method further comprises the following steps:
and when the virtual machine writes data, writing the data to be written into the second disk.
Meanwhile, the embodiment of the present application further discloses a virtual machine migration apparatus, including:
a virtual machine determination module to determine a virtual machine on a first cluster;
the virtual machine stopping module is used for stopping the virtual machine;
the first physical machine determining module is used for determining a first physical machine in a second cluster and migrating the virtual machine from the first cluster to the first physical machine;
the disk information acquisition module is used for acquiring the disk information of the first disk associated with the virtual machine;
and the disk creating and mounting module is used for creating a second disk according to the disk information and mounting the second disk to the virtual machine of the first physical machine.
Preferably, the first physical machine determination module includes:
the installation specification information acquisition submodule is used for acquiring the installation specification information of the virtual machine;
and the compliance physical machine determining submodule is used for determining the physical machine which meets the installation specification information of the virtual machine as the first physical machine in the second cluster.
Preferably, the disk creation and mount module includes:
the first disk creating submodule is used for creating a second disk on the first physical machine according to the disk information;
or, the second disk creating sub-module is configured to determine a second physical machine in a third cluster, and create a second disk on the second physical machine according to the disk information.
Preferably, the disk information includes: the number and size of the first disks; the first disk creation sub-module includes:
a first creating unit, configured to create, on the first physical machine, second disks that are the same as the first disks in number and size;
the second disk creation sub-module includes:
and the second creating unit is used for creating second disks which are the same as the first disks in number and size on the second physical machine.
Preferably, the method further comprises the following steps:
a network traffic obtaining module, configured to obtain network traffic on the first cluster before the virtual machine is started;
and the network flow import module is used for importing the network flow into the second cluster.
Preferably, the method further comprises the following steps:
a disk metadata obtaining module, configured to obtain metadata of the second disk when the virtual machine reads data, where the metadata includes: data location information;
the data position information determining module is used for determining whether the data to be read is in the first disk or the second disk according to the data position information;
and the data copying and reading module is used for copying the data to be read to the second disk if the data to be read is in the first disk, and the virtual machine reads the data to be read from the second disk.
Preferably, the method further comprises the following steps:
and the data writing module is used for writing the data to be written into the second disk when the virtual machine writes the data.
The embodiment of the application has the following advantages:
in the embodiment of the application, the virtual machine in the old cluster is migrated to the new cluster, and the new disk is created and associated with the migrated virtual machine based on the disk information of the old disk associated with the virtual machine. And after the migrated virtual machine is associated with the new disk, starting the virtual machine. In the embodiment of the application, when the virtual machine is migrated, all disk data does not need to be migrated, so that the data transmission time is reduced, the virtual machine downtime is greatly reduced, and the virtual machine is migrated quickly. The method and the device for migrating the virtual machines in the cluster can be used for migrating the batch virtual machines, and the virtual machines of the whole cluster can be rapidly migrated to a new cluster.
Drawings
Fig. 1 is a flowchart of steps of a virtual machine migration method embodiment 1 according to the present application;
fig. 2 is a flowchart of steps of embodiment 2 of a virtual machine migration method according to the present application;
fig. 3 is a schematic diagram of data flow directions in an embodiment of a virtual machine migration method according to the present application;
fig. 4 is a block diagram of a virtual machine migration apparatus according to an embodiment of the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, the present application is described in further detail with reference to the accompanying drawings and the detailed description.
The existing cloud server migration scheme mainly comprises the following steps: cold migration (shutdown migration), which may specifically be: firstly, the power supply of the physical machine where the virtual machine is located is closed, then the virtual machine and the associated disk are migrated to a new physical machine cluster, and the virtual machine can be restarted after all data are migrated. This results in a longer downtime due to the large amount of data migrated.
Based on the above problems, the embodiment of the present application provides a virtual machine migration method, which can quickly migrate a virtual machine to another cluster in batch and recover the normal operation of the virtual machine after the virtual machine is stopped, and even if data is not completely migrated to a new cluster, the virtual machine can be normally started and data can be normally read and written.
Referring to fig. 1, a flowchart of steps of embodiment 1 of a virtual machine migration method according to the present application is shown, which may specifically include the following steps:
step 101, determining a virtual machine on a first cluster;
the first cluster may be a cluster composed of physical machines which have passed a warranty period or have poor performance and on which a plurality of virtual machines may be installed. The cloud server provider provides services to customers by taking the virtual machines and the disks mounted by the virtual machines as cloud servers.
For stability, when a physical machine is over a warranty period or the physical machine has poor hardware performance, a cloud server provider generally migrates a virtual machine on an old physical machine cluster to a new physical cluster in order to ensure the performance of a cloud server.
In a distributed architecture of cloud servers, virtual machine clusters may be installed on different physical machine clusters, for example, virtual machine cluster a may be a physical machine cluster installed in beijing, and virtual machine cluster B may be a physical machine cluster installed in hangzhou.
In a distributed architecture of the cloud server, virtual machines located in different physical machine clusters can be uniformly managed through the control node. The database of the control node may store a correspondence between the physical machine and the virtual machine, and the ID of the virtual machine installed on each physical machine may be queried through the correspondence.
The database may also store usage information (age, warranty age, etc.) and performance information (Memory size, CPU resources, etc.) of the physical machine. The physical machines with the service life or poor performance can be found by checking the use information or the performance information of each physical machine in the data. After the physical machine with the service life or poor performance is found, the virtual machine installed on the physical machine can be found according to the corresponding relation of the physical machine.
Step 102, stopping the virtual machine;
in a virtualization system of a virtual machine, a function library that provides a programming interface for the virtualization system is installed. The programming interface provided by the function library can be provided with a programming interface for directly closing the virtual machine, and the virtual machine can be directly closed by calling the programming interface.
Step 103, determining a first physical machine in a second cluster, and migrating the virtual machine from the first cluster to the first physical machine;
the second cluster may be a cluster of better performing physical machines. In this embodiment of the present application, the first cluster and the second cluster may be clusters across network domains, that is, the embodiment of the present application may implement migration across network domains. In a second cluster, a first physical machine satisfying a migration condition is determined. The virtual machine is migrated from the physical machine of the first cluster to the physical machine of the second cluster.
104, acquiring disk information of a first disk associated with the virtual machine;
one virtual machine can mount a plurality of disks and is associated with the disks, and the disks are managed through a storage system. The virtual system of the virtual machine realizes data access through the storage system. The virtual system and the storage system of the virtual machine can be installed in the same cluster or in different clusters.
In general, disk information of a virtual machine may be stored in a database, and configuration information and disk information of the virtual machine may be found in the data by a virtual machine name. In addition, the disk information of the virtual machine may also be stored in a local file of the physical machine in which the control node is located. And the disk information of the virtual machine can be found in the local file of the node through the name of the virtual machine.
And 105, creating a second disk according to the disk information, and mounting the second disk on the virtual machine of the first physical machine.
Mounting means establishing a mapping relationship between a disk and a virtual machine. And when the virtual machine accesses data, determining the disk to be accessed according to the mapping relation. Before the virtual machine is migrated, the virtual machine has a mapping relation with the first disk, and after the virtual machine is migrated to the first physical machine, the mapping relation between the virtual machine and the first disk is changed into the mapping relation between the virtual machine and the second disk.
After the second disk is mounted to the virtual machine, the virtual machine can be started, and the virtual machine migration can be quickly recovered. In practice, a cloud service provider generally migrates disk data to a new cluster when the cluster where the disk is located is over-guaranteed. When the cluster where the disk is located is not over-guaranteed, the virtual machine can be started only after the virtual machine is migrated without migrating the disk.
In the embodiment of the application, the virtual machine in the old cluster is migrated to the new cluster, and the new disk is created and associated with the migrated virtual machine based on the disk information of the old disk associated with the virtual machine. And after the migrated virtual machine is associated with the new disk, starting the virtual machine. In the embodiment of the application, when the virtual machine is migrated, all disk data does not need to be migrated, so that the data transmission time is reduced, the virtual machine downtime is greatly reduced, and the virtual machine is migrated quickly. The method and the device for migrating the virtual machines in the cluster can be used for migrating the batch virtual machines, and the virtual machines of the whole cluster can be rapidly migrated to a new cluster.
Referring to fig. 2, a flowchart of steps of embodiment 2 of a virtual machine migration method according to the present application is shown, which may specifically include the following steps:
step 201, determining a virtual machine on a first cluster;
step 202, stopping the virtual machine;
step 203, determining a first physical machine in a second cluster, and migrating the virtual machine from the first cluster to the first physical machine;
in one embodiment of the present application, step 203 may comprise the sub-steps of:
a substep S11 of obtaining installation specification information of the virtual machine;
the installation specification information of the virtual machine comprises the Cpu resource size and the Memory size.
And a substep S12, determining the physical machine meeting the installation specification information of the virtual machine as the first physical machine in the second cluster.
And in the second cluster, determining the physical machine meeting the installation specification information as the first physical machine. Specifically, the CPU resources and memory available for allocation by each physical machine are recorded in the database. And in the database, the physical machine which can be allocated with the CPU resource and the Memory and meets the requirements of the size of the CPU resource and the size of the Memory required by the installation of the virtual machine is used as the first physical machine.
Step 204, acquiring disk information of a first disk associated with the virtual machine;
step 205, creating a second disk according to the disk information, and mounting the second disk on the virtual machine of the first physical machine;
in one embodiment of the present application, step 205 may comprise the following sub-steps:
a substep S21, creating a second disk on the first physical machine according to the disk information;
in a preferred example, the virtual system and the storage system may be installed in the same physical cluster, i.e., both the virtual machine and its mounted disk are installed in the same physical machine.
After the virtual machine is migrated to the first physical machine, a disk is created in the first physical machine according to disk information of the first disk.
Or, in sub-step S22, determining a second physical machine in the third cluster, and creating a second disk on the second physical machine according to the disk information.
In another preferred example, the virtual system and the storage system may be installed in different physical clusters, i.e., the virtual machine and its mounted disk are installed in different physical machines.
And after the virtual machine is migrated to the first physical machine of the second cluster, selecting the second physical machine in the third cluster as a storage system. And creating a second operation on the second physical machine according to the disk information of the first disk.
The disk creation and destruction used by the virtual machine are realized by providing a uniform interface by a virtual storage team, the creation of one disk needs to prepare a configuration file of disk information of a new disk and an old disk, the new disk configuration file is associated with the old disk configuration file, and the creation of the disk can be completed by calling the created disk interface once again.
In this embodiment of the present application, immediately after the second disk is created, the disk data in the first disk is not completely copied to the second disk, but only necessary metadata is created, where the metadata includes: the number of disks, the size of the disks, data location information and the like.
Further, the disk information may include: the number and size of the first disks;
the substep S21 may specifically be:
creating second disks, the number and the size of which are the same as those of the first disks, on the first physical machine;
the number and size of the second disks newly created on the first physical machine are the same as the number and size of the first disks.
The substep S22 may specifically be:
and determining a second physical machine in a third cluster, and creating second disks with the same number and size as the first disks on the second physical machine.
The number and size of the second disks newly created on the second physical machine are the same as the number and size of the first disks.
Step 206, before the virtual machine is started, acquiring network traffic on the first cluster;
specifically, after stopping the virtual machine, if the Web service is provided inside the virtual machine and the Web service is accessed, the first cluster generates network traffic.
Step 207, importing the network traffic into the second cluster;
and resetting the route of the virtual machine on the network equipment setting of the physical machine of the second cluster, deleting the route of the virtual machine and the first cluster, and establishing the route of the virtual machine and the second cluster.
The routing of the virtual machine may include: an IP address. Generally, the virtual machine has the same route as the physical machine it is on. After the virtual machine is migrated to the new cluster, the route of the virtual machine is changed to the route of the new physical machine in the network device of the new cluster physical machine, so that the network traffic can be introduced into the new cluster. After the network traffic is led into the new cluster, the virtual machine can provide normal network service during operation.
Step 208, starting the virtual machine;
after the virtual machine is started, the virtual machine can perform normal data access operation.
Step 209, when the virtual machine reads data, obtaining metadata of the second disk, where the metadata includes: data location information;
when the second disk is created, metadata of the second disk is created, wherein the metadata comprises: the number, size, and data location information of the second disk. The data is stored in the disk of the storage system according to blocks, the data position information can be recorded by a bit-map, and whether the block corresponding to the data needing to be read is in the first disk of the first cluster or the second disk which is copied to the second cluster is recorded by the bit-map.
For example, 1bit is allocated to each data block as an identification bit, an identification bit of 0 indicates that the data block is in a first disk of a first cluster, and an identification bit of 1 indicates that the data block is in a second disk that has been copied to a second cluster.
It should be understood by those skilled in the art that the above-mentioned storage manner of the data location information is only an example of the present application, and those skilled in the art may use other storage manners of the data location information for storage, and the present application is not limited herein.
Step 210, determining whether the data to be read is in the first disk or the second disk according to the data position information;
step 211, if the data to be read is in the first disk, copying the data to be read to the second disk, and reading the data to be read from the second disk by the virtual machine.
And if the data to be read is still in the first disk, copying the data to be read to a second disk by the distributed storage system for the virtual machine to use.
In the embodiment of the application, the virtual machine uses a distributed storage system, and after the virtual machine is started, the virtual machine is migrated in a shutdown migration mode across network domains. In the process of reading data by the virtual machine, the virtual machine is started before the data migration is finished in an asynchronous data loading mode. The asynchronous data loading is a mode that another thread is adopted to load data in the running process of the virtual machine.
In step 212, if the data to be read is in the second disk, the virtual machine reads the data to be read from the second disk.
And if the data to be read is already in the second disk, the virtual machine directly reads the data to be read in the second disk.
In step 213, when the virtual machine writes data, the data to be written is written into the second disk.
And when the virtual machine needs to write data, writing the data to be written into the disk of the second-level group.
In the embodiment of the present application, the virtual machine and the disk may be arranged in the same physical machine cluster, or may be arranged in different physical machine clusters. When the virtual machine is arranged in the over-protection cluster and the disk is arranged in a new cluster, the virtual machine only needs to be migrated to the new cluster without migrating the disk.
When the virtual machine is arranged in a new cluster and the disk is arranged in an over-protection cluster, only the disk needs to be migrated to the new cluster without migrating the virtual machine, and when the disk is migrated, the disk data is not immediately migrated from an old disk to a new disk, but when the virtual machine reads, if the read data is in the old disk, the data to be read is copied to the new disk for the virtual machine to read. The virtual machine does not need to be started after all the disk data are migrated, so that the stop time of the virtual machine is greatly shortened.
Referring to fig. 3, a schematic diagram of a data flow direction in an embodiment of a virtual machine migration method according to the present application is shown.
Before the virtual machine is migrated, the virtual machine cluster 311 where the virtual machine is located and the storage cluster 312 where the disk mounted by the virtual machine is located belong to the same protected physical cluster (i.e., the protected cluster 31 shown in fig. 3), and the virtual machine cluster 311 reads and writes data in the storage cluster 312 of the protected cluster 31.
For stability reasons, the virtual machine cluster 311 and the storage cluster 312 in the overarching cluster 31 need to be migrated in bulk to the new cluster 32.
The migration process may include:
1) all virtual machines of virtual machine cluster 311 are shut down.
2) The installation specifications (CPU resources and memory size) required by each virtual machine are obtained, where the installation specifications of each virtual machine may be different from each other.
3) In the new cluster 32, target physical machines which can meet the installation specifications of the virtual machines are searched one by one, wherein one physical machine can meet the installation specifications of the virtual machines.
4) Each virtual machine is migrated to the corresponding target physical machine, but the virtual machine is not started after the migration, and after the migration of the virtual machine is completed, the virtual machine cluster 321 is formed in the new cluster 32.
5) Acquiring disk information of each virtual machine, wherein the disk information comprises: the number of mounted disks and the size of each disk. The disk information may be stored in a database or may be stored in a local file of the physical machine in which the control node is located.
6) According to the disk information, new disks are created in the new cluster 32, the number of newly created disks is equal to the number of original disks, and the size of the newly created disks is equal to the size of the original disks. The newly created disks are only necessary metadata (disk size information, data location information, etc.), and after the creation of the new disks is completed, the storage cluster 322 is formed in the new cluster.
7) And mounting the newly created disk on the migrated virtual machine, wherein the mounting mode is usually to establish a mapping relation between the disk and the virtual machine in a database. After the virtual machine is started, data can be read from the corresponding disk according to the mapping relation.
8) After the mounting is completed, the virtual machine can be started, and normal cloud service is provided.
In particular, if network traffic is generated in the overarching cluster 31 after the virtual machine is shut down and before the virtual machine is started (e.g., network traffic is generated when WEB services provided inside the virtual machine are accessed), all network traffic needs to be imported into the new cluster 32. Only after the network traffic is imported into the new cluster 32 can the migrated virtual machine provide normal network services.
After the virtual machine is migrated to the new cluster 32, the virtual machine cluster 321 reads and writes data from and to the storage cluster 322 of the new cluster 32.
When the virtual machine in the virtual machine cluster 321 reads data, if the data to be read is not in the new disk of the storage cluster 322, the new disk reads information of the original disk located in the old storage cluster 312, and determines whether the data to be read is in the original disk. If the data is in the original disk, the original disk is notified. And after receiving the notification, the original disk writes the data to be read into the new disk, so that the virtual machine can read the data from the new disk. If the data to be read is in the new disk, the virtual machine can read the data from the new disk directly.
When the virtual machine writes data, the virtual machine directly writes the data to the persistent data in the new disk.
In the embodiment of the application, the virtual machine after the shutdown and the migration can be restarted by mounting the newly created disk. In the process of reading data by the virtual machine, the data in the old disk is copied to the new disk in an asynchronous data loading mode for the virtual machine to use. Compared with the method for restarting the virtual machine after completing the migration of all the disk data in the existing migration scheme, the method and the device greatly reduce the downtime of the virtual machine and realize the rapid migration of the virtual machine.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the embodiments are not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the embodiments. Further, those skilled in the art will also appreciate that the embodiments described in the specification are presently preferred and that no particular act is required of the embodiments of the application.
Referring to fig. 4, a block diagram of a virtual machine migration apparatus according to an embodiment of the present application is shown, and specifically, the block diagram may include the following modules:
a virtual machine determining module 401, configured to determine a virtual machine on a first cluster;
a virtual machine stopping module 402 for stopping the virtual machine;
a first physical machine determining module 403, configured to determine a first physical machine in a second cluster, and migrate the virtual machine from the first cluster to the first physical machine;
a disk information obtaining module 404, configured to obtain disk information of a first disk associated with the virtual machine;
and a disk creation mount module 405, configured to create a second disk according to the disk information, and mount the second disk to the virtual machine of the first physical machine.
In the embodiment of the application, the virtual machine in the old cluster is migrated to the new cluster, and the new disk is created and associated with the migrated virtual machine based on the disk information of the old disk associated with the virtual machine. And after the migrated virtual machine is associated with the new disk, starting the virtual machine. In the embodiment of the application, when the virtual machine is migrated, all disk data does not need to be migrated, so that the data transmission time is reduced, the virtual machine downtime is greatly reduced, and the virtual machine is migrated quickly. The method and the device for migrating the virtual machines in the cluster can be used for migrating the batch virtual machines, and the virtual machines of the whole cluster can be rapidly migrated to a new cluster.
In an embodiment of the present application, the first physical machine determination module 403 may include:
the installation specification information acquisition submodule is used for acquiring the installation specification information of the virtual machine;
and the compliance physical machine determining submodule is used for determining the physical machine which meets the installation specification information of the virtual machine as the first physical machine in the second cluster.
In an embodiment of the present application, the disk creation mount module 405 may include:
the first disk creating submodule is used for creating a second disk on the first physical machine according to the disk information;
or, the second disk creating sub-module is configured to determine a second physical machine in a third cluster, and create a second disk on the second physical machine according to the disk information.
In one embodiment of the present application, the disk information includes: the number and size of the first disks;
the first disk creation sub-module includes:
a first creating unit, configured to create, on the first physical machine, second disks that are the same as the first disks in number and size;
the second disk creation sub-module includes:
and the second creating unit is used for creating second disks which are the same as the first disks in number and size on the second physical machine.
In an embodiment of the present application, the apparatus may further include:
a network traffic obtaining module, configured to obtain network traffic on the first cluster before the virtual machine is started;
and the network flow import module is used for importing the network flow into the second cluster.
In an embodiment of the present application, the apparatus may further include:
a disk metadata obtaining module, configured to obtain metadata of the second disk when the virtual machine reads data, where the metadata includes: data location information;
the data position information determining module is used for determining whether the data to be read is in the first disk or the second disk according to the data position information;
and the data copying and reading module is used for copying the data to be read to the second disk if the data to be read is in the first disk, and the virtual machine reads the data to be read from the second disk.
In an embodiment of the present application, the apparatus may further include:
and the data writing module is used for writing the data to be written into the second disk when the virtual machine writes the data.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one of skill in the art, embodiments of the present application may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present application are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present application have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the true scope of the embodiments of the application.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The foregoing describes in detail a virtual machine migration method and a virtual machine migration apparatus provided in the present application, and specific examples are applied in the present application to explain the principles and embodiments of the present application, and the descriptions of the foregoing embodiments are only used to help understand the method and the core ideas of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (12)

1. A virtual machine migration method is characterized by comprising the following steps:
determining a virtual machine on a first cluster;
stopping the virtual machine;
determining a first physical machine meeting a migration condition in a second cluster, and migrating the virtual machine from the first cluster to the first physical machine;
acquiring disk information of a first disk associated with the virtual machine;
creating a second disk according to the disk information, and mounting the second disk on a virtual machine of the first physical machine;
wherein the method further comprises:
when the virtual machine reads data, obtaining metadata of the second disk, where the metadata includes: data location information;
determining whether the data to be read is in the first disk or the second disk according to the data position information;
and if the data to be read is in the first disk, copying the data to be read into the second disk, and reading the data to be read from the second disk by the virtual machine.
2. The method of claim 1, wherein the step of determining the first physical machine in the second cluster that satisfies the migration condition comprises:
acquiring installation specification information of the virtual machine;
and determining the physical machine which meets the installation specification information of the virtual machine as a first physical machine in the second cluster.
3. The method of claim 1, wherein the step of creating a second disk according to the disk information comprises:
creating a second disk on the first physical machine according to the disk information;
or determining a second physical machine in a third cluster, and creating a second disk on the second physical machine according to the disk information.
4. The method of claim 3, wherein the disk information comprises: the number and size of the first disks; the step of creating a second disk on the first physical machine according to the disk information includes:
creating second disks, the number and the size of which are the same as those of the first disks, on the first physical machine;
the step of creating a second disk on the second physical machine according to the disk information includes:
and creating second disks with the same number and size as the first disks on the second physical machine.
5. The method of claim 1, 2, 3 or 4, further comprising:
before starting the virtual machine, acquiring network traffic on the first cluster;
directing the network traffic to the second cluster.
6. The method of claim 1, 2, 3 or 4, further comprising:
and when the virtual machine writes data, writing the data to be written into the second disk.
7. A virtual machine migration apparatus, comprising:
a virtual machine determination module to determine a virtual machine on a first cluster;
the virtual machine stopping module is used for stopping the virtual machine;
the first physical machine determining module is used for determining a first physical machine meeting a migration condition in a second cluster and migrating the virtual machine from the first cluster to the first physical machine;
the disk information acquisition module is used for acquiring the disk information of the first disk associated with the virtual machine;
the disk creating and mounting module is used for creating a second disk according to the disk information and mounting the second disk on the virtual machine of the first physical machine;
wherein the apparatus further comprises:
a disk metadata obtaining module, configured to obtain metadata of the second disk when the virtual machine reads data, where the metadata includes: data location information;
the data position information determining module is used for determining whether the data to be read is in the first disk or the second disk according to the data position information;
and the data copying and reading module is used for copying the data to be read to the second disk if the data to be read is in the first disk, and the virtual machine reads the data to be read from the second disk.
8. The apparatus of claim 7, wherein the first physical machine determination module comprises:
the installation specification information acquisition submodule is used for acquiring the installation specification information of the virtual machine;
and the compliance physical machine determining submodule is used for determining the physical machine which meets the installation specification information of the virtual machine as the first physical machine in the second cluster.
9. The apparatus of claim 7, wherein the disk create mount module comprises:
the first disk creating submodule is used for creating a second disk on the first physical machine according to the disk information;
or, the second disk creating sub-module is configured to determine a second physical machine in a third cluster, and create a second disk on the second physical machine according to the disk information.
10. The apparatus of claim 9, wherein the disk information comprises: the number and size of the first disks; the first disk creation sub-module includes:
a first creating unit, configured to create, on the first physical machine, second disks that are the same as the first disks in number and size;
the second disk creation sub-module includes:
and the second creating unit is used for creating second disks which are the same as the first disks in number and size on the second physical machine.
11. The apparatus of claim 7, 8, 9 or 10, further comprising:
a network traffic obtaining module, configured to obtain network traffic on the first cluster before starting the virtual machine;
and the network flow import module is used for importing the network flow into the second cluster.
12. The apparatus of claim 7, 8, 9 or 10, further comprising:
and the data writing module is used for writing the data to be written into the second disk when the virtual machine writes the data.
CN201610856234.5A 2016-09-27 2016-09-27 Virtual machine migration method and device Active CN107870802B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610856234.5A CN107870802B (en) 2016-09-27 2016-09-27 Virtual machine migration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610856234.5A CN107870802B (en) 2016-09-27 2016-09-27 Virtual machine migration method and device

Publications (2)

Publication Number Publication Date
CN107870802A CN107870802A (en) 2018-04-03
CN107870802B true CN107870802B (en) 2021-09-07

Family

ID=61752385

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610856234.5A Active CN107870802B (en) 2016-09-27 2016-09-27 Virtual machine migration method and device

Country Status (1)

Country Link
CN (1) CN107870802B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078127B (en) * 2018-10-22 2024-03-12 阿里巴巴集团控股有限公司 Data migration method, system and device
CN109358952A (en) * 2018-10-30 2019-02-19 张家口浩扬科技有限公司 A kind of virtual machine migration method and system
CN109445908B (en) * 2018-10-30 2021-04-27 杭州炎魂网络科技有限公司 Virtual machine backup method and system
CN110515697A (en) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 A kind of virtual machine migration method, device, storage medium and computer equipment
CN113468136A (en) * 2020-03-30 2021-10-01 北京金山云网络技术有限公司 Upgrading method and device of cloud platform and server
CN113672333B (en) * 2020-05-15 2024-04-05 顺丰科技有限公司 Virtual machine hot cloning method, device, system, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103399778A (en) * 2013-07-01 2013-11-20 华为技术有限公司 Method and device for on-line integral migration of virtual machine
CN103559077A (en) * 2013-11-08 2014-02-05 北京华胜天成科技股份有限公司 Optimized automatic transfer method and system for virtual machines
CN103699429A (en) * 2013-12-31 2014-04-02 华为技术有限公司 Virtual machine migration method and virtual machine migration device
CN104731915A (en) * 2015-03-24 2015-06-24 上海爱数软件有限公司 Magnetic disk device mapping method in distributed memory system
CN105138394A (en) * 2015-09-21 2015-12-09 上海爱数软件有限公司 Method for thermally migrating K virtual machine (KVM) and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9588796B2 (en) * 2014-06-28 2017-03-07 Vmware, Inc. Live migration with pre-opened shared disks

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103399778A (en) * 2013-07-01 2013-11-20 华为技术有限公司 Method and device for on-line integral migration of virtual machine
CN103559077A (en) * 2013-11-08 2014-02-05 北京华胜天成科技股份有限公司 Optimized automatic transfer method and system for virtual machines
CN103699429A (en) * 2013-12-31 2014-04-02 华为技术有限公司 Virtual machine migration method and virtual machine migration device
CN104731915A (en) * 2015-03-24 2015-06-24 上海爱数软件有限公司 Magnetic disk device mapping method in distributed memory system
CN105138394A (en) * 2015-09-21 2015-12-09 上海爱数软件有限公司 Method for thermally migrating K virtual machine (KVM) and system

Also Published As

Publication number Publication date
CN107870802A (en) 2018-04-03

Similar Documents

Publication Publication Date Title
CN107870802B (en) Virtual machine migration method and device
US10545781B2 (en) Dynamically deployed virtual machine
US11586673B2 (en) Data writing and reading method and apparatus, and cloud storage system
CN108287669B (en) Date storage method, device and storage medium
CA2984142C (en) Automatic scaling of resource instance groups within compute clusters
US20230229637A1 (en) Intelligent file system with transparent storage tiering
US20190215313A1 (en) Implementing Secure Communication In A Distributed Computing System
CN108153849B (en) Database table segmentation method, device, system and medium
US9886398B2 (en) Implicit sharing in storage management
US10440132B2 (en) Tracking application usage in a computing environment
CN105468473A (en) Data migration method and data migration apparatus
US11036535B2 (en) Data storage method and apparatus
US9928056B1 (en) Operating system update management
CN111475483A (en) Database migration method and device and computing equipment
CN111866045A (en) Information processing method and device, computer system and computer readable medium
CN112256433A (en) Partition migration method and device based on Kafka cluster
US11159402B1 (en) Virtual machine import/export risk assessment
CN117131014A (en) Database migration method, device, equipment and storage medium
CN110298031B (en) Dictionary service system and model version consistency distribution method
CN116594734A (en) Container migration method and device, storage medium and electronic equipment
CN115080309A (en) Data backup system, method, storage medium, and electronic device
CN115033551A (en) Database migration method and device, electronic equipment and storage medium
CN115061841A (en) Alarm merging method and device, electronic equipment and storage medium
US20210326249A1 (en) Media import and export in storage management systems
CN112711469A (en) Cloud host migration method and device, computer equipment and storage medium

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
TR01 Transfer of patent right

Effective date of registration: 20230524

Address after: Room 1-2-A06, Yungu Park, No. 1008 Dengcai Street, Sandun Town, Xihu District, Hangzhou City, Zhejiang Province

Patentee after: Aliyun Computing Co.,Ltd.

Address before: Box 847, four, Grand Cayman capital, Cayman Islands, UK

Patentee before: ALIBABA GROUP HOLDING Ltd.

TR01 Transfer of patent right