CN113672333B - Virtual machine hot cloning method, device, system, computer equipment and storage medium - Google Patents

Virtual machine hot cloning method, device, system, computer equipment and storage medium Download PDF

Info

Publication number
CN113672333B
CN113672333B CN202010412168.9A CN202010412168A CN113672333B CN 113672333 B CN113672333 B CN 113672333B CN 202010412168 A CN202010412168 A CN 202010412168A CN 113672333 B CN113672333 B CN 113672333B
Authority
CN
China
Prior art keywords
virtual machine
cloning
machine
physical
source
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
CN202010412168.9A
Other languages
Chinese (zh)
Other versions
CN113672333A (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.)
SF Technology Co Ltd
Original Assignee
SF Technology Co 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 SF Technology Co Ltd filed Critical SF Technology Co Ltd
Priority to CN202010412168.9A priority Critical patent/CN113672333B/en
Publication of CN113672333A publication Critical patent/CN113672333A/en
Application granted granted Critical
Publication of CN113672333B publication Critical patent/CN113672333B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to a virtual machine hot cloning method, a device, a system, computer equipment and a storage medium. The method comprises the following steps: receiving a virtual machine cloning instruction sent by a terminal; the method comprises the steps of sending a virtual machine disk cloning task generated according to a virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone the source virtual machine disk to obtain a cloned disk file; when receiving prompt information which is fed back by a source physical machine and indicates that disk cloning is successful, dynamically selecting a target physical machine according to a virtual machine cloning instruction; generating basic information of each destination virtual machine according to the virtual machine cloning instruction; sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine; the virtual machine cloning task is used for indicating the destination physical machine to obtain a cloning disk file from the source physical machine, and the destination virtual machine is cloned locally according to corresponding basic information based on the cloning disk file. The data processing pressure of the physical machine can be relieved by adopting the method.

Description

Virtual machine hot cloning method, device, system, computer equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a system, a computer device, and a storage medium for hot cloning a virtual machine.
Background
With the development of computer technology, a virtual machine technology based on a computer gradually appears, and a virtual machine obtained based on the virtual machine technology is a complete computer system with complete hardware system functions and can be used for completing data processing realized by a corresponding entity computer. By deploying a plurality of virtual machines with the same function to execute the same data processing, the data processing efficiency can be improved. In order to improve the deployment efficiency of the virtual machine, a plurality of virtual machines with the same functions can be deployed in a virtual machine hot cloning mode. Currently, virtual machines, which are usually the same physical machines, are hot cloned to deploy multiple virtual machines with the same functions on the same physical machine to perform the same data processing. However, this approach can increase the data processing pressure of the physical machine in which the virtual machine is deployed.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a virtual machine hot cloning method, apparatus, system, computer device, and storage medium that can relieve the data processing pressure of a physical machine in which a virtual machine is deployed.
A method of virtual machine hot cloning, the method comprising:
receiving a virtual machine cloning instruction sent by a terminal;
sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone a source virtual machine disk to obtain a cloned disk file;
when receiving prompt information which is fed back by the source physical machine and indicates that disk cloning is successful, dynamically selecting a target physical machine according to the virtual machine cloning instruction;
generating basic information of each destination virtual machine according to the virtual machine cloning instruction;
sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine; the virtual machine cloning task is used for indicating the corresponding destination physical machine to acquire the cloning disk file from the source physical machine and locally cloning the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file.
In one embodiment, the dynamically selecting the destination physical machine according to the virtual machine cloning instruction includes:
determining the quantity of a deployment set and the number of target virtual machines according to the virtual machine cloning instruction;
Determining candidate physical machines according to the deployment set;
and selecting the target physical machines of the target virtual machine number from the candidate physical machines.
In one embodiment, the determining candidate physical machines according to the deployment set includes:
when the deployment set is at the physical machine level, taking the physical machines in each storage cluster as candidate physical machines;
and when the deployment set is at the storage cluster level, taking the physical machines which are in different storage clusters from the source physical machine as candidate physical machines.
In one embodiment, the method further comprises:
generating a clone disk file deleting instruction after receiving prompt information which is fed back by each destination physical machine and indicates that the virtual machine cloning is successful;
sending the clone disk file deleting instruction to the source physical machine; the clone disk file deleting instruction is used for indicating the source physical machine to delete the clone disk file.
In one embodiment, the step of locally cloning the corresponding destination virtual machine by the destination physical machine according to the corresponding basic information based on the cloned disk file includes:
analyzing the received cloning task of the virtual machine by the target physical machine to obtain basic information of the corresponding target virtual machine, and generating a storage catalog and a configuration file according to the basic information;
The target physical machine renames the file identifier corresponding to the clone disk file, modifies the renamed clone disk file to obtain a target disk file, and stores the target disk file according to the storage directory;
and the destination physical machine generates metadata of the corresponding destination virtual machine based on the configuration file so as to finish cloning operation of the corresponding destination virtual machine.
In one embodiment, the virtual machine cloning task further carries a determination result representing whether the corresponding destination physical machine and the source physical machine are in the same storage cluster; the step of the destination physical machine obtaining the clone disk file from the source physical machine includes:
the target physical machine extracts a judging result from the received virtual machine cloning task, and determines the acquisition mode of the cloning disk file according to the extracted judging result;
and the destination physical machine acquires the clone disk file from the source physical machine according to the determined acquisition mode.
A virtual machine thermal cloning apparatus, the apparatus comprising:
the receiving module is used for receiving a virtual machine cloning instruction sent by the terminal;
the first cloning module is used for sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone a source virtual machine disk to obtain a cloned disk file;
The selection module is used for dynamically selecting the target physical machine according to the virtual machine cloning instruction when receiving the prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful;
the generation module is used for generating basic information of each destination virtual machine according to the virtual machine cloning instruction;
the second cloning module is used for sending virtual machine cloning tasks carrying basic information of the corresponding target virtual machines to each target physical machine; the virtual machine cloning task is used for indicating the corresponding destination physical machine to acquire the cloning disk file from the source physical machine and locally cloning the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file.
A virtual machine hot cloning system, the system comprising: the system comprises a terminal, a source physical machine, a destination physical machine and control equipment;
the terminal is used for sending a virtual machine cloning instruction to the control equipment;
the control device is used for sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to the source physical machine;
the source physical machine is used for cloning a source virtual machine disk according to the virtual machine disk cloning task to obtain a cloning disk file;
The control equipment is also used for dynamically selecting a target physical machine according to the virtual machine cloning instruction when receiving prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful; generating basic information of each destination virtual machine according to the virtual machine cloning instruction; sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine;
the destination physical machine is used for acquiring the clone disk file from the source physical machine according to the received virtual machine cloning task, and locally cloning the corresponding destination virtual machine according to the clone disk file and the corresponding basic information.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the method embodiments described above when the computer program is executed.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the various method embodiments described above.
According to the virtual machine hot cloning method, device, system, computer equipment and storage medium, after receiving a virtual machine cloning instruction sent by a terminal, a virtual machine disk cloning task generated according to the virtual machine cloning instruction is sent to a source physical machine, so that the source physical machine can be instructed to clone a source virtual machine disk appointed by the virtual machine cloning instruction to obtain a cloning disk file, when receiving prompting information which indicates that disk cloning is successful and is fed back by the source physical machine, a target physical machine is dynamically selected according to the virtual machine cloning instruction, basic information of each target virtual machine is generated, a virtual machine cloning task carrying the basic information of each target virtual machine is sent to a corresponding target physical machine, so that each target physical machine can be instructed to acquire the cloning disk file from the source physical machine according to the received virtual machine cloning task, and the corresponding target virtual machine is locally cloned according to the corresponding basic information based on the cloning disk file, and therefore virtual machine hot cloning of a cross-physical machine is achieved. Therefore, by means of the hot cloning of the virtual machines, the plurality of virtual machines with the same functions are distributed and deployed on different physical machines, the data processing pressure of each physical machine can be relieved, and in the deployment mode, the availability of the virtual machines can be improved, so that the reliability of data processing can be improved.
Drawings
FIG. 1 is an application environment diagram of a virtual machine hot cloning method in one embodiment;
FIG. 2 is a flow diagram of a method for virtual machine hot cloning in one embodiment;
FIG. 3 is a flowchart of a method for hot cloning a virtual machine according to another embodiment;
FIG. 4 is a timing diagram of a virtual machine hot cloning method in one embodiment;
FIG. 5 is a block diagram of a virtual machine thermal cloning apparatus in one embodiment;
FIG. 6 is an architecture diagram of a virtual machine thermal cloning system in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The virtual machine hot cloning method provided by the application can be applied to an application environment shown in figure 1. The terminal 102, the source physical machine 106, and the destination physical machine 108 communicate with the control device 104 via a network, and the source physical machine 106 communicates with the destination physical machine 108 via a network. The control device 104 receives a virtual machine cloning instruction sent by the terminal 102, sends a virtual machine disk cloning task generated according to the virtual machine cloning instruction to the source physical machine 106 to instruct the source physical machine 106 to clone a source virtual machine disk to obtain a corresponding cloning disk file, dynamically selects the destination physical machine 108 according to the virtual machine cloning instruction when receiving prompt information which indicates that disk cloning is successful and is fed back by the source physical machine 106, generates basic information of each destination virtual machine, and sends a virtual machine cloning task carrying the basic information of the corresponding destination virtual machine to each dynamically determined destination physical machine 108 to instruct the destination physical machine 108 to acquire the cloning disk file from the source physical machine 106, and locally clones the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and the control device 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers. It will be appreciated that the destination physical machines shown in fig. 1 are not intended to limit the number of destination physical machines, and there may be a plurality of destination physical machines dynamically selected according to the virtual machine cloning instruction.
In one embodiment, as shown in fig. 2, a method for hot cloning a virtual machine is provided, and the method is applied to the control device in fig. 1 for illustration, and includes the following steps:
step 202, receiving a virtual machine cloning instruction sent by a terminal.
Wherein the virtual machine clone instruction is an instruction for triggering a virtual machine clone operation. The virtual machine cloning instruction carries a source virtual machine identifier to be cloned, which is used for specifying the source virtual machine to be cloned, and can also carry the number of destination virtual machines, which is used for specifying the number of destination virtual machines to be cloned. The virtual machine cloning instruction can also carry a source physical machine identifier corresponding to a source physical machine of the source virtual machine to be cloned.
Specifically, the terminal detects a virtual machine cloning operation triggered by a user, determines a source virtual machine to be cloned according to the detected virtual machine cloning operation, generates a virtual machine cloning instruction carrying a source virtual machine identifier of the source virtual machine, and sends the generated virtual machine cloning instruction to the control device. And the control equipment receives a virtual machine cloning instruction sent by the terminal.
In one embodiment, the terminal further determines the number of destination virtual machines according to the detected virtual machine cloning operation, and triggers generation of a virtual machine cloning instruction carrying the source virtual machine identifier and the number of destination virtual machines.
In one embodiment, the terminal may further determine a source physical machine identifier corresponding to a source physical machine where the active virtual machine is deployed according to the virtual machine cloning operation, and send a virtual machine cloning instruction carrying the source virtual machine identifier, the number of destination virtual machines and the source physical machine identifier to the control device, so that the control device can determine the source physical machine where the source virtual machine to be cloned is deployed according to the source physical machine identifier in the virtual machine cloning instruction. The terminal can also send virtual machine cloning instructions carrying the source virtual machine identifications and the number of the target virtual machines to the control equipment so that the control equipment can determine the source physical machines with the corresponding source virtual machines from the database based on the source virtual machine identifications in the virtual machine cloning instructions.
Step 204, sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone the source virtual machine disk to obtain a cloned disk file.
The virtual machine disk cloning task is a task for triggering virtual machine disk cloning operation, and is specifically used for indicating a source physical machine to clone a source virtual machine disk of a source virtual machine so as to obtain a corresponding clone disk file. Cloning a disk file may also be understood as a storage volume, as a disk file obtained by cloning or copying a source virtual machine disk. The clone disk file includes all the data that the source virtual machine is currently.
Specifically, the control device analyzes the received virtual machine cloning instruction to obtain a source virtual machine identifier to be cloned, generates a virtual machine disk cloning task carrying the source virtual machine identifier, and sends the virtual machine disk cloning task to a corresponding source physical machine. The source physical machine analyzes the received virtual machine disk cloning task to obtain a source virtual machine identifier to be cloned, searches a corresponding source virtual machine disk according to the source virtual machine identifier, and performs cloning operation on the source virtual machine disk to obtain a corresponding cloning disk file.
In one embodiment, after receiving the virtual machine cloning instruction, the control device determines a transit virtual machine identifier, and sends a virtual machine disk cloning task carrying the transit virtual machine identifier and the source virtual machine identifier to the source physical machine. When the source physical machine clones the source virtual machine disk corresponding to the source virtual machine identification according to the virtual machine disk cloning task, renaming the file identification corresponding to the cloned disk file according to the transit virtual machine identification to obtain the cloned disk file. It can be understood that the file identifier corresponding to the disk file includes a source virtual machine identifier corresponding to the corresponding source virtual machine, so that the source virtual machine identifier in the file identifier corresponding to the cloned disk file is updated to a corresponding transit virtual machine identifier, so as to rename the file identifier.
In one embodiment, the virtual machine disk cloning task may further carry an active physical machine identifier, so that the source physical machine can check the virtual machine disk cloning task according to the received source physical machine identifier in the virtual machine disk cloning task, and execute the source virtual machine disk cloning operation when the check passes. It can be understood that when the source physical machine identifier carried in the virtual machine disk cloning task is consistent with the source physical machine identifier corresponding to the source physical machine, the source physical machine determines that the corresponding virtual machine disk cloning task passes the verification.
In one embodiment, the source physical machine stores the obtained clone disk file locally, so that when the destination physical machine requests the source physical machine to acquire the clone disk file according to the cloning task of the virtual machine, the source physical machine can quickly acquire and feed back the clone disk file from the local. It can be understood that when there are multiple destination physical machines, by means of caching and cloning the disk files, it is possible to avoid executing the disk cloning operation of the source virtual machine for each destination physical machine, so that the cloning complexity of the virtual machine can be reduced and the cloning efficiency can be improved.
And 206, dynamically selecting the target physical machine according to the virtual machine cloning instruction when receiving the prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful.
The destination physical machine is a physical machine needing to deploy the destination virtual machine, and corresponds to the source physical machine. The target virtual machine is a virtual machine obtained by performing hot cloning on the source virtual machine, and corresponds to the source virtual machine, and the target virtual machine and the source virtual machine can realize the same data processing.
Specifically, the source physical machine clones the source virtual machine disk according to the virtual machine disk cloning task to obtain a corresponding cloned disk file, generates prompt information indicating successful disk cloning, and feeds the prompt information back to the control equipment. And the control equipment dynamically selects the target physical machine according to the received corresponding virtual machine cloning instruction after receiving prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful.
In one embodiment, the control device dynamically selects one or more destination physical machines according to the virtual machine cloning instruction, and the number of destination physical machines may be specified by the virtual machine cloning instruction.
In one embodiment, the control device dynamically selects the destination physical machine from the preconfigured physical machines according to the virtual machine cloning instruction. The control device may dynamically select the destination physical machine from all the preconfigured physical machines, or may select the destination physical machine from each storage cluster except the storage cluster where the source physical machine is located according to the storage cluster. The storage cluster includes one or more pre-configured physical machines.
And step 208, generating basic information of each destination virtual machine according to the virtual machine cloning instruction.
The basic information of the target virtual machine comprises network configuration and virtual machine initial metadata. Network configuration refers to a companion service or configuration associated with a network and may specifically include IP (Internet Protocol ) addresses, physical network card addresses, domain names, time synchronization services, etc. The virtual machine initial metadata comprises a password, a host name, a destination virtual machine identifier, an affiliated available area, an affiliated tenant and the like corresponding to the destination virtual machine. The destination virtual machine identification is used to uniquely identify the destination virtual machine. The host name and the destination virtual machine identifier are generated through a random algorithm, so that the uniqueness of the host name and the destination virtual machine identifier corresponding to each destination virtual machine is guaranteed. The availability zone refers to where the destination virtual machine is deployed, such as Shenzhen or Shanghai. The tenant refers to which organization or organization user has the right to use the destination virtual machine. The destination virtual machine identifiers, host names and passwords corresponding to different destination virtual machines are different from each other, and the tenant and the available area corresponding to each destination virtual machine are consistent with the source virtual machine.
Specifically, the virtual machine cloning instruction further includes basic information of the source virtual machine. The control equipment analyzes the virtual machine cloning instruction to obtain the basic information of the source virtual machines and the number of the target virtual machines, and generates the basic information of each target virtual machine according to the number of the target virtual machines according to the basic information of the source virtual machines.
In one embodiment, the control device determines the available area and the tenant of each destination virtual machine according to the available area and the tenant of the source virtual machine in the basic information. The control device randomly generates a password, a host name and a destination virtual machine identifier corresponding to each destination virtual machine through a random algorithm. The virtual machine cloning instruction also comprises a network segment selected by a user when the virtual machine cloning operation is triggered. The control equipment calls an interface according to a network segment designated by the virtual machine cloning instruction so as to randomly select an unoccupied IP address from the network segment as an IP address of a corresponding destination virtual machine, and each destination virtual machine is allocated with a corresponding IP address. And the control equipment determines the configuration of the physical network card address, the domain name, the time synchronization service and the like corresponding to each destination virtual machine according to the basic information of the source virtual machine. The control device obtains virtual machine initial metadata corresponding to each target virtual machine according to the determined password, host name, target virtual machine identification, the belonging available area and the belonging tenant of each target virtual machine, obtains network configuration of the corresponding target virtual machine according to the determined IP address, physical network card address, domain name, time synchronization service and the like, and obtains basic information of the corresponding target virtual machine according to the virtual machine initial metadata and the network configuration.
Step 210, sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine; the virtual machine cloning task is used for indicating the corresponding destination physical machine to obtain the cloning disk file from the source physical machine and locally cloning the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file.
The virtual machine cloning task is a task for triggering virtual machine cloning operation and is used for indicating a destination physical machine to locally clone a destination physical machine corresponding to the source physical machine. The virtual machine cloning task corresponds to the destination virtual machine. The virtual machine cloning task includes basic information of a single destination virtual machine, may further include one or more of a source physical machine identifier and source physical machine network information, such as a source physical machine IP address, and may further include one or more of a source virtual machine identifier and a storage path of a cloned disk file corresponding to the source virtual machine.
Specifically, the control device dynamically selects the destination physical machines of the number of the destination virtual machines, and determines the association relationship between the destination physical machines and the destination virtual machines after generating corresponding basic information for each destination virtual machine in the destination virtual machines of the number of the destination virtual machines, so as to allocate the corresponding destination physical machines for each destination virtual machine. And the control equipment respectively generates virtual machine cloning tasks carrying the basic information of each target virtual machine according to the basic information of each target virtual machine to obtain virtual machine cloning tasks with the same number as the target virtual machines. And the control equipment respectively sends each generated virtual machine cloning task to the corresponding destination physical machine according to the determined association relation between the destination physical machine and the destination virtual machine. After each destination physical machine receives the virtual machine cloning task sent by the control device, acquiring a corresponding cloning disk file from the source physical machine according to the received virtual machine cloning task, and carrying out virtual machine cloning operation locally according to the acquired cloning disk file and the basic information carried by the received virtual machine cloning task to obtain the corresponding destination virtual machine.
In one embodiment, each destination physical machine analyzes the received cloning task of the virtual machine to obtain a source physical machine identifier, a source virtual machine identifier and basic information of the corresponding destination virtual machine, and obtains a cloning disk file corresponding to the source virtual machine identifier from the corresponding source physical machine according to the source physical machine identifier and the source virtual machine identifier obtained by analysis. It can be understood that if the cloning task of the virtual machine includes the storage path of the clone disk file corresponding to the source physical machine network information and the source virtual machine, the control device may obtain the clone disk file from the corresponding source physical machine according to the storage path of the clone disk file and the source physical machine network information.
In one embodiment, the virtual machine cloning task may also carry a destination physical machine identifier. Each destination physical machine analyzes the received virtual machine cloning task to obtain a destination physical machine identifier, checks the corresponding virtual machine cloning task according to the destination physical machine identifier obtained by analysis and the destination physical machine identifier of the destination physical machine, and executes corresponding virtual machine cloning operation when the check is passed.
In one embodiment, after determining the association relationship between the destination physical machine and the destination virtual machine, the control device generates a virtual machine cloning task corresponding to each destination virtual machine, where the generated virtual machine cloning task may further carry destination physical machine network information of the destination physical machine associated with the corresponding destination virtual machine, so as to send the virtual machine cloning task to the corresponding destination physical machine according to the physical machine network information in each virtual machine cloning task.
According to the virtual machine hot cloning method, after a virtual machine cloning instruction sent by a terminal is received, a virtual machine disk cloning task generated according to the virtual machine cloning instruction is sent to a source physical machine, so that the source physical machine can be instructed to clone a source virtual machine disk appointed by the virtual machine cloning instruction to obtain a cloning disk file, when prompt information which is fed back by the source physical machine and indicates that disk cloning is successful is received, a target physical machine is dynamically selected according to the virtual machine cloning instruction, basic information of each target virtual machine is generated, a virtual machine cloning task carrying the basic information of each target virtual machine is sent to a corresponding target physical machine, so that each target physical machine can be instructed to acquire a cloning disk file from the source physical machine according to the received virtual machine cloning task, and the corresponding target virtual machine is locally cloned according to the corresponding basic information based on the cloning disk file, so that virtual machine hot cloning across the physical machines is realized. Therefore, by means of the hot cloning of the virtual machines, the plurality of virtual machines with the same functions are distributed and deployed on different physical machines, the data processing pressure of each physical machine can be relieved, and in the deployment mode, the availability of the virtual machines can be improved, so that the reliability of data processing can be improved.
In one embodiment, dynamically selecting a destination physical machine according to virtual machine clone instructions includes: determining the quantity of the deployment set and the destination virtual machines according to the virtual machine cloning instruction; determining candidate physical machines according to the deployment set; and selecting the destination physical machines with the number of the destination virtual machines from the candidate physical machines.
The deployment set is used for representing the dispersion level of the virtual machine, and specifically may refer to the dispersion level of the source virtual machine and the destination virtual machine. The deployment set includes a physical machine level and a storage cluster level. The physical machine level refers to that a source virtual machine and a destination physical machine are respectively deployed on different physical machines, and the source physical machine deployed with the active virtual machine and the destination physical machine deployed with the destination virtual machine can belong to one storage cluster or different storage clusters. The storage cluster level means that a source virtual machine and a destination virtual machine are respectively deployed in different storage clusters, and a source physical machine deploying the active virtual machine and a destination physical machine deploying the destination virtual machine belong to different storage clusters. The deployment set level may be specified or selected by the user, in particular, when triggering a virtual machine clone operation. The number of destination virtual machines refers to the number of destination virtual machines that need to be cloned.
Specifically, the control device analyzes the received virtual machine cloning instruction to obtain a deployment set and the number of target virtual machines. The control equipment determines candidate physical machines according to the deployment set obtained by analysis, and selects target physical machines from the determined candidate physical machines according to the number of the target virtual machines obtained by analysis, so as to obtain target physical machines with the number consistent with that of the target virtual machines.
In one embodiment, the control device obtains deployment conditions of each preconfigured physical machine from the database, and determines candidate physical machines from the preconfigured physical machines according to the deployment conditions of each physical machine and the deployment set. The deployment situation of the physical machine comprises a storage cluster to which the physical machine belongs.
In one embodiment, the control device dynamically obtains a current load of each candidate physical machine, and selects a destination physical machine of the number of destination virtual machines from the candidate physical machines according to the current load of each candidate physical machine. And the control equipment selects the candidate physical machines with relatively smaller current load as the target physical machines according to the number of the target virtual machines. Therefore, the target virtual machines are distributed and deployed on the relatively idle target physical machines according to the deployment set, so that load balancing among the physical machines can be realized, and the data processing pressure of the target physical machines can be reduced.
In one embodiment, the number of destination virtual machines in the virtual machine clone instruction is less than or equal to a number threshold, such as 4. Therefore, in the single cloning process of the source virtual machine, the problem that the normal operation of other virtual machines is affected due to overlarge storage network bandwidth occupied by single cloning can be avoided by limiting the number of target virtual machines of the single cloning. It will be appreciated that if more destination virtual machines need to be cloned for the source virtual machine, this can be achieved through a multiple cloning process.
In the above embodiment, according to the number of the deployment sets and the destination virtual machines specified by the virtual machine cloning instruction, the destination physical machine for deploying the destination virtual machine is selected, so that the virtual machine hot cloning with distributed deployment sets can be realized.
In one embodiment, determining candidate physical machines in accordance with a deployment set includes: when the deployment set is at the physical machine level, taking the physical machines in each storage cluster as candidate physical machines; when the deployment set is at the storage cluster level, the physical machine which is in a different storage cluster from the source physical machine is taken as a candidate physical machine.
The physical machine level refers to that a source virtual machine and a destination virtual machine are respectively deployed on different physical machines. The storage cluster level refers to that a source virtual machine and a destination virtual machine are respectively deployed in different storage clusters.
Specifically, when the deployment set specified by the virtual machine cloning instruction is at the physical machine level, the control device takes all the physical machines preconfigured in each existing storage cluster as candidate physical machines. When the deployment set is at the storage cluster level, the control device determines storage clusters except for the storage cluster where the source physical machine is located from the existing storage clusters, and takes the pre-configured physical machine in each determined storage cluster as a candidate physical machine, so that the determined candidate physical machine and the source physical machine are in different storage clusters.
In one embodiment, when the deployment set is at the physical machine level, the control device obtains the pre-configured physical machines in each storage cluster from the database as candidate physical machines. It will be appreciated that when the deployment set is at the physical machine level, the candidate physical machines determined in the manner described above do not include the source physical machine. When the deployment set is at the storage cluster level, the control device acquires the physical machines which are in different storage clusters from the source physical machine from the database as candidate physical machines.
In the above embodiment, the candidate physical machines are determined according to the deployment set, so that the destination physical machine for deploying the destination virtual machine is selected from the determined candidate physical machines, and the virtual machine thermal cloning is performed through the selected destination physical machine, so that the virtual machine thermal cloning with dispersed deployment sets can be realized, and the data processing pressure of each destination physical machine can be reduced.
In one embodiment, the virtual machine hot cloning method further includes: generating a clone disk file deleting instruction after receiving prompt information which is fed back by each destination physical machine and indicates that the virtual machine cloning is successful; sending a clone disk file deleting instruction to a source physical machine; the clone disk file deleting instruction is used for instructing the source physical machine to delete the clone disk file.
The clone disk file deleting instruction is an instruction for triggering clone disk file deleting operation and is used for indicating a source physical machine to delete the locally stored clone disk file.
Specifically, after each destination physical machine obtains a corresponding destination virtual machine in a local cloning mode according to the received virtual machine cloning task, triggering generation of prompt information representing successful cloning of the virtual machine, and feeding the generated prompt information back to the control equipment. The control equipment receives prompt information which is fed back by each destination physical machine and indicates that the virtual machine cloning is successful, triggers generation of a clone disk file deleting instruction after receiving the prompt information which is fed back by all destination physical machines corresponding to the source physical machine, and sends the clone disk file deleting instruction to the source physical machine. And the source physical machine locally deletes the corresponding clone disk file according to the received clone disk file deleting instruction.
In one embodiment, the source physical machine analyzes the received clone disk file to obtain a source virtual machine identifier or a storage path of the clone disk file corresponding to the source virtual machine, and deletes the corresponding clone disk file according to the storage path, or determines and deletes the corresponding clone disk file according to the source virtual machine identifier.
In one embodiment, if the destination physical machine is one and the destination physical machine and the source physical machine are in the same storage cluster, the source physical machine migrates the locally stored corresponding clone disk file to the destination physical machine based on the clone disk file acquisition request of the destination physical machine, that is, the source physical machine feeds back the corresponding clone disk file to the destination physical machine and simultaneously deletes the clone disk file from the local.
In one embodiment, after the source physical machine clones the source virtual machine disk according to the virtual machine disk cloning task to obtain a cloned disk file, a storage pool corresponding to the cloned disk file is also generated, so that the destination physical machine can obtain the corresponding cloned disk file from the source physical machine based on the storage pool. The source physical machine deletes the corresponding clone disk file according to the clone disk file deleting instruction and deletes the storage pool corresponding to the clone disk file so as to release the storage space occupied by the clone disk file and the storage pool.
In the above embodiment, after the hot cloning operation of the virtual machine is successfully completed, the source physical machine is instructed to delete the locally stored clone disk file, so as to reduce the data storage amount of the source physical machine. Because the clone disk files stored on the source physical machine are not used in the running process of the source virtual machine and the destination virtual machine, unnecessary storage space occupied by unused clone disk files can be avoided by deleting the clone disk files after the execution of the cloning operation of the virtual machine is completed.
In one embodiment, the step of locally cloning the corresponding destination virtual machine according to the corresponding basic information by the destination physical machine based on the cloned disk file includes: the target physical machine analyzes the received cloning task of the virtual machine to obtain basic information of the corresponding target virtual machine, and a storage catalog and a configuration file are generated according to the basic information; the target physical machine renames the file identifier corresponding to the clone disk file, modifies the renamed clone disk file to obtain a target disk file, and stores the target disk file according to a storage directory; the destination physical machine generates metadata of the corresponding destination virtual machine based on the configuration file so as to complete cloning operation of the corresponding destination virtual machine.
Specifically, each destination physical machine analyzes the received cloning task of the virtual machine to obtain basic information of the corresponding destination virtual machine, generates a corresponding storage catalog according to the destination virtual machine identifier in the basic information, and generates a configuration file corresponding to the destination virtual machine according to the basic information. After each destination physical machine obtains the corresponding clone disk file from the source physical machine according to the received virtual machine cloning task, renaming the file identifier corresponding to the obtained clone disk file according to the destination virtual machine identifier specified by the virtual machine cloning task, modifying the renamed clone disk file to obtain a target disk file corresponding to the corresponding destination virtual machine, and storing the target disk file according to the storage catalog generated correspondingly. And each destination physical machine generates metadata of the destination virtual machine based on the configuration file generated for the corresponding destination virtual machine so as to finish cloning operation on the corresponding destination virtual machine and obtain the destination virtual machine deployed locally. Further, after the target virtual machine is obtained through cloning, the target virtual machine is started, and the target virtual machine runs based on the corresponding target disk file and metadata, so that data processing consistent with the source virtual machine can be achieved.
In one embodiment, the destination virtual machine identification corresponding to each destination virtual machine is unique. And after each destination physical machine determines the corresponding destination virtual machine identifier according to the received virtual machine cloning task, taking the determined destination virtual machine identifier as a name to generate a corresponding storage catalog.
In one embodiment, each destination physical machine updates the transit virtual machine identifier carried by the file identifier corresponding to the cloned disk file to the corresponding destination virtual machine identifier, so as to rename the file identifier corresponding to the cloned disk file. In this way, each destination physical machine renames the file identifications corresponding to the obtained clone disk files to obtain the target disk files with different file identifications.
In one embodiment, after each destination physical machine stores the obtained target disk file according to the corresponding generated storage directory, a storage pool corresponding to the target disk file is generated according to the storage directory, so that the corresponding target disk file is managed according to the storage pool. The target physical machine body can call a preset storage pool creation interface to create a storage pool corresponding to the target disk file.
In one embodiment, each destination physical machine organizes basic information of a corresponding destination virtual machine obtained based on a virtual machine cloning task and a cloning disk file obtained from a source physical machine into a target file in a preset format so as to facilitate subsequent virtual machine cloning operation based on the target file. Target files of a preset format such as xml (a data organization format) files.
In one embodiment, each destination physical machine also modifies the system configuration of the destination virtual machine. The system configuration refers to the relevant configuration of the operating system corresponding to the target virtual machine, such as login and permission control configuration. And in the process of modifying the renamed clone disk file, the target physical machine executes the modification operation of the system configuration of the target virtual machine. It is understood that clone disk files may be understood as mirror files, and thus renaming and modifying operations on clone disk files may be understood as renaming and modifying operations on mirror files.
In one embodiment, each destination physical machine invokes a preset disk file modification function, modifies the renamed clone disk file to obtain a corresponding target disk file, invokes a preset component modification function to modify a virtual machine initialization component in the destination virtual machine, and invokes a preset metadata generation function to generate metadata of the destination virtual machine according to the configuration file. It can be understood that the preset disk file modification function, the preset component modification function and the preset metadata generation function can be packaged into a virtual machine cloning function, so that the cloning of the target virtual machine can be realized by calling the virtual machine cloning function by the target physical machine. And generating metadata of the target virtual machine based on the configuration file, namely initializing the target virtual machine so that the initialized target virtual machine can run based on the target disk file and the metadata.
In one embodiment, when there are a plurality of destination physical machines, the plurality of destination physical machines execute the above-mentioned virtual machine cloning operation in parallel according to the virtual machine cloning task received by each.
In the above embodiment, each destination physical machine locally clones and obtains a corresponding destination virtual machine according to the same cloning operation flow based on the received virtual machine cloning task, so as to complete the deployment set distributed virtual machine hot cloning flow, and obtain the deployment set distributed source virtual machine and the destination virtual machine.
In one embodiment, the virtual machine cloning task further carries a determination result representing whether the corresponding destination physical machine and the source physical machine are in the same storage cluster; the step of the destination physical machine obtaining the clone disk file from the source physical machine comprises the following steps: the target physical machine extracts a judging result from the received virtual machine cloning task, and determines the acquisition mode of the cloning disk file according to the extracted judging result; and the destination physical machine acquires the clone disk file from the source physical machine according to the determined acquisition mode.
Specifically, before generating a virtual machine cloning task corresponding to each destination physical machine, the control device respectively judges whether each destination physical machine and the source physical machine are in the same storage cluster, obtains a judging result corresponding to each destination physical machine and representing whether the destination physical machine and the source physical machine are in the same storage cluster, and generates a virtual machine cloning task carrying the judging result and basic information of the corresponding destination virtual machine. Each destination physical machine analyzes the received virtual machine cloning task to obtain basic information of the corresponding destination virtual machine, characterizes a judging result of whether the destination physical machine and the source physical machine are in the same storage cluster, determines an obtaining mode of the corresponding cloning disk file according to the judging result obtained by analysis and a corresponding obtaining mode of the cloning disk file according to the corresponding judging result, and further obtains the corresponding cloning disk file from the source physical machine according to the determined obtaining mode so as to facilitate cloning operation of the destination virtual machine according to the basic information of the destination virtual machine and the cloning disk file and the process.
In one embodiment, when the judging result characterizes that the destination physical machine and the source physical machine are in the same storage cluster, the obtaining mode of the clone disk file corresponding to the judging result is a first obtaining mode. When the judging result represents that the target physical machine and the source physical machine are not in the same storage cluster, the acquiring mode of the clone disk file corresponding to the judging result is a second acquiring mode. The first acquisition mode is, for example, a cp-based (a mode capable of realizing file copying between different storage directories under the same operating system) acquisition mode. The second acquisition mode is, for example, an acquisition mode based on scp (a mode capable of realizing file copying between different operating systems).
In the above embodiment, the corresponding clone disk file obtaining modes are provided respectively for the determination result of whether the destination physical machine and the source physical machine are in the same storage cluster, so that the corresponding clone disk file can be obtained quickly and accurately based on the corresponding obtaining modes.
As shown in fig. 3, in one embodiment, a method for hot cloning a virtual machine is provided, which specifically includes the following steps:
and step 302, receiving a virtual machine cloning instruction sent by the terminal.
Step 304, a virtual machine disk cloning task generated according to a virtual machine cloning instruction is sent to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone the source virtual machine disk to obtain a cloned disk file.
And 306, when receiving prompt information which is fed back by the source physical machine and indicates that disk cloning is successful, determining the quantity of the deployment set and the destination virtual machines according to the virtual machine cloning instruction.
And 308, when the deployment set is at the physical machine level, taking the physical machines in each storage cluster as candidate physical machines.
In step 310, when the deployment set is at the storage cluster level, the physical machines in different storage clusters from the source physical machine are used as candidate physical machines.
Step 312, selecting the destination physical machines of the destination virtual machine number from the candidate physical machines.
And step 314, generating basic information of each destination virtual machine according to the virtual machine cloning instruction.
Step 316, sending a virtual machine cloning task carrying basic information of the corresponding destination virtual machine to each destination physical machine; the virtual machine cloning task is used for indicating the corresponding destination physical machine to obtain the cloning disk file from the source physical machine and locally cloning the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file.
And step 318, generating a clone disk file deleting instruction after receiving prompt information which is fed back by each destination physical machine and indicates that the virtual machine cloning is successful.
Step 320, sending a clone disk file deleting instruction to a source physical machine; the clone disk file deleting instruction is used for instructing the source physical machine to delete the clone disk file.
In the above embodiment, the destination physical machine with the distributed deployment set is dynamically selected based on the number of the deployment set and the destination virtual machine specified by the virtual machine cloning instruction, so that when the destination physical machine clones the destination physical machine corresponding to the source virtual machine from the source physical machine, the deployment set of the source virtual machine and the destination virtual machine can be distributed. Therefore, virtual machine thermal cloning of the cross-physical machine and the cross-storage cluster can be realized under the shared storage and local disk scene, and the data processing pressure of the target physical machine can be reduced.
FIG. 4 is a timing diagram of a virtual machine hot cloning method in one embodiment. As shown in fig. 4, the control device receives a virtual machine cloning instruction sent by the terminal, generates a virtual machine disk cloning task according to the virtual machine cloning instruction, and sends the virtual machine disk cloning task to the source physical machine. The source physical machine clones the source virtual machine disk according to the virtual machine disk cloning task to obtain a cloned disk file, and feeds back prompt information representing successful disk cloning to the control equipment. After receiving prompt information indicating successful disk cloning, the control device selects a destination physical machine according to the deployment set specified by the virtual machine cloning instruction and the number of the destination virtual machines, and generates basic information of each destination virtual machine. The control equipment judges whether each target physical machine and the source physical machine are in the same storage cluster, generates a virtual machine cloning task carrying the judging result and basic information of the target virtual machine, and sends the virtual machine cloning task to the corresponding target physical machine. Fig. 4 is an example in which the destination physical machine includes a first destination physical machine and a second destination physical machine, but is not limited to the number of destination physical machines.
Further, assuming that the first destination physical machine and the source physical machine are in the same storage cluster, the first destination physical machine acquires the clone disk file from the source physical machine according to a first acquisition mode. And if the second destination physical machine and the source physical machine are not in the same storage cluster, the first destination physical machine acquires the clone disk file from the source physical machine according to a second acquisition mode. After the first target physical machine and the second target physical machine acquire the clone disk file, the renamed clone disk file is modified to obtain a target disk file, namely, a corresponding target disk file is obtained based on the clone disk file. The method comprises the steps of generating a storage catalog according to a received cloning task of a virtual machine by a first target physical machine and a second target physical machine, storing a corresponding obtained target disk file according to the generated storage catalog, creating a storage pool corresponding to the target disk file, generating metadata corresponding to the target virtual machine to complete cloning of the target virtual machine, and starting the cloned target virtual machine to achieve data processing consistent with a source virtual machine. After the first destination physical machine and the second destination physical machine clone to obtain the corresponding destination virtual machines, the prompt information indicating that the virtual machines clone successfully is fed back to the control equipment. After receiving prompt information which is fed back by all the destination physical machines and indicates that the cloning of the virtual machine is successful, the control equipment sends a clone disk file deleting instruction to the source physical machine. The source physical machine deletes the corresponding clone disk file based on the received clone disk file deleting instruction.
It should be understood that, although the steps in the flowcharts of fig. 2-3 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2-3 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 5, there is provided a virtual machine thermal cloning apparatus 500, comprising: a receiving module 501, a first gram Long Mokuai 502, a selecting module 503, a generating module 504 and a second cloning module 505, wherein:
a receiving module 501, configured to receive a virtual machine cloning instruction sent by a terminal;
the first cloning module 502 is configured to send a virtual machine disk cloning task generated according to a virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone the source virtual machine disk to obtain a cloned disk file;
A selecting module 503, configured to dynamically select a destination physical machine according to a virtual machine cloning instruction when receiving a prompt message indicating that disk cloning is successful, which is fed back by a source physical machine;
a generating module 504, configured to generate basic information of each destination virtual machine according to the virtual machine cloning instruction;
a second cloning module 505, configured to send, to each destination physical machine, a virtual machine cloning task that carries basic information of the corresponding destination virtual machine; the virtual machine cloning task is used for indicating the corresponding destination physical machine to obtain the cloning disk file from the source physical machine and locally cloning the corresponding destination virtual machine according to the corresponding basic information based on the cloning disk file.
In one embodiment, the selecting module 503 is further configured to determine the number of the deployment set and the destination virtual machines according to the virtual machine cloning instruction; determining candidate physical machines according to the deployment set; and selecting the destination physical machines with the number of the destination virtual machines from the candidate physical machines.
In one embodiment, the selecting module 503 is further configured to use the physical machines in each storage cluster as candidate physical machines when the deployment set is at a physical machine level; when the deployment set is at the storage cluster level, the physical machine which is in a different storage cluster from the source physical machine is taken as a candidate physical machine.
In one embodiment, the first cloning module 502 is further configured to generate a clone disk file deletion instruction after receiving prompt information that indicates that cloning of the virtual machine is successful, which is fed back by each destination physical machine respectively; sending a clone disk file deleting instruction to a source physical machine; the clone disk file deleting instruction is used for instructing the source physical machine to delete the clone disk file.
For specific limitations of the virtual machine hot cloning apparatus, reference may be made to the above limitation of the virtual machine hot cloning method, and no further description is given here. The modules in the virtual machine hot cloning apparatus described above may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, as shown in FIG. 1, a virtual machine thermal cloning system is provided, the system comprising: a terminal 102, a source physical machine 106, a destination physical machine 108 and a control device 104;
a terminal 102, configured to send a virtual machine cloning instruction to a control device 104;
The control device 104 is configured to send a virtual machine disk cloning task generated according to the virtual machine cloning instruction to the source physical machine 106;
the source physical machine 106 is configured to clone a source virtual machine disk according to a virtual machine disk cloning task to obtain a cloned disk file;
the control device 104 is further configured to dynamically select, when receiving a prompt message indicating that the disk cloning is successful, which is fed back by the source physical machine 106, the destination physical machine 108 according to a virtual machine cloning instruction; generating basic information of each destination virtual machine according to the virtual machine cloning instruction; sending a virtual machine cloning task carrying basic information of a corresponding destination virtual machine to each destination physical machine 108;
the destination physical machine 108 is configured to obtain a clone disk file from the source physical machine 106 according to the received cloning task of the virtual machine, and locally clone a corresponding destination virtual machine according to the clone disk file and corresponding basic information.
In one embodiment, the control device 104 is further configured to determine the number of the deployment set and the destination virtual machines according to the virtual machine cloning instruction; determining candidate physical machines according to the deployment set; and selecting the destination physical machines with the number of the destination virtual machines from the candidate physical machines.
In one embodiment, the control device 104 is further configured to use the physical machines in each storage cluster as candidate physical machines when the deployment set is at a physical machine level; when the deployment set is at the storage cluster level, the physical machine which is in a different storage cluster from the source physical machine is taken as a candidate physical machine.
In one embodiment, the control device 104 is further configured to generate a clone disk file deletion instruction after receiving the prompt information indicating that the cloning of the virtual machine is successful, which is fed back by each destination physical machine 108 respectively; sending a clone disk file deleting instruction to the source physical machine 106; the source physical machine 106 is further configured to delete the clone disk file according to the clone disk file deletion instruction.
In one embodiment, the destination physical machine 108 is further configured to parse the received cloning task of the virtual machine to obtain basic information of the corresponding destination virtual machine, and generate a storage directory and a configuration file according to the basic information; renaming a file identifier corresponding to the clone disk file, modifying the renamed clone disk file to obtain a target disk file, and storing the target disk file according to a storage directory; metadata of the corresponding destination virtual machine is generated based on the configuration file so as to complete cloning operation of the corresponding destination virtual machine.
In one embodiment, the virtual machine cloning task further carries a determination result representing whether the corresponding destination physical machine and the source physical machine are in the same storage cluster; the destination physical machine 108 is further configured to extract a determination result from the received cloning task of the virtual machine, and determine an acquisition mode of the cloned disk file according to the extracted determination result; and acquiring the clone disk file from the source physical machine according to the determined acquisition mode.
FIG. 6 is an architecture diagram of a virtual machine thermal cloning system in one embodiment. As shown in fig. 6, the virtual machine thermal cloning system includes a terminal, a control device, and a storage cluster, where the storage cluster includes a first storage cluster and a second storage cluster, the first storage cluster includes a first physical machine and a second physical machine, the second storage cluster includes a third physical machine, two virtual machines of VM1 and VM2 are disposed in the first physical machine, two virtual machines of VM3 and VM4 are disposed in the second physical machine, and two virtual machines of VM3 and VM4 are disposed in the third physical machine. The control equipment receives a virtual machine cloning instruction sent by a terminal aiming at the virtual machine VM1, determines the virtual machine VM1 to be cloned as a source virtual machine according to the virtual machine cloning instruction, deploys a first physical machine of the source virtual machine as a source physical machine, and dynamically selects a destination virtual machine according to a deployment set and the number of destination virtual machines designated by the virtual machine cloning instruction and a database. In fig. 6, taking the deployment set as a physical machine level and the number of destination virtual machines as 2 as an example, the control device selects the second physical machine and the third physical machine as destination physical machines, and sends a virtual machine cloning task to each destination physical machine respectively, so as to instruct each destination physical machine to execute cloning operation on the source virtual machine respectively to obtain a destination virtual machine deployed locally.
It should be noted that the number of storage clusters shown in fig. 6, the number of physical machines included in each storage cluster, the number of virtual machines deployed on each physical machine, and the number of deployment sets and destination virtual machines are only examples, and are not limited to specific examples, and may include a third storage cluster, a first storage cluster, a fourth physical machine, and a virtual machine VM5. It will be appreciated that the source physical machine is opposed to the destination physical machine. The database shown in fig. 6 may be an integral part of the control device or may be a database independent of the control device.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing the deployment condition of each preconfigured physical machine. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a virtual machine hot cloning method.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A method for hot cloning a virtual machine, the method comprising:
receiving a virtual machine cloning instruction sent by a terminal;
sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone a source virtual machine disk to obtain a cloned disk file;
When receiving prompt information which is fed back by the source physical machine and indicates that disk cloning is successful, determining the quantity of a deployment set and a target virtual machine according to the virtual machine cloning instruction; the deployment set is used for representing the dispersion level of the source virtual machine and the target virtual machine;
determining candidate physical machines according to the deployment set;
selecting the number of the target virtual machines from the candidate physical machines;
generating basic information of each destination virtual machine according to the virtual machine cloning instruction;
sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine; the virtual machine cloning task also carries a judging result for representing whether the corresponding target physical machine and the source physical machine are in the same storage cluster; the virtual machine cloning task is used for indicating the corresponding destination physical machine to extract a judging result from the received virtual machine cloning task, determining the acquisition mode of the cloned disk file according to the extracted judging result, and acquiring the cloned disk file from the source physical machine according to the determined acquisition mode; analyzing the received cloning task of the virtual machine to obtain basic information of the corresponding target virtual machine, and generating a storage catalog and a configuration file according to the basic information; renaming a file identifier corresponding to the clone disk file, modifying the renamed clone disk file to obtain a target disk file, and storing the target disk file according to the storage catalog; and generating metadata of the corresponding destination virtual machine based on the configuration file so as to finish cloning operation of the corresponding destination virtual machine.
2. The method of claim 1, wherein said determining candidate physical machines according to the deployment set comprises:
when the deployment set is at the physical machine level, taking the physical machines in each storage cluster as candidate physical machines;
and when the deployment set is at the storage cluster level, taking the physical machines which are in different storage clusters from the source physical machine as candidate physical machines.
3. The method according to claim 1, wherein the method further comprises:
generating a clone disk file deleting instruction after receiving prompt information which is fed back by each destination physical machine and indicates that the virtual machine cloning is successful;
sending the clone disk file deleting instruction to the source physical machine; the clone disk file deleting instruction is used for indicating the source physical machine to delete the clone disk file.
4. A virtual machine thermal cloning apparatus, the apparatus comprising:
the receiving module is used for receiving a virtual machine cloning instruction sent by the terminal;
the first cloning module is used for sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to a source physical machine; the virtual machine disk cloning task is used for indicating the source physical machine to clone a source virtual machine disk to obtain a cloned disk file;
The selection module is used for determining the quantity of the deployment set and the destination virtual machines according to the virtual machine cloning instruction when receiving prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful; the deployment set is used for representing the dispersion level of the source virtual machine and the target virtual machine; determining candidate physical machines according to the deployment set; selecting the number of the target virtual machines from the candidate physical machines;
the generation module is used for generating basic information of each destination virtual machine according to the virtual machine cloning instruction;
the second cloning module is used for sending virtual machine cloning tasks carrying basic information of the corresponding target virtual machines to each target physical machine; the virtual machine cloning task also carries a judging result for representing whether the corresponding target physical machine and the source physical machine are in the same storage cluster; the virtual machine cloning task is used for indicating the corresponding destination physical machine to extract a judging result from the received virtual machine cloning task, determining the acquisition mode of the cloned disk file according to the extracted judging result, and acquiring the cloned disk file from the source physical machine according to the determined acquisition mode; analyzing the received cloning task of the virtual machine to obtain basic information of the corresponding target virtual machine, and generating a storage catalog and a configuration file according to the basic information; renaming a file identifier corresponding to the clone disk file, modifying the renamed clone disk file to obtain a target disk file, and storing the target disk file according to the storage catalog; and generating metadata of the corresponding destination virtual machine based on the configuration file so as to finish cloning operation of the corresponding destination virtual machine.
5. The apparatus of claim 4, wherein the selection module is further configured to:
when the deployment set is at the physical machine level, taking the physical machines in each storage cluster as candidate physical machines;
and when the deployment set is at the storage cluster level, taking the physical machines which are in different storage clusters from the source physical machine as candidate physical machines.
6. The apparatus of claim 4, wherein the first cloning module is further configured to generate a clone disk file deletion instruction after receiving prompt information indicating that cloning of the virtual machine is successful, which is fed back by each of the destination physical machines, respectively; sending the clone disk file deleting instruction to the source physical machine; the clone disk file deleting instruction is used for indicating the source physical machine to delete the clone disk file.
7. A virtual machine hot cloning system, the system comprising: the system comprises a terminal, a source physical machine, a destination physical machine and control equipment;
the terminal is used for sending a virtual machine cloning instruction to the control equipment;
the control device is used for sending a virtual machine disk cloning task generated according to the virtual machine cloning instruction to the source physical machine;
The source physical machine is used for cloning a source virtual machine disk according to the virtual machine disk cloning task to obtain a cloning disk file;
the control equipment is also used for determining the quantity of the deployment set and the target virtual machines according to the virtual machine cloning instruction when receiving prompt information which is fed back by the source physical machine and indicates that the disk cloning is successful; the deployment set is used for representing the dispersion level of the source virtual machine and the target virtual machine; determining candidate physical machines according to the deployment set; selecting the number of the target virtual machines from the candidate physical machines; generating basic information of each destination virtual machine according to the virtual machine cloning instruction; sending a virtual machine cloning task carrying basic information of a corresponding target virtual machine to each target physical machine; the virtual machine cloning task also carries a judging result for representing whether the corresponding target physical machine and the source physical machine are in the same storage cluster;
the target physical machine is used for extracting a judging result from the received virtual machine cloning task according to the received virtual machine cloning task, determining an acquisition mode of the cloning disk file according to the extracted judging result, and acquiring the cloning disk file from the source physical machine according to the determined acquisition mode; analyzing the received cloning task of the virtual machine to obtain basic information of the corresponding target virtual machine, and generating a storage catalog and a configuration file according to the basic information; renaming a file identifier corresponding to the clone disk file, modifying the renamed clone disk file to obtain a target disk file, and storing the target disk file according to the storage catalog; and generating metadata of the corresponding destination virtual machine based on the configuration file so as to finish cloning operation of the corresponding destination virtual machine.
8. The system of claim 7, wherein the control device is further configured to generate a clone disk file deletion instruction after receiving prompt information indicating that cloning of the virtual machine is successful, which is fed back by each of the destination physical machines, respectively; sending the clone disk file deleting instruction to the source physical machine;
the source physical machine is further configured to delete the clone disk file according to the clone disk file deletion instruction.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 3 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 3.
CN202010412168.9A 2020-05-15 2020-05-15 Virtual machine hot cloning method, device, system, computer equipment and storage medium Active CN113672333B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010412168.9A CN113672333B (en) 2020-05-15 2020-05-15 Virtual machine hot cloning method, device, system, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010412168.9A CN113672333B (en) 2020-05-15 2020-05-15 Virtual machine hot cloning method, device, system, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113672333A CN113672333A (en) 2021-11-19
CN113672333B true CN113672333B (en) 2024-04-05

Family

ID=78537599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010412168.9A Active CN113672333B (en) 2020-05-15 2020-05-15 Virtual machine hot cloning method, device, system, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113672333B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468734A (en) * 2014-11-18 2015-03-25 国云科技股份有限公司 Virtual cluster expanding method based on cloning
CN105893115A (en) * 2016-04-05 2016-08-24 上海携程商务有限公司 Method and system for differential deployment of virtual machine
CN107870802A (en) * 2016-09-27 2018-04-03 阿里巴巴集团控股有限公司 A kind of virtual machine migration method and device
CN107908460A (en) * 2017-11-23 2018-04-13 平安科技(深圳)有限公司 Virtual machine rapid volume-expanding method, device, equipment and storage medium
CN107967165A (en) * 2016-10-20 2018-04-27 上海盛霄云计算技术有限公司 The offline moving method of virtual machine based on LVM
CN110515697A (en) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 A kind of virtual machine migration method, device, storage medium and computer equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9268610B2 (en) * 2013-11-01 2016-02-23 Vmware, Inc. Rapid virtual machine cloning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104468734A (en) * 2014-11-18 2015-03-25 国云科技股份有限公司 Virtual cluster expanding method based on cloning
CN105893115A (en) * 2016-04-05 2016-08-24 上海携程商务有限公司 Method and system for differential deployment of virtual machine
CN107870802A (en) * 2016-09-27 2018-04-03 阿里巴巴集团控股有限公司 A kind of virtual machine migration method and device
CN107967165A (en) * 2016-10-20 2018-04-27 上海盛霄云计算技术有限公司 The offline moving method of virtual machine based on LVM
CN107908460A (en) * 2017-11-23 2018-04-13 平安科技(深圳)有限公司 Virtual machine rapid volume-expanding method, device, equipment and storage medium
CN110515697A (en) * 2019-08-16 2019-11-29 济南浪潮数据技术有限公司 A kind of virtual machine migration method, device, storage medium and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
虚拟化环境下的数据库集群系统构建与性能分析;刘宇;《计算机与现代化》(第8期);全文 *

Also Published As

Publication number Publication date
CN113672333A (en) 2021-11-19

Similar Documents

Publication Publication Date Title
CN108376100B (en) Security-based container scheduling
CN108829459B (en) Nginx server-based configuration method and device, computer equipment and storage medium
US10528390B2 (en) Idempotent task execution in on-demand network code execution systems
CN113296792B (en) Storage method, device, equipment, storage medium and system
US9395973B2 (en) Virtual machine deployment method, recording medium, and information processing apparatus
WO2019154202A1 (en) Security protection method and apparatus
WO2019128984A1 (en) Container security policy handling method and related device
CN111158959A (en) Virtual machine backup method and device and virtual machine recovery method and device
CN108664274A (en) Implementation method, system and the device of operating system initialization configuration
CN113961520A (en) Dynamic file mounting method, system, computer equipment and readable storage medium
JP5317020B2 (en) Information processing system and information processing method
CN113900774B (en) Virtual machine control method and device of cloud operating system and storage medium
WO2021254214A1 (en) Migration method and apparatus for android application program
CN110674095A (en) CTDB cluster expansion method, device, equipment and readable storage medium
CN113672333B (en) Virtual machine hot cloning method, device, system, computer equipment and storage medium
CN111629031B (en) Cluster storage method, system, computer equipment and storage medium
CN108173892B (en) Cloud mirror image operation method and device
CN113093995B (en) Cloud disk data migration method and system
CN113572856B (en) Method, control method and medium for configuring seven-layer load balancing for OVN architecture
WO2021233152A1 (en) Virtualized network function deployment method, management and orchestration platform, and medium
WO2016041202A1 (en) Deployment method and apparatus based on cloud environment system
KR101554554B1 (en) Method for driving verture machine and and system thereof
WO2020001617A1 (en) Method for obtaining verification information and data center
JP5780297B2 (en) Port number identification system, port number identification system control method and control program therefor
WO2022083156A1 (en) Asset access control method, apparatus and device, and 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