Upgrading method and device of virtualization manager and storage medium
By passing the memory address of the virtual instance status information between the original virtualization manager and the new virtualization manager during the KVM hot upgrade process, the problem of long virtual machine pause time is solved, and the virtual instance pause time is lower and the virtual instance pause time and more stable user service is achieved.
Patent Information
- Application Number
- CN202311206139.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2025-03-18
AI Technical Summary
During the KVM hot upgrade process, the virtual machine pause time is longer, resulting in greater user service jitter.
By passing the memory address of the virtual instance status information between the original virtualization manager and the upgraded new virtualization manager during the virtualization manager upgrade process, instead of directly copying the status information, it reduces the amount of data replication and reduces the state recovery time.
Reduces the pause time of virtual instances during the virtualization manager upgrade, reduces jitter in user applications, and ensures service performance.
Smart Images

Figure CN119645444A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for upgrading a virtualization manager. Background Art
[0002] In the cloud computing scenario, tenants as cloud users expect virtual machines to run their applications uninterruptedly and stably. As a core virtualization component, the kernel-based virtual machine (KVM) often releases new versions to fix security vulnerabilities, functional problems, etc. This requires cloud vendors to have the ability to hot-upgrade this component, that is, the operation of the virtual machine cannot be terminated during the KVM upgrade, and the virtual machine cannot be suspended for a long time to avoid causing obvious jitter to user services.
[0003] During the traditional KVM hot upgrade process, the virtual machine operation is suspended for a long time, that is, a long virtual machine suspension time (Downtime) is generated. Summary of the invention
[0004] Multiple aspects of the present application provide a method, device, and storage medium for upgrading a virtualization manager, so as to reduce the pause time of a virtual instance during a hot upgrade of the virtualization manager.
[0005] The present application provides a method for upgrading a virtualization manager, including:
[0006] The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event;
[0007] The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; the virtual instance state information is the state information of the virtual instance;
[0008] The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager;
[0009] The second virtualization manager obtains the virtual instance state information according to the memory address information; and restores the state of the virtual instance in the second virtualization manager according to the virtual instance state information.
[0010] The embodiment of the present application also provides a method for upgrading a virtualization manager, wherein a first virtualization management component and a second virtualization management component of the virtualization manager for upgrading the first virtualization management component are running in a kernel state of a host machine; the method comprises:
[0011] A first virtualization management process running in a user state of the host machine creates a second virtualization management process in the user state in response to a virtualization manager upgrade event; the first virtualization management process cooperates with the first virtualization management component; the second virtualization management process cooperates with the second virtualization management component;
[0012] The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request sent by the first virtualization management process; and provides the memory address information of the virtual instance state information to the first virtualization management process;
[0013] The first virtualization management process provides the memory address information of the virtual instance state information to the second virtualization management process;
[0014] The second virtualization management component responds to the virtual instance state recovery request sent by the second virtualization management process, obtains the virtual instance state information according to the memory address information of the virtual instance state information contained in the virtual instance state recovery request; and restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0015] The embodiment of the present application also provides a method for upgrading a virtualization manager, wherein a first virtualization management component and a second virtualization management component of the virtualization manager for upgrading the first virtualization management component are running in a kernel state of a host machine; a first virtualization management process cooperating with the first virtualization management component is running in a user state of the host machine; the method comprises:
[0016] The first virtualization management process creates a second virtualization management process in the user state in response to the virtualization manager upgrade event; the second virtualization management process cooperates with the second virtualization management component;
[0017] The first virtualization management process suspends the operation of the virtual instance on the host machine;
[0018] The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state saving request sent by the first virtualization management process;
[0019] The first virtualization management component provides the memory address information of the virtual instance state information to the first virtualization management process, so that the first virtualization management process provides the memory address information to the second virtualization management process;
[0020] The second virtualization management component obtains the virtual instance state information according to the memory address information in the virtual instance state recovery request sent by the second virtualization management process;
[0021] The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0022] The embodiment of the present application further provides a computing device, which can be implemented as a host machine; the computing device includes: a memory and a processor; wherein the memory is used to store computer programs corresponding to the first virtualization manager and the second virtualization manager, and other computer programs;
[0023] The processor is coupled to the memory and is configured to execute a computer program stored in the memory to execute the steps in the above-mentioned method for upgrading the virtualization manager.
[0024] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned virtualization manager upgrade method.
[0025] In the embodiment of the present application, during the virtualization manager upgrade process, when the virtual instance state is saved and restored, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the upgraded new virtualization manager. Compared with the traditional solution in which the virtual instance state information needs to be copied back and forth between the user-state virtualization management process and the kernel-state virtualization manager, the amount of data copied between the original virtualization manager and the new virtualization manager is reduced, and the time overhead in the virtual instance state recovery process is reduced, which helps to reduce the pause time of the virtual instance caused by the virtualization manager upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0027] Figure 1 A schematic diagram of the process of performing KVM hot upgrade for the traditional KVM hot upgrade solution;
[0028] Figure 2a A schematic diagram of the internal structure of the host machine and a schematic diagram of the upgrade process of the virtualization manager provided in the embodiment of the present application;
[0029] Figure 2bAnother schematic diagram of the internal structure of the host machine and a schematic diagram of the upgrade process of the virtualization manager provided in an embodiment of the present application;
[0030] Figure 3 A detailed process diagram of the upgrade process of the virtualization manager provided in an embodiment of the present application;
[0031] Figure 4a and Figure 4b A flowchart of a method for upgrading a virtualization manager provided in an embodiment of the present application;
[0032] Figure 5 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0034] A Virtual Machine Monitor (VMM) is a computer program that runs on a host system and implements virtualization management functions. VMM generally includes: a simulator QEMU process and a kernel-based virtual machine management component (KVM).
[0035] Among them, KVM is a virtualization component used in the kernel. The main functions of KVM are to realize central processing unit (CPU) virtualization, memory virtualization and interrupt virtualization. After the operating system loads the KVM module, the user cannot directly control the operation of the kernel module, so other tools need to be used to create a virtual machine.
[0036] QEMU is a process running in user mode. The virtual machine runs in the QEMU process, and a virtual CPU (Virtual CPU, VCPU) of the virtual machine corresponds to a thread of the QEMU process. The memory used by the virtual machine is requested by the QEMU process on the host machine. In addition, the QEMU process is also responsible for the simulation of virtual machine devices (such as network cards, keyboards, and mice).
[0037] However, QEMU has poor performance when running independently. By using the interfaces provided by KVM through some hardware virtualization functions, high performance can be achieved during runtime. QEMU opens or closes the / dev / kvm device interface file through the open() command or close(), and calls the interface function provided by KVM through the device input / output control (ioctl) interface ioctl(), so as to apply KVM's CPU virtualization, memory virtualization, and IO virtualization functions based on hardware-assisted virtualization technology.
[0038] The hot upgrade of the virtual machine manager is divided into QEMU hot upgrade and KVM hot upgrade. This application focuses on KVM hot upgrade. KVM hot upgrade means that during the KVM upgrade process, the operation of the virtual machine is not terminated, and the virtual machine is not suspended for a long time, so as to avoid interrupting the user services deployed on the virtual machine, thereby avoiding obvious jitter to the user services deployed on the virtual machine.
[0039] like Figure 1 The traditional KVM hot upgrade solution shown in the figure usually adopts the idea of local hot migration. Among them, the QEMU process runs in the user state of the host machine, and the KVM runs in the kernel state of the host machine. The new KVM is a KVM that upgrades the original KVM, which is generally loaded into the kernel state by the KVM operation and maintenance personnel. Among them, the kernel state and the user state are two different operating states of the operating system. In the kernel state, the operating system program can be run and the hardware can be operated; while in the user state, only the application program can be run.
[0040] like Figure 1 As shown in the figure, the traditional KVM hot upgrade solution mainly includes the following steps:
[0041] Step 1: The original QEMU process can create a new QEMU process in response to the KVM hot upgrade instruction; and load the new QEMU binary file in the new QEMU process to implement the QEMU hot upgrade.
[0042] The KVM hot upgrade instruction is generally issued by the hot upgrade management component in the user state. The hot upgrade management component can be triggered by the operation and maintenance personnel to issue the KVM hot upgrade instruction to the original QEMU process. Alternatively, the hot upgrade management component can periodically issue the KVM hot upgrade instruction to the original QEMU process.
[0043] Step 2: The new QEMU process opens a new KVM and creates a structure object related to the virtual machine (VM) in the new KVM, that is, a new VM is created in the new KVM. The structure object is a data structure used to store the state information of the VM, such as kvm, kvm_vcpu, kvm_device, etc. The structure object in step 2 is in the initial state, which is used to store the state information of the VM.
[0044] After the new QEMU completes creating the new VM, it replies to the original QEMU with a message that the virtual machine creation is complete.
[0045] Step 3: The original QEMU process responds to the virtual machine creation completion message and suspends the operation of the virtual machine on the host machine.
[0046] Step 4: The original KVM synchronizes the virtual machine status information in the original KVM to the original QEMU process through a large number of device input / output control (IOCTL) instructions. The virtual machine status information includes: CPU register status, status of devices on the motherboard where the CPU is located, etc. The devices on the motherboard where the CPU is located include but are not limited to: interrupt controllers, interrupt-related devices, and other devices.
[0047] The synchronization of the status information recorded in a CPU register corresponds to one IOCTL call. The synchronization of the status of a device also corresponds to one IOCTL call. There are a large number of CPU registers and devices. Synchronizing the virtual machine status information to the original QEMU also requires a large number of IOCTL calls.
[0048] Step 5: The original QEMU process serializes the state information of the virtual machine and the state information of the virtual machine's simulated devices (such as the network card, keyboard, mouse, etc.), and saves the serialized state information in the user state memory space. The new QEMU process can obtain the serialized state information from the user state memory space; and deserialize the serialized state information to obtain the above virtual machine state information and the state information of the virtual machine's simulated devices.
[0049] Step 6: The new QEMU process transmits the virtual machine state information to the new KVM through a large number of IOCTL calls. The new KVM restores the state of the virtual machine according to the virtual machine state information, that is, restores the state of each structure object in the new KVM.
[0050] Step 7: The new QEMU process resumes the operation of the virtual machine. The original QEMU releases the occupied resources and exits.
[0051] According to the above-mentioned traditional KVM hot upgrade process, it can be seen that steps 4-6 of the traditional KVM hot upgrade are all completed when the virtual machine is suspended. The above-mentioned steps 4-6 involve a large number of IOCTL calls and multiple data replications. These operations increase the suspension time of the virtual machine, making the downtime of the KVM hot upgrade longer, resulting in greater jitter of user applications deployed on the virtual machine. Among them, the downtime of the KVM hot upgrade refers to the length of time the virtual machine is suspended during the KVM hot upgrade.
[0052] In order to reduce the pause time of the virtual machine during the KVM hot upgrade process, in some embodiments of the present application, during the virtualization manager upgrade process, when the virtual instance state is saved and restored, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the upgraded new virtualization manager. Compared with the traditional solution in which the virtual instance state information needs to be copied back and forth between the user-state virtualization management process and the kernel-state virtualization manager, the amount of data copied between the original virtualization manager and the new virtualization manager is reduced, and the time overhead in the virtual instance state recovery process is reduced, which helps to reduce the pause time of the virtual instance caused by the virtualization manager upgrade.
[0053] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0054] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.
[0055] Figure 2a The schematic diagram of the internal system structure of the host machine provided in the embodiment of the present application. The host machine can be implemented as any computer device with computing, storage and other functions, such as a server or terminal device. The terminal device can be a computer, workstation or mobile phone.
[0056] A virtualization manager is deployed on the host machine. A virtualization manager refers to a computer program that manages virtualization instances, which can be implemented as software function modules or plug-ins. A virtualization instance refers to multiple virtual servers deployed on a host machine using virtual machine technology, which can provide different services. A virtualization instance can be a virtual machine (VM), a container, or a container group (such as Pod, etc.). A virtualization instance can also be called a client (Guest). The host machine operating system is responsible for allocating hardware resources among multiple virtualization instances, making multiple virtualization instances independent of each other. The operating system of the virtualization instance can communicate with the hardware through the virtualization manager. Different implementation forms of virtualization instances have different virtualization managers.
[0057] For example, in an embodiment where the virtualization instance is a container or a container group, the operating system virtualization architecture can be used to divide a single operating system of the host into multiple containers, and the container manager can be used to manage them. Multiple refers to 2 or more. Accordingly, the virtualization manager is implemented as a container manager.
[0058] For another example, in an embodiment where the virtualization instance is a virtual machine, the underlying hardware resources are no longer divided, but a virtual machine monitor (VMM) is installed on the host machine's operating system. The virtual layer exists as application-level software and does not involve the operating system kernel. The virtual layer simulates a set of independent hardware devices for each virtual machine, including hardware resources such as processors, memory, motherboards, graphics cards, and network cards, and installs the client operating system on them. Accordingly, the virtualization manager is implemented as a VMM.
[0059] The virtualization manager often releases new versions to fix security vulnerabilities, functional issues, etc., which requires hot upgrades of the virtualization manager. Hot upgrades of the virtualization manager mean that during the upgrade of the virtualization manager, the operation of the virtual instance is not terminated, and the virtual instance does not generate a large virtual machine downtime during the virtualization manager upgrade, so as to avoid obvious jitters for user applications deployed on the virtual instance. The downtime of the virtual instance refers to the length of time the virtual instance is suspended during the virtualization manager upgrade.
[0060] The following is an exemplary description of the upgrade process of the virtualization manager provided in the embodiment of the present application.
[0061] like Figure 2a As shown, when the virtualization manager needs to be upgraded, the computer program corresponding to the new virtualization manager that upgrades the virtualization manager currently running in the host machine can be loaded into the host machine to obtain a new virtualization manager. In the embodiment of the present application, for the convenience of description and distinction, the virtualization manager originally running on the host machine is defined as the first virtualization manager S10; the new virtualization manager that upgrades the first virtualization manager is defined as the second virtualization manager S20.
[0062] During the virtualization manager upgrade process, the virtual instance state information in the first virtualization manager S10 needs to be synchronized to the second virtualization manager S20, and then the second virtualization manager S20 manages the virtual instance on the host. The virtual instance state information refers to the state information of the virtual instance on the host, including but not limited to: the state information of the virtual processor corresponding to the virtual instance (such as the state information recorded by each register corresponding to the virtual processor) and the state information of the device on the mainboard (such as the state information of the interrupt controller and other interrupt-related devices).
[0063] During the virtualization manager upgrade process, the faster the state of the virtual instance is restored in the second virtualization manager, the shorter the suspension time of the virtual instance, and the smaller the jitter of the user application on the virtual instance. In the embodiment of the present application, in order to reduce the suspension time of the virtual instance, the first virtualization manager S10 can respond to the virtualization manager upgrade event and suspend the operation of the virtual instance on the host machine (corresponding to Figure 2a Step 1).
[0064] The virtualization manager upgrade event can be an upgrade management component running in user mode ( Figure 2a The upgrade management component can implement a software function module or plug-in for managing the virtualization management upgrade. The upgrade management component can detect whether the host machine has a new virtualization manager; and when a new virtualization manager is detected, a virtualization manager upgrade event is triggered, and a process creation instruction ( Figure 2a Alternatively, after loading the second virtualization manager into the host machine, the operation and maintenance personnel can use the calling interface provided by the upgrade management component to call the upgrade management component to trigger the virtualization manager upgrade event. In response to the virtualization manager upgrade event, the upgrade management component issues a process creation instruction to the first virtualization manager.
[0065] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization manager S20, and the operation of the virtual instance can be resumed in the second virtualization manager S20 to achieve a hot upgrade of the virtualization manager. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization manager S20, the virtual instance state information in the first virtualization manager S10 is saved to the target memory of the host machine (corresponding to Figure 2a Step 2). Specifically, the first virtualization manager S10 may apply for the target memory in the host machine; and save the virtual instance state information in the first virtualization manager S10 to the target memory. Further, the first virtualization manager S10 may provide the memory address information of the virtual instance state information to the second virtualization manager S20 (corresponding to Figure 2a Step 3). The memory address information of the virtual instance state information may be the starting address and length of the virtual instance state information in the kernel state memory space.
[0066] Accordingly, the second virtualization manager S20 can obtain the memory address information of the target memory, and obtain the virtual instance state information from the target memory according to the memory address information of the target memory. Further, the second virtualization manager S20 can restore the state of the virtual instance in the second virtualization management component S20 according to the virtual instance state information, thereby realizing the hot upgrade of the virtualization manager (corresponding to Figure 2aStep 4).
[0067] In the process of preserving and restoring the virtual instance state in the traditional solution, the virtual instance state information needs to be copied back and forth between the original virtualization manager and the new virtualization manager, and the virtual instance state information also needs to be copied back and forth between the virtualization management process in the user state and the virtualization manager in the kernel state, and a large amount of data copying takes a long time. In this embodiment, during the process of preserving and restoring the virtual instance state, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the new virtualization manager, which reduces the amount of data copied between the original virtualization manager and the new virtualization manager, reduces the virtual instance pause time caused by the virtualization manager upgrade, and thus reduces the jitter of user applications on the virtual instance, ensuring service performance.
[0068] In the embodiments of the present application, Figure 2b As shown, the host machine is divided into user state and kernel state. Kernel state and user state are two different operating states of the operating system. In kernel state, operating system programs can be run and hardware can be operated; while in user state, only application programs can be run. Accordingly, the virtualization manager includes: a virtualization management process 10 deployed in user state and a virtualization management component 20 deployed in kernel state.
[0069] The virtualization management component 20 deployed in the kernel state is a virtualization component used in the kernel, and its main function is to realize processor virtualization, memory virtualization, interrupt virtualization, etc. After the operating system loads the virtualization management component 20, since the user cannot directly control the operation of the kernel module, other tools need to be used to create a virtual machine.
[0070] The virtualization management process 10 is a process running in user mode. The virtual machine runs in the virtualization management process 10, and a virtual processor of the virtual machine corresponds to a thread of the virtualization management process. The memory used by the virtual machine is applied for by the virtualization management process on the host machine. In addition, the virtualization management process is also responsible for simulating virtual machine devices (such as network cards, keyboards, and mice).
[0071] However, the performance of the virtualization management process is poor when it runs independently. The virtualization management component 20 can be used to provide interfaces through some hardware virtualization functions to achieve high performance during runtime.
[0072] In some embodiments, the virtualization management component 20 may be KVM. Accordingly, the virtualization management process 10 may be a QEMU process. QEMU opens or closes the / dev / kvm device interface file through the open() command or close(), and calls the interface function provided by KVM through the device input / output control (ioctl) interface ioctl(), so as to apply the CPU virtualization, memory virtualization and IO virtualization functions implemented by KVM based on hardware-assisted virtualization technology. That is, the user-state virtualization management process 10 and the kernel-state virtualization management component 20 work together to manage the virtual instances on the host machine.
[0073] The virtualization manager often releases new versions to fix security vulnerabilities, functional problems, etc., which requires hot upgrades of the virtualization manager. Hot upgrades of the virtualization manager are divided into hot upgrades of the virtualization management process and hot upgrades of the virtualization management components deployed in the kernel state. This application focuses on the hot upgrade of the virtualization management components deployed in the kernel state.
[0074] When the virtualization management component 20 running in the kernel state needs to be upgraded, the computer program corresponding to the new virtualization management component for upgrading the virtualization management component 20 currently running in the kernel state can be loaded into the kernel state to obtain a new virtualization management component deployed in the kernel state. In the embodiment of the present application, for the convenience of description and distinction, the virtualization management component originally running in the kernel state of the host machine is defined as the first virtualization management component 201; the new virtualization management component for upgrading the first virtualization management component is defined as the second virtualization management component 202.
[0075] During the kernel-state virtualization management component upgrade process, it is necessary to synchronize the virtual instance state information in the first virtualization management component 201 to the second virtualization management component 202, and then the second virtualization management component 202 manages the virtual instance on the host. The virtual instance state information refers to the state information of the virtual instance on the host, including but not limited to: the state information of the virtual processor corresponding to the virtual instance (such as the state information recorded by each register corresponding to the virtual processor) and the state information of the device on the mainboard (such as the state information of the interrupt controller and other interrupt-related devices).
[0076] During the upgrade process of the virtualization management component 20 in the kernel state, the faster the state of the virtual instance is restored in the second virtualization management component 202, the shorter the suspension time of the virtual instance, and the smaller the jitter of the user application on the virtual instance. Figure 2b and Figure 3, the original virtualization management process in the user state can respond to the virtualization manager upgrade event and create a new virtualization management process in the user state (corresponding to Figure 2b Step 1 and Figure 3 In the embodiment of the present application, for the convenience of description and distinction, the original virtualization management process in the user state is defined as the first virtualization management process 101; and the new virtualization management process created by the first virtualization management process 101 is defined as the second virtualization management process 102.
[0077] like Figure 3 As shown, the virtualization manager upgrade event can be triggered by the upgrade management component 30 running in the user state. The upgrade management component 30 can implement a software function module or plug-in for managing the virtualization management upgrade. The upgrade management component 30 can detect whether there is a new virtualization management component in the kernel state of the host machine; and when a new virtualization management component is detected, the virtualization manager upgrade event (corresponding to Figure 3 Step 1), and issue a process creation instruction to the first virtualization management process 101 (corresponding to Figure 3 Alternatively, after loading the second virtualization management component 202 into the kernel state, the operation and maintenance personnel can use the calling interface provided by the upgrade management component 30 to call the upgrade management component 30 to trigger the virtualization manager upgrade event. In response to the virtualization manager upgrade event, the upgrade management component 30 issues a process creation instruction to the first virtualization management process 101.
[0078] For the first virtualization management process 101, the virtualization manager upgrade event is implemented as receiving a process creation instruction issued by the upgrade management component 30. Further, the first virtualization management process 101, in response to the process creation instruction, creates a second virtualization management process 102 (corresponding to Figure 3 In step 3), the second virtualization management process 102 cooperates with the second virtualization management component 202 to manage the virtual instance on the host machine.
[0079] In some embodiments, the first virtualization management process 101 may create a child process of the first virtualization management process 101 in the user state in response to the virtualization manager upgrade event; and load the binary file of the virtualization management process in the child process to obtain the second virtualization management process 102 (corresponding to Figure 3 Step 3).
[0080] Specifically, Figure 3As shown in step 3, the first virtualization management process 101 can call a replica function (such as a fork function) to create a child process of the first virtualization management process 101 in response to the virtualization manager upgrade event. The first virtualization management process 101 is the parent process, and the created process is called a child process. Since the fork function will copy the memory image of the parent process, the new process will receive a copy of the data in the parent process address space. After the fork function, the two processes will continue to execute the subsequent instructions in their own memory space.
[0081] In this embodiment, the fork function creates a copy process (i.e., a child process) of the calling process (i.e., the first virtualization management process 101), but many applications require the child process to execute different codes from its parent process. The exec function provides the function of overwriting the image of the calling process (i.e., the parent process) with a new image. The combined use of the fork-exec function allows the child process (using the exec function) to execute the new program while the parent process continues to execute the original program. Accordingly, if Figure 3 As shown in step 3, the first virtualization management process 101 may call the exec function to load the binary file of the virtualization management process in the child process to obtain the second virtualization management process 102.
[0082] Among them, if there is a new version of the binary file in the user state of the host machine, the binary file of the virtualization management process loaded in the child process is the new version of the binary file. At this time, the second virtualization management process is the virtualization management process upgraded from the first virtualization management process, and the virtualization management process has been upgraded. If there is no new version of the binary file in the user state of the host machine, the binary file of the virtualization management process loaded in the child process is the binary file corresponding to the original virtualization management process (i.e., the first virtualization management process), and the virtualization management process has not been upgraded.
[0083] In this embodiment, the second virtualization management process 102 cooperates with the second virtualization management component 202 in the kernel state to manage the virtual instance. Specifically, the upgrade management component 30 may carry the identifier of the second virtualization management component 202 in the process creation instruction, and the first virtualization management process 101 may provide the identifier of the second virtualization management component 202 to the second virtualization management process 102 during the process of creating the second virtualization management process 102.
[0084] Based on the identifier of the second virtualization management component 202, the second virtualization management process 102 may open the second virtualization management component 202. Further, the second virtualization management process 102 may create a structure object associated with the virtual instance in the second virtualization management component 202 (corresponding to Figure 3The structure object associated with the virtual instance refers to a data structure in the virtualization management component 20 in the kernel state for recording the state information of the virtual instance, including but not limited to: a data structure for recording the state information of the register associated with the virtual processor corresponding to the virtual instance and a data structure for recording the state information of the virtual device corresponding to the virtual instance.
[0085] Specifically, the second virtualization management process 102 may obtain the interface (such as / dev / kvm interface) provided by the second virtualization management component 202 to the user state according to the identifier of the second virtualization management component 202, and the second virtualization management process 102 may open the interface (such as / dev / kvm interface) provided by the second virtualization management component 202 to the user state through an open command (such as an open() command) to open the second virtualization management component 202. The second virtualization management component 202 may return a file handle to the second virtualization management process 102. The second virtualization management process 102 may create a structure object associated with the virtual instance in the second virtualization management component 202 according to the file handle.
[0086] Specifically, the second virtual management process 102 can create a structure object associated with the virtual instance in the second virtualization management component 202 through an IOCTL instruction. The IOCTL instruction includes: a command and a file handle instructing the second virtualization management component 202 to execute. The IOCTL instruction can be IOCTL (fd1, cmd). fd1 is a file handle; cmd is a command instructing the second virtualization management component 202 to execute, and the command here is a creation command cmd. Accordingly, the second virtualization management component 202 can respond to the IOCTL instruction and create a structure object associated with the virtual instance in the second virtualization management component 202. The structure object associated with the virtual instance created at this time is the initial state of the virtual processor and device corresponding to the virtual instance, and can be used to run a new virtual instance.
[0087] After the structure object associated with the virtual instance is completed, the second virtual management process 102 can return a structure object creation completion message (corresponding to Figure 3 The first virtual management process 101 may suspend the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event (corresponding to Figure 2b Step 2 and Figure 3 Specifically, the first virtual management process 101 may suspend the operation of the virtual instance on the host machine after the structure object associated with the virtual instance is completed (corresponding to Figure 2b Step 2 and Figure 3Specifically, after receiving the structure object creation completion message, the first virtual management process 101 may suspend the operation of the virtual instance on the host machine.
[0088] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization management component 202, and the operation of the virtual instance can be resumed in the second virtualization management component 202, so as to realize the hot upgrade of the virtualization management component in the kernel state. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization management component 202, the first virtualization management process 101 can request the first virtualization management component 201 to save the state information of the virtual instance after the virtual instance is suspended. Specifically, the first virtualization management process 101 can send a virtual instance state save request (corresponding to the request to save the virtual instance state) to the first virtualization management component 201 after the virtual instance is suspended. Figure 2b Step 3 and Figure 3 Step 7).
[0089] Accordingly, the first virtualization management component 201 saves the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state (corresponding to Figure 2b Step 4 and Figure 3 Specifically, the first virtualization management component 201 responds to the virtual instance state save request, applies for the target memory in the kernel state, and saves the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state. Further, the first virtualization management component 201 can provide the memory address information of the virtual instance state information to the first virtualization management process 101 (corresponding to Figure 2b Step 5 and Figure 3 In step 9), the memory address information of the virtual instance state information may be the starting address and length of the virtual instance state information in the kernel state memory space.
[0090] In some embodiments, after the virtual instance is suspended, the first virtualization management process 101 may send a virtual instance state saving request to the first virtualization management component 201 through an IOCTL instruction. Accordingly, the virtual instance state saving request may be implemented as an IOCTL instruction, and the IOCTL instruction is used to request the first virtualization management component 201 to save the virtual instance state information. The IOCTL instruction may include: a save command instructing the first virtualization management component 201 to save the virtual instance state information, such as a save command, and may also include a file handle fd0 provided by the first virtualization management component 201. Accordingly, the first virtualization management component 201 may respond to the IOCTL instruction, save the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state; and return the memory address information of the virtual instance state information to the first virtualization management process 101 as the call result of the IOCTL instruction.
[0091] Optionally, the first virtualization management component 201 may respond to the IOCTL instruction and serialize the virtual instance state information in the first virtualization management component 201 to obtain serialized virtual instance state information (corresponding to Figure 3 Step 8 in the above). In this embodiment, serializing the virtual instance state information in the first virtualization management component 201 mainly refers to converting the virtual instance state information into a correspondence between a structure object and the state information of each structure object, so that when the virtual instance state is migrated to the second virtualization management component 202, the second virtualization management component 202 can determine which state information corresponds to which field of the structure object of the virtual instance based on the serialized virtual instance state information. Optionally, the correspondence between the structure object and the state information of each structure object can be implemented as a key-value pair (Key-Value, KV) structure. Among them, the field identifier of the structure object is a key (Key), and the state information corresponding to the field of the structure object is a value (Value).
[0092] Accordingly, the first virtualization management component 201 can return the memory address information of the serialized virtual instance state information to the first virtualization management process 101 (corresponding to Figure 3 Step 9).
[0093] Further, the first virtualization management process 101 may provide the memory address information of the virtual instance state information to the second virtualization management process 102 (corresponding to Figure 2b Step 6 and Figure 3The second virtualization management process 102 may request the second virtualization management component 202 to restore the virtual instance state based on the memory address information of the virtual instance state information. Specifically, the second virtualization management process 102 may send a virtual instance state restoration request to the second virtualization management component 202, and the virtual instance state restoration request includes the memory address information of the virtual instance state information (corresponding to Figure 2b Step 7 and Figure 3 Step 11).
[0094] Accordingly, the second virtualization management component 202 may respond to the virtual instance state recovery request and obtain the virtual instance state information (corresponding to the virtual instance state address information) from the target memory in the kernel state according to the memory address information of the virtual instance state information contained in the request. Figure 2b Step 7 and Figure 3 Step 12).
[0095] In some embodiments, the second virtualization management process 102 may send a virtual instance state recovery request to the second virtualization management component 202 through an IOCTL instruction. Accordingly, the virtual instance state recovery request may be implemented as an IOCTL instruction, and the IOCTL instruction is used to request the second virtualization management component 202 to restore the virtual instance state information. The IOCTL instruction may include: a recovery command instructing the second virtualization management component 202 to restore the virtual instance state information, such as a restore command, and may also include a file handle fd1 provided by the second virtualization management component 202 and memory address information of the virtual instance state information.
[0096] Accordingly, the second virtualization management component 202 may respond to the IOCTL instruction, obtain the memory address information of the virtual instance state information, and obtain the virtual instance state information from the target memory in the kernel state according to the memory address information of the virtual instance state information included in the request.
[0097] For the embodiment in which the virtual instance state information is stored in the target memory in the kernel state in a serialized form, the second virtualization management component 202 can obtain the serialized virtual instance state information from the target memory in the kernel state according to the memory address information of the serialized virtual instance state information; and deserialize the serialized virtual instance state information to obtain the virtual instance state information (corresponding to Figure 3 Step 12).
[0098] In this embodiment, the kernel-state virtualization management component can directly serialize and deserialize the virtual instance state information in the kernel state, skipping the process in which the user-state virtualization management process directly serializes and deserializes the virtual instance state information in the user state, thereby reducing the processing time of the virtual instance state information, reducing the pause time of the virtual instance during the hot upgrade of the kernel-state virtualization management component, reducing the jitter of the user application on the virtual instance, and ensuring service performance.
[0099] Further, the second virtualization management component 202 can restore the state of the virtual instance in the second virtualization management component 202 according to the virtual instance state information, thereby realizing the hot upgrade of the virtualization management component in the kernel state (corresponding to Figure 2b Step 8 and Figure 3 Step 13).
[0100] Specifically, the second virtualization management component 202 may assign values to the structure objects in the second virtualization management component 202 according to the virtual instance state information, thereby restoring the state of the virtual instance in the second virtualization management component 202 .
[0101] In this embodiment, during the upgrade of the virtualization management component in kernel state, the original virtualization management process in user state sends a virtual instance state save request to the original virtualization management component, and the original virtualization management component responds to the request, saves the virtual instance state information to the memory space in kernel state, and returns the memory address of the virtual instance state information, so that the original virtualization management process saves the virtual instance state through a system call. Compared with the traditional solution of saving the virtual instance state through a large number of IOCTL type system calls, this embodiment can reduce the number of system calls in the process of saving the virtual instance state, thereby reducing the time overhead of the system call in the process of saving the virtual instance state, which helps to reduce the virtual instance pause time caused by the upgrade of the virtualization management component in kernel state, and can reduce the jitter of user applications on the virtual instance, and ensure service performance.
[0102] On the other hand, in this embodiment, the new virtualization management process in user state sends a virtual instance state recovery request containing the memory address of the virtual instance state information to the new virtualization management component. The new virtualization management component can obtain the virtual instance state information according to the memory address of the virtual instance state information, and restore the virtual instance state in the new virtualization management component, so that the new virtualization management process can restore the virtual instance state through a system call. Compared with the traditional solution of realizing recovery through a large number of IOCTL type system calls, this embodiment can reduce the number of system calls in the process of virtual instance state recovery, thereby reducing the time overhead of system calls in the process of virtual instance state recovery, which helps to reduce the virtual instance suspension time caused by the upgrade of the virtualization management component, and can further reduce the jitter of user applications on the virtual instance, ensuring service performance.
[0103] Furthermore, in the process of saving and restoring the virtual instance state in the traditional solution, the virtual instance state information needs to be copied back and forth between the virtualization management process in the user state and the virtualization management component in the kernel state, and copying a large amount of data takes a long time. In this embodiment, during the process of saving and restoring the virtual instance state, the memory address of the virtual instance state information is transmitted between the virtualization management process in the user state and the virtualization management component in the kernel state, which reduces the amount of data copied between the virtualization management process in the user state and the virtualization management component in the kernel state, can further reduce the virtual instance pause time caused by the virtualization management component upgrade, can reduce the jitter of the user application on the virtual instance, and ensure service performance.
[0104] In addition to the above-mentioned hot upgrade of the virtualization management component in kernel state, the embodiment of the present application also provides the decoupling of the upgrade of the virtualization management process in user state from the upgrade of the virtualization management component in kernel state, and can flexibly choose whether to upgrade the virtualization management process in user state when the virtualization management component in kernel state is hot upgraded. For example, a selection interface for whether to upgrade the virtualization management process in user state can be provided to the user, and the user can independently choose whether to upgrade the virtualization management process.
[0105] In this embodiment, after restoring the state of the virtual instance, the second virtualization management component 202 may return a restoration completion message to the second virtualization management process 102. Optionally, the second virtualization management component 202 may return the restoration completion message to the second virtualization management process 102 as the call result of the IOCTL instruction for requesting the second virtualization management component 202 to restore the state information of the virtual instance. For the embodiment of the virtualization management process that selects to upgrade the user state, the second virtualization management process 102 may respond to the restoration completion message and restore the operation of the virtual instance on the host machine.
[0106] For the embodiment of the virtualization management process that does not upgrade the user state, since the file handle of the upgraded second virtualization management component 202 is opened by the second virtualization management process 102, the first virtualization management process 101 needs to obtain the operation handle of the second virtualization management component 202 before operating the upgraded second virtualization management component 202. Based on this, the second virtualization management process 102 can provide the opened target file handle to the first virtualization management process 101 (for the restored file handle) in response to the recovery completion message. Figure 3 Step 14), and release the resources occupied by the second virtualization management process 102. The target file handle opened by the second virtualization management process 102 is the file handle provided by the opened second virtualization management component 202, including the file handle fd1 in the process of opening the second virtualization management component 202, and also including other file handles operated on the second virtualization management component 202.
[0107] After obtaining the target file handle, the first virtualization management process 102 may release the file handle of the original first virtualization management component 201 and continue to run based on the target file handle of the second virtualization management component 202. Specifically, the first virtualization management process 102 may resume the operation of the virtual instance on the host machine in the second virtualization management component 202 based on the target file handle (corresponding to Figure 2b Step 9 and Figure 3 Step 15).
[0108] Specifically, the first virtualization management process 102 sends an IOCTL instruction requesting to run the virtual instance to the second virtualization management component based on the target file handle. The IOCTL instruction may include a command requesting to run the virtual instance, such as a run command. The second virtualization management component 202 responds to the IOCTL instruction and resumes the operation of the virtual instance on the host in the second virtualization management component 202.
[0109] In this embodiment, by returning the file handle opened by the new virtualization management process to the original virtualization management process, it is possible to upgrade only the kernel-state virtualization management component while maintaining the original user-state virtualization management process, thereby improving the flexibility of virtualization manager operation and maintenance.
[0110] It is worth noting that the upgrade process of the above-mentioned virtualization management component can be applied to upgrading a single virtualization management component, and can also be applied to upgrading multiple virtualization management components at the same time. Multiple refers to 2 or more. The process of upgrading multiple virtualization management components at the same time is to upgrade each virtualization management component separately, and the upgrade process is the same as the upgrade process of a single virtualization management component. When multiple virtualization management components are upgraded at the same time, the new virtualization management component (i.e., the second virtualization management component) corresponding to each original virtualization management component (i.e., the first virtualization management component) can be the same or different, and the operation and maintenance personnel can flexibly set it according to actual needs.
[0111] In addition to the virtualization manager upgrade system provided in the above embodiment, the embodiment of the present application also provides a virtualization manager upgrade method. The following is an exemplary description of the virtualization manager upgrade method provided in the embodiment of the present application.
[0112] Figure 4a The following is a flow chart of a method for upgrading a virtualization manager provided in an embodiment of the present application. Figure 4a As shown, the method includes:
[0113] 41. In response to the virtualization manager upgrade event, the first virtualization manager suspends the operation of the virtual instance on the host machine.
[0114] 42. The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; the virtual instance state information is the state information of the virtual instance.
[0115] 43. The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager.
[0116] 44. The second virtualization manager obtains virtual instance state information according to the memory address information.
[0117] 45. The second virtualization manager restores the state of the virtual instance in the second virtualization manager according to the virtual instance state information.
[0118] The virtualization manager often releases new versions for reasons such as fixing security vulnerabilities and functional problems, which requires hot upgrading of the virtualization manager. When the virtualization manager needs to be upgraded, the computer program corresponding to the new virtualization manager that upgrades the virtualization manager currently running in the host machine can be loaded into the host machine to obtain a new virtualization manager. In the embodiment of the present application, for the convenience of description and distinction, the virtualization manager originally running on the host machine is defined as the first virtualization manager; the new virtualization manager that upgrades the first virtualization manager is defined as the second virtualization manager.
[0119] During the virtualization manager upgrade process, the virtual instance state information in the first virtualization manager needs to be synchronized to the second virtualization manager, and then the second virtualization manager manages the virtual instance on the host. For the description of the virtual instance state information, please refer to the relevant content of the above embodiment, which will not be repeated here.
[0120] During the virtualization manager upgrade process, the faster the state of the virtual instance is restored in the second virtualization manager, the shorter the suspension time of the virtual instance, and the smaller the jitter of the user application on the virtual instance. In the embodiment of the present application, in order to reduce the suspension time of the virtual instance, in step 41, the first virtualization manager can respond to the virtualization manager upgrade event and suspend the operation of the virtual instance on the host machine. For the description of the virtualization manager upgrade event, please refer to the relevant content of the above embodiment, which will not be repeated here.
[0121] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization manager, and the operation of the virtual instance can be resumed in the second virtualization manager to achieve a hot upgrade of the virtualization manager. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization manager, in step 42, the first virtualization manager can save the virtual instance state information in the first virtualization manager to the target memory of the host machine. Specifically, the first virtualization manager can apply for the target memory in the host machine; and save the virtual instance state information in the first virtualization manager to the target memory. Further, in step 43, the first virtualization manager can provide the memory address information of the virtual instance state information to the second virtualization manager. The memory address information of the virtual instance state information can be the starting address and length of the virtual instance state information in the kernel state memory space, etc.
[0122] Accordingly, in step 44, the second virtualization manager may obtain the memory address information of the target memory, and obtain the virtual instance state information from the target memory according to the memory address information of the target memory. Further, in step 45, the second virtualization manager may restore the state of the virtual instance in the second virtualization management component according to the virtual instance state information, thereby realizing the hot upgrade of the virtualization manager.
[0123] In the process of preserving and restoring the virtual instance state in the traditional solution, the virtual instance state information needs to be copied back and forth between the original virtualization manager and the new virtualization manager, and the virtual instance state information also needs to be copied back and forth between the virtualization management process in the user state and the virtualization manager in the kernel state, and a large amount of data copying takes a long time. In this embodiment, during the process of preserving and restoring the virtual instance state, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the new virtualization manager, which reduces the amount of data copied between the original virtualization manager and the new virtualization manager, reduces the virtual instance pause time caused by the virtualization manager upgrade, and thus reduces the jitter of user applications on the virtual instance, ensuring service performance.
[0124] In the embodiment of the present application, the host machine is divided into a user state and a kernel state. Accordingly, the virtualization manager includes: a virtualization management process deployed in the user state and a virtualization management component deployed in the kernel state. The hot upgrade of the virtualization manager is divided into the hot upgrade of the virtualization management process and the hot upgrade of the virtualization management component deployed in the kernel state. The following focuses on the hot upgrade of the virtualization management component deployed in the kernel state.
[0125] Figure 4b A flowchart of another method for upgrading a virtualization manager provided in an embodiment of the present application is shown below. Figure 4b As shown, the method mainly includes:
[0126] 401. In response to a virtualization manager upgrade event, a first virtualization management process creates a second virtualization management process in a user state; the second virtualization management process collaborates with a second virtualization management component.
[0127] 402. The first virtualization management process suspends the operation of the virtual instance on the host machine.
[0128] 403. The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request sent by the first virtualization management process.
[0129] 404. The first virtualization management component provides memory address information of the target memory to the first virtualization management process, so that the first virtualization management process provides the memory address information to the second virtualization management process.
[0130] 405. The second virtualization management component obtains virtual instance state information according to the memory address information in the virtual instance state recovery request sent by the second virtualization management process.
[0131] 406. The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0132] When the virtualization manager running in kernel state needs to be upgraded, the computer program corresponding to the new virtualization management component that upgrades the virtualization management component currently running in kernel state can be loaded into kernel state to obtain the new virtualization management component deployed in kernel state. In the embodiment of the present application, for the convenience of description and distinction, the virtualization management component originally running in the kernel state of the host machine is defined as the first virtualization management component; the new virtualization management component that upgrades the first virtualization management component is defined as the second virtualization management component.
[0133] During the kernel-state virtualization management component upgrade process, it is necessary to synchronize virtual instance state information in the first virtualization management component to the second virtualization management component, and then the second virtualization management component manages the virtual instance on the host machine.
[0134] In the embodiment of the present application, in order to reduce the suspension time of the virtual instance, in step 401, the original virtualization management process in the user state responds to the virtualization management component upgrade event and creates a new virtualization management process in the user state. In the embodiment of the present application, for the convenience of description and distinction, the original virtualization management process in the user state is defined as the first virtualization management process; and the new virtualization management process created by the first virtualization management process is defined as the second virtualization management process. The second virtualization management process cooperates with the second virtualization management component to manage the virtual instance on the host machine.
[0135] In some embodiments, the first virtualization management process creates a child process of the first virtualization management process in user mode in response to a virtualization manager upgrade event; and loads a binary file of the virtualization management process in the child process to obtain a second virtualization management process.
[0136] Specifically, the first virtualization management process responds to the virtualization manager upgrade event, calls a replica function (such as a fork function) to create a child process of the first virtualization management process; and controls the first virtualization management process to call an exec function to load the binary file of the virtualization management process in the child process to obtain a second virtualization management process.
[0137] Among them, if there is a new version of the binary file in the user state of the host machine, the binary file of the virtualization management process loaded in the child process is the new version of the binary file. At this time, the second virtualization management process is the virtualization management process upgraded from the first virtualization management process, and the virtualization management process has been upgraded. If there is no new version of the binary file in the user state of the host machine, the binary file of the virtualization management process loaded in the child process is the binary file corresponding to the original virtualization management process (i.e., the first virtualization management process), and the virtualization management process has not been upgraded.
[0138] In this embodiment, the second virtualization management process cooperates with the second virtualization management component in the kernel state to manage the virtual instance. Specifically, the second virtualization management process opens the second virtualization management component. Further, the second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component.
[0139] Specifically, the second virtualization management process can obtain the interface (such as / dev / kvm interface) provided by the second virtualization management component to the user state according to the identifier of the second virtualization management component. Further, the second virtualization management process opens the interface (such as / dev / kvm interface) provided by the second virtualization management component to the user state by using an open command (such as an open() command) to open the second virtualization management component to obtain the file handle (Filehandle) returned by the second virtualization management process. Further, the second virtualization management process can create a structure object associated with the virtual instance in the second virtualization management component according to the file handle.
[0140] Specifically, the second virtual management process creates a structure object associated with the virtual instance in the second virtualization management component through an IOCTL instruction. The IOCTL instruction includes: a command and a file handle for instructing the second virtualization management component to execute to create a data structure object. Correspondingly, the second virtualization management component responds to the IOCTL instruction and creates a structure object associated with the virtual instance in the second virtualization management component. The structure object associated with the virtual instance created at this time is the initial state of the virtual processor and device corresponding to the virtual instance, and can be used to run a new virtual instance.
[0141] After the second virtual management process completes the creation of the structure object associated with the virtual instance, it can return a structure object creation completion message to the first virtual management process. After the structure object associated with the virtual instance is completed, in step 402, the first virtual management process can suspend the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event. The above step 41 can be implemented as this step 402.
[0142] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization management component, and the second virtualization management component resumes the operation of the virtual instance, thereby realizing a hot upgrade of the virtualization management component in kernel state. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization management component, the above step 42 can be implemented as follows: after the virtual instance is suspended, the first virtualization management process can request the first virtualization management component to save the state information of the virtual instance. Specifically, after the virtual instance is suspended, the first virtualization management process can send a virtual instance state save request to the first virtualization management component.
[0143] Accordingly, in step 403, the first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request. Specifically, the first virtualization management component applies for the target memory in the kernel state in response to the virtual instance state save request; and saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state. Further, in step 404, the first virtualization management component may provide the memory address information of the target memory to the first virtualization management process.
[0144] In some embodiments, after the virtual instance is suspended, the first virtualization management process may send a virtual instance state save request to the first virtualization management component through an IOCTL instruction. Accordingly, the virtual instance state save request may be implemented as an IOCTL instruction, and the IOCTL instruction is used to request the first virtualization management component to save the virtual instance state information. The IOCTL instruction may include: a save command instructing the first virtualization management component to save the virtual instance state information, such as a save command, and may also include a file handle fd0 provided by the first virtualization management component. Accordingly, the first virtualization management component responds to the IOCTL instruction, saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state; and returns the memory address information of the virtual instance state information to the first virtualization management process as the call result of the IOCTL instruction.
[0145] Optionally, the first virtualization management component responds to the IOCTL instruction and serializes the virtual instance state information in the first virtualization management component to obtain serialized virtual instance state information. Further, the first virtualization management component returns the memory address information of the serialized virtual instance state information to the first virtualization management process as the call result of the IOCTL instruction.
[0146] Further, the first virtualization management process provides the memory address information of the target memory to the second virtualization management process. The second virtualization management process may request the second virtualization management component to restore the virtual instance state based on the memory address information of the target memory. Specifically, the second virtualization management process may send a virtual instance state recovery request to the second virtualization management component, and the virtual instance state recovery request includes the memory address information of the virtual instance state information.
[0147] Accordingly, in step 405, the second virtualization management component responds to the virtual instance state recovery request and obtains the virtual instance state information from the target memory in the kernel state according to the memory address information of the target memory included in the request.
[0148] In some embodiments, the second virtualization management process sends a virtual instance state recovery request to the second virtualization management component through an IOCTL instruction. Accordingly, the virtual instance state recovery request can be implemented as an IOCTL instruction, and the IOCTL instruction is used to request the second virtualization management component to restore the virtual instance state information. The IOCTL instruction may include: a recovery command instructing the second virtualization management component to restore the virtual instance state information, such as a restore command, and may also include a file handle fd1 provided by the second virtualization management component and memory address information of the virtual instance state information.
[0149] Correspondingly, the second virtualization management component responds to the IOCTL instruction, obtains the memory address information of the target memory, and obtains the virtual instance state information from the target memory in the kernel state according to the memory address information of the target memory included in the request.
[0150] For the above-mentioned embodiment in which the virtual instance status information is stored in a serialized form in the target memory in the kernel state, the second virtualization management component can be controlled to obtain the serialized virtual instance status information from the target memory in the kernel state according to the memory address information of the serialized virtual instance status information; and the serialized virtual instance status information can be deserialized to obtain the virtual instance status information.
[0151] In this embodiment, the kernel-state virtualization management component can directly serialize and deserialize the virtual instance state information in the kernel state, skipping the process in which the user-state virtualization management process directly serializes and deserializes the virtual instance state information in the user state, thereby reducing the processing time of the virtual instance state information, reducing the pause time of the virtual instance during the hot upgrade of the kernel-state virtualization management component, reducing the jitter of the user application on the virtual instance, and ensuring service performance.
[0152] Further, in step 406, the second virtualization management component may restore the state of the virtual instance in the second virtualization management component according to the virtual instance state information, thereby implementing a hot upgrade of the virtualization management component in kernel state.
[0153] Specifically, the second virtualization management component assigns a value to a structure object in the second virtualization management component according to the virtual instance state information, thereby restoring the state of the virtual instance in the second virtualization management component.
[0154] In this embodiment, during the upgrade of the virtualization management component in kernel state, the original virtualization management process in user state sends a virtual instance state save request to the original virtualization management component, and the original virtualization management component responds to the request, saves the virtual instance state information to the memory space in kernel state, and returns the memory address of the virtual instance state information, so that the original virtualization management process saves the virtual instance state through a system call. Compared with the traditional solution of saving the virtual instance state through a large number of IOCTL type system calls, this embodiment can reduce the number of system calls in the process of saving the virtual instance state, thereby reducing the time overhead of the system call in the process of saving the virtual instance state, which helps to reduce the virtual instance pause time caused by the upgrade of the virtualization management component, and can reduce the jitter of user applications on the virtual instance, and ensure service performance.
[0155] On the other hand, in this embodiment, the new virtualization management process in user state sends a virtual instance state recovery request containing the memory address of the virtual instance state information to the new virtualization management component. The new virtualization management component can obtain the virtual instance state information according to the memory address of the virtual instance state information, and restore the virtual instance state in the new virtualization management component, so that the new virtualization management process can restore the virtual instance state through a system call. Compared with the traditional solution of realizing recovery through a large number of IOCTL type system calls, this embodiment can reduce the number of system calls in the process of virtual instance state recovery, thereby reducing the time overhead of system calls in the process of virtual instance state recovery, which helps to reduce the virtual instance suspension time caused by the upgrade of the virtualization management component, and can further reduce the jitter of user applications on the virtual instance, ensuring service performance.
[0156] Furthermore, in the process of saving and restoring the virtual instance state in the traditional solution, the virtual instance state information needs to be copied back and forth between the virtualization management process in the user state and the virtualization management component in the kernel state, and copying a large amount of data takes a long time. In this embodiment, during the process of saving and restoring the virtual instance state, the memory address of the virtual instance state information is transmitted between the virtualization management process in the user state and the virtualization management component in the kernel state, which reduces the amount of data copied between the virtualization management process in the user state and the virtualization manager in the kernel state, can further reduce the virtual instance pause time caused by the upgrade of the virtualization management component, can reduce the jitter of the user application on the virtual instance, and ensure service performance.
[0157] In addition to the above-mentioned hot upgrade of the virtualization management component in kernel state, the embodiment of the present application also provides the decoupling of the upgrade of the virtualization management process in user state from the upgrade of the virtualization management component in kernel state, and can flexibly choose whether to upgrade the virtualization management process in user state when the virtualization management component in kernel state is hot upgraded. For example, a selection interface for whether to upgrade the virtualization management process in user state can be provided to the user, and the user can independently choose whether to upgrade the virtualization management process.
[0158] In this embodiment, after restoring the state of the virtual instance, the second virtualization management component may return a restoration completion message to the second virtualization management process. Optionally, the second virtualization management component returns the restoration completion message to the second virtualization management process as the call result of the above-mentioned IOCTL instruction for requesting the second virtualization management component to restore the virtual instance state information. For the embodiment of the virtualization management process that selects to upgrade the user state, the second virtualization management process may respond to the restoration completion message and restore the operation of the virtual instance on the host machine.
[0159] For the embodiment of the virtualization management process in the user state that is not upgraded, since the file handle of the upgraded second virtualization management component is opened by the second virtualization management process, the original first virtualization management process needs to obtain the operation handle of the second virtualization management component before operating the upgraded second virtualization management component. Based on this, the second virtualization management process responds to the recovery completion message, provides the opened target file handle to the first virtualization management process, and releases the resources occupied by the second virtualization management process.
[0160] After the first virtualization management process obtains the target file handle, the first virtualization management process releases the file handle of the first virtualization management component and continues to run based on the target file handle of the second virtualization management component. Specifically, the first virtualization management process resumes the running of the virtual instance on the host in the second virtualization management component based on the target file handle.
[0161] Specifically, the first virtualization management process sends an IOCTL instruction requesting to run the virtual instance to the second virtualization management component based on the target file handle. The IOCTL instruction may include a command requesting to run the virtual instance, such as a run command. Further, the second virtualization management component responds to the IOCTL instruction and resumes the operation of the virtual instance on the host in the second virtualization management component.
[0162] In this embodiment, by returning the file handle opened by the new virtualization management process to the original virtualization management process, it is possible to upgrade only the kernel-state virtualization management component while maintaining the original user-state virtualization management process, thereby improving the flexibility of virtualization manager operation and maintenance.
[0163] It should be noted that the execution subject of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 401 and 402 can be device A; for another example, the execution subject of step 401 can be device A, and the execution subject of step 402 can be device B; and so on.
[0164] In addition, in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 401, 402, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.
[0165] Accordingly, an embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned virtualization manager upgrade method.
[0166] Figure 5 The schematic diagram of the structure of the computing device provided in the embodiment of the present application. The computing device can be implemented as a host machine. Figure 5 As shown, the computing device may include: a memory 50a and a processor 50b. The memory 50a is used to store the computer programs corresponding to the first virtualization manager and the second virtualization manager, as well as other computer programs. In this embodiment, the processor 50b is coupled to the memory 50a to execute the computer program stored in the memory 50a, so as to execute the steps in the upgrade method of the virtualization manager. For detailed description of each method step, please refer to the above embodiment, which will not be repeated here.
[0167] In some embodiments, the kernel state of the host machine runs a first virtualization management component and a second virtualization management component of the virtualization manager that upgrades the first virtualization management component; the user state of the host machine runs a first virtualization management process that cooperates with the first virtualization management component. The memory 50a is used to store computer programs corresponding to the first virtualization management component, the second virtualization management component and the first virtualization management process, as well as other computer programs.
[0168] In this embodiment, the processor 50b is coupled to the memory 50a for executing the above computer program to execute the above Figure 4b The steps in the method for upgrading the virtualization manager shown in the specific implementation manner thereof. The detailed description of each method step can be found in the above-mentioned embodiment, which will not be repeated here.
[0169] In some optional embodiments, such as Figure 5 As shown, the computing device may also include optional components such as a communication component 50c, a power component 50d, a display component 50e and an audio component 50f. Figure 5 The components are shown schematically only and do not necessarily include Figure 5 The components shown do not necessarily mean that the computing device can only include Figure 5 Components shown.
[0170] in addition, Figure 5 The components in the dashed box are optional components, not mandatory components, and may depend on the product form of the electronic device. The computing device of this embodiment can be implemented as a terminal device such as a desktop computer, a laptop computer, a mobile phone, or an Internet of Things device; it can also be a traditional server, a cloud server, or a server cluster.
[0171] In an embodiment of the present application, the memory is used to store a computer program and can be configured to store various other data to support operations on the device where it is located. Among them, the processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random-Access Memory, SRAM), electrically erasable programmable read only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), erasable programmable read only memory (Electrical Programmable Read Only Memory, EPROM), programmable read only memory (Programmable Read Only Memory, PROM), read only memory (Read Only Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0172] In the embodiment of the present application, the processor can be any hardware processing device that can execute the logic of the above method. Optionally, the processor can be a central processing unit (CPU), a graphics processing unit (GPU) or a microcontroller unit (MCU); it can also be a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD) and other programmable devices; or an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (SoC), etc., but not limited to this.
[0173] In an embodiment of the present application, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.
[0174] In an embodiment of the present application, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0175] In an embodiment of the present application, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.
[0176] In an embodiment of the present application, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (Microphone, MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user can be achieved through an audio component.
[0177] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0178] It should also be noted that the descriptions such as "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to different types.
[0179] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage, etc.) that contain computer-usable program code.
[0180] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0181] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0183] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.
[0184] Memory may include non-permanent storage in a computer-readable medium, random-access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0185] The storage medium of a computer is a readable storage medium, which may also be referred to as a readable medium. The readable storage medium includes permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include temporary computer-readable media (transitory media), such as modulated data signals and carrier waves.
[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the above elements.
[0187] The above contents are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for upgrading a virtualization manager, characterized in that: include: The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event; The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; The virtual instance state information is state information of the virtual instance; The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager; The second virtualization manager obtains the virtual instance state information according to the memory address information; And according to the virtual instance state information, the state of the virtual instance is restored in the second virtualization manager.
2. The method according to claim 1, characterized in that The first virtualization manager includes: a first virtualization management process running in user mode; The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event, including: The first virtualization management process, in response to a virtualization manager upgrade event, suspends the operation of the virtual instance on the host machine.
3. The method according to claim 2, characterized in that The first virtualization manager also includes: a first virtualization management component running in kernel state; The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine, including: The first virtualization management process sends a virtual instance state saving request to the first virtualization management component; The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state saving request.
4. The method according to claim 3, characterized in that The kernel state also runs a second virtualization management component; the second virtualization component is a component for upgrading the first virtualization management component, and the second virtualization manager includes: the second virtualization management component; The method further comprises: The first virtualization management process, in response to a virtualization manager upgrade event, creates a second virtualization management process in the user state; the second virtualization manager also includes the second virtualization management process; the second virtualization management process cooperates with the second virtualization management component; The first virtualization management component provides the memory address information of the target memory to the first virtualization management process; The first virtualization management process provides the memory address information of the target memory to the second virtualization management process.
5. The method according to claim 4, characterized in that The second virtualization manager obtains the virtual instance state information according to the memory address information, including: The second virtualization management process sends a virtual instance state recovery request to the second virtualization management component; the virtual instance state recovery request includes memory address information of the target memory; The second virtualization management component obtains the virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request; The step of restoring the state of the virtual instance in the second virtualization manager according to the virtual instance state information includes: The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
6. The method according to claim 4, characterized in that The first virtualization management process creates a second virtualization management process in the user state in response to the virtualization manager upgrade event, including: In response to the virtualization manager upgrade event, the first virtualization management process creates a child process of the first virtualization management process in the user state; and loads a binary file of the virtualization management process in the child process to obtain the second virtualization management process.
7. The method according to claim 5, characterized in that Also includes: The second virtualization management process opens the second virtualization management component and creates a structure object associated with the virtual instance in the second virtualization management component; The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information, including: The second virtualization management component assigns a value to the structure object according to the virtual instance state information, so as to restore the state of the virtual instance in the second virtualization management component.
8. The method according to claim 7, characterized in that The second virtualization management process opens the second virtualization management component and creates a structure object associated with the virtual instance in the second virtualization management component, including: The second virtualization management process opens the second virtualization management component to obtain a file handle provided by the second virtualization management component; The second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component according to the file handle.
9. The method according to claim 8, characterized in that The second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component according to the file handle, including: The second virtualization management process sends, according to the file handle, to the second virtualization management component a first device input / output control IOCTL instruction for requesting the second virtualization management component to create a structure object; The second virtualization management component responds to the first IOCTL instruction and creates a structure object associated with the virtual instance.
10. The method according to claim 5, characterized in that The first virtualization management component sends a virtual instance state saving request, including: The first virtualization management process sends a second IOCTL instruction for requesting the first virtualization management component to save virtual instance state information to the first virtualization management component as the virtual instance state saving request; The second virtualization management process sends a virtual instance state recovery request to the second virtualization management component, including: The second virtualization management process sends a third IOCTL instruction for requesting the second virtualization management component to restore the state of the virtual instance in the first virtualization management component to the first virtualization management process as the virtual instance state recovery request; the third IOCTL instruction includes memory address information of the virtual instance state information.
11. The method according to claim 5, characterized in that The first virtualization management component responds to the virtual instance state saving request, and saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state, including: The first virtualization management component responds to the virtual instance state saving request sent by the first virtualization management process, and obtains the virtual instance state information in the first virtualization management component; The first virtualization management component performs serialization processing on the virtual instance state information in the first virtualization management component to obtain serialized virtual instance state information; and The first virtualization management component saves the serialized virtual instance state information to the target memory in the kernel state.
12. The method according to claim 11, characterized in that The second virtualization management component obtains the virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request, including: The second virtualization management component obtains the serialized virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request; The second virtualization management component deserializes the serialized virtual instance state information to obtain the virtual instance state information.
13. The method according to any one of claims 5 or 7-12, characterized in that: After the second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information, the method further includes: The second virtualization management process provides the opened target file handle to the first virtualization management process, and releases the resources occupied by the second virtualization management process; The first virtualization management process resumes the operation of the virtual instance in the second virtualization management component based on the target file handle.
14. The method according to claim 13, characterized in that The first virtualization management process resumes the operation of the virtual instance in the second virtualization management component based on the target file handle, including: The first virtualization management process sends a fourth IOCTL instruction requesting to run a virtual instance to the second virtualization management component based on the target file handle; The second virtualization management component responds to the fourth IOCTL instruction and resumes the operation of the virtual instance in the second virtualization management component.
15. A computing device, characterized in that: The computing device may be implemented as a host machine; The computing device comprises: a memory and a processor; wherein the memory is used to store computer programs corresponding to the first virtualization manager and the second virtualization manager, and other computer programs; The processor is coupled to the memory and is configured to execute a computer program stored in the memory to perform the steps in the method according to any one of claims 1 to 14.
16. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 14.
Citation Information
Cited By
Intelligent application life cycle management method and system
CN121918901A