WO2022267427A1 - Virtual machine migration method and system, and electronic device - Google Patents

Virtual machine migration method and system, and electronic device Download PDF

Info

Publication number
WO2022267427A1
WO2022267427A1 PCT/CN2021/143173 CN2021143173W WO2022267427A1 WO 2022267427 A1 WO2022267427 A1 WO 2022267427A1 CN 2021143173 W CN2021143173 W CN 2021143173W WO 2022267427 A1 WO2022267427 A1 WO 2022267427A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
file
copied
receiving end
virtual machine
Prior art date
Application number
PCT/CN2021/143173
Other languages
French (fr)
Chinese (zh)
Inventor
孟亮
何继文
潘宗辉
金博玉
黄学军
刘蜀东
穆森
朱玥
刘辉军
邱桂苹
杨硕
俞坚华
董全
Original Assignee
航天云网科技发展有限责任公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 航天云网科技发展有限责任公司 filed Critical 航天云网科技发展有限责任公司
Publication of WO2022267427A1 publication Critical patent/WO2022267427A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1004Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's to protect a block of data words, e.g. CRC or checksum
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/4557Distribution of virtual machine instances; Migration and load balancing

Definitions

  • the present application relates to the technical field of virtual machines, in particular to a virtual machine migration method, system and electronic equipment.
  • a system disk image file (referred to as a disk file) will first be created in the source host machine during static migration, and then the disk file will be copied to the destination host machine.
  • the copy process on the source host machine is: (1) open the disk file to be migrated; (2) read the file content to the cache; (3) send the read file content to the new host through TCP/UCP (4) cycle (2)-(3) until the file is sent.
  • the copy process on the destination host is: (1) create a new file and open it; (2) read the disk content transmitted by the peer through TCP/UDP; (3) write the read content into (1) Created file; (4) cycle (2)-(3) until the file is received.
  • Disks of different formats have different voids as they are used. Take disks in qcow2 and raw formats as an example. Generally speaking, the ratio of holes in disks in raw format will decrease with use; while the ratio of holes in disks in qcow2 format will increase with use. During the virtual machine migration process, the transmission of these empty data will waste bandwidth and reduce transmission efficiency.
  • the biggest problem of using cached I/O during virtual machine migration is the consumption of page cache.
  • a large number of frequent file read and write operations are involved, and a large number of data copy operations are performed between the address space of the application program and the page cache, and between the page cache and the disk. These data copy operations bring The CPU and memory overhead is very large. If the migrated disk file is large, or if there are multiple virtual machine files to be migrated at the same time, the migration efficiency will decrease.
  • the current virtual machine migration solution has the problem of wasting transmission bandwidth caused by "empty" data; and the page cache is occupied during the process of reading and writing files, resulting in low read and write efficiency, and is not conducive to the transmission of large disk files .
  • the purpose of this application is to provide a virtual machine migration method, system and electronic equipment, in which the offset data of the file empty block can be used in the message to replace the transmission of the file empty block, thereby increasing the migration speed; and
  • the occupancy rate of the page cache is reduced, the efficiency of reading and writing is improved, and the transmission rate of very large disk files is improved.
  • the embodiment of the present application provides a virtual machine migration method, which is applied to the sending end, including:
  • the empty area is a storage block that continuously stores binary values of 0 in the file to be copied;
  • the hole area and its location information determine the non-hole area and its offset of the file to be copied, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end;
  • the second message is sent to the receiving end; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
  • the step of establishing a connection with the receiving end and sending the first message to the receiving end includes:
  • the sending end establishes a long connection with the receiving end, and initializes the request message and the header message message in the first message; wherein, the request message is used to notify the receiving end to perform the copy process; the header message message is used to inform the receiving end Attribute information of the file to be copied;
  • the step of determining the empty area of the file to be copied and its location information includes:
  • the location information of the copied file where the empty area is located is obtained, and the storage block is determined as the empty area.
  • sequentially transferring the non-hole area and its offset from the address space of the sending end to the disk of the receiving end includes:
  • the embodiment of the present application provides a virtual machine migration method, which is applied to the receiving end, including:
  • the receiving end After the receiving end establishes the connection, receive the first message sent by the sending end; wherein, the first message includes attribute information of the file to be copied;
  • a temporary file corresponding to the file to be copied is established in the disk of the receiving end;
  • the second message from the sender is received, and the integrity of the temporary file is verified by using the verification information contained in the second message.
  • a temporary file mapped to the file to be copied is established in the disk of the receiving end, including:
  • the receiving end responds to the request message and transmits the response message to the sending end;
  • the header message message is used to obtain the attribute information of the file to be copied;
  • the embodiment of the present application provides a virtual machine migration system, which is applied to the sending end, including:
  • the first message sending module is used to establish a connection with the receiving end, and send the first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
  • Hollow area determination module used to determine the empty area of the file to be copied and its location information; wherein, the empty area is a storage block that continuously stores binary values of 0 in the file to be copied;
  • the data sending module is used to determine the non-hole area and its offset of the file to be copied according to the hole area and its location information, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end ;
  • the second message sending module is used to send the second message to the receiving end after the transmission of the non-hole area and its offset is completed; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
  • the embodiment of the present application provides a virtual machine migration system, which is applied to the receiving end, including:
  • the first message receiving module is used to receive the first message sent by the sending end after the sending end establishes the connection; wherein, the first message includes attribute information of the file to be copied;
  • a temporary file generating module configured to create a temporary file mapped to the file to be copied in the disk at the receiving end according to the attribute information of the file to be copied contained in the first message
  • the data receiving module is used to receive the data flow and its offset from the sending end, and save the data flow to a temporary file according to the offset data;
  • the data verification module is configured to receive the second message from the sending end when the data stream is saved, and use the verification information contained in the second message to verify the integrity of the temporary file.
  • the embodiment of the present application also provides an electronic device, including a memory and a processor, and a computer program that can run on the processor is stored in the memory, wherein, when the processor executes the computer program, the above first aspect and the first aspect are realized.
  • the steps of the virtual machine migration method mentioned in the second aspect are realized.
  • the embodiment of the present application also provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code causes the processor to execute the virtual steps in the machine migration method.
  • the present application provides a virtual machine migration method, system and electronic equipment.
  • the sending end first establishes a connection with the receiving end, and sends a first message to the receiving end; wherein, the first message includes the attribute of the file to be copied information; then determine the hole area and its position information of the file to be copied; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied; then determine the non-hole of the file to be copied according to the hole area and its position information area and its offset, and transfer the non-hole area and its offset from the address space of the sender to the disk of the receiver in turn; after the non-hole area and its offset are transmitted, the second message is sent to the receiver ; Wherein, the second message contains verification information for verifying the integrity of the file to be copied; and at the receiving end, the method first receives the first message sent by the sending end after the sending end establishes a connection; then according to the first The attribute information of the file to be copied contained in a message, create a
  • the value of the offset field can be used in the message to replace the transmission of empty blocks in the file, thereby improving the migration speed; and by writing directly to the disk, the occupancy rate of the page cache is reduced, and the read and write efficiency is improved, which is beneficial to the improvement of the ultra-large disk.
  • the file transfer rate can be used in the message to replace the transmission of empty blocks in the file, thereby improving the migration speed; and by writing directly to the disk, the occupancy rate of the page cache is reduced, and the read and write efficiency is improved, which is beneficial to the improvement of the ultra-large disk.
  • FIG. 1 is a flow chart of a method for migrating a virtual machine applied to a sending end provided in an embodiment of the present application
  • FIG. 2 is a flow chart of step S101 in a method for migrating a virtual machine applied to a sender provided in an embodiment of the present application;
  • FIG. 3 is a flow chart of step S102 in a method for migrating a virtual machine applied to a sender provided in an embodiment of the present application;
  • FIG. 4 is a flow chart of sequentially transferring the non-hole area and its offset from the address space of the sending end to the disk of the receiving end in a virtual machine migration method applied to the sending end provided by the embodiment of the present application;
  • FIG. 5 is a flow comparison diagram of bypassing the page cache for data reading and writing in a virtual machine migration method applied to the sending end provided by the embodiment of the present application;
  • FIG. 6 is a flow chart of a method for migrating a virtual machine applied to a receiving end provided in an embodiment of the present application
  • FIG. 7 is a flow chart of step S603 in a method for migrating a virtual machine applied to a receiving end provided by an embodiment of the present application;
  • FIG. 8 is a signaling diagram of a virtual machine migration method provided in an embodiment of the present application.
  • FIG. 9 is a signaling diagram of another virtual machine migration method provided by the embodiment of the present application.
  • Figure 10 is a cache occupancy diagram during traditional static migration
  • Figure 11 is a cache occupancy diagram when static migration is adopted in the virtual machine migration method
  • FIG. 12 is a schematic structural diagram of a virtual machine migration system applied to the sending end provided by the embodiment of the present application.
  • FIG. 13 is a schematic structural diagram of a virtual machine migration system applied to a receiving end provided by an embodiment of the present application
  • FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • System virtualization refers to virtualizing a physical computer system into one or more virtual computer systems, and each virtual computer system (referred to as a virtual machine) has its own virtual hardware (such as CPU, memory and equipment, etc.), To provide an independent virtual machine execution environment.
  • VMM Virtual Machine Monitor
  • the operating system task in the virtual machine is still running exclusively on one system.
  • the operating systems in each virtual machine can be completely different, and their execution environments are completely independent.
  • the environment where the virtual monitor runs, that is, the real physical platform, is called the host machine, and the virtualized platform, that is, the virtual machine, is also called the guest machine.
  • Virtualization technology refers to the technology for realizing virtualization at the software level, and is generally divided into two camps: open source virtualization and commercial virtualization. Typical representatives are: Xen, KVM, VMware, Hyper-V, etc. Among them, VMware and Hyper-V are paid commercial software, and Xen has been removed from the official kernel of Linux to support it.
  • the current mainstream open source virtualization technology is KVM.
  • virtualization Compared with direct use of physical platforms, virtualization has great advantages in effective resource utilization, dynamic allocation and high reliability.
  • enterprises can build a new information infrastructure without abandoning the existing infrastructure, so as to make full use of the original IT investment.
  • the excellent encapsulation of the virtual machine makes it easier to save the virtual machine, thus playing a greater role in disaster recovery.
  • Virtual machine snapshots and clones make it easier to deploy various software operating environments, making testing and debugging of software development faster and easier.
  • Running multiple virtual machines on one computer can make resource scheduling more optimal. Although different workloads can be consolidated without virtualization, the isolation of virtual machines allows each application to run independently in its own operating system environment without affecting the work in other systems load.
  • the main purpose of virtual machine migration is to migrate the client from one host to another, and ensure that its various services can be used normally.
  • the main operation is to completely copy all the software (including the operating system) on the client computer to another physical hardware machine. Virtualization removes hardware dependencies, so that virtual machines on different hardware platforms can be migrated.
  • Virtual machine migration can be divided into static migration and live migration. The difference between the two lies in whether the virtual machine needs to be stopped during the migration process.
  • the migration performed when the virtual machine is shut down or suspended is called static migration, and the migration performed when the virtual machine remains running is called dynamic migration.
  • the content that needs to be migrated when the virtual machine is in the running state includes the disk file, configuration file, status and memory of the virtual machine, while only the first three items need to be migrated when the virtual machine is in the paused state, and only the first two items need to be migrated when the virtual machine is shut down.
  • the static migration method is simple and easy to implement, and is suitable for occasions that do not have strict requirements on service availability, while the dynamic migration process only has a very short and imperceptible downtime, and the user experience is better.
  • VMM-based data transmission transmits raw data, that is, directly transmits the content of the file without any processing, and does not support data encryption and integrity verification; while libvirtd-based data transmission transmits this transmission mode Encryption is supported, and data is transmitted through the RPC protocol built into libvirtd.
  • the copy process on the source host is:
  • the copy process on the destination host is:
  • Disks of different formats have different voids as they are used. Take disks in qcow2 and raw formats as an example. Generally speaking, the ratio of holes in disks in raw format will decrease with use; while the ratio of holes in disks in qcow2 format will increase with use. During the virtual machine migration process, the transmission of these empty data will waste bandwidth and reduce transmission efficiency.
  • Buffered I/O also known as standard I/O
  • the operating system will cache the I/O data in the page cache (page cache) of the file system. That is to say, when reading a disk file, the data will be copied to the buffer of the operating system kernel first, and then copied from the buffer of the operating system kernel to the address space of the application program.
  • Cached I/O has the following advantages: Cached I/O uses the kernel buffer of the operating system, which to a certain extent separates the application space and the actual physical device space; cached I/O can reduce the number of disk reads, thereby improving performance.
  • an application program reads a certain piece of data, if the piece of data is already in the page cache, then this piece of data can be returned to the application program immediately without going through the actual physical disk reading operation. Since the reading speed of the page cache is much higher than that of the disk, and data access is usually continuous, the data acquisition speed can be greatly improved by caching. For write operations, the application will first write the data to the page cache.
  • Whether the data is written to the disk immediately depends on the writing mechanism used by the application: but whether the application uses synchronous writes (synchronous writes), delayed writes Mechanism (deferred writes) or asynchronous writes (asynchronous writes) will pass through the page cache and then be written to the real physical disk.
  • the current virtual machine migration solution has the problem of wasting transmission bandwidth caused by "empty" data; and the page cache is occupied during the process of reading and writing files, resulting in low read and write efficiency, and is not conducive to the transmission of large disk files .
  • a virtual machine migration method, system, and electronic device provided by the embodiments of the present application can use the offset data of the empty block of the file in the message to replace the transmission of the empty block of the file, thereby increasing the migration speed; and by
  • the write-to-disk mode reduces the occupancy rate of the page cache, improves read and write efficiency, and helps to increase the transmission rate of very large disk files.
  • the method is applied to the sending end, including:
  • Step S101 establish a connection with the receiving end, and send a first message to the receiving end; wherein, the first message includes attribute information of the file to be copied.
  • This step is an initialization step. Because the virtual machine migration process consumes a lot of resources and time, the sending end and the receiving end need to establish a reliable and stable connection, usually using a long-term connection for interconnection. To ensure transmission reliability, you can choose to use TCP connection, and the connection protocol supports bidirectional transmission of files.
  • the first message is sent to it to perform the migration, and the first message includes the attribute information of the file to be copied.
  • the first message may include a request message and a head message, notifying the receiving end that the file will be copied.
  • head files and messages During the data sending process, related head files and messages will be involved, and the receiving end will be notified of the basic information of the file through the head message, such as file name and file size.
  • head message such as file name and file size.
  • Base Head the basic message header. It is used to determine different message types and contains the basic information of the message message, such as the following parameters: Total Size: the length of the entire message; HEAD: the "HEAD" mark; Version: the software version number; HeadSize: the length of the message header; PacketType: message type; PathSize: length of the transmitted file path; CRCCode: CRC check code of all previous contents; FilePath: transmitted file path.
  • Step S102 determining the hole area and its location information of the file to be copied; wherein, the hole area is a memory block in the file to be copied that continuously stores binary values of 0.
  • the empty area is a storage block that continuously stores binary values of 0 in the file to be copied. By scanning the file to be copied and judging whether it contains an empty area, if it is included, record the position of the empty area. At the same time, after the position of the cavity area is obtained during the scanning process, the position information of the non-cavity area can be obtained at the same time.
  • Step S103 according to the hole area and its location information, determine the non-hole area and its offset of the file to be copied, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end.
  • the non-hole area of the file to be copied can be obtained, that is, the data to be transmitted.
  • the offset of the non-hole area can be obtained according to the position information of the non-hole area and the position information of the hole area. This offset is used as a copy parameter, and is transmitted to the disk at the receiving end together with the data in the non-hole area. This process does not copy the non-hole area, thereby saving transmission bandwidth.
  • Step S104 after the non-hole area and its offset are transmitted, a second message is sent to the receiving end; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
  • the sending end sends a second message to the receiving end to inform the receiving end of the completion of the transmission.
  • the integrity of the file to be transmitted that has been transmitted is verified through the verification information contained in the second message.
  • this method can optimize the transmission speed of files with "holes"; Send, thereby reducing the number of packets transmitted by the file network, shortening the overall time of file transmission, and improving its transmission efficiency.
  • the step S101 of establishing a connection with the receiving end and sending the first message to the receiving end includes:
  • Step S201 the sending end establishes a long connection with the receiving end, and initializes the request message and the header message message in the first message; wherein, the request message is used to notify the receiving end to perform the copy process; the header message message is used to send The receiving end notifies the attribute information of the file to be copied.
  • the format of the Request message can refer to the format of the aforementioned Request type message, as follows:
  • HEAD "HEAD" tag
  • HeadSize message header length
  • PacketType 4; indicates request type message
  • PathSize the length of the transmitted file path
  • CRCCode CRC check code of all previous content
  • FilePath the path of the transferred file
  • Operation operation (send file/receive file);
  • EnableVerify Whether to verify.
  • the format of the header message message can refer to the aforementioned Head type message, as follows:
  • HEAD "HEAD" tag
  • HeadSize message header length
  • PacketType 1; indicates head type message
  • PathSize the length of the transmitted file path
  • CRCCode CRC check code of all previous content
  • FilePath the path of the transferred file
  • FileSize file size.
  • Step S202 sending a request message to the receiving end.
  • Step S203 after receiving the response message of the request message, sending the header message message to the receiving end.
  • the sending end informs the receiving end of the basic information of the file through the head message, including the file name (path) and file size.
  • the step S102 of determining the empty area of the file to be copied and its location information includes:
  • Step S301 scan the file to be copied according to the preset fragmentation strategy, and judge whether the fragments of the copied file are storage blocks with consecutive binary values of 0.
  • Step S302 if yes, obtain the location information of the copied file where the empty area is located, and determine the storage block as the empty area.
  • the positions of these hollow areas such as the start number, the end number, the length of the hollow area, and so on. These position information can be used to calculate the offset of the non-hole area, and finally perform data offset during the copy process.
  • the non-hole area is used as the data for real transmission, while the hole area does not perform actual transmission; therefore, in the actual operation process, it is necessary to transfer the file content and offset in the relevant storage block in the non-hole area, for example, the offset field can be used value to replace the transfer of empty blocks in the file.
  • the files read in the page cache only need to be sent to the peer end as needed, and there is no possibility of secondary reading; the data written in the page cache does not involve re-modification , the need to delay writes.
  • the improvement of read and write efficiency brought about by the conventional cache I/O method will not play a role in the process of virtual machine migration, but will reduce efficiency. Therefore, in some embodiments, the non-hole area and its offset are sequentially transferred from the address space of the sending end to the disk of the receiving end, as shown in FIG. 4 , including:
  • step S401 the data stream of the non-hole area is obtained, and the data stream is transferred from the address space of the sender to the application buffer.
  • the operating system will cache the I/O data in the page cache (page cache) of the file system. That is to say, when reading a disk file, the data will be copied to the buffer of the operating system kernel first, and then copied from the buffer of the operating system kernel to the address space of the application program.
  • Cached I/O has the following advantages: Cached I/O uses the kernel buffer of the operating system, which to a certain extent separates the application space and the actual physical device space; cached I/O can reduce the number of disk reads, thereby improving performance.
  • an application program reads a certain piece of data, if the piece of data is already in the page cache, then this piece of data can be returned to the application program immediately without going through the actual physical disk reading operation. Since the reading speed of the page cache is much higher than that of the disk, and data access is usually continuous, the data acquisition speed can be greatly improved by caching.
  • Step S402 controlling the data flow of the application buffer, bypassing the system kernel buffer of the virtual machine, and directly transmitting to the disk at the receiving end.
  • step S402 by bypassing the page cache and directly reading and writing the disk to perform data read and write operations, it is also possible to transfer very large disk files when the memory is small or occupied by other applications. .
  • a comparison diagram of the above process is shown in FIG. 5 , which will not be repeated here.
  • the embodiment of the present application provides a virtual machine migration method, which is applied to the receiving end, as shown in Figure 6, including:
  • step S601 after the connection is established by the receiving end, the first message sent by the sending end is received; wherein, the first message includes attribute information of the file to be copied.
  • the sending end After sending the first message to the receiving end, the sending end informs the receiving end that it is ready to accept the file. For example, the sending end sends the request message to the receiving end, and after receiving the message, the receiving end sends a response message of the request message to the sending end.
  • Step S602 according to the attribute information of the file to be copied contained in the first message, a temporary file mapped to the file to be copied is created in the disk of the receiving end.
  • the first message includes a related head message, and the head message includes related attribute information of the file to be copied, such as file name, path, file size, and the like.
  • the receiving end creates a file to be copied in the local disk of the receiving end according to the content of the head message.
  • the file names of these temporary files are in one-to-one correspondence with the files contained in the file to be copied, but the content of the files is temporarily empty, which needs to be passed through each The data stream of the file to fill.
  • Step S603 receiving the data stream and its offset from the sender, and saving the data stream into a temporary file according to the offset data.
  • Step S604 when the data stream is saved, receive the second message from the sender, and verify the integrity of the temporary file by using the verification information included in the second message.
  • the sending end When the data stream is saved, the sending end will send the second message to the receiving end. At this time, the receiving end obtains the second packet and then verifies the integrity of the temporary file. When the temporary file is consistent with the file to be copied, it indicates that the copy process is normal, and the verification result can be sent to the sender at the same time.
  • the step S603 of creating a temporary file mapped to the file to be copied in the disk of the receiving end includes:
  • Step S701 receiving a request message from the sender; wherein, the request message is used to notify the receiver to execute the copying process.
  • the request message in this step is a request message, which is sent from the sending end to the receiving end, and is used to notify the receiving end to execute file copying.
  • Step S702 the receiving end responds to the request message, and transmits the response message to the sending end.
  • the receiving end responds to the request message, and sends a response message to the sending end, informing the sending end that the file can be copied.
  • Step S703 receiving a header message from the sender; wherein, the header message is used to acquire attribute information of the file to be copied.
  • the sending end After receiving the response message from the receiving end, the sending end sends a head message to the receiving end to inform the receiving end of the file attribute information to be copied, including file name, file path, and file size.
  • Step S704 according to the attribute information of the file to be copied contained in the header message, create a temporary file mapped to the copied file.
  • the attribute information of the file to be copied contained in the head message message such as multiple types of Head type message, Data type message, End type message, Request type message, and Response type message mentioned in the above-mentioned embodiment message, according to the message content contained in these header message messages, create corresponding temporary files in the receiving end disk.
  • the sender initiates a connection, first sends a request message to notify the receiver that the file will be copied;
  • the sending end sends an end message to the receiving end.
  • the end message is used to notify the receiving end that the file transfer is over, and carries verification information for the receiving end to verify the integrity of the transmitted file;
  • the receiving end sequentially receives the messages sent by the sending end and performs corresponding processing.
  • the above process can be described by a signaling diagram of a virtual machine migration method as shown in FIG. 8 , in which Host1 can be understood as a sending end; Host2 is a receiving end.
  • Host1 sends a Requset message to Host2, informing Host2 that the file will be copied;
  • Host2 responds to the Requset message and sends a Response message to Host1;
  • Host1 sends the head message to Host2, informing Host2 of the basic information of the file to be copied;
  • Host2 responds to the head message and sends a Response message to Host1;
  • Host1 transmits the file to Host2 through the data message, and the transmission process ends with the data and its offset not including the empty area.
  • the data transmission is completed after N times of recirculation.
  • N+1 transmissions send an end message to Host2, instructing Host2 to complete the file transmission, and verify the data in Host2 through the verification data in the end message.
  • FIG. 9 is a signaling diagram of another virtual machine migration method, in which Host1 requests Host2 to migrate to Host1. If it is classified by the location of the migrated data, Host2 is the sending end; Host1 is the receiving end.
  • the above virtual machine migration process is as follows:
  • Host2 sends a Requset message to Host1, informing Hos1 that the file will be copied;
  • Host1 responds to the Requset message and sends a Response message to Host2;
  • Host2 sends the head message to Host1, informing Host1 of the basic information of the file to be copied;
  • Host1 responds to the head message and sends a Response message to Host2;
  • Host2 transmits the file to Host1 through the data message, and the transmission process reaches the data and its offset that does not include the empty area.
  • the data transmission is completed after N times of recirculation.
  • N+1 transmissions send an end message to Host1, instructing Host1 to complete the file transmission, and verify the data in Host1 through the verification data in the end message.
  • Fig. 10 is a cache occupancy diagram during traditional static migration
  • Fig. 11 is a cache occupancy diagram during static migration using the virtual machine migration method.
  • the horizontal axis in the figure is time (unit s)
  • the vertical axis is cache usage (unit M)
  • the total cache size of the host is 3500M.
  • the embodiment of the present application provides a virtual machine migration system, as shown in Figure 12, the system is applied to the sending end, including:
  • the first message sending module 1210 is configured to establish a connection with the receiving end, and send the first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
  • Hole area determining module 1220 for determining the hole area of the file to be copied and its location information; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied;
  • the data sending module 1230 is configured to determine the non-hole area and its offset of the file to be copied according to the hole area and its location information, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end middle;
  • the second message sending module 1240 is configured to send a second message to the receiving end after the non-hole area and its offset are transmitted; wherein, the second message includes verification information for verifying the integrity of the file to be copied .
  • the embodiment of the present application provides a virtual machine migration system, as shown in Figure 13, the system is applied to the receiving end, including:
  • the first message receiving module 1310 is configured to receive the first message sent by the sending end after the connection is established by the sending end; wherein, the first message includes attribute information of the file to be copied;
  • the temporary file generation module 1320 is used to create a temporary file mapped to the file to be copied in the disk of the receiving end according to the attribute information of the file to be copied contained in the first message;
  • the data receiving module is used to receive the data flow and its offset from the sending end, and save the data flow to a temporary file according to the offset data;
  • the data verification module 1330 is configured to receive the second message from the sender when the data stream is saved, and use the verification information contained in the second message to verify the integrity of the temporary file.
  • the virtual machine migration system provided in the embodiment of the present application has the same technical features as the virtual machine migration method provided in the above embodiment, so it can also solve the same technical problem and achieve the same technical effect.
  • the parts not mentioned in the embodiments reference may be made to the corresponding content in the aforementioned embodiments of the virtual machine migration method.
  • This embodiment also provides an electronic device, the structural diagram of which is shown in Figure 14, the device includes a processor 101 and a memory 102; wherein, the memory 102 is used to store one or more computer instructions, one or more A computer instruction is executed by the processor to implement the above virtual machine migration method.
  • the electronic device shown in FIG. 14 further includes a bus 103 and a communication interface 104 , and the processor 101 , the communication interface 104 and the memory 102 are connected through the bus 103 .
  • the memory 102 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
  • the bus 103 may be an ISA bus, a PCI bus, or an EISA bus, etc.
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 14 , but it does not mean that there is only one bus or one type of bus.
  • the communication interface 104 is used to connect with at least one user terminal and other network elements through the network interface, and send the encapsulated IPv4 message or the IPv4 message to the user terminal through the network interface.
  • the processor 101 may be an integrated circuit chip with signal processing capability.
  • each step of the above method can be completed by an integrated logic circuit of hardware in the processor 101 or instructions in the form of software.
  • processor 101 can be general-purpose processor, comprises central processing unit (Central Processing Unit, be called for short CPU), network processor (Network Processor, be called for short NP) etc.; Can also be Digital Signal Processor (Digital Signal Processor, be called for short DSP) ), Application Specific Integrated Circuit (ASIC for short), Field Programmable Gate Array (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
  • CPU central processing unit
  • Network Processor Network Processor
  • NP Network Processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field Programmable Gate Array
  • a general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like.
  • the steps of the methods disclosed in the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory 102, and the processor 101 reads the information in the memory 102, and completes the steps of the methods of the foregoing embodiments in combination with its hardware.
  • the embodiment of the present application also provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the methods in the foregoing embodiments are executed.
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division.
  • multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor.
  • the essence of the technical solution of this application or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .

Landscapes

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

Abstract

A virtual machine migration method and system and an electronic device, which relate to the technical field of virtual machines. The method comprises: first, establishing a connection with a receiving end and sending a first message to the receiving end, wherein the first message comprises attribute information of a file to be copied (S101); then, determining a hole region of the file and location information thereof, the hole region being a storage block in the file that continuously stores a binary value of zero (S102); next, determining a non-hole region of the file and an offset thereof according to the hole region and the location information thereof; and once the transmission of the non-hole region and the offset thereof is complete, sending to the receiving end a second message and verification information for verifying the integrity of the file. In the described method, offset data of a file hole block may be used in a message to replace the transmission of the file hole block, thereby increasing the migration speed. Moreover, the occupancy rate of a page cache is reduced by means of a write-through disk method, which increases the read-write efficiency, and helps to improve the transfer rate of very large disk files.

Description

虚拟机迁移方法、系统及电子设备Virtual machine migration method, system and electronic device
相关申请的交叉引用Cross References to Related Applications
本申请要求于2021年06月25日提交中国国家知识产权局的申请号为202110715998.3、名称为“虚拟机迁移方法、系统及电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to a Chinese patent application with application number 202110715998.3 and titled "Virtual Machine Migration Method, System, and Electronic Device" filed with the State Intellectual Property Office of China on June 25, 2021, the entire contents of which are hereby incorporated by reference In this application.
技术领域technical field
本申请涉及虚拟机技术领域,尤其是涉及一种虚拟机迁移方法、系统及电子设备。The present application relates to the technical field of virtual machines, in particular to a virtual machine migration method, system and electronic equipment.
背景技术Background technique
现有虚拟机在迁移过程中,在静态迁移时会在源宿主机中首先创建系统的磁盘镜像文件(简称磁盘文件),然后将磁盘文件拷贝至目的宿主机上。具体的说,在源宿主机上的拷贝过程为:(1)打开待迁移的磁盘文件;(2)读取文件内容到缓存;(3)通过TCP/UCP将读取的文件内容发送到新的宿主机;(4)循环(2)-(3)直至文件发送完毕。在目的宿主上的拷贝过程为:(1)创建新文件并打开;(2)读取对端通过TCP/UDP传输过来的磁盘内容;(3)将读取的内容写入至(1)中创建的文件;(4)循环(2)-(3)直至文件接收完毕。During the migration process of an existing virtual machine, a system disk image file (referred to as a disk file) will first be created in the source host machine during static migration, and then the disk file will be copied to the destination host machine. Specifically, the copy process on the source host machine is: (1) open the disk file to be migrated; (2) read the file content to the cache; (3) send the read file content to the new host through TCP/UCP (4) cycle (2)-(3) until the file is sent. The copy process on the destination host is: (1) create a new file and open it; (2) read the disk content transmitted by the peer through TCP/UDP; (3) write the read content into (1) Created file; (4) cycle (2)-(3) until the file is received.
由于虚拟机运行产生的磁盘文件与普通文件不同,通常会存在较多的“空洞”数据。“空洞”数据是连续存储二进制为0的文件部分,一般来说虚拟机中的空洞占据磁盘总体空间的三分之一左右。不同格式的磁盘随着使用,其空洞变化也是不同的。以qcow2和raw格式的磁盘为例,一般来说,raw格式的磁盘中的空洞占比会随着使用而减少;qcow2格式的磁盘中的空洞占比会随着使用而增多。在虚拟机迁移过程中,这些空洞数据的传输会浪费带宽,降低传输效率。Because the disk files generated by the running of the virtual machine are different from ordinary files, there are usually more "empty" data. "Hole" data is the part of the file that continuously stores binary 0. Generally speaking, the hole in the virtual machine occupies about one-third of the total disk space. Disks of different formats have different voids as they are used. Take disks in qcow2 and raw formats as an example. Generally speaking, the ratio of holes in disks in raw format will decrease with use; while the ratio of holes in disks in qcow2 format will increase with use. During the virtual machine migration process, the transmission of these empty data will waste bandwidth and reduce transmission efficiency.
同时,使用缓存I/O在虚拟机迁移过程中最大的问题是对页缓存的消耗。在虚拟机迁移过程中,涉及大量、频繁的文件读写操作,数据从应用程序的地址空间和页缓存之间,页缓存和磁盘之间进行大量的数据拷贝操作,这些数据拷贝操作所带来的CPU及内存开销是非常大的。若迁移的磁盘文件较大,或同时存在多个虚拟机文件进行迁移的时候,迁移效率会变低。At the same time, the biggest problem of using cached I/O during virtual machine migration is the consumption of page cache. During the virtual machine migration process, a large number of frequent file read and write operations are involved, and a large number of data copy operations are performed between the address space of the application program and the page cache, and between the page cache and the disk. These data copy operations bring The CPU and memory overhead is very large. If the migrated disk file is large, or if there are multiple virtual machine files to be migrated at the same time, the migration efficiency will decrease.
综上所述,目前的虚拟机迁移方案中存在着“空洞”数据造成浪费传输带宽的问题;并在读写文件过程中占用页缓存,导致读写效率低,且不利于超大磁盘文件的传输。To sum up, the current virtual machine migration solution has the problem of wasting transmission bandwidth caused by "empty" data; and the page cache is occupied during the process of reading and writing files, resulting in low read and write efficiency, and is not conducive to the transmission of large disk files .
发明内容Contents of the invention
有鉴于此,本申请的目的在于提供一种虚拟机迁移方法、系统及电子设备,在报文中可使用文件空洞块的偏移量数据来代替文件空洞块的传输,进而提高迁移速度;并通过直写磁盘方式降低页缓存的占有率,提高了读写效率,有利于提升超大磁盘文件的传输速率。In view of this, the purpose of this application is to provide a virtual machine migration method, system and electronic equipment, in which the offset data of the file empty block can be used in the message to replace the transmission of the file empty block, thereby increasing the migration speed; and By writing directly to the disk, the occupancy rate of the page cache is reduced, the efficiency of reading and writing is improved, and the transmission rate of very large disk files is improved.
第一方面,本申请实施例提供了一种虚拟机迁移方法,该方法应用于发送端,包括:In the first aspect, the embodiment of the present application provides a virtual machine migration method, which is applied to the sending end, including:
与接收端建立连接,并向接收端发送第一报文;其中,第一报文包含待拷贝文件的属性信息;Establish a connection with the receiving end, and send the first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
确定待拷贝文件的空洞区域及其位置信息;其中,空洞区域为待拷贝文件中连续存储二进制数值为0的存储块;Determine the empty area and its location information of the file to be copied; wherein, the empty area is a storage block that continuously stores binary values of 0 in the file to be copied;
根据空洞区域及其位置信息,确定待拷贝文件的非空洞区域及其偏移量,并将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中;According to the hole area and its location information, determine the non-hole area and its offset of the file to be copied, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end;
待非空洞区域及其偏移量传输完毕后向接收端发送第二报文;其中,第二报文包含对 待拷贝文件完整性进行校验的校验信息。After the non-hole area and its offset are transmitted, the second message is sent to the receiving end; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
在一些实施方式中,与接收端建立连接,并向接收端发送第一报文的步骤,包括:In some embodiments, the step of establishing a connection with the receiving end and sending the first message to the receiving end includes:
发送端与接收端建立长连接,并初始化第一报文中的请求报文以及头消息报文;其中,请求报文用于通知接收端执行拷贝过程;头消息报文用于向接收端告知待拷贝文件的属性信息;The sending end establishes a long connection with the receiving end, and initializes the request message and the header message message in the first message; wherein, the request message is used to notify the receiving end to perform the copy process; the header message message is used to inform the receiving end Attribute information of the file to be copied;
向接收端发送请求报文;Send a request message to the receiving end;
当接收到请求报文的响应报文后,向接收端发送头消息报文。After receiving the response message of the request message, send the header message message to the receiving end.
在一些实施方式中,确定待拷贝文件的空洞区域及其位置信息的步骤,包括:In some embodiments, the step of determining the empty area of the file to be copied and its location information includes:
按照预设的分片策略对待拷贝文件进行扫描,判断拷贝文件的分片是否为连续二进制数值为0的存储块;Scan the file to be copied according to the preset fragmentation strategy, and judge whether the fragmentation of the copied file is a storage block with a continuous binary value of 0;
如果是,则获取空洞区域所在拷贝文件的位置信息,并将存储块确定为空洞区域。If so, the location information of the copied file where the empty area is located is obtained, and the storage block is determined as the empty area.
在一些实施方式中,将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中,包括:In some implementation manners, sequentially transferring the non-hole area and its offset from the address space of the sending end to the disk of the receiving end includes:
获取非空洞区域的数据流,将数据流从发送端的地址空间传输至应用缓冲区;Obtain the data flow of the non-hole area, and transfer the data flow from the address space of the sender to the application buffer;
控制应用缓冲区的数据流,绕过虚拟机的系统内核缓冲区,直接传输至接收端的磁盘中。Control the data flow of the application buffer, bypass the system kernel buffer of the virtual machine, and transmit it directly to the disk at the receiving end.
第二方面,本申请实施例提供了一种虚拟机迁移方法,该方法应用于接收端,包括:In the second aspect, the embodiment of the present application provides a virtual machine migration method, which is applied to the receiving end, including:
接收发送端建立连接后,接收发送端发来的第一报文;其中,第一报文包含待拷贝文件的属性信息;After the receiving end establishes the connection, receive the first message sent by the sending end; wherein, the first message includes attribute information of the file to be copied;
根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件;According to the attribute information of the file to be copied contained in the first message, a temporary file corresponding to the file to be copied is established in the disk of the receiving end;
接收来自发送端的数据流及其偏移量,根据偏移量数据将数据流保存至临时文件中;Receive the data stream and its offset from the sender, and save the data stream to a temporary file according to the offset data;
待数据流保存完毕时,接收来自发送端的第二报文,并利用第二报文中包含的校验信息对临时文件的完整性进行校验。When the data stream is saved, the second message from the sender is received, and the integrity of the temporary file is verified by using the verification information contained in the second message.
在一些实施方式中,根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件,包括:In some embodiments, according to the attribute information of the file to be copied contained in the first message, a temporary file mapped to the file to be copied is established in the disk of the receiving end, including:
接收来自发送端的请求报文;其中,请求报文用于通知接收端执行拷贝过程;Receive a request message from the sender; where the request message is used to notify the receiver to execute the copy process;
接收端响应请求报文,并将响应报文传输至发送端;The receiving end responds to the request message and transmits the response message to the sending end;
接收来自发送端的头消息报文;其中,头消息报文用于获取待拷贝文件的属性信息;Receive the header message message from the sender; wherein, the header message message is used to obtain the attribute information of the file to be copied;
根据头消息报文中包含的待拷贝文件的属性信息,建立与拷贝文件相映射的临时文件。According to the attribute information of the file to be copied contained in the header message, a temporary file mapped to the copied file is established.
第三方面,本申请实施例提供了一种虚拟机迁移系统,该系统应用于发送端,包括:In the third aspect, the embodiment of the present application provides a virtual machine migration system, which is applied to the sending end, including:
第一报文发送模块,用于与接收端建立连接,并向接收端发送第一报文;其中,第一报文包含待拷贝文件的属性信息;The first message sending module is used to establish a connection with the receiving end, and send the first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
空洞区域确定模块,用于确定待拷贝文件的空洞区域及其位置信息;其中,空洞区域为待拷贝文件中连续存储二进制数值为0的存储块;Hollow area determination module, used to determine the empty area of the file to be copied and its location information; wherein, the empty area is a storage block that continuously stores binary values of 0 in the file to be copied;
数据发送模块,用于根据空洞区域及其位置信息,确定待拷贝文件的非空洞区域及其偏移量,并将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中;The data sending module is used to determine the non-hole area and its offset of the file to be copied according to the hole area and its location information, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end ;
第二报文发送模块,用于待非空洞区域及其偏移量传输完毕后向接收端发送第二报文;其中,第二报文包含对待拷贝文件完整性进行校验的校验信息。The second message sending module is used to send the second message to the receiving end after the transmission of the non-hole area and its offset is completed; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
第四方面,本申请实施例提供了一种虚拟机迁移系统,该系统应用于接收端,包括:In the fourth aspect, the embodiment of the present application provides a virtual machine migration system, which is applied to the receiving end, including:
第一报文接收模块,用于接收发送端建立连接后,接收发送端发来的第一报文;其中,第一报文包含待拷贝文件的属性信息;The first message receiving module is used to receive the first message sent by the sending end after the sending end establishes the connection; wherein, the first message includes attribute information of the file to be copied;
临时文件生成模块,用于根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件;A temporary file generating module, configured to create a temporary file mapped to the file to be copied in the disk at the receiving end according to the attribute information of the file to be copied contained in the first message;
数据接收模块,用于接收来自发送端的数据流及其偏移量,根据偏移量数据将数据流保存至临时文件中;The data receiving module is used to receive the data flow and its offset from the sending end, and save the data flow to a temporary file according to the offset data;
数据校验模块,用于待数据流保存完毕时,接收来自发送端的第二报文,并利用第二报文中包含的校验信息对临时文件的完整性进行校验。The data verification module is configured to receive the second message from the sending end when the data stream is saved, and use the verification information contained in the second message to verify the integrity of the temporary file.
第五方面,本申请实施例还提供一种电子设备,包括存储器、处理器,存储器中存储有可在处理器上运行的计算机程序,其中,处理器执行计算机程序时实现上述第一方面和第二方面提到的虚拟机迁移方法的步骤。In the fifth aspect, the embodiment of the present application also provides an electronic device, including a memory and a processor, and a computer program that can run on the processor is stored in the memory, wherein, when the processor executes the computer program, the above first aspect and the first aspect are realized. The steps of the virtual machine migration method mentioned in the second aspect.
第六方面,本申请实施例还提供一种具有处理器可执行的非易失的程序代码的计算机可读介质,其中,程序代码使处理器执行上述第一方面和第二方面提到的虚拟机迁移方法的步骤。In the sixth aspect, the embodiment of the present application also provides a computer-readable medium having a non-volatile program code executable by a processor, wherein the program code causes the processor to execute the virtual steps in the machine migration method.
本申请实施例带来了至少以下有益效果:The embodiment of the present application brings at least the following beneficial effects:
本申请提供了一种虚拟机迁移方法、系统及电子设备,该方法在发送端首先与接收端建立连接,并向接收端发送第一报文;其中,第一报文包含待拷贝文件的属性信息;然后确定待拷贝文件的空洞区域及其位置信息;其中,空洞区域为待拷贝文件中连续存储二进制数值为0的存储块;再根据空洞区域及其位置信息,确定待拷贝文件的非空洞区域及其偏移量,并将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中;待非空洞区域及其偏移量传输完毕后向接收端发送第二报文;其中,第二报文包含对待拷贝文件完整性进行校验的校验信息;而在接收端,该方法首先接收发送端建立连接后,接收发送端发来的第一报文;然后根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件,并接收来自发送端的数据流及其偏移量,根据偏移量数据将数据流保存至临时文件中;待数据流保存完毕时,接收来自发送端的第二报文,并利用第二报文中包含的校验信息对临时文件的完整性进行校验。该方法在报文中可使用offset字段的值来代替文件中空洞块的传输,进而提高迁移速度;并通过直写磁盘方式降低页缓存的占有率,提高了读写效率,有利于提升超大磁盘文件的传输速率。The present application provides a virtual machine migration method, system and electronic equipment. In the method, the sending end first establishes a connection with the receiving end, and sends a first message to the receiving end; wherein, the first message includes the attribute of the file to be copied information; then determine the hole area and its position information of the file to be copied; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied; then determine the non-hole of the file to be copied according to the hole area and its position information area and its offset, and transfer the non-hole area and its offset from the address space of the sender to the disk of the receiver in turn; after the non-hole area and its offset are transmitted, the second message is sent to the receiver ; Wherein, the second message contains verification information for verifying the integrity of the file to be copied; and at the receiving end, the method first receives the first message sent by the sending end after the sending end establishes a connection; then according to the first The attribute information of the file to be copied contained in a message, create a temporary file mapped to the file to be copied in the disk of the receiving end, and receive the data stream and its offset from the sending end, and convert the data stream according to the offset data saving to a temporary file; when the data stream is saved, receiving the second message from the sending end, and using the verification information contained in the second message to verify the integrity of the temporary file. In this method, the value of the offset field can be used in the message to replace the transmission of empty blocks in the file, thereby improving the migration speed; and by writing directly to the disk, the occupancy rate of the page cache is reduced, and the read and write efficiency is improved, which is beneficial to the improvement of the ultra-large disk. The file transfer rate.
本申请的其他特征和优点将在随后的说明书中阐述,或者,部分特征和优点可以从说明书推知或毫无疑义的确定,或者通过实施本申请的上述技术即可得知。Other features and advantages of the present application will be described in the following descriptions, or some of the features and advantages can be deduced or unambiguously determined from the descriptions, or can be known by implementing the above-mentioned technologies of the present application.
为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实施方式,并配合所附附图,作详细说明如下。In order to make the above-mentioned purpose, features and advantages of the present application more comprehensible, preferred implementation modes are specifically cited below, together with the accompanying drawings, which are described in detail as follows.
附图说明Description of drawings
为了更清楚地说明本申请具体实施方式或现有技术中的技术方案,下面将对具体实施方式或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施方式,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the specific embodiments of the present application or the technical solutions in the prior art, the following will briefly introduce the accompanying drawings that need to be used in the description of the specific embodiments or prior art. Obviously, the accompanying drawings in the following description The drawings are some implementations of the present application, and those skilled in the art can obtain other drawings based on these drawings without creative work.
图1为本申请实施例提供的一种应用于发送端的虚拟机迁移方法的流程图;FIG. 1 is a flow chart of a method for migrating a virtual machine applied to a sending end provided in an embodiment of the present application;
图2为本申请实施例提供的一种应用于发送端的虚拟机迁移方法中步骤S101的流程图;FIG. 2 is a flow chart of step S101 in a method for migrating a virtual machine applied to a sender provided in an embodiment of the present application;
图3为本申请实施例提供的一种应用于发送端的虚拟机迁移方法中步骤S102的流程图;FIG. 3 is a flow chart of step S102 in a method for migrating a virtual machine applied to a sender provided in an embodiment of the present application;
图4为本申请实施例提供的一种应用于发送端的虚拟机迁移方法中,将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘的流程图;FIG. 4 is a flow chart of sequentially transferring the non-hole area and its offset from the address space of the sending end to the disk of the receiving end in a virtual machine migration method applied to the sending end provided by the embodiment of the present application;
图5为本申请实施例提供的一种应用于发送端的虚拟机迁移方法中绕过页缓存进行数据读写的流程对比图;FIG. 5 is a flow comparison diagram of bypassing the page cache for data reading and writing in a virtual machine migration method applied to the sending end provided by the embodiment of the present application;
图6为本申请实施例提供的一种应用于接收端的虚拟机迁移方法的流程图;FIG. 6 is a flow chart of a method for migrating a virtual machine applied to a receiving end provided in an embodiment of the present application;
图7为本申请实施例提供的一种应用于接收端的虚拟机迁移方法中步骤S603的流程图;FIG. 7 is a flow chart of step S603 in a method for migrating a virtual machine applied to a receiving end provided by an embodiment of the present application;
图8为本申请实施例提供的一种虚拟机迁移方法的信令图;FIG. 8 is a signaling diagram of a virtual machine migration method provided in an embodiment of the present application;
图9为本申请实施例提供的另一种虚拟机迁移方法的信令图;FIG. 9 is a signaling diagram of another virtual machine migration method provided by the embodiment of the present application;
图10为传统静态迁移时cache占用图;Figure 10 is a cache occupancy diagram during traditional static migration;
图11为采用本虚拟机迁移方法中静态迁移时的cache占用图;Figure 11 is a cache occupancy diagram when static migration is adopted in the virtual machine migration method;
图12为本申请实施例提供的一种应用于发送端的虚拟机迁移系统的结构示意图;FIG. 12 is a schematic structural diagram of a virtual machine migration system applied to the sending end provided by the embodiment of the present application;
图13为本申请实施例提供的一种应用于接收端的虚拟机迁移系统的结构示意图;FIG. 13 is a schematic structural diagram of a virtual machine migration system applied to a receiving end provided by an embodiment of the present application;
图14为本申请实施例提供的一种电子设备的结构示意图。FIG. 14 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
图标:icon:
1210-第一报文发送模块;1220-空洞区域确定模块;1230-数据发送模块;1240-第二报文发送模块;1310-第一报文接收模块;1320-临时文件生成模块;1330-数据校验模块;101-处理器;102-存储器;103-总线;104-通信接口。1210-the first message sending module; 1220-the hollow area determination module; 1230-the data sending module; 1240-the second message sending module; 1310-the first message receiving module; 1320-temporary file generation module; 1330-data Check module; 101-processor; 102-memory; 103-bus; 104-communication interface.
具体实施方式detailed description
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all of them. the embodiment. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
系统虚拟化是指将一台物理计算机系统虚拟化为一台或多台虚拟计算机系统,每个虚拟计算机系统(简称为虚拟机)都拥有自己的虚拟硬件(如CPU、内存和设备等),来提供一个独立的虚拟机执行环境。通过虚拟机监控器(Virtual Machine Monitor,VMM)的模拟,虚拟机中的操作系统任务仍然是独占一个系统在运行。每个虚拟机中的操作系统可以完全不同,并且他们的执行环境是完全独立的。虚拟监控器运行的环境,也就是真实的物理平台,称之为宿主机(host machine),虚拟出来的平台,也就是虚拟机,也被称为客户机(guest machine)。System virtualization refers to virtualizing a physical computer system into one or more virtual computer systems, and each virtual computer system (referred to as a virtual machine) has its own virtual hardware (such as CPU, memory and equipment, etc.), To provide an independent virtual machine execution environment. Through the simulation of the virtual machine monitor (Virtual Machine Monitor, VMM), the operating system task in the virtual machine is still running exclusively on one system. The operating systems in each virtual machine can be completely different, and their execution environments are completely independent. The environment where the virtual monitor runs, that is, the real physical platform, is called the host machine, and the virtualized platform, that is, the virtual machine, is also called the guest machine.
虚拟化技术指的是软件层面的实现虚拟化的技术,整体上分为开源虚拟化和商业虚拟化两大阵营。典型的代表有:Xen、KVM、VMware、Hyper-V等。其中,VMware和Hyper-V是收费的商业化软件,Xen已经被Linux的官方内核去除对它的支持。目前主流的开源虚拟化技术为KVM。Virtualization technology refers to the technology for realizing virtualization at the software level, and is generally divided into two camps: open source virtualization and commercial virtualization. Typical representatives are: Xen, KVM, VMware, Hyper-V, etc. Among them, VMware and Hyper-V are paid commercial software, and Xen has been removed from the official kernel of Linux to support it. The current mainstream open source virtualization technology is KVM.
比起直接使用物理平台,虚拟化在资源的有效利用、动态调配和高可靠性方面有着巨大的优势。利用虚拟化,企业不必抛弃现有的基础架构即可以构建全新的信息基础架构,从而更加充分地利用原有的IT投资。虚拟机的优秀封装性使得虚拟机更容易保存,从而在灾难恢复中发挥更大的作用。虚拟机快照和克隆使得部署各种软件运行环境更容易,从而使软件开发的测试和调试更为快捷方便。在一个计算机上运行多个虚拟机可以使得资源的调度更为优化。尽管不使用虚拟化也可以对不同的工作负载进行整合,但是虚拟机所具有 的隔离性可以使得每个应用程序在自己的操作系统环境中独立地运行,而不会影响到其他系统中的工作负载。Compared with direct use of physical platforms, virtualization has great advantages in effective resource utilization, dynamic allocation and high reliability. Using virtualization, enterprises can build a new information infrastructure without abandoning the existing infrastructure, so as to make full use of the original IT investment. The excellent encapsulation of the virtual machine makes it easier to save the virtual machine, thus playing a greater role in disaster recovery. Virtual machine snapshots and clones make it easier to deploy various software operating environments, making testing and debugging of software development faster and easier. Running multiple virtual machines on one computer can make resource scheduling more optimal. Although different workloads can be consolidated without virtualization, the isolation of virtual machines allows each application to run independently in its own operating system environment without affecting the work in other systems load.
虚拟机迁移的主要目的是将客户机从一台宿主机迁移到另外一台宿主机上,并保证其各个服务都能正常使用。主要操作是将客户机上的所有软件(包括操作系统)完全复制到另外一台物理硬件机器之上。虚拟化去掉了硬件的相关性,从而可以实现不同硬件上平台上的虚拟机的迁移。The main purpose of virtual machine migration is to migrate the client from one host to another, and ensure that its various services can be used normally. The main operation is to completely copy all the software (including the operating system) on the client computer to another physical hardware machine. Virtualization removes hardware dependencies, so that virtual machines on different hardware platforms can be migrated.
虚拟机迁移可以分为静态迁移(static migration)和动态迁移(live migration)。两者区别在于迁移过程中虚拟机是否需要停机。虚拟机关机或暂停的情况下进行的迁移为静态迁移,虚拟机保持运行状态进行的迁移为动态迁移。虚拟机在运行状态需要迁移的内容包括虚拟机的磁盘文件、配置文件、状态和内存,而在暂停状态下只需要迁移前三项,在关机的情况下则只需要迁移前两项。静态迁移方式简单易行,适用于对服务可用性要求不严格的场合,而动态迁移过程中仅有非常短暂不易察觉的停机时间,用户体验更好。Virtual machine migration can be divided into static migration and live migration. The difference between the two lies in whether the virtual machine needs to be stopped during the migration process. The migration performed when the virtual machine is shut down or suspended is called static migration, and the migration performed when the virtual machine remains running is called dynamic migration. The content that needs to be migrated when the virtual machine is in the running state includes the disk file, configuration file, status and memory of the virtual machine, while only the first three items need to be migrated when the virtual machine is in the paused state, and only the first two items need to be migrated when the virtual machine is shut down. The static migration method is simple and easy to implement, and is suitable for occasions that do not have strict requirements on service availability, while the dynamic migration process only has a very short and imperceptible downtime, and the user experience is better.
现有虚拟机在迁移过程中,常有两种常用的数据传输方式:一种是基于VMM的传输机制,即通过宿主机之间连接来进行数据传输;另一种是基于libvirtd的传输机制,即两个libvirtd进程之间的数据传输。基于VMM的数据传输这种传输方式传输的是裸数据,即直接传输文件的内容,不做任何的处理,并且不支持数据的加密和完整性校验;而基于libvirtd的数据传输这种传输方式支持加密,是通过libvirtd内建的RPC协议来进行数据的传输的。During the migration process of existing virtual machines, there are often two commonly used data transmission methods: one is the transmission mechanism based on VMM, that is, data transmission is performed through the connection between the host machines; the other is the transmission mechanism based on libvirtd, That is, data transfer between two libvirtd processes. VMM-based data transmission transmits raw data, that is, directly transmits the content of the file without any processing, and does not support data encryption and integrity verification; while libvirtd-based data transmission transmits this transmission mode Encryption is supported, and data is transmitted through the RPC protocol built into libvirtd.
无论是基于哪种方式的虚拟机迁移方案,在静态迁移时会在源宿主机中首先创建系统的磁盘镜像文件(简称磁盘文件),然后将磁盘文件拷贝至目的宿主机上。No matter which method of virtual machine migration is based on, during static migration, a system disk image file (disk file for short) will first be created on the source host, and then the disk file will be copied to the destination host.
具体的说,在源宿主机上的拷贝过程为:Specifically, the copy process on the source host is:
(1)打开待迁移的磁盘文件;(1) Open the disk file to be migrated;
(2)读取文件内容到缓存;(2) Read the content of the file to the cache;
(3)通过TCP/UCP将读取的文件内容发送到新的宿主机;(3) Send the read file content to the new host computer through TCP/UCP;
(4)循环(2)-(3)直至文件发送完毕。(4) Loop (2)-(3) until the file is sent.
在目的宿主上的拷贝过程为:The copy process on the destination host is:
(1)创建新文件并打开;(1) Create a new file and open it;
(2)读取对端通过TCP/UDP传输过来的磁盘内容;(2) Read the disk content transmitted by the peer through TCP/UDP;
(3)将读取的内容写入至(1)中创建的文件;(3) Write the read content to the file created in (1);
(4)循环(2)-(3)直至文件接收完毕。(4) Loop (2)-(3) until the file is received.
由于虚拟机运行产生的磁盘文件与普通文件不同,通常会存在较多的“空洞”数据。“空洞”数据是连续存储二进制为0的文件部分,一般来说虚拟机中的空洞占据磁盘总体空间的三分之一左右。不同格式的磁盘随着使用,其空洞变化也是不同的。以qcow2和raw格式的磁盘为例,一般来说,raw格式的磁盘中的空洞占比会随着使用而减少;qcow2格式的磁盘中的空洞占比会随着使用而增多。在虚拟机迁移过程中,这些空洞数据的传输会浪费带宽,降低传输效率。Because the disk files generated by the running of the virtual machine are different from ordinary files, there are usually more "empty" data. "Hole" data is the part of the file that continuously stores binary 0. Generally speaking, the hole in the virtual machine occupies about one-third of the total disk space. Disks of different formats have different voids as they are used. Take disks in qcow2 and raw formats as an example. Generally speaking, the ratio of holes in disks in raw format will decrease with use; while the ratio of holes in disks in qcow2 format will increase with use. During the virtual machine migration process, the transmission of these empty data will waste bandwidth and reduce transmission efficiency.
同时,使用缓存I/O在虚拟机迁移过程中最大的问题是对页缓存的消耗。缓存I/O又被称作标准I/O,是大多数文件系统的默认I/O操作方式。在Linux的缓存I/O机制中,操作系统会将I/O的数据缓存在文件系统的页缓存(page cache)中。也就是说在读取磁盘文件时,数据会先被拷贝到操作系统内核的缓冲区中,然后才会从操作系统内核的缓冲区拷贝到应用程序的地址空间。缓存I/O具有如下优点:缓存I/O使用了操作系统的内核缓冲区, 在一定程度上分离了应用程序空间和实际物理设备空间;缓存I/O可以减少读盘次数,从而提高性能。当应用程序去读取某块数据的时候,如果这块数据已经在页缓存中,那么这块数据可以立即返回给应用程序,而不需经过实际的物理读盘操作。由于页缓存的读取速度远大于磁盘的读取速度,并且数据的访问通常具有连续性,因此通过缓存方式可以大大提高数据获取速度。对应写操作来说,应用程序也会先将数据写到页缓存中,数据是否被立即写到磁盘上取决于应用程序所采用的写机制:但是无论应用采用同步写(synchronous writes),延迟写机制(deferred writes)还是异步写(asynchronous writes)都会经过页缓存再写入到真正的物理磁盘当中。At the same time, the biggest problem of using cached I/O during virtual machine migration is the consumption of page cache. Buffered I/O, also known as standard I/O, is the default I/O operation mode for most file systems. In the cached I/O mechanism of Linux, the operating system will cache the I/O data in the page cache (page cache) of the file system. That is to say, when reading a disk file, the data will be copied to the buffer of the operating system kernel first, and then copied from the buffer of the operating system kernel to the address space of the application program. Cached I/O has the following advantages: Cached I/O uses the kernel buffer of the operating system, which to a certain extent separates the application space and the actual physical device space; cached I/O can reduce the number of disk reads, thereby improving performance. When an application program reads a certain piece of data, if the piece of data is already in the page cache, then this piece of data can be returned to the application program immediately without going through the actual physical disk reading operation. Since the reading speed of the page cache is much higher than that of the disk, and data access is usually continuous, the data acquisition speed can be greatly improved by caching. For write operations, the application will first write the data to the page cache. Whether the data is written to the disk immediately depends on the writing mechanism used by the application: but whether the application uses synchronous writes (synchronous writes), delayed writes Mechanism (deferred writes) or asynchronous writes (asynchronous writes) will pass through the page cache and then be written to the real physical disk.
在虚拟机迁移过程中,涉及大量、频繁的文件读写操作,数据从应用程序的地址空间和页缓存之间,页缓存和磁盘之间进行大量的数据拷贝操作,这些数据拷贝操作所带来的CPU及内存开销是非常大的。若迁移的磁盘文件较大,或同时存在多个虚拟机文件进行迁移的时候,迁移效率会变低。During the virtual machine migration process, a large number of frequent file read and write operations are involved, and a large number of data copy operations are performed between the address space of the application program and the page cache, and between the page cache and the disk. These data copy operations bring The CPU and memory overhead is very large. If the migrated disk file is large, or if there are multiple virtual machine files to be migrated at the same time, the migration efficiency will decrease.
综上所述,目前的虚拟机迁移方案中存在着“空洞”数据造成浪费传输带宽的问题;并在读写文件过程中占用页缓存,导致读写效率低,且不利于超大磁盘文件的传输。To sum up, the current virtual machine migration solution has the problem of wasting transmission bandwidth caused by "empty" data; and the page cache is occupied during the process of reading and writing files, resulting in low read and write efficiency, and is not conducive to the transmission of large disk files .
基于此,本申请实施例提供的一种虚拟机迁移方法、系统及电子设备,可在报文中使用文件空洞块的偏移量数据来代替文件空洞块的传输,进而提高迁移速度;并通过直写磁盘方式降低页缓存的占有率,提高了读写效率,有利于提升超大磁盘文件的传输速率。Based on this, a virtual machine migration method, system, and electronic device provided by the embodiments of the present application can use the offset data of the empty block of the file in the message to replace the transmission of the empty block of the file, thereby increasing the migration speed; and by The write-to-disk mode reduces the occupancy rate of the page cache, improves read and write efficiency, and helps to increase the transmission rate of very large disk files.
为便于对本实施例进行理解,首先对本申请实施例所公开的一种虚拟机迁移方法进行详细介绍。To facilitate understanding of this embodiment, a method for migrating a virtual machine disclosed in this embodiment of the present application is firstly introduced in detail.
参见图1所示的一种虚拟机迁移方法的流程图,该方法应用于发送端,包括:Referring to the flow chart of a virtual machine migration method shown in Figure 1, the method is applied to the sending end, including:
步骤S101,与接收端建立连接,并向接收端发送第一报文;其中,第一报文包含待拷贝文件的属性信息。Step S101, establish a connection with the receiving end, and send a first message to the receiving end; wherein, the first message includes attribute information of the file to be copied.
该步骤为初始化步骤,由于虚拟机迁移的过程需消耗较大的资源及时间,因此发送端与接收端需要建立可靠稳定的连接,通常使用长连接的方式进行互联。为保证传输可靠性,可选择使用TCP连接,且该连接协议支持文件的双向传输。This step is an initialization step. Because the virtual machine migration process consumes a lot of resources and time, the sending end and the receiving end need to establish a reliable and stable connection, usually using a long-term connection for interconnection. To ensure transmission reliability, you can choose to use TCP connection, and the connection protocol supports bidirectional transmission of files.
与接收端连接成功后向其发送第一报文执行迁移,第一报文中包含待拷贝文件的属性信息。第一报文中可包含request报文以及head消息报文,告知接收端将要拷贝文件。After the connection with the receiving end is successful, the first message is sent to it to perform the migration, and the first message includes the attribute information of the file to be copied. The first message may include a request message and a head message, notifying the receiving end that the file will be copied.
在数据发送过程中,会涉及相关head文件及报文,通过head消息告知接收端文件的基本信息,如文件名、文件大小等。例如:During the data sending process, related head files and messages will be involved, and the receiving end will be notified of the basic information of the file through the head message, such as file name and file size. E.g:
1.Base Head,基础消息头。用于确定不同的消息类型,并包含消息报文的基础信息,如包含以下参数:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType:消息类型;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径。1.Base Head, the basic message header. It is used to determine different message types and contains the basic information of the message message, such as the following parameters: Total Size: the length of the entire message; HEAD: the "HEAD" mark; Version: the software version number; HeadSize: the length of the message header; PacketType: message type; PathSize: length of the transmitted file path; CRCCode: CRC check code of all previous contents; FilePath: transmitted file path.
2.Head类型消息。具体如下:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType=1;表示head类型报文;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径;FileSize:文件大小。2.Head type message. The details are as follows: Total Size: the entire message length; HEAD: "HEAD" mark; Version: software version number; HeadSize: message header length; PacketType=1; indicates head type message; PathSize: transmitted file path length; CRCCode : CRC check code of all previous contents; FilePath: path of the transferred file; FileSize: file size.
3.Data类型报文。具体如下:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType=2;表示data类型报文;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径; Offset:内容在磁盘上的偏移,用来解决空洞片未能传输导致的数据不一致的问题;Data:文件内容。3. Data type message. The details are as follows: Total Size: the entire message length; HEAD: "HEAD" mark; Version: software version number; HeadSize: message header length; PacketType=2; indicates data type message; PathSize: transmitted file path length; CRCCode : CRC check code of all previous content; FilePath: file path to transfer; Offset: offset of the content on the disk, used to solve the problem of data inconsistency caused by the failure of the transmission of the empty slice; Data: file content.
4.End类型报文。具体如下:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType=3;表示end类型报文;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径;MD5Code:整个文件的MD5值。4. End type message. The details are as follows: Total Size: the entire message length; HEAD: "HEAD" mark; Version: software version number; HeadSize: message header length; PacketType=3; indicates end type message; PathSize: transmitted file path length; CRCCode : CRC check code of all previous contents; FilePath: path of the transmitted file; MD5Code: MD5 value of the entire file.
5.Request类型报文。具体如下:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType=4;表示request类型报文;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径;Operation:操作(发送文件/接收文件);EnableVerify:是否进行校验。5. Request type message. The details are as follows: Total Size: the entire message length; HEAD: "HEAD" mark; Version: software version number; HeadSize: message header length; PacketType=4; indicates request type message; PathSize: transmitted file path length; CRCCode : CRC check code of all previous content; FilePath: file path to transfer; Operation: operation (send file/receive file); EnableVerify: whether to perform verification.
6.Response类型报文。具体如下:Total Size:整个报文长度;HEAD:“HEAD”标记;Version:软件版本号;HeadSize:报文头长度;PacketType=5;表示response类型报文;PathSize:传输的文件路径长度;CRCCode:前面所有内容的CRC校验码;FilePath:传输的文件路径;Response Type:回复消息类型;Error Code:错误码。6. Response type message. The details are as follows: Total Size: the entire message length; HEAD: "HEAD" mark; Version: software version number; HeadSize: message header length; PacketType=5; indicates response type message; PathSize: transmitted file path length; CRCCode : CRC check code of all previous content; FilePath: path of the transmitted file; Response Type: reply message type; Error Code: error code.
步骤S102,确定待拷贝文件的空洞区域及其位置信息;其中,空洞区域为待拷贝文件中连续存储二进制数值为0的存储块。Step S102, determining the hole area and its location information of the file to be copied; wherein, the hole area is a memory block in the file to be copied that continuously stores binary values of 0.
空洞区域为待拷贝文件中连续存储二进制数值为0的存储块,通过扫描待拷贝文件并判断其是否包含空洞区域,如果包含则记录空洞区域的位置。与此同时,扫描过程中在获得空洞区域的位置后,可同时获取非空洞区域的位置信息。The empty area is a storage block that continuously stores binary values of 0 in the file to be copied. By scanning the file to be copied and judging whether it contains an empty area, if it is included, record the position of the empty area. At the same time, after the position of the cavity area is obtained during the scanning process, the position information of the non-cavity area can be obtained at the same time.
步骤S103,根据空洞区域及其位置信息,确定待拷贝文件的非空洞区域及其偏移量,并将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中。Step S103, according to the hole area and its location information, determine the non-hole area and its offset of the file to be copied, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end.
在获得非空洞区域后,即可得到待拷贝文件的非空洞区域,即需要传输的数据。根据非空洞区域的位置信息以及空洞区域的位置信息即可获得非空洞区域的偏移量。这个偏移量作为拷贝参数,与非空洞区域的数据一起传输至接收端的磁盘中,这个过程并不会拷贝非空洞区域,从而节省了传输带宽。After the non-hole area is obtained, the non-hole area of the file to be copied can be obtained, that is, the data to be transmitted. The offset of the non-hole area can be obtained according to the position information of the non-hole area and the position information of the hole area. This offset is used as a copy parameter, and is transmitted to the disk at the receiving end together with the data in the non-hole area. This process does not copy the non-hole area, thereby saving transmission bandwidth.
步骤S104,待非空洞区域及其偏移量传输完毕后向接收端发送第二报文;其中,第二报文包含对待拷贝文件完整性进行校验的校验信息。Step S104, after the non-hole area and its offset are transmitted, a second message is sent to the receiving end; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
传输结束后,发送端向接收端发送第二报文,告知接收端完成传输。同时通过第二报文中包含的校验信息来对已完成传输的待传输文件的完整性进行校验。After the transmission ends, the sending end sends a second message to the receiving end to inform the receiving end of the completion of the transmission. At the same time, the integrity of the file to be transmitted that has been transmitted is verified through the verification information contained in the second message.
通过上述实施例中提供的虚拟机迁移方法可知,该方法可以实现有“空洞”的文件的传输速度优化;通过对报文分片后校验其内容,对全“空洞”报文片不进行发送,进而减少文件网络传输的报文数量,缩短文件传输整体时间,提高其传输效率。It can be known from the virtual machine migration method provided in the above-mentioned embodiments that this method can optimize the transmission speed of files with "holes"; Send, thereby reducing the number of packets transmitted by the file network, shortening the overall time of file transmission, and improving its transmission efficiency.
在一些实施方式中,与接收端建立连接,并向接收端发送第一报文的步骤S101,如图2所示,包括:In some embodiments, the step S101 of establishing a connection with the receiving end and sending the first message to the receiving end, as shown in FIG. 2 , includes:
步骤S201,发送端与接收端建立长连接,并初始化第一报文中的请求报文以及头消息报文;其中,请求报文用于通知接收端执行拷贝过程;头消息报文用于向接收端告知待拷贝文件的属性信息。Step S201, the sending end establishes a long connection with the receiving end, and initializes the request message and the header message message in the first message; wherein, the request message is used to notify the receiving end to perform the copy process; the header message message is used to send The receiving end notifies the attribute information of the file to be copied.
具体的说,Request报文的格式可参照前述Request类型报文的格式,具体如下:Specifically, the format of the Request message can refer to the format of the aforementioned Request type message, as follows:
Total Size:整个报文长度;Total Size: the length of the entire message;
HEAD:“HEAD”标记;HEAD: "HEAD" tag;
Version:软件版本号;Version: software version number;
HeadSize:报文头长度;HeadSize: message header length;
PacketType=4;表示request类型报文;PacketType=4; indicates request type message;
PathSize:传输的文件路径长度;PathSize: the length of the transmitted file path;
CRCCode:前面所有内容的CRC校验码;CRCCode: CRC check code of all previous content;
FilePath:传输的文件路径;FilePath: the path of the transferred file;
Operation:操作(发送文件/接收文件);Operation: operation (send file/receive file);
EnableVerify:是否进行校验。EnableVerify: Whether to verify.
头消息报文的格式可参考前述Head类型消息,具体如下:The format of the header message message can refer to the aforementioned Head type message, as follows:
Total Size:整个报文长度;Total Size: the length of the entire message;
HEAD:“HEAD”标记;HEAD: "HEAD" tag;
Version:软件版本号;Version: software version number;
HeadSize:报文头长度;HeadSize: message header length;
PacketType=1;表示head类型报文;PacketType=1; indicates head type message;
PathSize:传输的文件路径长度;PathSize: the length of the transmitted file path;
CRCCode:前面所有内容的CRC校验码;CRCCode: CRC check code of all previous content;
FilePath:传输的文件路径;FilePath: the path of the transferred file;
FileSize:文件大小。FileSize: file size.
步骤S202,向接收端发送请求报文。Step S202, sending a request message to the receiving end.
在与接收端建立长连接后,首先向接收端发送request报文通知接收端将要拷贝文件。该步骤可作为接收端的告知步骤,需要待接收端对该请求报文进行响应后再进行后续头消息报文的传输。After establishing a long connection with the receiving end, first send a request message to the receiving end to notify the receiving end that the file will be copied. This step can be used as a notification step of the receiving end, and the transmission of the subsequent header message needs to be performed after the receiving end responds to the request message.
步骤S203,当接收到请求报文的响应报文后,向接收端发送头消息报文。Step S203, after receiving the response message of the request message, sending the header message message to the receiving end.
当发送端接收到来自接收端的响应报文后,通过head消息告知接收端文件基本信息,包括文件名(路径),文件大小。After receiving the response message from the receiving end, the sending end informs the receiving end of the basic information of the file through the head message, including the file name (path) and file size.
在一些实施方式中,确定待拷贝文件的空洞区域及其位置信息的步骤S102,如图3所示,包括:In some implementations, the step S102 of determining the empty area of the file to be copied and its location information, as shown in FIG. 3 , includes:
步骤S301,按照预设的分片策略对待拷贝文件进行扫描,判断拷贝文件的分片是否为连续二进制数值为0的存储块。Step S301, scan the file to be copied according to the preset fragmentation strategy, and judge whether the fragments of the copied file are storage blocks with consecutive binary values of 0.
对于待拷贝文件需要对其进行扫描,检测其存储信息进行读取;具体的说可按照预设分片策略来实现。如在待拷贝文件中,每次读取指定大小的存储区,判断这些分片是否为连续为0的存储块。For the files to be copied, it is necessary to scan them, detect their storage information and read them; specifically, it can be realized according to the preset fragmentation strategy. For example, in the file to be copied, each time the storage area of the specified size is read, it is judged whether these fragments are continuous storage blocks of 0.
步骤S302,如果是,则获取空洞区域所在拷贝文件的位置信息,并将存储块确定为空洞区域。Step S302, if yes, obtain the location information of the copied file where the empty area is located, and determine the storage block as the empty area.
在获得空洞区域后,确定这些空洞区域的位置,如起始编号、结束编号,空洞区域长度等。这些位置信息可用于计算非空洞区域的偏移量,最终在拷贝过程中进行数据偏移。After obtaining the hollow areas, determine the positions of these hollow areas, such as the start number, the end number, the length of the hollow area, and so on. These position information can be used to calculate the offset of the non-hole area, and finally perform data offset during the copy process.
非空洞区域作为真实传输的数据,而空洞区域不进行实际传输;故在实际操作过程中,需要将非空洞区域中相关存储块中文件内容、偏移量来进行传输,例如可使用offset字段的值来代替文件中空洞块的传输。对于虚拟机迁移这种场景,读取到页缓存中的文件,只需要根据需要发送到对端,其实并不存在二次读取的可能;写到页缓存中的数据,也不涉 及再次修改,需要延迟写的需要。基于以上考虑,常规使用缓存I/O方式带来的读写效率提升在进行虚拟机的迁移过程中并不能起到作用,反而会降低效率。因此在一些实施方式中,将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中,如图4所示,包括:The non-hole area is used as the data for real transmission, while the hole area does not perform actual transmission; therefore, in the actual operation process, it is necessary to transfer the file content and offset in the relevant storage block in the non-hole area, for example, the offset field can be used value to replace the transfer of empty blocks in the file. For the scenario of virtual machine migration, the files read in the page cache only need to be sent to the peer end as needed, and there is no possibility of secondary reading; the data written in the page cache does not involve re-modification , the need to delay writes. Based on the above considerations, the improvement of read and write efficiency brought about by the conventional cache I/O method will not play a role in the process of virtual machine migration, but will reduce efficiency. Therefore, in some embodiments, the non-hole area and its offset are sequentially transferred from the address space of the sending end to the disk of the receiving end, as shown in FIG. 4 , including:
步骤S401,获取非空洞区域的数据流,将数据流从发送端的地址空间传输至应用缓冲区。In step S401, the data stream of the non-hole area is obtained, and the data stream is transferred from the address space of the sender to the application buffer.
在Linux的缓存I/O机制中,操作系统会将I/O的数据缓存在文件系统的页缓存(page cache)中。也就是说在读取磁盘文件时,数据会先被拷贝到操作系统内核的缓冲区中,然后才会从操作系统内核的缓冲区拷贝到应用程序的地址空间。缓存I/O具有如下优点:缓存I/O使用了操作系统的内核缓冲区,在一定程度上分离了应用程序空间和实际物理设备空间;缓存I/O可以减少读盘次数,从而提高性能。当应用程序去读取某块数据的时候,如果这块数据已经在页缓存中,那么这块数据可以立即返回给应用程序,而不需经过实际的物理读盘操作。由于页缓存的读取速度远大于磁盘的读取速度,并且数据的访问通常具有连续性,因此通过缓存方式可以大大提高数据获取速度。In the cached I/O mechanism of Linux, the operating system will cache the I/O data in the page cache (page cache) of the file system. That is to say, when reading a disk file, the data will be copied to the buffer of the operating system kernel first, and then copied from the buffer of the operating system kernel to the address space of the application program. Cached I/O has the following advantages: Cached I/O uses the kernel buffer of the operating system, which to a certain extent separates the application space and the actual physical device space; cached I/O can reduce the number of disk reads, thereby improving performance. When an application program reads a certain piece of data, if the piece of data is already in the page cache, then this piece of data can be returned to the application program immediately without going through the actual physical disk reading operation. Since the reading speed of the page cache is much higher than that of the disk, and data access is usually continuous, the data acquisition speed can be greatly improved by caching.
步骤S402,控制应用缓冲区的数据流,绕过虚拟机的系统内核缓冲区,直接传输至接收端的磁盘中。Step S402, controlling the data flow of the application buffer, bypassing the system kernel buffer of the virtual machine, and directly transmitting to the disk at the receiving end.
针对缓存I/O在虚拟机迁移中带来的内存开销和多次拷贝效率问题,通过绕过页缓存,由应用程序直接读写磁盘的方式来进行数据传输。传统方式的数据流需要从Application buffer(应用缓冲区)通过Clib buffer(Clib缓冲区)传输至Page cache(页缓存),再由页缓存传输至设备层的Disk cache(磁盘缓存)并最终传输至磁盘中。对于虚拟机迁移这种场景,读取到页缓存中的文件,只需要根据需要发送到对端,其实并不存在二次读取的可能;写到页缓存中的数据,也不涉及再次修改,需要延迟写的需要。基于以上考虑,常规使用缓存I/O方式带来的读写效率提升在进行虚拟机的迁移过程中并不能起到作用,反而会降低效率。Aiming at the memory overhead and multiple copy efficiency problems caused by cache I/O in virtual machine migration, data transmission is performed by directly reading and writing disks by applications, bypassing the page cache. The traditional data flow needs to be transmitted from the Application buffer (application buffer) to the Page cache (page cache) through the Clib buffer (Clib buffer), and then from the page cache to the Disk cache (disk cache) of the device layer, and finally to the disk. For the scenario of virtual machine migration, the files read in the page cache only need to be sent to the peer end as needed, and there is no possibility of secondary reading; the data written in the page cache does not involve re-modification , the need to delay writes. Based on the above considerations, the improvement of read and write efficiency brought about by the conventional cache I/O method will not play a role in the process of virtual machine migration, but will reduce efficiency.
因此,在步骤S402中,通过绕过页缓存而直接读写磁盘的方式来进行数据读写操作,可在内存较小或被其他应用程序占用较多的情况下,同样可以传输超大的磁盘文件。上述过程的对比图如图5所示,在此不再赘述。Therefore, in step S402, by bypassing the page cache and directly reading and writing the disk to perform data read and write operations, it is also possible to transfer very large disk files when the memory is small or occupied by other applications. . A comparison diagram of the above process is shown in FIG. 5 , which will not be repeated here.
本申请实施例提供了一种虚拟机迁移方法,该方法应用于接收端,如图6所示,包括:The embodiment of the present application provides a virtual machine migration method, which is applied to the receiving end, as shown in Figure 6, including:
步骤S601,接收发送端建立连接后,接收发送端发来的第一报文;其中,第一报文包含待拷贝文件的属性信息。In step S601, after the connection is established by the receiving end, the first message sent by the sending end is received; wherein, the first message includes attribute information of the file to be copied.
发送端将第一报文发送至接收端后,告知接收端准备接受文件。例如,发送端将request消息发送至接收端,接收端接收到该消息后,向发送端发送该request消息的响应报文。After sending the first message to the receiving end, the sending end informs the receiving end that it is ready to accept the file. For example, the sending end sends the request message to the receiving end, and after receiving the message, the receiving end sends a response message of the request message to the sending end.
步骤S602,根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件。Step S602, according to the attribute information of the file to be copied contained in the first message, a temporary file mapped to the file to be copied is created in the disk of the receiving end.
第一报文中包含相关head消息,在head消息中包含待拷贝文件的相关属性信息,如文件名称、路径、文件大小等。接收端根据head消息的内容,在接收端本地磁盘中创建待拷贝文件。创建过程中,需要建立与待拷贝文件的文件名称一一对应的临时文件,这些临时文件的文件名与待拷贝文件中包含的文件一一对应,但文件内容暂时为空,需要后续通过每个文件的数据流来进行填充。The first message includes a related head message, and the head message includes related attribute information of the file to be copied, such as file name, path, file size, and the like. The receiving end creates a file to be copied in the local disk of the receiving end according to the content of the head message. During the creation process, it is necessary to create temporary files corresponding to the file names of the files to be copied one by one. The file names of these temporary files are in one-to-one correspondence with the files contained in the file to be copied, but the content of the files is temporarily empty, which needs to be passed through each The data stream of the file to fill.
步骤S603,接收来自发送端的数据流及其偏移量,根据偏移量数据将数据流保存至临 时文件中。Step S603, receiving the data stream and its offset from the sender, and saving the data stream into a temporary file according to the offset data.
接收到数据流的数据后,按照其偏移量进行数据复制。由于从发送端传输来的数据量以及去除了空洞数据,因此该数据量的实际大小远小于传统包含空洞数据的数据量。这些数据流根据自己的偏移量,依次保存至临时文件中。After receiving the data of the data stream, copy the data according to its offset. Due to the amount of data transmitted from the sender and the removal of the hole data, the actual size of the data amount is much smaller than the conventional data amount containing the hole data. These data streams are sequentially saved to temporary files according to their own offsets.
步骤S604,待数据流保存完毕时,接收来自发送端的第二报文,并利用第二报文中包含的校验信息对临时文件的完整性进行校验。Step S604, when the data stream is saved, receive the second message from the sender, and verify the integrity of the temporary file by using the verification information included in the second message.
数据流保存完毕时,发送端会向接收端发送第二报文。此时接收端获取第二报文后来对临时文件的完整性进行校验。当临时文件与待拷贝文件一致时表明拷贝过程正常,同时可将校验结果发送至发送端。When the data stream is saved, the sending end will send the second message to the receiving end. At this time, the receiving end obtains the second packet and then verifies the integrity of the temporary file. When the temporary file is consistent with the file to be copied, it indicates that the copy process is normal, and the verification result can be sent to the sender at the same time.
在一些实施方式中,根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件的步骤S603,如图7所示,包括:In some implementations, according to the attribute information of the file to be copied contained in the first message, the step S603 of creating a temporary file mapped to the file to be copied in the disk of the receiving end, as shown in FIG. 7 , includes:
步骤S701,接收来自发送端的请求报文;其中,请求报文用于通知接收端执行拷贝过程。Step S701, receiving a request message from the sender; wherein, the request message is used to notify the receiver to execute the copying process.
该步骤中的请求报文为request消息,该消息为发送端发送至接收端的,用于通知接收端执行拷贝文件。The request message in this step is a request message, which is sent from the sending end to the receiving end, and is used to notify the receiving end to execute file copying.
步骤S702,接收端响应请求报文,并将响应报文传输至发送端。Step S702, the receiving end responds to the request message, and transmits the response message to the sending end.
接收端响应该request消息,并将响应报文发送至发送端,告知发送端可以执行拷贝文件。The receiving end responds to the request message, and sends a response message to the sending end, informing the sending end that the file can be copied.
步骤S703,接收来自发送端的头消息报文;其中,头消息报文用于获取待拷贝文件的属性信息。Step S703, receiving a header message from the sender; wherein, the header message is used to acquire attribute information of the file to be copied.
发送端接收到来自接收端发送的响应报文后,将head消息发送至接收端,告知接收端需要拷贝的文件属性信息,包括文件名、文件路径以及文件大小等。After receiving the response message from the receiving end, the sending end sends a head message to the receiving end to inform the receiving end of the file attribute information to be copied, including file name, file path, and file size.
步骤S704,根据头消息报文中包含的待拷贝文件的属性信息,建立与拷贝文件相映射的临时文件。Step S704, according to the attribute information of the file to be copied contained in the header message, create a temporary file mapped to the copied file.
头消息报文中包含的待拷文件的属性信息,如上述实施例中提到的Head类型消息、Data类型报文、End类型报文、Request类型报文、Response类型报文等多个类型的报文,按照这些头消息报文中包含的消息内容,在接收端磁盘中建立相应的临时文件。The attribute information of the file to be copied contained in the head message message, such as multiple types of Head type message, Data type message, End type message, Request type message, and Response type message mentioned in the above-mentioned embodiment message, according to the message content contained in these header message messages, create corresponding temporary files in the receiving end disk.
下面结合具体实施例来对上述虚拟机迁移方法中包含发送端和接收端的数据迁移过程进行整体描述。An overall description of the data migration process including the sending end and the receiving end in the above virtual machine migration method is given below in combination with specific embodiments.
以发送端作为操作发起端,将本地文件传输到接收端为例:Take the sender as the operation initiator and transfer the local file to the receiver as an example:
1.发送端发起连接,先发送request报文通知接收端将要拷贝文件;1. The sender initiates a connection, first sends a request message to notify the receiver that the file will be copied;
2.通过head消息告知接收端需要拷贝的文件的基本信息,包括文件名(路径),文件大小;2. Inform the receiving end of the basic information of the file to be copied through the head message, including the file name (path) and file size;
3.依次扫描待拷贝文件,每次读取指定大小(协议分片大小),并判断其是否为“空洞”片。所有“空洞”片,不进行传输;非空洞片携带信息要包括:该片在磁盘中的偏移和文件片内容,用偏移量来解决空洞片未能传输导致的数据不一致的问题。3. Scan the files to be copied in turn, read the specified size (protocol fragment size) each time, and judge whether it is a "hole" slice. All "hole" slices are not transmitted; the information carried by non-hole slices must include: the offset of the slice in the disk and the content of the file slice, and the offset is used to solve the problem of data inconsistency caused by the failure of transmission of the hollow slice.
4.传输结束后,发送端发end消息给接收端,end消息用以通知接收端文件传输结束,并携带校验信息供接收端进行传输文件的完整性校验;4. After the transmission is over, the sending end sends an end message to the receiving end. The end message is used to notify the receiving end that the file transfer is over, and carries verification information for the receiving end to verify the integrity of the transmitted file;
接收端依次接收发送端发送过来的消息并进行对应的处理。The receiving end sequentially receives the messages sent by the sending end and performs corresponding processing.
1.接收到request消息后,准备接收文件;1. After receiving the request message, prepare to receive the file;
2.接收到head消息后,按照消息内容在本地的指定位置创建指定名称文件;2. After receiving the head message, create a file with the specified name in the local specified location according to the content of the message;
3.接收到data消息后,按照偏移,进行数据复制;3. After receiving the data message, copy the data according to the offset;
4.接收end消息后,计算校验内容完整性;并返回校验结果给发送端。4. After receiving the end message, calculate the integrity of the verification content; and return the verification result to the sender.
上述过程可通过如图8所述的一种虚拟机迁移方法的信令图来描述,该图中的Host1可理解为发送端;Host2为接收端。The above process can be described by a signaling diagram of a virtual machine migration method as shown in FIG. 8 , in which Host1 can be understood as a sending end; Host2 is a receiving end.
1.Host1向Host2发送Requset报文,通知Host2将要拷贝文件;1. Host1 sends a Requset message to Host2, informing Host2 that the file will be copied;
2.Host2响应Requset报文,并向Host1发送Response报文;2. Host2 responds to the Requset message and sends a Response message to Host1;
3.Host1将head消息发送至Host2,告知Host2需要拷贝的文件的基本消息;3. Host1 sends the head message to Host2, informing Host2 of the basic information of the file to be copied;
4.Host2响应head消息,并向Host1发送Response报文;4. Host2 responds to the head message and sends a Response message to Host1;
5.Host1通过data报文向Host2传输文件,传输过程至传输不包含空洞区域的数据及其偏移量。再循环N次后完成数据传输,此时的N+1次传输向Host2发送end报文,告知Host2完成文件传输,并通过end报文中的校验数据来对Host2中的数据进行校验。5. Host1 transmits the file to Host2 through the data message, and the transmission process ends with the data and its offset not including the empty area. The data transmission is completed after N times of recirculation. At this time, N+1 transmissions send an end message to Host2, instructing Host2 to complete the file transmission, and verify the data in Host2 through the verification data in the end message.
图9所述的另一种虚拟机迁移方法的信令图,该图中的Host1请求Host2向Host1进行迁移。以迁移数据的位置来分类的话,Host2为发送端;Host1为接收端。具体的,上述虚拟机迁移过程如下:FIG. 9 is a signaling diagram of another virtual machine migration method, in which Host1 requests Host2 to migrate to Host1. If it is classified by the location of the migrated data, Host2 is the sending end; Host1 is the receiving end. Specifically, the above virtual machine migration process is as follows:
1.Host2向Host1发送Requset报文,通知Hos1将要拷贝文件;1. Host2 sends a Requset message to Host1, informing Hos1 that the file will be copied;
2.Host1响应Requset报文,并向Host2发送Response报文;2. Host1 responds to the Requset message and sends a Response message to Host2;
3.Host2将head消息发送至Host1,告知Host1需要拷贝的文件的基本消息;3. Host2 sends the head message to Host1, informing Host1 of the basic information of the file to be copied;
4.Host1响应head消息,并向Host2发送Response报文;4. Host1 responds to the head message and sends a Response message to Host2;
5.Host2通过data报文向Host1传输文件,传输过程至传输不包含空洞区域的数据及其偏移量。再循环N次后完成数据传输,此时的N+1次传输向Host1发送end报文,告知Host1完成文件传输,并通过end报文中的校验数据来对Host1中的数据进行校验。5. Host2 transmits the file to Host1 through the data message, and the transmission process reaches the data and its offset that does not include the empty area. The data transmission is completed after N times of recirculation. At this time, N+1 transmissions send an end message to Host1, instructing Host1 to complete the file transmission, and verify the data in Host1 through the verification data in the end message.
通过上述实施例中提到的虚拟机迁移方法可知,可以实现有“空洞”的文件的传输速度优化;通过对报文分片后校验其内容,对全“空洞”报文片不进行发送,进而减少文件网络传输的报文数量,缩短文件传输整体时间,提高其传输效率。通过直接读写磁盘的方式进行虚拟机迁移,可以减小cache占用,迁移超大文件。图10为传统静态迁移时cache占用图,图11为采用本虚拟机迁移方法中静态迁移时的cache占用图,图中的横轴为时间(单位s),纵轴为cache的使用情况(单位M),宿主机的cache总大小为3500M。可以看到普通的静态迁移过程中,cache被迅速占满,而直写磁盘方式的虚拟机迁移过程中,cache几乎没有增长。可见,该方法提高了读写效率,有利于提升超大磁盘文件的传输速率。According to the virtual machine migration method mentioned in the above embodiment, it can be seen that the transmission speed of files with "holes" can be optimized; by verifying the content of the message fragments, the full "hole" message fragments are not sent , thereby reducing the number of packets transmitted over the file network, shortening the overall time of file transmission, and improving its transmission efficiency. Virtual machine migration can be performed by directly reading and writing disks, which can reduce cache usage and migrate very large files. Fig. 10 is a cache occupancy diagram during traditional static migration, and Fig. 11 is a cache occupancy diagram during static migration using the virtual machine migration method. The horizontal axis in the figure is time (unit s), and the vertical axis is cache usage (unit M), the total cache size of the host is 3500M. It can be seen that during the ordinary static migration process, the cache is quickly filled, but during the write-to-disk virtual machine migration process, the cache hardly increases. It can be seen that this method improves the read-write efficiency and is beneficial to increase the transmission rate of super-large disk files.
对应于上述方法实施例,本申请实施例提供了一种虚拟机迁移系统,如图12所示,该系统应用于发送端,包括:Corresponding to the above method embodiment, the embodiment of the present application provides a virtual machine migration system, as shown in Figure 12, the system is applied to the sending end, including:
第一报文发送模块1210,用于与接收端建立连接,并向接收端发送第一报文;其中,第一报文包含待拷贝文件的属性信息;The first message sending module 1210 is configured to establish a connection with the receiving end, and send the first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
空洞区域确定模块1220,用于确定待拷贝文件的空洞区域及其位置信息;其中,空洞区域为待拷贝文件中连续存储二进制数值为0的存储块;Hole area determining module 1220, for determining the hole area of the file to be copied and its location information; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied;
数据发送模块1230,用于根据空洞区域及其位置信息,确定待拷贝文件的非空洞区域及其偏移量,并将非空洞区域及其偏移量依次从发送端的地址空间传输至接收端的磁盘中;The data sending module 1230 is configured to determine the non-hole area and its offset of the file to be copied according to the hole area and its location information, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the disk of the receiving end middle;
第二报文发送模块1240,用于待非空洞区域及其偏移量传输完毕后向接收端发送第二报文;其中,第二报文包含对待拷贝文件完整性进行校验的校验信息。The second message sending module 1240 is configured to send a second message to the receiving end after the non-hole area and its offset are transmitted; wherein, the second message includes verification information for verifying the integrity of the file to be copied .
对应于上述方法实施例,本申请实施例提供了一种虚拟机迁移系统,如图13所示,该系统应用于接收端,包括:Corresponding to the above method embodiment, the embodiment of the present application provides a virtual machine migration system, as shown in Figure 13, the system is applied to the receiving end, including:
第一报文接收模块1310,用于接收发送端建立连接后,接收发送端发来的第一报文;其中,第一报文包含待拷贝文件的属性信息;The first message receiving module 1310 is configured to receive the first message sent by the sending end after the connection is established by the sending end; wherein, the first message includes attribute information of the file to be copied;
临时文件生成模块1320,用于根据第一报文中包含的待拷贝文件的属性信息,在接收端的磁盘中建立与待拷贝文件相映射的临时文件;The temporary file generation module 1320 is used to create a temporary file mapped to the file to be copied in the disk of the receiving end according to the attribute information of the file to be copied contained in the first message;
数据接收模块,用于接收来自发送端的数据流及其偏移量,根据偏移量数据将数据流保存至临时文件中;The data receiving module is used to receive the data flow and its offset from the sending end, and save the data flow to a temporary file according to the offset data;
数据校验模块1330,用于待数据流保存完毕时,接收来自发送端的第二报文,并利用第二报文中包含的校验信息对临时文件的完整性进行校验。The data verification module 1330 is configured to receive the second message from the sender when the data stream is saved, and use the verification information contained in the second message to verify the integrity of the temporary file.
本申请实施例提供的虚拟机迁移系统,与上述实施例提供的虚拟机迁移方法具有相同的技术特征,所以也能解决相同的技术问题,达到相同的技术效果。为简要描述,实施例部分未提及之处,可参考前述虚拟机迁移方法实施例中相应内容。The virtual machine migration system provided in the embodiment of the present application has the same technical features as the virtual machine migration method provided in the above embodiment, so it can also solve the same technical problem and achieve the same technical effect. For brief description, for the parts not mentioned in the embodiments, reference may be made to the corresponding content in the aforementioned embodiments of the virtual machine migration method.
本实施例还提供一种电子设备,为该电子设备的结构示意图如图14所示,该设备包括处理器101和存储器102;其中,存储器102用于存储一条或多条计算机指令,一条或多条计算机指令被处理器执行,以实现上述虚拟机迁移方法。This embodiment also provides an electronic device, the structural diagram of which is shown in Figure 14, the device includes a processor 101 and a memory 102; wherein, the memory 102 is used to store one or more computer instructions, one or more A computer instruction is executed by the processor to implement the above virtual machine migration method.
图14所示的电子设备还包括总线103和通信接口104,处理器101、通信接口104和存储器102通过总线103连接。The electronic device shown in FIG. 14 further includes a bus 103 and a communication interface 104 , and the processor 101 , the communication interface 104 and the memory 102 are connected through the bus 103 .
其中,存储器102可能包含高速随机存取存储器(RAM,Random Access Memory),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。总线103可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图14中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。Wherein, the memory 102 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. The bus 103 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one double-headed arrow is used in FIG. 14 , but it does not mean that there is only one bus or one type of bus.
通信接口104用于通过网络接口与至少一个用户终端及其它网络单元连接,将封装好的IPv4报文或IPv4报文通过网络接口发送至用户终端。The communication interface 104 is used to connect with at least one user terminal and other network elements through the network interface, and send the encapsulated IPv4 message or the IPv4 message to the user terminal through the network interface.
处理器101可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器101中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器101可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(Digital Signal Processor,简称DSP)、专用集成电路(Application Specific Integrated Circuit,简称ASIC)、现场可编程门阵列(Field-Programmable Gate Array,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本公开实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本公开实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器102,处理器101读取存储器102中的信息,结合其硬件完成前述实施例的方法的步骤。The processor 101 may be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor 101 or instructions in the form of software. Above-mentioned processor 101 can be general-purpose processor, comprises central processing unit (Central Processing Unit, be called for short CPU), network processor (Network Processor, be called for short NP) etc.; Can also be Digital Signal Processor (Digital Signal Processor, be called for short DSP) ), Application Specific Integrated Circuit (ASIC for short), Field Programmable Gate Array (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. Various methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure may be implemented or executed. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, or the like. The steps of the methods disclosed in the embodiments of the present disclosure may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register. The storage medium is located in the memory 102, and the processor 101 reads the information in the memory 102, and completes the steps of the methods of the foregoing embodiments in combination with its hardware.
本申请实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该计算机程序被处理器运行时执行前述实施例的方法的步骤。The embodiment of the present application also provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the methods in the foregoing embodiments are executed.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、设备和方法,可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些通信接口,设备或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个处理器可执行的非易失的计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以用软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .
最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的精神和范围,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利要求的保护范围为准。Finally, it should be noted that: the above-described embodiments are only specific implementations of the application, used to illustrate the technical solutions of the application, rather than limiting it, and the scope of protection of the application is not limited thereto, although referring to the aforementioned The embodiment has described this application in detail, and those of ordinary skill in the art should understand that any person familiar with this technical field can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed in this application Changes can be easily imagined, or equivalent replacements can be made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be covered by this application. within the scope of protection. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims (10)

  1. 一种虚拟机迁移方法,其特征在于,所述方法应用于发送端,包括:A virtual machine migration method, characterized in that the method is applied to the sending end, including:
    与接收端建立连接,并向所述接收端发送第一报文;其中,所述第一报文包含待拷贝文件的属性信息;Establishing a connection with the receiving end, and sending a first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
    确定所述待拷贝文件的空洞区域及其位置信息;其中,所述空洞区域为所述待拷贝文件中连续存储二进制数值为0的存储块;Determining the hole area and its location information of the file to be copied; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied;
    根据所述空洞区域及其位置信息,确定所述待拷贝文件的非空洞区域及其偏移量,并将所述非空洞区域及其偏移量依次从所述发送端的地址空间传输至所述接收端的磁盘中;According to the hole area and its location information, determine the non-hole area and its offset of the file to be copied, and sequentially transmit the non-hole area and its offset from the address space of the sending end to the In the disk at the receiving end;
    待所述非空洞区域及其偏移量传输完毕后向所述接收端发送第二报文;其中,所述第二报文包含对所述待拷贝文件完整性进行校验的校验信息。Sending a second message to the receiving end after the non-hole area and its offset are transmitted; wherein, the second message includes verification information for verifying the integrity of the file to be copied.
  2. 根据权利要求1所述的虚拟机迁移方法,其特征在于,与接收端建立连接,并向所述接收端发送第一报文的步骤,包括:The virtual machine migration method according to claim 1, wherein the step of establishing a connection with the receiving end and sending the first message to the receiving end includes:
    所述发送端与所述接收端建立长连接,并初始化所述第一报文中的请求报文以及头消息报文;其中,所述请求报文用于通知所述接收端执行拷贝过程;所述头消息报文用于向所述接收端告知所述待拷贝文件的属性信息;The sending end establishes a long connection with the receiving end, and initializes a request message and a header message message in the first message; wherein, the request message is used to notify the receiving end to perform a copy process; The header message is used to inform the receiving end of the attribute information of the file to be copied;
    向所述接收端发送所述请求报文;sending the request message to the receiving end;
    当接收到所述请求报文的响应报文后,向所述接收端发送所述头消息报文。After receiving the response message of the request message, sending the header message message to the receiving end.
  3. 根据权利要求1所述的虚拟机迁移方法,其特征在于,确定所述待拷贝文件的空洞区域及其位置信息的步骤,包括:The virtual machine migration method according to claim 1, wherein the step of determining the empty area of the file to be copied and its location information includes:
    按照预设的分片策略对所述待拷贝文件进行扫描,判断所述拷贝文件的分片是否为连续二进制数值为0的存储块;Scan the file to be copied according to the preset fragmentation strategy, and judge whether the fragmentation of the copied file is a storage block with a continuous binary value of 0;
    如果是,则获取所述空洞区域所在所述拷贝文件的位置信息,并将所述存储块确定为所述空洞区域。If yes, acquire the location information of the copied file where the empty area is located, and determine the storage block as the empty area.
  4. 根据权利要求1所述的虚拟机迁移方法,其特征在于,将所述非空洞区域及其偏移量依次从所述发送端的地址空间传输至所述接收端的磁盘中,包括:The virtual machine migration method according to claim 1, wherein sequentially transferring the non-hole area and its offset from the address space of the sending end to the disk of the receiving end includes:
    获取所述非空洞区域的数据流,将所述数据流从所述发送端的地址空间传输至应用缓冲区;Obtaining the data stream of the non-hole area, and transferring the data stream from the address space of the sending end to the application buffer;
    控制所述应用缓冲区的所述数据流,绕过所述虚拟机的系统内核缓冲区,直接传输至所述接收端的磁盘中。The data flow of the application buffer is controlled, bypassing the system kernel buffer of the virtual machine, and directly transmitted to the disk of the receiving end.
  5. 一种虚拟机迁移方法,其特征在于,所述方法应用于接收端,包括:A virtual machine migration method, characterized in that the method is applied to a receiving end, including:
    接收发送端建立连接后,接收所述发送端发来的第一报文;其中,所述第一报文包含待拷贝文件的属性信息;After the receiving end establishes the connection, receive the first message sent by the sending end; wherein, the first message includes attribute information of the file to be copied;
    根据所述第一报文中包含的所述待拷贝文件的属性信息,在所述接收端的磁盘中建立与所述待拷贝文件相映射的临时文件;According to the attribute information of the file to be copied contained in the first message, create a temporary file mapped to the file to be copied in the disk of the receiving end;
    接收来自所述发送端的数据流及其偏移量,根据所述偏移量数据将所述数据流保存至所述临时文件中;receiving the data stream and its offset from the sending end, and saving the data stream into the temporary file according to the offset data;
    待所述数据流保存完毕时,接收来自所述发送端的第二报文,并利用所述第二报文中包含的校验信息对所述临时文件的完整性进行校验。When the storage of the data stream is completed, the second message from the sending end is received, and the integrity of the temporary file is verified by using the verification information contained in the second message.
  6. 根据权利要求5所述的虚拟机迁移方法,其特征在于,根据所述第一报文中包含的 所述待拷贝文件的属性信息,在所述接收端的磁盘中建立与所述待拷贝文件相映射的临时文件,包括:The virtual machine migration method according to claim 5, wherein, according to the attribute information of the file to be copied contained in the first message, an Mapped temporary files, including:
    接收来自所述发送端的请求报文;其中,所述请求报文用于通知所述接收端执行拷贝过程;receiving a request message from the sending end; wherein, the request message is used to notify the receiving end to perform a copy process;
    所述接收端响应所述请求报文,并将响应报文传输至所述发送端;The receiving end responds to the request message, and transmits the response message to the sending end;
    接收来自所述发送端的头消息报文;其中,所述头消息报文用于获取所述待拷贝文件的属性信息;receiving a header message message from the sending end; wherein, the header message message is used to obtain attribute information of the file to be copied;
    根据所述头消息报文中包含的所述待拷贝文件的属性信息,建立与所述拷贝文件相映射的临时文件。A temporary file mapped to the copied file is established according to the attribute information of the file to be copied contained in the header message.
  7. 一种虚拟机迁移系统,其特征在于,所述系统应用于发送端,包括:A virtual machine migration system, characterized in that the system is applied to the sending end, including:
    第一报文发送模块,用于与接收端建立连接,并向所述接收端发送第一报文;其中,所述第一报文包含待拷贝文件的属性信息;A first message sending module, configured to establish a connection with the receiving end, and send a first message to the receiving end; wherein, the first message includes attribute information of the file to be copied;
    空洞区域确定模块,用于确定所述待拷贝文件的空洞区域及其位置信息;其中,所述空洞区域为所述待拷贝文件中连续存储二进制数值为0的存储块;A hole area determination module, configured to determine the hole area of the file to be copied and its location information; wherein, the hole area is a storage block that continuously stores binary values of 0 in the file to be copied;
    数据发送模块,用于根据所述空洞区域及其位置信息,确定所述待拷贝文件的非空洞区域及其偏移量,并将所述非空洞区域及其偏移量依次从所述发送端的地址空间传输至所述接收端的磁盘中;The data sending module is used to determine the non-hole area and its offset of the file to be copied according to the hole area and its position information, and sequentially transfer the non-hole area and its offset from the sending end The address space is transmitted to the disk at the receiving end;
    第二报文发送模块,用于待所述非空洞区域及其偏移量传输完毕后向所述接收端发送第二报文;其中,所述第二报文包含对所述待拷贝文件完整性进行校验的校验信息。The second message sending module is configured to send a second message to the receiving end after the transmission of the non-hole area and its offset is completed; wherein, the second message includes complete information about the file to be copied. The verification information for verification.
  8. 一种虚拟机迁移系统,其特征在于,所述系统应用于接收端,包括:A virtual machine migration system, characterized in that the system is applied to a receiving end, including:
    第一报文接收模块,用于接收发送端建立连接后,接收所述发送端发来的第一报文;其中,所述第一报文包含待拷贝文件的属性信息;The first message receiving module is used to receive the first message sent by the sending end after the connection is established by the sending end; wherein, the first message includes attribute information of the file to be copied;
    临时文件生成模块,用于根据所述第一报文中包含的所述待拷贝文件的属性信息,在所述接收端的磁盘中建立与所述待拷贝文件相映射的临时文件;A temporary file generation module, configured to create a temporary file mapped to the file to be copied in the disk of the receiving end according to the attribute information of the file to be copied contained in the first message;
    数据接收模块,用于接收来自所述发送端的数据流及其偏移量,根据所述偏移量数据将所述数据流保存至所述临时文件中;A data receiving module, configured to receive the data stream and its offset from the sending end, and save the data stream into the temporary file according to the offset data;
    数据校验模块,用于待所述数据流保存完毕时,接收来自所述发送端的第二报文,并利用所述第二报文中包含的校验信息对所述临时文件的完整性进行校验。A data verification module, configured to receive the second message from the sending end when the data stream is saved, and check the integrity of the temporary file by using the verification information contained in the second message check.
  9. 一种电子设备,其特征在于,包括:处理器和存储装置;所述存储装置上存储有计算机程序,所述计算机程序在被所述处理器运行时实现如权利要求1至6任一项所述的虚拟机迁移方法的步骤。An electronic device, characterized in that it comprises: a processor and a storage device; a computer program is stored on the storage device, and when the computer program is executed by the processor, the computer program according to any one of claims 1 to 6 can be realized. Steps of the virtual machine migration method described above.
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,其特征在于,所述计算机程序被处理器运行时实现上述权利要求1至6任一项所述的虚拟机迁移方法的步骤。A computer-readable storage medium, with a computer program stored on the computer-readable storage medium, characterized in that, when the computer program is run by a processor, the virtual machine migration described in any one of claims 1 to 6 is implemented method steps.
PCT/CN2021/143173 2021-06-25 2021-12-30 Virtual machine migration method and system, and electronic device WO2022267427A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110715998.3A CN113342471A (en) 2021-06-25 2021-06-25 Virtual machine migration method and system and electronic equipment
CN202110715998.3 2021-06-25

Publications (1)

Publication Number Publication Date
WO2022267427A1 true WO2022267427A1 (en) 2022-12-29

Family

ID=77478975

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/143173 WO2022267427A1 (en) 2021-06-25 2021-12-30 Virtual machine migration method and system, and electronic device

Country Status (2)

Country Link
CN (1) CN113342471A (en)
WO (1) WO2022267427A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826885A (en) * 2023-02-21 2023-03-21 浪潮电子信息产业股份有限公司 Data migration method and device, electronic equipment and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113342471A (en) * 2021-06-25 2021-09-03 航天云网科技发展有限责任公司 Virtual machine migration method and system and electronic equipment
CN113485874B (en) * 2021-09-07 2021-11-23 联想凌拓科技有限公司 Data processing method and distributed storage system

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105487984A (en) * 2014-09-17 2016-04-13 中兴通讯股份有限公司 Dynamic compression method and apparatus for virtual machine disk data by host system
CN106469085A (en) * 2016-08-31 2017-03-01 北京航空航天大学 The online migration method, apparatus and system of virtual machine
CN110888843A (en) * 2019-10-31 2020-03-17 北京浪潮数据技术有限公司 Cross-host sparse file copying method, device, equipment and storage medium
WO2020063879A1 (en) * 2018-09-30 2020-04-02 华为技术有限公司 Method and apparatus for migrating virtual machine
CN112148430A (en) * 2020-09-28 2020-12-29 中电积至(海南)信息技术有限公司 Method for online safe migration of virtual machine with virtual network function
CN112486918A (en) * 2019-09-11 2021-03-12 浙江宇视科技有限公司 File processing method, device, equipment and medium
CN113342471A (en) * 2021-06-25 2021-09-03 航天云网科技发展有限责任公司 Virtual machine migration method and system and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101464812B (en) * 2009-01-06 2012-05-30 北京航空航天大学 Virtual machine migration method
CN110347483B (en) * 2018-04-08 2021-05-11 中兴通讯股份有限公司 Method and device for migrating physical machine to virtual machine and storage medium
CN111506386A (en) * 2020-02-27 2020-08-07 平安科技(深圳)有限公司 Virtual machine online migration method, device, equipment and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105487984A (en) * 2014-09-17 2016-04-13 中兴通讯股份有限公司 Dynamic compression method and apparatus for virtual machine disk data by host system
CN106469085A (en) * 2016-08-31 2017-03-01 北京航空航天大学 The online migration method, apparatus and system of virtual machine
WO2020063879A1 (en) * 2018-09-30 2020-04-02 华为技术有限公司 Method and apparatus for migrating virtual machine
CN112486918A (en) * 2019-09-11 2021-03-12 浙江宇视科技有限公司 File processing method, device, equipment and medium
CN110888843A (en) * 2019-10-31 2020-03-17 北京浪潮数据技术有限公司 Cross-host sparse file copying method, device, equipment and storage medium
CN112148430A (en) * 2020-09-28 2020-12-29 中电积至(海南)信息技术有限公司 Method for online safe migration of virtual machine with virtual network function
CN113342471A (en) * 2021-06-25 2021-09-03 航天云网科技发展有限责任公司 Virtual machine migration method and system and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826885A (en) * 2023-02-21 2023-03-21 浪潮电子信息产业股份有限公司 Data migration method and device, electronic equipment and storage medium
CN115826885B (en) * 2023-02-21 2023-05-09 浪潮电子信息产业股份有限公司 Data migration method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113342471A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
WO2022267427A1 (en) Virtual machine migration method and system, and electronic device
US11336721B2 (en) Dynamic resource movement in heterogeneous computing environments including cloud edge locations
US10540196B2 (en) Techniques to enable live migration of virtual environments
US11917446B1 (en) Mobility of cloud compute instances hosted within communications service provider networks
US10838665B2 (en) Method, device, and system for buffering data for read/write commands in NVME over fabric architecture
US10965737B1 (en) Cloud computing in communications service provider networks
US9588807B2 (en) Live logical partition migration with stateful offload connections using context extraction and insertion
US9442812B2 (en) Priming failover of stateful offload adapters
US10979534B1 (en) Latency-based placement of cloud compute instances within communications service provider networks
US8830870B2 (en) Network adapter hardware state migration discovery in a stateful environment
US7996484B2 (en) Non-disruptive, reliable live migration of virtual machines with network data reception directly into virtual machines' memory
US9396101B2 (en) Shared physical memory protocol
US10120705B2 (en) Method for implementing GPU virtualization and related apparatus, and system
WO2015062339A1 (en) Method and device for running remote application program
US20100049785A1 (en) Recovery of disconnected channels over a reliable protocol
WO2021073546A1 (en) Data access method, device, and first computer device
CN102917055A (en) Method and device of online migration of virtual machine, and terminal device
WO2015123225A1 (en) Aggregating memory to create a network addressible storage volume for storing virtual machine files
WO2022143717A1 (en) Method, apparatus, and system for migrating virtual machine
US11461123B1 (en) Dynamic pre-copy and post-copy determination for live migration between cloud regions and edge locations
US11579911B1 (en) Emulated edge locations in cloud-based networks for testing and migrating virtualized resources
US11734038B1 (en) Multiple simultaneous volume attachments for live migration between cloud regions and edge locations
US11573839B1 (en) Dynamic scheduling for live migration between cloud regions and edge locations
CN110798366B (en) Task logic processing method, device and equipment
CN116760850B (en) Data processing method, device, equipment, medium and system

Legal Events

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

Ref document number: 21946900

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE