Compatible method and device for virtual machine migration, computer equipment and storage medium
By using WinPE image files and driver installation services during the virtual machine migration process, the driver is automatically installed and partition information is adjusted, which solves the problem of Windows virtual machines not being able to run normally after migration, achieves hardware compatibility between the virtual machine and the new environment, and improves the reliability and efficiency of the migration process.
Patent Information
- Application Number
- CN202510702394.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-16
AI Technical Summary
During virtual machine migration, especially when migrating across cloud platforms, Windows virtual machines may experience abnormal dirty data on disk due to the migration mechanism. This can cause conventional offline disk injection tools to be unable to properly inject files into the disk and modify the registry, affecting driver injection and causing the virtual machine to fail to operate normally.
Start the virtual machine through the pre-created WinPE image file, obtain the system registry file, add the configuration information of the driver installation service, and add the driver installation file to the system partition. Use the driver installation service to automatically install the driver, and adjust the partition information in combination with the disk repair service to ensure that the virtual machine is compatible with the new environment.
It ensures hardware compatibility between the virtual machine and the new environment after migration, solves the driver installation problem in the event of disk anomalies, improves the reliability and efficiency of the migration process, reduces manpower and time costs, and reduces the risk of errors caused by human operations.
Smart Images

Figure CN120653362A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a compatible method, apparatus, computer device, and storage medium for virtual machine migration. Background Art
[0002] In modern data centers and cloud computing environments, virtualization technology is widely used to achieve efficient resource utilization and flexible management. Virtualization platforms (such as VMware vSphere, Microsoft Hyper-V, and KVM) allow virtual machines to migrate between different physical hosts for purposes such as load balancing, fault recovery, and hardware maintenance. However, the migration of virtual machines often faces a critical issue: the hardware configurations of different physical hosts may differ. Especially when the virtual machine is running the Windows operating system, such differences may cause the migrated virtual machine to malfunction. To address this issue, it is necessary to automatically inject drivers suitable for the new hardware environment during the virtual machine migration process to ensure that the virtual machine can operate normally under different hardware configurations.
[0003] Traditionally, conventional offline disk injection tools, such as libguestfs, are used for injection. However, when migrating Windows virtual machines across cloud platforms, the migration mechanism causes abnormal dirty data on the disk to be set, causing the disk to be set to read-only mode. This in turn prevents conventional offline disk injection tools from injecting files into the disk and modifying the registry, ultimately affecting driver injection and causing the virtual machine to fail to operate normally after migration. Summary of the Invention
[0004] Based on this, it is necessary to provide a compatible method, device, computer equipment and storage medium for virtual machine migration that can enable the virtual machine to successfully install the driver after migration, thereby achieving compatibility with the hardware of the new environment after the virtual machine migration.
[0005] In a first aspect, the present application provides a compatible method for virtual machine migration, comprising:
[0006] In response to the completion of the virtual machine migration, the virtual machine is started using the pre-created winPE image file;
[0007] In response to the virtual machine entering the WinPE system, obtaining a system registry file of the virtual machine;
[0008] Add the pre-created driver installation service configuration information to the system registry file of the virtual machine through the WinPE system;
[0009] Determine the system partition of the virtual machine based on the disk partition where the system registry file of the virtual machine is located, and add the driver installation file in the WinPE system to the system partition;
[0010] The driver installation service obtains the driver installation file in the system partition and installs the virtual machine driver according to the driver installation file to ensure compatibility with virtual machine migration.
[0011] In one embodiment, the compatible method for virtual machine migration further includes:
[0012] Mount the virtual machine's system registry file to the registry editor of the winPE system;
[0013] Use the WinPE system to add the pre-created driver installation service configuration information to the virtual machine's system registry file, including:
[0014] Use the registry editor of the WinPE system to add the configuration information of the driver installation service to the system registry file of the virtual machine.
[0015] In one embodiment, after adding the driver installation file in the WinPE system to the system partition, the compatible method for virtual machine migration further includes:
[0016] Control virtual machine shutdown;
[0017] Before obtaining the driver installation file from the system partition through the driver installation service, compatible methods for virtual machine migration also include:
[0018] Restart the virtual machine from its system partition;
[0019] Compatible methods for virtual machine migration also include:
[0020] Add the driver installation script pre-integrated in the WinPE system to the system partition of the virtual machine;
[0021] Obtain the driver installation file from the system partition through the driver installation service and install the virtual machine driver according to the driver installation file, including:
[0022] The driver installation service obtains the driver installation file and driver installation script in the system partition and runs the driver installation file according to the driver installation script to install the driver of the virtual machine.
[0023] In one embodiment, the compatible method for virtual machine migration further includes:
[0024] Add the pre-created disk repair service configuration information to the virtual machine's system registry file through the WinPE system;
[0025] After restarting the virtual machine from the system partition of the virtual machine, start the disk repair service according to the configuration information of the disk repair service;
[0026] Scan each disk corresponding to the virtual machine through the disk repair service to obtain the current partition information of the disk;
[0027] Get the original partition information of the virtual machine disk before migration;
[0028] The current partition information of the disk is compared with the corresponding original partition information. When the comparison results are inconsistent, the current partition information is adjusted according to the difference information obtained from the comparison and the original partition information.
[0029] In one embodiment, the system registry file of the virtual machine includes a software configuration file and a system configuration file, and obtaining the system registry file of the virtual machine includes:
[0030] Scan the directories in each disk partition of the virtual machine and the file identifiers in the directories;
[0031] Obtain software configuration files and system configuration files based on the directory and the file identifiers in the directory;
[0032] Use the WinPE system to add the pre-created driver installation service configuration information to the virtual machine's system registry file, including:
[0033] Use the registry operation command in the WinPE system to add the configuration information of the pre-created driver installation service to the software configuration file;
[0034] Compatible methods for virtual machine migration also include:
[0035] Modify the user permission configuration item in the system configuration file to enable user permissions for driver installation.
[0036] In one embodiment, starting a virtual machine using a pre-created winPE image file includes:
[0037] Mount the WinPE image file to the virtual machine's CD-ROM drive;
[0038] Start the virtual machine from the virtual machine's CD-ROM drive to start the virtual machine using the WinPE image file.
[0039] In one embodiment, before restarting the virtual machine from the system partition of the virtual machine, the compatible method for virtual machine migration further includes:
[0040] Detect the status of the virtual machine. When it is detected that the virtual machine is shut down, uninstall the WinPE image file.
[0041] After performing the compatibility of the virtual machine migration, the method further includes:
[0042] Restore the system registry files of the virtual machine;
[0043] Clear the driver installation files and shut down the driver installation service.
[0044] In a second aspect, a compatible device for virtual machine migration includes:
[0045] Creating a module for starting the virtual machine using a pre-created winPE image file in response to completion of virtual machine migration;
[0046] An acquisition module, configured to acquire a system registry file of the virtual machine in response to the virtual machine entering the WinPE system;
[0047] Add a module to add the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system;
[0048] A modification module is used to determine the system partition of the virtual machine according to the disk partition where the system registry file of the virtual machine is located, and to add the driver installation file in the WinPE system to the system partition;
[0049] The compatibility module is used to obtain the driver installation file in the system partition through the driver installation service, and install the driver of the virtual machine according to the driver installation file to achieve compatibility with the virtual machine migration.
[0050] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements the compatible steps of virtual machine migration provided in any embodiment of the first aspect of the present application.
[0051] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the compatible steps of virtual machine migration provided in any embodiment of the first aspect of the present application.
[0052] The above-mentioned compatible method, device, computer equipment and storage medium for virtual machine migration, by identifying the system partition and using the WinPE system as an intermediate environment to start the virtual machine, can inject the driver installation service into the virtual machine's registry file, and add the driver installation file required by the driver installation service to the virtual machine's system partition, so that the virtual machine can smoothly install the driver after migration, and achieve hardware compatibility between the virtual machine and the new environment, and can operate normally in the new environment. It solves the problem in traditional technology that when the virtual machine migration causes special circumstances on the disk (such as dirty data is set to 1 so that conventional tools cannot write), conventional offline disk injection tools cannot inject files into the disk and modify the registry.
[0053] By manipulating the virtual machine's system registry file in WinPE, adding the driver installation file to the system partition, and adding a driver installation service, the driver installation process no longer relies on the user entering a username and password when logging in. This overcomes the limitation of Windows virtual machine startup services requiring a logged-in user to execute, and enables unattended driver installation. In large-scale virtual machine migration scenarios, this can save significant manpower and time costs, reduce the risk of errors caused by manual operations, and improve the reliability and efficiency of the entire migration process. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A flowchart of a compatible method for virtual machine migration in some embodiments;
[0055] Figure 2 A flowchart of a compatible method for virtual machine migration in some other embodiments;
[0056] Figure 3 A block diagram of a compatible device for virtual machine migration in some embodiments;
[0057] Figure 4 1 is a diagram of the internal structure of a computer device in some embodiments. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0059] In a first aspect, the present application provides a compatible method for virtual machine migration, such as Figure 1 As shown, the method is applied to a server as an example for description, and includes the following steps:
[0060] Step S11: In response to the completion of the virtual machine migration, the virtual machine is started through the pre-created winPE image file.
[0061] Among them, virtual machine migration refers to cross-platform migration, which is the process of migrating a virtual machine from one physical platform or virtual environment to another different physical platform or virtual environment, that is, migrating between heterogeneous platforms. During this process, the virtual machine's operating system, applications, and data can maintain their original state and continue to run on the new platform, such as migrating from one brand of server to another, or migrating from one virtualization software environment to another.
[0062] A WinPE (Windows Preinstallation Environment) image file is a lightweight Windows operating system image. It is primarily used for system installation, maintenance, and repair. A WinPE image file contains the basic Windows kernel, necessary drivers, and system tools. It loads into memory during computer startup, providing a minimal executable environment for users to perform tasks such as operating system installation, disk partitioning, and data backup and recovery.
[0063] Compatibility of virtual machine migration means ensuring that when a virtual machine is migrated from one physical platform or virtual environment to another different physical platform or virtual environment, the virtual machine can run normally on the new platform, and its operating system, applications, and various functions are not affected by hardware differences.
[0064] Specifically, the present application can pre-create a virtual machine migration task when a virtual machine needs to be migrated from another platform, further execute the virtual machine migration task, and when the virtual machine migration task is completed, execute the step of starting the virtual machine through the pre-created winPE image file in response to the completion of the virtual machine migration.
[0065] Furthermore, the present application pre-builds a WinPE image file. Furthermore, in the virtual machine settings, the boot order is adjusted to prioritize booting from the device that stores the WinPE image file, such as a virtual CD-ROM drive or a virtual disk. When the virtual machine is migrated, the server will load the WinPE image file into the virtual machine's memory according to the settings. The kernel in the image will initialize system resources, load the necessary drivers to identify the hardware, and then start the WinPE environment, finally presenting the WinPE operating interface, in which the user can perform corresponding maintenance and management operations.
[0066] Step S12: in response to the virtual machine entering the WinPE system, obtaining the system registry file of the virtual machine.
[0067] WinPE, or Windows Preinstallation Environment, is a lightweight Windows operating system used for installing, deploying, and repairing the Windows operating system. It contains the basic kernel, essential drivers, and system tools, and is loaded into memory upon computer startup, providing a minimal, executable environment. In virtual machine scenarios, WinPE can be used for maintenance and management of virtual machines in specialized situations.
[0068] The virtual machine's system registry is a database file that stores the virtual machine's operating system configuration information. It contains various parameters and information, including system hardware configuration, software settings, user preferences, system services, and more. For example, hardware device driver information, application installation paths and settings, and system startup items are all stored in the registry.
[0069] Specifically, the present application can use tools in WinPE to search for the corresponding virtual machine system registry file according to the specified directory and the folder name under the directory.
[0070] Step S13: adding the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system.
[0071] The driver installation service is a software program or system component whose primary function is to automatically detect, download, and install the drivers required for hardware devices in a computer system. In a virtual machine environment, since a virtual machine may be migrated to a host with a different hardware configuration, the driver installation service ensures that the operating system within the virtual machine can correctly identify and use new hardware devices, such as new network cards, graphics cards, and storage controllers, thereby ensuring the normal operation and performance of the virtual machine.
[0072] The configuration information of the driver installation service refers to a series of parameters and settings used to define and control the behavior of the driver installation service.
[0073] Specifically, after the virtual machine enters the WinPE system, the configuration information of the driver installation service is added to the system registry file of the virtual machine.
[0074] Step S14: determining the system partition of the virtual machine according to the disk partition where the system registry file of the virtual machine is located, and adding the driver installation file in the WinPE system to the system partition.
[0075] The system partition refers to the disk partition that contains the operating system's startup and system files. In Windows systems, this is typically the partition where the Windows operating system is installed. It stores key files such as the system kernel, drivers, and system configuration files, and is essential for computer startup and operating system operation.
[0076] A driver installation file is a collection of files that contains hardware device drivers and related installation information. Typically, a driver installation file is an executable file (.exe) or a compressed package containing the driver binary, installation script, and configuration files. These files install the appropriate driver for a specific hardware device in the operating system, enabling the hardware to be correctly identified and controlled by the operating system and function properly.
[0077] In this application, the WinPE system has driver installation files pre-integrated. Adding the driver installation files to the system partition allows the operating system to easily find and use these driver files during startup and operation. The system partition is one of the default locations where the operating system searches for drivers. Placing the driver installation files here allows the system to quickly locate the driver files according to the established search path when loading hardware drivers, ensuring the proper functioning of the hardware devices.
[0078] Specifically, this application can use disk management tools in the WinPE system to view disk partition status. For example, enter the diskpart command through the command prompt to enter the disk management interactive interface, then view the disk list, then select the disk where the virtual machine is located, and then view the partition information on that disk. Based on the partition type, size, volume label and other information, combined with the disk partition where the virtual machine system registry file is located, the system partition is determined.
[0079] Furthermore, after finding the system partition, the driver installation file in the WinPE system is copied to the specified location of the system partition.
[0080] Step S15: obtaining the driver installation file in the system partition through the driver installation service, and installing the driver of the virtual machine according to the driver installation file to achieve compatibility with the virtual machine migration.
[0081] During the virtual machine migration process, the previously set up driver installation service is used to find the driver installation files stored in the virtual machine's system partition, and then install drivers adapted to the new hardware environment for the virtual machine based on these files. This solves the driver incompatibility issues that may arise when the virtual machine is migrated to a physical host with a different hardware configuration, ensures that the virtual machine can run normally on the new host, and achieves compatibility of virtual machine migration.
[0082] In one embodiment, the compatible method for virtual machine migration may also include: mounting the system registry file of the virtual machine to the registry editor of the winPE system, and adding the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the winPE system, including: adding the configuration information of the driver installation service to the system registry file of the virtual machine through the registry editor of the winPE system.
[0083] The Registry Editor is a tool used in Windows to view and modify the system registry. The registry is a database that stores configuration information for the Windows operating system, including various parameters such as system hardware, software, and user settings.
[0084] Mounting refers to connecting a storage device or file system to a specific directory or location of the operating system, allowing the operating system to access and use the data in the storage device or file system.
[0085] Specifically, the present application uses WinPE boot media to start the virtual machine and enter the WinPE environment.
[0086] In the WinPE system, find the system registry file of the virtual machine (usually located in the Windows\System32\config directory of the virtual disk), select the registry file to be loaded and specify a directory name.
[0087] In the Registry Editor, navigate to the key and value locations related to the driver installation service in the above directory. Create the corresponding key and value pairs based on the pre-created driver installation service configuration information.
[0088] The beneficial effects of this embodiment are: injecting driver installation services in the WinPE environment, realizing offline injection of driver installation services, and after the virtual machine is migrated, the appropriate driver can be automatically installed according to the hardware conditions of the new environment and the configuration information, thereby improving the compatibility of the virtual machine in different hardware environments, reducing system failures and hardware malfunctions caused by driver incompatibility, and ensuring that the virtual machine can run quickly and stably on the new host.
[0089] In one embodiment, after adding the driver installation file in the winPE system to the system partition, the compatible method of virtual machine migration also includes: controlling the virtual machine to shut down, and before obtaining the driver installation file in the system partition through the driver installation service, the compatible method of virtual machine migration also includes: restarting the virtual machine from the system partition of the virtual machine, and the compatible method of virtual machine migration also includes: adding the driver installation script pre-integrated in the winPE system to the system partition of the virtual machine, obtaining the driver installation file in the system partition through the driver installation service, and installing the driver of the virtual machine according to the driver installation file, including: obtaining the driver installation file and driver installation script in the system partition through the driver installation service, and running the driver installation file according to the driver installation script to install the driver of the virtual machine.
[0090] In this application, the driver installation script is a text file containing a series of instructions used to instruct the computer system on how to perform the driver installation process, such as determining the order of driver installation, checking the system environment, calling the installation program in the driver installation file, etc. It clarifies the specific operating steps that the driver installation service relies on.
[0091] Driver Installation Service: A background program running in the operating system that coordinates and executes the driver installation process. Based on system requirements and configuration information, it calls driver installation files and scripts to automatically install and configure the driver.
[0092] Driver installation file: A collection of files that contains hardware device drivers and related installation information. It may be in the form of an executable file or a compressed package. It is the main file that actually installs the driver into the system.
[0093] Specifically, the driver installation script defines the specific process and steps executed by the driver installation service. The driver installation service obtains and runs the driver installation file according to the instructions of the script to complete the driver installation. They work together to realize the installation and configuration of the virtual machine driver to ensure that the virtual machine is compatible with the new hardware environment after migration.
[0094] Specifically, in a WinPE system, the driver installation file and the pre-integrated driver installation script are copied to the system partition of the virtual machine. The files can be placed in the system default driver installation directory or a specified specific directory.
[0095] Furthermore, after the virtual machine is shut down, the virtual machine is restarted from the system partition of the virtual machine so that the system can load the newly added driver installation file and script.
[0096] Furthermore, after the virtual machine is restarted from the system partition, the driver installation service will run according to the preset rules, and it will obtain the driver installation file and driver installation script in the system partition.
[0097] Furthermore, the driver installation service runs the driver installation file according to the instructions in the driver installation script, and completes the installation of the virtual machine driver according to the prescribed steps.
[0098] The beneficial effect of this embodiment is that: this application creates a self-starting driver installation service, which can automatically execute the driver installation file through the guidance of the driver installation script and the coordination of the driver installation service. The startup of this service does not depend on the username and password, and then the driver installation script is executed through the service to get rid of the dependence on the username and password.
[0099] In one embodiment, Figure 2 As shown, the compatible method of virtual machine migration may also include:
[0100] Step S21: adding the configuration information of the pre-created disk repair service to the system registry file of the virtual machine through the WinPE system.
[0101] Step S22: After the virtual machine is restarted from the system partition of the virtual machine, the disk repair service is started according to the configuration information of the disk repair service.
[0102] Step S23: Scan each disk corresponding to the virtual machine through the disk repair service to obtain current partition information of the disk.
[0103] Step S24: obtaining original partition information of the disk before the virtual machine migration.
[0104] Step S25 , comparing the current partition information of the disk with the corresponding original partition information. If the comparison results are inconsistent, adjusting the current partition information based on the difference information obtained from the comparison and the original partition information.
[0105] Among them, the disk repair service is a program or functional module running in the virtual machine system, which is used to detect, repair and maintain the virtual machine's disk to ensure the normal operation of the disk and the integrity of the data.
[0106] Disk repair service configuration information: refers to a series of data used to set disk repair service operating parameters and rules, including scanning methods, repair strategies, log records and other related information. This information determines how the disk repair service operates.
[0107] Partition information: refers to the relevant data of each partition on the disk, such as the partition size, starting position, file system type, partition identifier, etc., which is used to describe the layout and properties of the disk partition.
[0108] Specifically, in the WinPE system environment, this application can write the pre-created disk repair service configuration information to the virtual machine's system registry file through specific tools or commands. Restarting the virtual machine from the virtual machine's system partition allows the system to load the newly added disk repair service configuration information. During the startup process, the system reads the configuration information in the registry to initialize the disk repair service.
[0109] Furthermore, after the disk repair service is started, a comprehensive scan is performed on each disk corresponding to the virtual machine according to the scanning method set in the configuration information, and the current partition information of each disk, including various attributes and parameters of the partition, is collected. By querying the relevant records before the virtual machine migration or the metadata stored in a specific location, the original partition information of the virtual machine disk before the migration is obtained. The obtained current partition information is compared with the original partition information one by one to check whether the various parameters of each partition are consistent. When the comparison results are inconsistent, the current partition information is adjusted according to the repair strategy set in the disk repair service configuration information based on the difference information obtained from the comparison and the original partition information, so that the partition information is restored to a state that is consistent with or as close as possible to the original state, so as to repair partition errors that may be caused by migration or other reasons.
[0110] The following methods can be used to adjust partition information:
[0111] First, if the current partition is smaller than the original partition, it may be due to misoperation or some software modifying the partition table, resulting in "hidden" space. In this case, the disk repair service can use the partition management tool to expand the current partition based on the original partition information and re-incorporate the unallocated space into the partition.
[0112] If the current partition is larger than the original, it may have been accidentally expanded. The repair service will check whether there is data in the extra space. If not, the partition can be shrunk back to its original size. If there is data, the importance of the data will determine whether to migrate the data before resizing the partition.
[0113] Second, when the partition's starting position changes, it may affect the system's ability to identify the partition and read data. The disk repair service calculates the correct starting position based on the original partition information and then uses underlying disk manipulation tools to adjust the partition to the correct starting position without damaging data. This may involve relocating data and updating the partition table.
[0114] Third, if the file system type of the current partition is inconsistent with the original partition, such as changing from NTFS to FAT32, and the system requires the original file system type to access data normally, the disk repair service will first back up the data in the partition, then convert the partition's file system format back to the original type, and then restore the data to the partition.
[0115] Fourth, the partition identifier is an important symbol for the system to identify the partition. If the partition identifier is incorrect, the disk repair service will use a special tool to modify the partition identifier based on the original partition information to make it consistent with the original identifier so that the system can correctly identify the partition.
[0116] During the adjustment process, the disk repair service follows the policies specified in the configuration information, such as performing a backup and using specific adjustment algorithms, to ensure the security of the adjustment process and data integrity. Detailed information about the adjustment process is also recorded for subsequent review and analysis.
[0117] The beneficial effects of this embodiment are: through the disk repair service, abnormal disks can be discovered in time and repaired, and the disk partition change problems that may occur during the migration process can be automatically handled, so that the virtual machine can quickly return to normal after migration in different environments, thereby enhancing the compatibility and adaptability of virtual machine migration.
[0118] In one embodiment, the system registry file of the virtual machine includes a software configuration file and a system configuration file. Obtaining the system registry file of the virtual machine includes: scanning the directories in each disk partition of the virtual machine and the file identifiers in the directories, obtaining the software configuration file and the system configuration file based on the directories and the file identifiers in the directories, adding the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the winPE system, including: adding the configuration information of the pre-created driver installation service to the software configuration file through the registry operation command in the winPE system, and the method also includes: modifying the configuration item of user permissions in the system configuration file to enable user permissions for driver installation.
[0119] The software configuration file (SOFTWARE file) is part of the system registry and primarily stores configuration information for various software installed in the virtual machine's operating system. This information includes the software's installation path, personalized software settings, software associations with the system and other software, and software license information.
[0120] The system configuration file (SYSTEM file) is also part of the system registry file and is used to store the configuration information of the operating system itself. It covers the configuration information of the system hardware (such as hardware device driver information and hardware device parameter settings), system startup item settings, system service configuration, user permission settings, system environment variables, etc. For example, the list of services that automatically load at system startup and the permission levels of different user accounts are all recorded in the system configuration file.
[0121] Specifically, the present application can scan disk partitions to obtain system registry files. Specifically, in the WinPE system environment, use a scanning tool to traverse the various disk partitions of the virtual machine. Scan the directory structure in each disk partition, and identify the file identifiers in the directory (such as file name, file type, etc.). Based on the directory and file identification information obtained by the scan, locate and obtain the software configuration files and system configuration files. Generally speaking, these files are usually located in specific directories such as Windows\System32\config in the Windows system. Then find the SOFTWARE file and SYSTEM file according to the file name.
[0122] Furthermore, the registry operation command provided by the WinPE system is used to find the corresponding location of the software configuration file in the registry (locating it through the registry key path). The configuration information of the pre-created driver installation service is added to the registry location corresponding to the software configuration file in the form of an appropriate key-value pair.
[0123] Furthermore, also under the WinPE system, the configuration items related to user permissions in the system configuration file are found through the registry operation tool.
[0124] Modify the value of this configuration item to enable the user permissions required for driver installation. For example, change a registry value that controls whether a user has permission to install a driver from "Prohibited" to "Allowed."
[0125] The beneficial effect of this embodiment is that by modifying the configuration items of user permissions in the system configuration file, the user's permissions for driver installation can be flexibly adjusted according to actual needs, solving the problem that when installing a driver in a Windows virtual machine, if the user account control permissions are set to a high level or there are untrusted certificate items, automatic installation will be blocked.
[0126] In one embodiment, starting a virtual machine through a pre-created winPE image file includes: mounting the winPE image file to an optical drive of the virtual machine, starting the virtual machine from the optical drive of the virtual machine, and starting the virtual machine through the winPE image file.
[0127] The virtual machine's optical drive is an optical storage device simulated by the virtual machine, similar to the optical drive in a physical computer. It can be used to read optical disc image files, such as WinPE image files, allowing the virtual machine to boot from the image file and run the operating system or related tools contained in it.
[0128] Specifically, in the virtual machine settings, you can find the storage or device-related options and choose to mount the pre-created WinPE image file to the optical drive device simulated by the virtual machine. This operation can usually be performed through the graphical interface provided by the virtual machine software, specifying the path of the WinPE image file and associating it with the optical drive of the virtual machine.
[0129] After the mount is complete, restart the virtual machine. During the virtual machine startup process, enter the boot options menu and select Boot from CD-ROM. The virtual machine will read and boot from the CD-ROM drive where the WinPE image file is mounted, load the operating system and related programs in the WinPE image file, and enter the WinPE environment.
[0130] The beneficial effect of this embodiment is that the WinPE environment is relatively independent of the virtual machine's conventional operating system, and operating within it can avoid further damage or interference to the original system. At the same time, security testing and maintenance can be performed on the virtual machine's system and data in this secure, isolated environment, ensuring the security of the system and data. Furthermore, the WinPE image file can integrate various system installation programs, drivers, and utilities. Using it to start a virtual machine facilitates the rapid deployment of a new operating system, or the installation and configuration of specific software tools within the virtual machine, thereby improving the efficiency of system deployment and software installation.
[0131] In one of the embodiments, before restarting the virtual machine from the system partition of the virtual machine, the compatibility method of virtual machine migration may also include: detecting the status of the virtual machine, and when it is detected that the virtual machine is shut down, uninstalling the winPE image file, and after performing the compatibility of the virtual machine migration, the compatibility method of virtual machine migration also includes: restoring the system registry file of the virtual machine, clearing the driver installation file, and shutting down the driver installation service.
[0132] In this application, you can use the virtual machine management tool or related API to query the status information of the virtual machine and determine whether it is in the shutdown state. When it is determined that the virtual machine is shut down, it is determined that the system partition of the virtual machine has integrated the hardware driver installation service, disk repair service, and the installation files and installation scripts that each service depends on. In the settings of the virtual machine or the related storage management interface, find the optical drive device corresponding to the mounted WinPE image file, perform the uninstall operation, and remove the WinPE image file from the optical drive of the virtual machine.
[0133] Furthermore, after completing the virtual machine migration compatibility operation, the system registry file is restored to its normal state before the migration using the backed-up system registry file or specific recovery tools and methods. This may involve overwriting the current registry file with the previously saved registry file, or performing reverse operations based on the changes recorded during the migration process to restore the various registry settings.
[0134] Furthermore, locate the directory containing the driver installation files and use file management tools or command line instructions to delete these driver installation files to clear unnecessary files in the system, avoid occupying disk space and potentially causing system clutter. Furthermore, use system service management tools to find the process or service item corresponding to the driver installation service. Then, execute a stop operation to terminate the driver installation service, so that the driver installation service is not reinstalled every time the virtual machine is started.
[0135] This embodiment has the beneficial effect of unloading the WinPE image file when the virtual machine is shut down, thereby avoiding compatibility issues or data transmission errors caused by the mounted image file during the virtual machine migration process, ensuring that the virtual machine can be successfully migrated to the target environment. Restoring the system registry file, clearing the driver installation file, and disabling the driver installation service prevents the driver from being reinstalled each time the virtual machine is started.
[0136] In a second aspect, the present application provides a compatible device for virtual machine migration, such as Figure 3 As shown, the compatible device for virtual machine migration includes: a creation module 31, an acquisition module 32, an addition module 33, a modification module 34 and a compatibility module 35, wherein:
[0137] A creation module 31 is configured to start the virtual machine using a pre-created winPE image file in response to completion of the virtual machine migration;
[0138] An acquisition module 32 is configured to acquire a system registry file of the virtual machine in response to the virtual machine entering the WinPE system;
[0139] An adding module 33 is used to add the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system;
[0140] A modification module 34 is used to determine the system partition of the virtual machine according to the disk partition where the system registry file of the virtual machine is located, and add the driver installation file in the WinPE system to the system partition;
[0141] The compatibility module 35 is used to obtain the driver installation file in the system partition through the driver installation service, and install the driver of the virtual machine according to the driver installation file to achieve compatibility with the virtual machine migration.
[0142] In one embodiment, the adding module 33 may also mount the system registry file of the virtual machine to the registry editor of the winPE system, and add the configuration information of the driver installation service to the system registry file of the virtual machine through the registry editor of the winPE system.
[0143] In one embodiment, the modification module 34 can also control the shutdown of the virtual machine, restart the virtual machine from the system partition of the virtual machine, and add the driver installation script pre-integrated in the winPE system to the system partition of the virtual machine. The compatible module 35 can obtain the driver installation file and driver installation script in the system partition through the driver installation service, and run the driver installation file according to the driver installation script to install the driver of the virtual machine.
[0144] In one embodiment, the modification module 34 can also add the configuration information of the pre-created disk repair service to the system registry file of the virtual machine through the winPE system.
[0145] After restarting the virtual machine from the system partition of the virtual machine, start the disk repair service according to the configuration information of the disk repair service. Use the disk repair service to scan each disk corresponding to the virtual machine to obtain the current partition information of the disk, obtain the original partition information of the disk before the virtual machine migration, and compare the current partition information of the disk with the corresponding original partition information. When the comparison results are inconsistent, adjust the current partition information based on the difference information obtained from the comparison and the original partition information.
[0146] In one embodiment, the system registry file of the virtual machine includes a software configuration file and a system configuration file. The acquisition module 32 can scan the directories in each disk partition of the virtual machine and the file identifiers in the directory, and obtain the software configuration file and the system configuration file based on the directory and the file identifiers in the directory. The adding module 33 can also add the configuration information of the pre-created driver installation service to the software configuration file through the registry operation command in the winPE system, and modify the configuration items of user permissions in the system configuration file to enable user permissions for driver installation.
[0147] In one embodiment, the creation module 31 mounts the winPE image file to the optical drive of the virtual machine, and starts the virtual machine from the optical drive of the virtual machine, so as to start the virtual machine through the winPE image file.
[0148] In one embodiment, the compatibility module 35 can also detect the state of the virtual machine, and when it is detected that the virtual machine is shut down, uninstall the winPE image file, and restore the system registry file of the virtual machine after performing the compatibility of the virtual machine migration.
[0149] Clear the driver installation files and shut down the driver installation service.
[0150] In a third aspect, the present application provides a computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor implements the steps of the compatible method for virtual machine migration provided in any embodiment of the first aspect of the present application.
[0151] In one embodiment, the computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a compatible method for virtual machine migration is implemented.
[0152] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the compatible method for virtual machine migration provided in any embodiment of the first aspect of the present application.
[0153] The computer readable storage medium may be Figure 4 A computer-readable storage medium in the computer device shown.
[0154] Those skilled in the art will understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0155] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0156] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.
Claims
1. A compatible method for virtual machine migration, characterized in that: The method comprises: In response to the completion of the virtual machine migration, starting the virtual machine through the pre-created winPE image file; In response to the virtual machine entering the WinPE system, obtaining a system registry file of the virtual machine; Adding the pre-created driver installation service configuration information to the system registry file of the virtual machine through the WinPE system; Determine the system partition of the virtual machine according to the disk partition where the system registry file of the virtual machine is located, and add the driver installation file in the WinPE system to the system partition; The driver installation file in the system partition is obtained through the driver installation service, and the driver of the virtual machine is installed according to the driver installation file to achieve compatibility of the virtual machine migration.
2. The method according to claim 1, characterized in that The method further comprises: Mounting the system registry file of the virtual machine to the registry editor of the winPE system; The step of adding the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system includes: The configuration information of the driver installation service is added to the system registry file of the virtual machine through the registry editor of the winPE system.
3. The method according to claim 1, characterized in that After adding the driver installation file in the WinPE system to the system partition, the method further includes: Controlling the virtual machine to shut down; Before obtaining the driver installation file in the system partition through the driver installation service, the method further includes: Restarting the virtual machine from the system partition of the virtual machine; The method further comprises: Adding the driver installation script pre-integrated in the WinPE system to the system partition of the virtual machine; The obtaining the driver installation file in the system partition through the driver installation service and installing the driver of the virtual machine according to the driver installation file includes: The driver installation file and the driver installation script in the system partition are obtained through the driver installation service, and the driver installation file is run according to the driver installation script to install the driver of the virtual machine.
4. The method according to claim 3, characterized in that The method further comprises: Adding the configuration information of the pre-created disk repair service to the system registry file of the virtual machine through the WinPE system; After restarting the virtual machine from the system partition of the virtual machine, starting the disk repair service according to the configuration information of the disk repair service; Scanning each disk corresponding to the virtual machine through the disk repair service to obtain current partition information of the disk; Obtaining original partition information of the disk before migration of the virtual machine; The current partition information of the disk is compared with the corresponding original partition information. When the comparison results are inconsistent, the current partition information is adjusted according to the difference information obtained from the comparison and the original partition information.
5. The method according to claim 1, characterized in that The system registry file of the virtual machine includes a software configuration file and a system configuration file, and obtaining the system registry file of the virtual machine includes: Scan the directories in each disk partition of the virtual machine and the file identifiers in the directories; Acquire the software configuration file and the system configuration file according to the directory and the file identifier in the directory; The step of adding the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system includes: Adding the pre-created driver installation service configuration information to the software configuration file through a registry operation command in the WinPE system; The method further comprises: Modify the user permission configuration item in the system configuration file to enable the user permission for driver installation.
6. The method according to claim 1, characterized in that The step of starting the virtual machine by using a pre-created winPE image file includes: Mount the WinPE image file to the optical drive of the virtual machine; The virtual machine is started from the optical drive of the virtual machine to start the virtual machine through the WinPE image file.
7. The method according to claim 3, characterized in that Before restarting the virtual machine from the system partition of the virtual machine, the method further includes: Detecting the state of the virtual machine, and when detecting that the virtual machine is shut down, uninstalling the winPE image file; After performing the compatibility of the virtual machine migration, the method further includes: Restoring the system registry file of the virtual machine; Clear the driver installation file and close the driver installation service.
8. A compatible device for virtual machine migration, characterized in that: The device comprises: A creation module is used to start the virtual machine through a pre-created winPE image file in response to completion of the virtual machine migration; An acquisition module, configured to acquire a system registry file of the virtual machine in response to the virtual machine entering the WinPE system; An adding module is used to add the configuration information of the pre-created driver installation service to the system registry file of the virtual machine through the WinPE system; A modification module, configured to determine the system partition of the virtual machine according to the disk partition where the system registry file of the virtual machine is located, and add the driver installation file in the WinPE system to the system partition; A compatibility module is used to obtain the driver installation file in the system partition through the driver installation service, and install the driver of the virtual machine according to the driver installation file to achieve compatibility with the migration of the virtual machine.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.