CN114461338B - virtio driver injection method and device - Google Patents

virtio driver injection method and device Download PDF

Info

Publication number
CN114461338B
CN114461338B CN202210022042.XA CN202210022042A CN114461338B CN 114461338 B CN114461338 B CN 114461338B CN 202210022042 A CN202210022042 A CN 202210022042A CN 114461338 B CN114461338 B CN 114461338B
Authority
CN
China
Prior art keywords
virtual machine
file system
linux virtual
virtio
initrd
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210022042.XA
Other languages
Chinese (zh)
Other versions
CN114461338A (en
Inventor
刘明磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SmartX Inc
Original Assignee
SmartX Inc
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 SmartX Inc filed Critical SmartX Inc
Priority to CN202210022042.XA priority Critical patent/CN114461338B/en
Publication of CN114461338A publication Critical patent/CN114461338A/en
Application granted granted Critical
Publication of CN114461338B publication Critical patent/CN114461338B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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
    • 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/45575Starting, stopping, suspending or resuming virtual machine instances
    • 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/45579I/O management, e.g. providing access to device drivers or storage

Abstract

The invention provides a virtio driver injection method and device. The method is applied to the cloud platforms, a virtio driver is injected in the process of Linux virtual machine migration between the cloud platforms, so that the Linux virtual machine can be immediately operated by the virtio driver after the Linux virtual machine is migrated, and the method comprises the following steps: decompressing an initrd file system under a root directory of a Linux virtual machine to obtain a folder and a file in the initrd file system; copying a virtio driver under a lib directory of a Linux virtual machine into a corresponding folder in an initrd file system; and executing a depmod command on the initrd file system containing the virtio driver, and compressing the initrd file system, so that the successful start and the expected running state of the Linux virtual machine after migration can be ensured.

Description

virtio driver injection method and device
Technical Field
The invention relates to the technical field of computers, in particular to a virtio driver injection method and a virtio driver injection device.
Background
Migration of a virtual machine between cloud platforms, also referred to as computing platforms, is mostly realized by a migration tool, since basic technologies adopted by each cloud platform may be different, due to compatibility problems and performance problems after the virtual machine is migrated to a target cloud platform, it is often necessary to install a suitable driver on the migrated virtual machine, for example, for a Linux virtual machine migrated from a VMWare-based cloud platform to a qemu-based platform, a virtio driver needs to be installed to improve the performance of the Linux virtual machine, and this driver may not be installed by default in some cases, and needs to be installed during or after the migration of the Linux virtual machine.
The injection method of the virtio driver of the existing Linux virtual machine mainly comprises the following two methods:
one is that after the Linux virtual machine is migrated, the Linux virtual machine is first booted in a compatible manner, and then the virtio driver is installed inside the Linux virtual machine, the installation manner is generally realized by a tool similar to VMWare tools provided by a cloud platform, and after the installation is completed, the virtual machine is shut down and then switched to the virtio driver for booting.
The other is that in the migration process of the Linux virtual machine, after the disk data migration is completed, the disk is mounted, and a virtual driver is injected into the Linux virtual machine, and the redcat/centrpos system generally injects the virtual driver through a draw-add-drivers "virtual video _ balloon video _ blk virtual _ net" command.
The first virtio driver injection method is simple to implement and good in compatibility. However, the method needs additional operation by a user, and cannot run the Linux virtual machine immediately by using a virtio driver after the Linux virtual machine is migrated.
The second virtio driver injection method can enable the Linux virtual machine to run immediately after being migrated by the virtio driver, but for some special Linux virtual machines, because the generation mode of the dracout command is to regenerate an initrd file according to the internal configuration of the Linux virtual machine and the detection of the current running environment, the Linux virtual machine is in a shutdown state in the cross-platform data migration process, and a migration tool executing the dracout command cannot provide a running environment the same as that of the original Linux virtual machine, so that in the case of some Linux virtual machine migration, a kernel module defined by a user may be lost, which causes the Linux virtual machine to be failed to start or the running state of the Linux virtual machine to be unexpected.
Disclosure of Invention
The invention provides a virtio driver injection method and a virtio driver injection device, which are used for solving the defects that a user needs to perform additional operation, a Linux virtual machine cannot be immediately operated by the virtio driver after being migrated, the Linux virtual machine fails to be started after being migrated or the running state of the Linux virtual machine is unexpected in the prior art, and can realize that the Linux virtual machine immediately operates by the virtio driver after being migrated on the basis of not needing the user to perform the additional operation, so that the Linux virtual machine can be ensured to be successfully started and the running state of the Linux virtual machine conforms to the expectation.
In a first aspect, the present invention provides a virtio driver injection method, which is applied to cloud platforms, and injects a virtio driver during a Linux virtual machine migration process between the cloud platforms, so that the Linux virtual machine can be immediately operated with the virtio driver after migration, where the injection method includes:
decompressing the initrd file system under the Linux virtual machine root directory to obtain folders and files in the initrd file system;
copying the virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system;
executing a depmod command on the initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system;
and compressing the initrd file system after the demomod command is executed.
According to the virtio driver injection method provided by the invention, the initrd file system under the root directory of the Linux virtual machine is decompressed to obtain folders and files in the initrd file system, and the method comprises the following steps:
determining a compression format of the initrd file system under the root directory of the Linux virtual machine;
decompressing the initrd file system according to the determined compression format to obtain a folder and a file in the initrd file system;
compressing the initrd file system after the demomod command is executed, wherein the compressing comprises the following steps:
and compressing the initrd file system after the depmod command is executed according to the determined compression format.
According to the virtio driver injection method provided by the invention, before the initial file system under the root directory of the Linux virtual machine is decompressed to obtain the folders and the files in the initial file system, the method further comprises the following steps:
and after the disk data of the Linux virtual machine is migrated, mounting the disk where the root directory of the Linux virtual machine is located.
According to the virtio driver injection method provided by the invention, the virtio driver under the lib directory of the Linux virtual machine is copied, and the method comprises the following steps:
and copying the virtio driver under the Linux virtual machine/lib/modules/$ KERNEL _ VERSION/KERNEL/drivers/catalog.
According to the virtio driver injection method provided by the invention, the Linux virtual machine is migrated from the VMWare-based cloud platform to the qemu-based cloud platform.
In a second aspect, the present invention provides a virtio driver injection apparatus, which is applied to cloud platforms, and injects a virtio driver during a Linux virtual machine migration process between the cloud platforms, so that the Linux virtual machine can run with the virtio driver immediately after the Linux virtual machine migration, where the injection apparatus includes:
the file decompression module is used for decompressing the initrd file system under the Linux virtual machine root directory to obtain a folder and a file in the initrd file system;
the drive copying module is used for copying the virtio drive program under the lib directory of the Linux virtual machine and pasting the virtio drive program into a corresponding folder in the initrd file system;
the file generation module is used for executing a depmod command on the initrd file system containing the virtio driver and generating a dependency relationship file among modules in the initrd file system;
and the file compression module is used for compressing the initrd file system after the depmod command is executed.
The virtio driver injection device provided by the invention further comprises:
and the disk mounting module is used for mounting the disk where the root directory of the Linux virtual machine is located after the disk data of the Linux virtual machine is migrated.
In a third aspect, the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the virtio driver injection method according to the first aspect when executing the program.
In a fourth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the virtio driver injection method as described in the first aspect above.
In a fifth aspect, the present invention also provides a computer program product having a computer program stored thereon, which when executed by a processor, performs the steps of the virtio driver injection method as described in the first aspect above.
According to the virtio driver injection method and device provided by the invention, in the process of migrating the Linux virtual machine between cloud platforms, the initrd file system under the root directory of the Linux virtual machine is decompressed, the virtio driver under the lib directory of the Linux virtual machine is copied and pasted into the corresponding folder in the initrd file system, the depmod command is executed on the initrd file system containing the virtio driver, the dependency relationship file among the modules in the initrd file system is generated, the original module configuration inside the Linux virtual machine is kept unchanged to the maximum extent, the Linux virtual machine can be immediately operated by the virtio driver after migration, the manual installation of the virtio driver and the column operations such as restarting are not needed, the injection mode of the virtio driver is safe, the Linux virtual machine can be guaranteed not to be influenced, the safety and the reliability of the migration process of the Linux virtual machine can be improved, and the Linux virtual machine can be started to run successfully and accord with the expected running state after the performance is improved by using the virtio driver.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a schematic flow diagram of a virtio driver injection method provided by the present invention;
FIG. 2 is a schematic flow chart diagram of another virtio driver injection method provided by the present invention;
FIG. 3 is a schematic flow chart of an application scenario of the virtio driver injection method provided by the present invention;
FIG. 4 is a schematic diagram of the structure of the virtio driver injection device provided by the present invention;
fig. 5 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The virtio driver injection method is described below in conjunction with fig. 1-3.
Referring to fig. 1, fig. 1 is a schematic flow diagram of a virtio driver injection method provided by the present invention, where the virtio driver injection method shown in fig. 1 is applied to a cloud platform, and can be executed by a virtio driver injection device arranged on the cloud platform, and a virtio driver is injected in a Linux virtual machine migration process between cloud platforms, so that the Linux virtual machine can immediately run as the virtio driver after migration, as shown in fig. 1, the virtio driver injection method at least includes:
101, decompressing an initrd file system under a Linux virtual machine root directory to obtain a folder and a file in the initrd file system.
In the embodiment of the present invention, the virtual machine may be a virtual machine that is created on the cloud platform by using a virtualization technology and runs a Linux operating system, where the existing virtualization technology may be used to create the virtual machine on the cloud platform, for example, qemu technology, VMWare technology, and the like. The virtio driver is a paravirtualization driver, and can be applied to a virtual machine to improve the IO efficiency of the virtual machine, so that the performance of the virtual machine is improved. In the process of migrating the Linux virtual machine from the original cloud platform to the target cloud platform, the Linux virtual machine can be immediately operated by the injected virtio driver after the Linux virtual machine is migrated by injecting the virtio driver, for example, the original cloud platform is a cloud platform based on VMWare, the target cloud platform is a cloud platform built based on qemu technology, and the Linux virtual machine can be migrated from the cloud platform based on VMWare to the cloud platform based on qemu.
In the embodiment of the present invention, since commands, hardware, software, processes, and the like in the Linux operating system can be regarded as files having respective properties or types for a kernel of the operating system, the files in the Linux operating system are indexed by a directory structure, and directories in the Linux operating system all start from a root directory. The Initrd file system is a temporary root file system used by the Linux operating system in a system boot process and is used for supporting a two-stage boot process, and the Initrd file system comprises various executable programs and drivers and is usually a compressed file under a root directory. Therefore, in the process of migrating the Linux virtual machine from the original cloud platform to the target cloud platform, the initrd file system under the root directory of the Linux virtual machine can be obtained, and the obtained initrd file system is decompressed, so that a series of startup-related folders and files in the initrd file system are obtained.
Optionally, the injecting of the virtual driver in the Linux virtual machine migration process may be after the Linux virtual machine disk data is migrated, and the injecting of the virtual driver in the Linux virtual machine migration process may further include: and mounting the disk where the Linux virtual machine root directory is located, and decompressing the installed initrd file system under the Linux virtual machine root directory to obtain a folder and a file in the initrd file system.
102, copying a virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system.
In the embodiment of the invention, the lib directory in the Linux operating system is a directory for storing dynamic link library files in the Linux operating system, and the virtio driver is stored in the lib directory, for example, files related to the virtio driver are stored in the Linux virtual machine/lib/modules/$ KERNEL _ VERSION/KERNEL/directory. After the folders and the files in the initrd file system are obtained, the virtio driver under the lib directory of the Linux virtual machine can be copied, and the copied virtio driver is pasted into the corresponding folder in the initrd file system.
103, executing the depmod command on the initrd file system containing the virtio driver, and generating a dependency relationship file among modules in the initrd file system.
In the embodiment of the invention, the Linux operating system can generate the mapping file of the dependency relationship between the modules through the depmod command for the modprobe to use. Therefore, after the virtio driver is pasted into the corresponding folder in the initrd file system, the depmod command is executed on the initrd file system containing the virtio driver, and the dependency relationship file between the modules in the initrd file system is generated.
And 104, compressing the initrd file system after executing the depmod command.
In the embodiment of the invention, after the dependency relationship file between the modules in the initrd file system is generated by executing the depmod command, the initrd file system after the depmod command is executed can be compressed to obtain a new initrd file system, and the obtained new initrd file system is a compressed file containing a virtio driver. The method for compressing the initrd file system can be determined according to the method for decompressing the initrd file system, so that the format of the new initrd file system obtained through compression is the same as that of the initrd file system before decompression.
According to the virtio driver injection method provided by the embodiment of the invention, in the process of migrating the Linux virtual machine between cloud platforms, an initrd file system under a root directory of the Linux virtual machine is decompressed, a virtio driver under a lib directory of the Linux virtual machine is copied and pasted into a corresponding folder in the initrd file system, a depmod command is executed on the initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system, and the original module configuration inside the Linux virtual machine is kept unchanged to the maximum extent, so that the Linux virtual machine can be immediately operated by the virtio driver after migration, column operations such as manual installation of the virtio driver, restarting and the like are not needed, the injection mode of the virtio driver is safe, the remaining kernel modules inside the Linux virtual machine can be guaranteed not to be influenced, the safety and the reliability of the migration process of the Linux virtual machine can be improved, and the successful and expected operation state of the Linux virtual machine can be guaranteed to be in accordance with the expected after the virtio driver is used for improving the performance of the Linux virtual machine.
Referring to fig. 2, fig. 2 is a schematic flow chart of another virtual driver injection method provided by the present invention, as shown in fig. 2, the virtual driver injection method at least includes:
201, determining a compression format of an initrd file system under a Linux virtual machine root directory.
In the embodiment of the present invention, because the format of the initrd file system of different Linux operating systems is different, for example, the format of the initrd file system may be a cpio format, an ext2 format, a gz format, or the like, and the type of the format of the initrd file system is not limited in the embodiment of the present invention. The compression format of the initrd file system under the Linux virtual machine root directory may be determined first before decompressing the initrd file system under the Linux virtual machine root directory.
And 202, decompressing the initrd file system according to the determined compression format to obtain the folders and files in the initrd file system.
In the embodiment of the invention, after the compression format of the initrd file system in the Linux virtual machine root directory is determined, the initrd file system can be decompressed according to the determined compression format of the initrd file system, so that a folder and a file in the initrd file system are obtained. For example, the determined compression format of the initrd file system is the gz format, and a decompression command corresponding to the gz format may be executed to decompress the initrd file system, so as to obtain a folder and a file in the initrd file system.
And 203, copying a virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system.
In the embodiment of the present invention, the description about 203 may refer to the description about 102 in fig. 1, and thus will not be repeated here.
And 204, executing a depmod command on the initrd file system containing the virtio driver, and generating a dependency relationship file among modules in the initrd file system.
In the embodiment of the present invention, the description about 203 may refer to the description about 102 in fig. 1, and thus will not be repeated here.
205, according to the determined compression format, compressing the initrd file system after executing the depmod command.
In the embodiment of the invention, after the dependency relationship file between the modules in the initrd file system is generated by executing the depmod command, the determined compression format of the initrd file system can be used for compressing the initrd file system after the depmod command is executed, so as to obtain a new initrd file system. For example, the determined compression format of the initrd file system is the gz format, and a compression command corresponding to the gz format may be executed to compress the initrd file system after the depmod command is executed, so as to obtain a new initrd file system.
Referring to fig. 3, fig. 3 is a schematic flow chart of an application scenario of the virtio driver injection method provided by the present invention, and as shown in fig. 3, when migrating a Linux virtual machine from a VMWare-based cloud platform to a qemu-based cloud platform, after migrating data of a Linux virtual machine disk, a disk where a Linux virtual machine root directory is located may be mounted, and after the Linux virtual machine root directory is mounted, the following steps are performed:
and determining the compression format of the initrd file system under the root directory of the current Linux virtual machine to be the gz format.
And decompressing the initrd file system by using a decompression command corresponding to the gz format to obtain a series of starting-related folders and files in the initrd file system.
And copying a virtio driver under a Linux virtual machine/lib/modules/$ KERNEL _ VERSION/KERNEL/drivers/directory, and pasting the copied virtio driver into a corresponding folder in the initrd file system.
And executing a depmod command on the initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system.
And compressing the initrd file system after executing the depmod command by using a compression command corresponding to the gz format to obtain a new initrd file system.
The virtio driver injection device provided by the present invention is described below, and the virtio driver injection device described below and the virtio driver injection method described above may be referred to in correspondence with each other.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a virtio driver injection device provided by the present invention, where the virtio driver injection device shown in fig. 4 is applied to a cloud platform, and may be used to execute the virtio driver injection method shown in fig. 1, and a virtio driver is injected in a process of migrating a Linux virtual machine between cloud platforms, so that the Linux virtual machine may run as the virtio driver immediately after the Linux virtual machine is migrated, as shown in fig. 4, the virtio driver injection device at least includes:
the file decompression module 410 is configured to decompress the initrd file system in the Linux virtual machine root directory to obtain a folder and a file in the initrd file system.
The driver copy module 420 is configured to copy a virtio driver under the lib directory of the Linux virtual machine, and paste the virtio driver into a corresponding folder in the initrd file system.
The file generating module 430 is configured to execute a depmod command on the initrd file system including the virtio driver, and generate a dependency relationship file between modules in the initrd file system.
And the file compression module 440 is configured to compress the initrd file system after the depmod command is executed.
Optionally, the file decompression module 410 includes:
and the format determining unit is used for determining the compression format of the initrd file system under the Linux virtual machine root directory.
And the file decompression unit is used for decompressing the initrd file system according to the determined compression format to obtain the folder and the file in the initrd file system.
And the file compression module 440 is configured to compress the initrd file system after the depmod command is executed according to the determined compression format.
Optionally, the virtio driver injection device further comprises:
and the disk mounting module is used for mounting the disk where the root directory of the Linux virtual machine is located after the disk data of the Linux virtual machine is migrated.
Optionally, the driver replication module 420 is configured to replicate the virtio driver in the Linux virtual machine/lib/modules/$ KERNEL _ VERSION/KERNEL/drivers/directory.
Optionally, the Linux virtual machine is migrated from the VMWare-based cloud platform to the qemu-based cloud platform.
Fig. 5 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 5: a processor (processor) 510, a communication interface (communication interface) 520, a memory (memory) 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other via the communication bus 540. Processor 510 may call logic instructions in memory 530 to perform a virtio driver injection method that includes:
decompressing an initrd file system under the root directory of the Linux virtual machine to obtain a folder and a file in the initrd file system;
copying the virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system;
executing a depmod command on an initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system;
and compressing the initrd file system after the demomod command is executed.
In addition, the logic instructions in the memory 530 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the virtio driver injection method provided by the above methods, the method comprising:
decompressing the initrd file system under the Linux virtual machine root directory to obtain folders and files in the initrd file system;
copying the virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system;
executing a depmod command on an initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system;
and compressing the initrd file system after the depmod command is executed.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program being capable of implementing the virtio driver injection method provided by the above-mentioned methods when executed by a processor, the method including:
decompressing an initrd file system under the root directory of the Linux virtual machine to obtain a folder and a file in the initrd file system;
copying the virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system;
executing a depmod command on the initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system;
and compressing the initrd file system after the demomod command is executed.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment may be implemented by software plus a necessary general hardware platform, and may also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A virtio driver injection method is applied to cloud platforms, and a virtio driver is injected in the Linux virtual machine migration process between the cloud platforms, so that the Linux virtual machine can run with the virtio driver immediately after migration, and the injection method comprises the following steps:
decompressing an initrd file system under the root directory of the Linux virtual machine to obtain a folder and a file in the initrd file system;
copying the virtio driver under the lib directory of the Linux virtual machine, and pasting the virtio driver into a corresponding folder in the initrd file system;
executing a depmod command on an initrd file system containing the virtio driver to generate a dependency relationship file among modules in the initrd file system;
and compressing the initrd file system after the depmod command is executed.
2. The virtio driver injection method according to claim 1, wherein decompressing an initrd file system under the Linux virtual machine root directory to obtain folders and files in the initrd file system, includes:
determining a compression format of the initrd file system under the root directory of the Linux virtual machine;
decompressing the initrd file system according to the determined compression format to obtain a folder and a file in the initrd file system;
compressing the initrd file system after the demomod command is executed, wherein the compressing comprises the following steps:
and compressing the initrd file system after the depmod command is executed according to the determined compression format.
3. The virtio driver injection method according to claim 1 or 2, wherein before decompressing an initrd file system in the Linux virtual machine root directory, and obtaining folders and files in the initrd file system, the method further includes:
and after the disk data of the Linux virtual machine is migrated, mounting the disk where the root directory of the Linux virtual machine is located.
4. The virtio driver injection method of claim 3, wherein copying the virtio driver under the Linux virtual machine lib directory comprises:
and copying the virtio driver under the Linux virtual machine/lib/modules/$ KERNEL _ VERSION/KERNEL/drivers/catalog.
5. The virtio driver injection method of claim 1, wherein the Linux virtual machine is migrated from a VMWare-based cloud platform onto a qemu-based cloud platform.
6. A virtio driver injection apparatus, applied to cloud platforms, for injecting a virtio driver during a Linux virtual machine migration between the cloud platforms, so that the Linux virtual machine can be operated with the virtio driver immediately after the Linux virtual machine migration, the injection apparatus comprising:
the file decompression module is used for decompressing an initrd file system under the Linux virtual machine root directory to obtain a folder and a file in the initrd file system;
the drive copying module is used for copying the virtio drive program under the lib directory of the Linux virtual machine and pasting the virtio drive program into a corresponding folder in the initrd file system;
the file generation module is used for executing a depmod command on an initrd file system containing the virtio driver and generating a dependency relationship file among modules in the initrd file system;
and the file compression module is used for compressing the initrd file system after the depmod command is executed.
7. The virtio driver injection device of claim 6, further comprising:
and the disk mounting module is used for mounting the disk where the root directory of the Linux virtual machine is located after the disk data of the Linux virtual machine is migrated.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the virtio driver injection method according to any one of claims 1 to 5 are implemented when the program is executed by the processor.
9. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the virtio driver injection method of any one of claims 1 to 5.
10. A computer program product having a computer program stored thereon, wherein the computer program, when executed by a processor, performs the steps of the virtio driver injection method as defined in any one of claims 1 to 5.
CN202210022042.XA 2022-01-10 2022-01-10 virtio driver injection method and device Active CN114461338B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210022042.XA CN114461338B (en) 2022-01-10 2022-01-10 virtio driver injection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210022042.XA CN114461338B (en) 2022-01-10 2022-01-10 virtio driver injection method and device

Publications (2)

Publication Number Publication Date
CN114461338A CN114461338A (en) 2022-05-10
CN114461338B true CN114461338B (en) 2022-10-14

Family

ID=81408925

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210022042.XA Active CN114461338B (en) 2022-01-10 2022-01-10 virtio driver injection method and device

Country Status (1)

Country Link
CN (1) CN114461338B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843682A (en) * 2016-03-29 2016-08-10 新浪网技术(中国)有限公司 Method and apparatus for migrating virtual machine to IaaS cloud platform
CN109522088A (en) * 2018-09-30 2019-03-26 华为技术有限公司 A kind of virtual machine migration method and device
CN110569111A (en) * 2019-09-12 2019-12-13 天津华云软件有限公司 virtual machine implementation method, device and system based on traditional container

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8370837B2 (en) * 2007-03-23 2013-02-05 Parallels IP Holdings GmbH Blocking file system for on-the-fly migration of a container with an NFS mount
CN113835822A (en) * 2020-06-23 2021-12-24 中兴通讯股份有限公司 Cross-cloud-platform virtual machine migration method and device, storage medium and electronic device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843682A (en) * 2016-03-29 2016-08-10 新浪网技术(中国)有限公司 Method and apparatus for migrating virtual machine to IaaS cloud platform
CN109522088A (en) * 2018-09-30 2019-03-26 华为技术有限公司 A kind of virtual machine migration method and device
CN110569111A (en) * 2019-09-12 2019-12-13 天津华云软件有限公司 virtual machine implementation method, device and system based on traditional container

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向桌面云的Android虚拟机设备虚拟化的研究与实现;时钰森;《中国优秀硕士学位论文库信息科技辑》;20170515;全文 *

Also Published As

Publication number Publication date
CN114461338A (en) 2022-05-10

Similar Documents

Publication Publication Date Title
US11762740B2 (en) Systems and methods for efficient backup restoration
EP2765508B1 (en) Installation method and installation device for application software
US8924954B2 (en) Application software installation method and application software installation apparatus
US6591376B1 (en) Method and system for failsafe recovery and upgrade of an embedded operating system
JP5461985B2 (en) Method and system for archiving data
US8166477B1 (en) System and method for restoration of an execution environment from hibernation into a virtual or physical machine
US8621461B1 (en) Virtual machine based operating system simulation using host ram-based emulation of persistent mass storage device
CN108241550B (en) Backup and restoration method for operating system
CN110825419B (en) Firmware refreshing method and device, electronic equipment and storage medium
CN110209525B (en) Operating system restoration method and device
US10185573B2 (en) Caching based operating system installation
CN111258666A (en) Reading method and device of computer file, computer system and storage medium
CN113032032A (en) System management method and device, computing equipment and readable storage medium
CN112579361B (en) Backup data reconstruction method, device, equipment and storage medium
CN114756290A (en) Operating system installation method, device and readable storage medium
CN114461338B (en) virtio driver injection method and device
US7340738B2 (en) Time optimized replacement of a software application
CN111338652B (en) Operating system mirror image manufacturing method, device, equipment and medium
CN114546581A (en) Service-free container starting method and related equipment
CN115576743B (en) Operating system recovery method, operating system recovery device, computer equipment and storage medium
CN110704085A (en) RAID executable file updating method, device, equipment and storage medium
CN102629209B (en) Method, single board and system for realizing plug-and-play of single board
CN117112072B (en) Cross-platform virtual machine drive replacement method, system and storage medium
CN111737048B (en) Openstack docking storage virtual machine volume backup processing method and device
CN112631637B (en) OTA upgrading method, system, equipment and storage medium based on RTOS

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant