Edge computing scene-oriented virtual machine starting method and device, equipment and medium
By creating virtual machine instances and determining target resource objects, the problem of incorporating small and medium-sized physical machines in edge computing is solved, efficient resource utilization and management is achieved, and operational costs are reduced.
Patent Information
- Application Number
- CN202411896208.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2044-12-20
AI Technical Summary
It is difficult for the existing technology to effectively manage small-scale physical machines such as PCFarm models into the edge computing resource pool, resulting in low resource utilization, complex management and high operational costs.
Create a virtual machine instance by receiving target parameters, and determine the target resource object according to the status of the candidate resource object, control the target physical machine to start the virtual machine, and realize efficient and flexible virtual machine startup and management.
It improves resource utilization and elastic scaling capabilities, reduces operational costs, simplifies management complexity, and realizes efficient virtual machine startup and management.
Smart Images

Figure CN119739463A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of cloud computing technology, and in particular to the fields of edge computing and virtualization. More specifically, the present disclosure provides a method, device, electronic device, storage medium, and computer program product for starting a virtual machine. Background Art
[0002] In edge computing scenarios, virtualization can be performed on physical machines to obtain cloud hosts, which are then provided to customers. Summary of the invention
[0003] The present disclosure provides a method, device, electronic device, storage medium and computer program product for starting a virtual machine.
[0004] According to one aspect of the present disclosure, a method for starting a virtual machine is provided, comprising: in response to receiving a target parameter for a virtual machine to be started, creating a virtual machine instance according to the target parameter; determining a target resource object from at least one candidate resource object according to the respective states of at least one candidate resource object; at least one candidate resource object is associated with at least one physical machine; and controlling a target physical machine in the at least one physical machine to start the virtual machine according to the virtual machine instance; wherein the target physical machine is associated with the target resource object.
[0005] According to another aspect of the present disclosure, a device for starting a virtual machine is provided, comprising: a first creation module, a target resource object determination module and a control module. The first creation module is used to create a virtual machine instance according to the target parameters received for the virtual machine to be started. The target resource object determination module is used to determine the target resource object from at least one candidate resource object according to the respective states of at least one candidate resource object; at least one candidate resource object is associated with at least one physical machine. The control module is used to control a target physical machine in at least one physical machine, and start the virtual machine according to the virtual machine instance; wherein the target physical machine is associated with the target resource object.
[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method provided by the present disclosure.
[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the method provided by the present disclosure.
[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method provided by the present disclosure is implemented.
[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0011] Figure 1 is a schematic flow chart of a method for starting a virtual machine according to an embodiment of the present disclosure;
[0012] Figure 2 is a schematic flow chart of a method for starting a virtual machine according to another embodiment of the present disclosure;
[0013] Figure 3 is a schematic diagram of binding a target resource object and a virtual machine instance according to an embodiment of the present disclosure;
[0014] Figure 4 is a schematic diagram of a method for starting a virtual machine according to an embodiment of the present disclosure;
[0015] Figure 5 is a schematic diagram of an application scenario of a method for starting a virtual machine according to an embodiment of the present disclosure;
[0016] Figure 6 is a schematic structural block diagram of an apparatus for starting a virtual machine according to an embodiment of the present disclosure; and
[0017] Figure 7 It is a structural block diagram of an electronic device used to implement the method for starting a virtual machine according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0019] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0020] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0021] In edge computing scenarios, you can virtualize large physical machines to get cloud hosts, and then provide cloud hosts to customers. Or for some customers who have their own virtualization solutions, you can directly provide bare metal servers to customers. For the convenience of management and unified scheduling, bare metal, physical machines, virtual machines and even containers are all in the edge unified resource pool.
[0022] PCFarm (Personal Computer Farm) refers to a high-density and centrally managed PC deployment solution in a standard cabinet. PCFarm is cheaper and more lightweight than conventional large servers. At the same time, it has higher performance and more complete out-of-band management capabilities than PCs (Personal Computers). Applying PCFarm in edge scenarios can integrate computing power, which is equivalent to shifting the capabilities of the data center downward to provide users with real-time response services. Therefore, the inventor hopes to integrate the PCFarm model into the resource pool for unified management and scheduling.
[0023] However, in related technologies, the edge computing architecture uses the open source Kubernetes (K8s for short) and Kubevirt to schedule and deploy virtual machines. Libvirt and kubelet components are installed and deployed on each physical machine. When users purchase a cloud host, the cloud generates and renders the purchased machine specifications and generates VM resources. Kubevirt generates VMI resources by monitoring VM resources, and then converts VMI resources into Pod resources. Pod resources start a Pod of the same specifications through the unified scheduling system of K8s, and then the Kubevirt component calls the libvirt interface to generate the corresponding virtual machine. This architecture requires the deployment of K8s-dependent related components on the physical machine. Generally, at least 10% of the memory and CPU are required for the deployment of dependent components. For example, 12 CPUs and 30GB of memory resources must be reserved for the deployment of basic components.
[0024] The related technology does not have a solution for managing PCFarm models. Even if the PCFarm model is forcibly added to the edge K8s cluster as a traditional server to act as an edge node, the CPU and memory specifications of the PCFarm model are very small compared to traditional servers. The whole machine specification is only about 20 CPUs and 20G memory, which cannot meet the requirements of reserved resources. Due to the limitation of the resources that need to be reserved, it is also impossible to fully virtualize a suitable cloud host for customer use. If PCFarm is treated as a bare metal machine and sold directly to users, the user's virtualization solution will also face the same resource problem, and it will increase the management complexity of edge vendors.
[0025] The disclosed embodiments aim to provide a solution for managing physical machines in a resource pool. The resource pool may be an edge resource pool, and the physical machine may be a PCFarm model or other models. The solution is suitable for edge reasoning, cloud gaming, cloud Internet cafes and other scenarios.
[0026] In actual applications, after incorporating PCFarm models into the edge computing platform and virtualizing them in edge scenarios, on the one hand, resource utilization and elastic expansion capabilities can be improved. For example, PCFarm's computing resources can be concentrated in the edge computing pool, allowing idle and low-load resources to be redistributed to support other tasks with heavier loads. During business peaks or when resource demand fluctuates, the edge computing platform can dynamically allocate and schedule these resources and flexibly expand computing power. On the other hand, operating costs can be reduced. For example, by uniformly incorporating PCFarm into the virtualization management of the edge computing platform, reliance on independently managed physical servers can be reduced, and resources can be effectively utilized to reduce overall hardware and operation and maintenance costs.
[0027] The technical solution provided by the present disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Figure 1 The present invention is a schematic flowchart of a method for starting a virtual machine according to an embodiment of the present invention.
[0029] like Figure 1 As shown, the method 100 for starting a virtual machine can be applied to edge computing scenarios or non-edge computing scenarios, and the method 100 for starting a virtual machine can include operations S110 to S130. This embodiment involves a management system and a physical machine. The management system for executing the method 100 can be implemented based on a K8s cluster or in other ways. This embodiment is described by taking a K8s cluster as an example. The K8s cluster can be a K8s cluster in an edge computing scenario or a K8s cluster in a non-edge computing scenario.
[0030] In operation S110 , in response to receiving target parameters for a virtual machine to be started, a virtual machine instance is created according to the target parameters.
[0031] For example, a user can enter the required virtual machine information through the front-end page, such as the required memory, CPU, etc., and this information is the target parameter. For example, after the K8s cluster obtains the target parameters, it can create a virtual machine instance (Virtual Machine Instances, VMI). The virtual machine instance is similar to the Pod in K8s. The virtual machine instance is the minimum resource for managing the virtual machine. A virtual machine instance includes various configurations required for a virtual machine. This embodiment does not limit the method of creating a virtual machine instance.
[0032] In operation S120, a target resource object is determined from at least one candidate resource object according to a state of each of the at least one candidate resource objects; the at least one candidate resource object is associated with at least one physical machine.
[0033] For example, at least one candidate resource object can be created in advance in the K8s cluster. The candidate resource object can be created based on a custom resource definition (CRD). At least one candidate resource object is associated with at least one physical machine. For example, each physical machine can start one or more virtual machines. The virtual machines correspond to the candidate resource objects one by one. For example, a physical machine starts a virtual machine. The candidate resource object and the physical machine also correspond one by one. For example, the physical machine can be a PCFarm server, and the physical machine can be a blade machine.
[0034] For example, the states of the candidate resource objects may include idle, occupied, online, offline, etc. For example, the target resource object may be selected from the idle candidate resource objects. The physical machine associated with the target resource object is referred to as the target physical machine.
[0035] In operation S130, a target physical machine among the at least one physical machine is controlled to start a virtual machine according to the virtual machine instance; wherein the target physical machine is associated with a target resource object.
[0036] For example, after determining the target physical machine from various physical machines, information required to start the virtual machine may be determined based on the target resource object, and then the virtual machine may be started in the target physical machine.
[0037] In actual applications, the started virtual machine can be provided to the user for use. For example, the user can install required application programs in the virtual machine, such as game programs, video programs, etc.
[0038] This embodiment creates a virtual machine instance according to the target parameters of the virtual machine, which can ensure the accuracy of resource configuration. According to the status of each candidate resource object, a suitable target resource object can be scheduled from multiple candidate resource objects. Then the target physical machine associated with the target resource object is controlled to start the virtual machine, so that efficient and flexible virtual machine startup and management can be achieved. The technical solution provided by this embodiment can be used to manage physical machines in the resource pool. The resource pool can be an edge resource pool, and the physical machine can be a PCFarm model or other models.
[0039] Figure 2 is a schematic flowchart of a method for starting a virtual machine according to another embodiment of the present disclosure.
[0040] Figure 2 As shown, the method 200 for starting a virtual machine may include operations S210 to S230, and also include operations S222 and S224, wherein operations S210 to S230 may refer to the above S110 to S130, and will not be repeated in this embodiment.
[0041] In operation S210 , in response to receiving target parameters for a virtual machine to be started, a virtual machine instance is created according to the target parameters.
[0042] Operation S220: determining a target resource object from at least one candidate resource object according to a state of each of the at least one candidate resource objects; the at least one candidate resource object is associated with at least one physical machine.
[0043] Operation S225: Bind the virtual machine instance and the target resource object to obtain binding information.
[0044] For example, after binding, it can be determined that the virtual machine instance and the target resource object satisfy the binding relationship, and the target resource object is associated with a physical machine. Therefore, based on the above binding relationship and association relationship, it can be determined that the physical machine associated with the target resource object is the target physical machine, and the target physical machine needs to start the virtual machine.
[0045] Operation S230, in response to determining the target physical machine, controlling the target physical machine in the at least one physical machine, and starting the virtual machine according to the virtual machine instance; wherein the target physical machine is associated with the target resource object, and the target physical machine is determined according to the binding information.
[0046] This embodiment ensures the accuracy and consistency of resource allocation by binding the virtual machine instance with the target resource object, avoiding resource conflicts and misallocation. Based on the binding information, the system can quickly determine the target physical machine, simplify the startup process, and speed up the deployment of the virtual machine. The binding operation can also improve the convenience of managing the physical machines managed in the resource pool, and improve the responsiveness and user experience of the virtualization service.
[0047] According to another embodiment of the present disclosure, the process of binding a virtual machine instance and a target resource object may include: using an identifier of a physical machine associated with the target resource object, updating a target field of the virtual machine instance; wherein the binding information includes the updated target field. For example, the identifier of the physical machine may be an IP (Internet Protocol) address of the physical machine, and the target field of the virtual machine instance may be a VMI.Status.nodeName field.
[0048] According to another embodiment of the present disclosure, the target physical machine can be determined and the virtual machine can be started in the following manner: if the identifier of the candidate physical machine in at least one physical machine is consistent with the target field, and the virtual machine instance corresponds to an update event, and the status of the virtual machine instance is that the creation has been completed, the candidate physical machine is used as the target physical machine.
[0049] For example, there is at least one physical machine. Taking one of the physical machines as an example, the physical machine can monitor each virtual machine instance in the management system. In the process of binding the virtual machine instance and the target resource object, the physical machine identifier associated with the target resource object is used to update the target field of the virtual machine instance, which triggers the virtual machine instance to generate an update event. The physical machine then monitors the update event, obtains the target field, and compares the target field with its own identifier. If they are consistent, and the status of the virtual machine instance is completed, it means that the physical machine needs to start the virtual machine. If the target field is inconsistent with the physical machine identifier, it means that the physical machine is not the target virtual machine and needs to be started by another physical machine.
[0050] This embodiment achieves an efficient and accurate virtual machine startup process by accurately binding the virtual machine instance with the target resource object and using the physical machine identifier to update the target field. The binding process triggers an update event, and the physical machine monitors and compares whether the target field is consistent with the identifier, which can ensure that only the target physical machine starts the virtual machine, avoiding misstart and resource waste.
[0051] In other embodiments, the management system may determine the target physical machine according to the target field in the virtual machine instance, and then may send a message to the target physical machine to notify the target physical machine to start the virtual machine.
[0052] According to another embodiment of the present disclosure, the process of binding a virtual machine instance and a target resource object may include: using the identifier of the physical machine associated with the target resource object, updating the target field of the virtual machine instance. Also using the target value, updating the label value of the target resource object. The binding information includes the updated target field and the updated label value. For example, on the one hand, before binding, the label value of the label "Whether to bind" of the target resource object is "F". After binding, the label value of the label is updated from "T" to "F". On the other hand, the target field of the virtual machine instance is also updated. In this way, two-way binding of the target resource object and the virtual machine instance can be achieved.
[0053] According to another embodiment of the present disclosure, the target physical machine can be determined and the virtual machine can be started in the following manner: for any candidate physical machine among at least one physical machine, if the label value of the candidate resource object associated with the candidate physical machine is the target value, and the identifier of the candidate physical machine is consistent with the target field, and the virtual machine instance corresponds to an update event, and the status of the virtual machine instance is that the creation has been completed, the candidate physical machine can be used as the target physical machine.
[0054] For example, taking a physical machine as an example, on the one hand, the physical machine can monitor the candidate resource objects associated with itself, thereby obtaining the tag value of the candidate resource object and determining whether the tag value is the target value. On the other hand, in the process of binding the virtual machine instance and the target resource object, the identifier of the physical machine associated with the target resource object is used to update the target field of the virtual machine instance, which triggers the virtual machine instance to generate an update event. The physical machine can monitor each virtual machine instance in the management system. The physical machine monitors the update event, obtains the target field, and compares whether the target field is consistent with its own identifier. In addition, it is also possible to determine whether the status is completed by monitoring the virtual machine instance. In this way, the physical machine can determine whether it needs to start the virtual machine.
[0055] This embodiment adopts two-way binding. During the two-way binding process, the target field of the virtual machine instance and the tag value of the resource object are updated to ensure the consistency and transparency of resource allocation, avoid resource conflicts and misallocation, and the physical machine automatically determines whether it is the target physical machine that needs to start the virtual machine by monitoring the tag value and the target field. The two-way binding method can further improve the accuracy of virtual machine startup and system management efficiency.
[0056] In other embodiments, the management system can determine the target physical machine based on the target field after updating the tag value of the target resource object to the target value and updating the target field in the virtual machine instance, and then send a message to the target physical machine to notify the target physical machine to start the virtual machine.
[0057] According to another embodiment of the present disclosure, the method for starting an application further includes the following operation: in response to receiving a start message of a target application in any one of at least one physical machine, creating a candidate resource object associated with any one of the physical machines according to the start message.
[0058] For example, after the target application in the physical machine is started, the physical machine can send a message to the management system, and then the management system creates a candidate resource object. It can be seen that the candidate resource objects in the management system correspond to the physical machines one by one. In the actual creation process, the candidate resource object can be created based on CRD. CRD is a mechanism in K8s that allows users to define new resource types according to their business needs.
[0059] In this embodiment, when the target application in the physical machine is ready to start, a startup message is sent to the management system, and the management system immediately creates a candidate resource object associated with the physical machine. By passing messages between the management system and the physical machine to create candidate resource objects, it can be ensured that resources can be dynamically allocated according to actual needs, avoiding idleness and waste of resources. By using the CRD mechanism in K8s, users can define new resource types according to their business needs, making resource management more customized and improving the scalability of the management system.
[0060] Figure 3 It is a schematic diagram of binding a target resource object and a virtual machine instance according to an embodiment of the present disclosure.
[0061] According to another embodiment of the present disclosure, the process of determining the target resource object from the at least one candidate resource object may include: determining the target resource object from the candidate resource objects that are in an idle state and in an online state.
[0062] like Figure 3 As shown, for example, after the target application in the physical machine is started, it can send a message to the control system, and then the control system creates a resource object associated with the physical machine, and the IP address of the physical machine can be used as the name of the associated resource object. For example, resource object 311, resource object 3121, resource object 313 and resource object 314 are created. After the user enters the target parameters on the front-end page, the control system can use the virtual machine parent class to create a virtual machine instance 320.
[0063] Next, in the process of starting the virtual machine instance 320, the status of each candidate resource object in the management system can be determined, for example, resource object 311 and resource object 3121 are in an idle state, and the idle state indicates that the candidate resource objects 311 and 3121 are not bound to the virtual machine instance. Resource object 313 is in an occupied state, and the occupied state indicates that the resource object 313 is bound to the virtual machine instance VM1. Resource object 314 is in an offline state, and the offline state indicates that the heartbeat signal between resource object 314 and the associated physical machine has timed out. If there are multiple resource objects in an idle state and in an online state, one can be randomly selected from them as the target resource object, for example, resource object 3121 is selected from resource objects 311 and 3121 as the target resource object, and then resource object 3121 is bound to the virtual machine instance 320. During the binding process, the state of resource object 3121 can be updated from idle to occupied, and the target value can be updated to the tag of resource object 3121. In this embodiment, the tag is "Status.vmName", and the target value can be the identifier of virtual machine instance 320, or other preset tags, so that resource object 3121 can be updated to resource object 3122. In addition, the relevant fields 330 of resource object 3121 can also be updated. For example, the value of the target field of virtual machine instance 320 can be updated, such as updating the value of the target field "VMI.Status.nodeName" to the name of resource object 3121. In addition, after resource object 3121 is created, the status field "VMI.Status.phase" of resource object 3121 can also be updated to "Shcedled" to mark the status of resource object 3121 as having been created.
[0064] This embodiment achieves high efficiency of virtual machine startup and maximum resource utilization by finely managing the status of each candidate resource object. By identifying idle and online resource objects, appropriate target resource objects can be intelligently selected to ensure rapid deployment of virtual machine instances. Status updates and label updates during the binding process can facilitate subsequent management and scheduling of resources. In addition, by updating the target field of the virtual machine instance, the startup of the virtual machine on the target physical machine can be accurately controlled.
[0065] According to another embodiment of the present disclosure, after the target physical machine starts the virtual machine, the target physical machine can also send the working status of the virtual machine to the management system. The working status includes, for example, running, shutting down, shutting down, restarting, etc., and then the management system uses the working status to update the status field in the virtual machine instance. This embodiment realizes real-time monitoring and management of the virtual machine status by feeding back the working status of the virtual machine to the management system in real time through the target physical machine. This method can ensure that the management system can know the operating status of the virtual machine in a timely manner, so as to make rapid responses and adjustments.
[0066] Figure 4 The figure is a schematic diagram of a method for starting a virtual machine according to an embodiment of the present disclosure.
[0067] This embodiment involves a management system 410 and at least one physical machine 420, 430. The management system 410 is, for example, a K8s cluster, and the physical machines 420, 430 may be, for example, blade machines. This embodiment does not limit the types of the physical machines 420, 430.
[0068] Kubevirt is deployed in the management system 410. The management system 410 is used as the control node for each physical machine to access. Kubevirt mainly provides the interface (virt-api) and the controller virt-controller function. Through the controller virt-controller, the virtual machine parent class VM can be used to create a virtual machine instance VMI. The controller virt-controller short-circuits the creation of PVC for the local disk of the PC-Farm virtual machine, and the agents Agent1 and Agent2 in the physical machines 420 and 430 are responsible for creating the qcow2 file of the image. In addition, the scheduler is also deployed in the management system 410 to execute the scheduling logic.
[0069] Agent Agent1 is deployed in physical machine 420, and Agent Agent2 is deployed in physical machine 430. In this embodiment, Agent Agent1 and Agent Agent2 are the target applications mentioned above. In this embodiment, each physical machine is used to start a virtual machine. In addition, each physical machine corresponds to a resource object. For example, a resource object is defined as resource object PF_A and another resource object is defined as resource object PF_B through CRD.
[0070] Taking the physical machine 420 as an example, when the agent Agent1 in the physical machine 420 is started, it will send a startup message to the management system 410, and then the management system 410 will create a candidate resource object PF_A associated with the physical machine, and can use the IP address of the physical machine 420 as the name of the resource object PF_A. In addition, the agent Agent1 will also monitor the candidate resource object PF_A. When the agent Agent1 restarts and at other times, it only updates the heartbeat, indicating that the physical machine 420 is in an available state.
[0071] The user enters the required virtual machine information through the front-end page, such as the required memory, CPU, etc., which are the target parameters. Then the controller virt-controller in the management system 410 creates a virtual machine instance VMI according to the target parameters. The virtual machine instance VMI in the management system 410 corresponds one-to-one to the virtual machine in each physical machine.
[0072] After the virtual machine instance VMI is created, the scheduler in the management system 410 determines the target resource object from the resource objects PF_A and PF_B in the management system 410, thereby determining the target physical machine to start the virtual machine. For example, the scheduler determines the resource object PF_A as the target resource object from the resource objects PF_A and PF_B that are in an idle state and in an online state.
[0073] After determining that resource object PF_A is the target resource object, resource object PF_A and virtual machine instance VMI need to be bound. During the binding process, on the one hand, the label value of resource object PF_A can be updated using the target value, for example, the label value of the label "Whether to bind" of resource object PF_A is updated from "F" to "T". On the other hand, the target field of virtual machine instance VMI can be updated using the identifier of physical machine 420 associated with resource object PF_A. For example, the target field "VMI.Status.nodeName" in virtual machine instance VMI is updated using the name of resource object PF_A (in this embodiment, the IP address of physical machine 420 is used as the name of resource object PF_A). When scheduler scheduler completes the scheduling, virtual machine instance VMI is taken over by agent Agent1.
[0074] The physical machine 420 can determine whether it is the target physical machine that needs to start the virtual machine. For example, on the one hand, the physical machine 420 monitors the resource object PF_A, so that the physical machine 420 can determine that the label value in the resource object PF_A is updated to T. On the other hand, the physical machine 420 also monitors each virtual machine instance VMI in the management system 410. The binding process will update the target field in the virtual machine instance VMI, which will trigger the virtual machine instance VMI to generate an update event (UPDATED event). The physical machine 420 monitors the update event, and the status of the VMI is the creation completion status, and the target field "VMI.Status.nodeName" in the virtual machine instance VMI is the same as its own IP address. Then the agent Agent1 can start the virtual machine in the physical machine 420 according to the information of the virtual machine instance VMI.
[0075] It should be noted that multiple physical machines can monitor the same virtual machine instance VMI in the management system 410. For example, agent Agent1 in physical machine 420 and agent Agent2 in physical machine 430 both monitor the update event generated by the virtual machine instance VMI, but because the value of the target field "VMI.Status.nodeName" is the same as the IP address of physical machine 420 but different from the IP address of physical machine 430, physical machine 430 does not process it, but physical machine 420 starts the virtual machine.
[0076] In the process of starting the virtual machine on the physical machine 420, for example, the agent Agent1 can call the second component libvirt1, and then the second component libvirt1 calls the third component qemu1, so that the virtual machine guest1 can be started. In addition, it can be understood that the virtual machine guest1 needs to use the network and disk, and the first component vpc-ebpf-agent1 can apply for the IP address of the virtual machine, and the fourth component cds-agent1 can prepare the disk required by the virtual machine. After the physical machine 420 starts the virtual machine guest1, the operating system of the virtual machine guest1 can also be activated to ensure the use of the functions of the genuine operating system. In this embodiment, in the process of starting the virtual machine guest1 on the physical machine 420, the disk and network can be prepared according to actual needs, and cloudinitdisk can also be prepared. For example, the cloudinit logic of kubevirt can be reused to generate a configdrive.iso file based on the meta information and network data of the virtual machine. Then the virtual machine instance VMI can be rendered as a libvirt XML file, and then the file can be used to start the virtual machine guest1.
[0077] The physical machine 430 is similar to the physical machine 420. For example, the agent Agent2, the first component vpc-ebpf-agent2, the second component libvirt2, the third component qemu2, and the fourth component cds-agent2 are deployed in the physical machine 430, and the virtual machine guest2 is started by these components. The working process of the physical machine 430 can refer to the physical machine 420, and will not be repeated in this embodiment.
[0078] In addition, it should be noted that in order to achieve the lightweight of the physical machine, so that the physical machine has more available resources, including CPU and memory, and reduce the resources occupied by the components used to start the virtual machine, therefore, edge components (such as kubelet) do not need to be deployed in the physical machine.
[0079] Figure 5 It is a schematic diagram of an application scenario of a method for starting a virtual machine according to an embodiment of the present disclosure.
[0080] In this embodiment, a virtual machine 511 can be started in a physical machine 510, and several applications can be installed in the virtual machine 511, such as game applications, audio and video applications, etc. The user can operate through the page of the front end 540 to generate a request, and the request is sent to the corresponding application after being processed by the network address translation module 530 (Network Address Translation, NAT). Then the application generates response data based on the request, and the response data is returned to the user's front end 540 page after being processed by the network address translation module 530. The response data includes, for example, audio and video data, and then the page of the front end 540 renders the received response data, thereby providing the user with services such as games, audio and video.
[0081] The physical machine 520 is similar to the physical machine 510. For example, the virtual machine 521 may be started in the physical machine 520, and several application programs may be installed in the virtual machine 521. The user may interact with several application programs in the virtual machine 521 according to actual needs.
[0082] Figure 6 The present invention is a schematic structural block diagram of an apparatus for starting a virtual machine according to an embodiment of the present disclosure.
[0083] like Figure 6 As shown, the device 600 for starting a virtual machine can be applied to edge computing scenarios or non-edge computing scenarios, and the device 600 for starting a virtual machine can include a first creation module 610, a target resource object determination module 620 and a control module 630.
[0084] The first creation module 610 is used for creating a virtual machine instance according to the target parameters in response to receiving the target parameters for the virtual machine to be started.
[0085] The target resource object determination module 620 is used to determine the target resource object from at least one candidate resource object according to the respective states of at least one candidate resource object; at least one candidate resource object is associated with at least one physical machine.
[0086] The control module 630 is used to control a target physical machine in at least one physical machine and start a virtual machine according to a virtual machine instance; wherein the target physical machine is associated with a target resource object.
[0087] According to another embodiment of the present disclosure, the above-mentioned device further includes: a binding module and a trigger binding module. The binding module is used to bind the virtual machine instance and the target resource object to obtain binding information. The trigger module is used to trigger and control the target physical machine in at least one physical machine in response to determining the target physical machine, and start the operation of the virtual machine according to the virtual machine instance, wherein the target physical machine is determined according to the binding information.
[0088] According to another embodiment of the present disclosure, the binding module includes: a first update submodule, used to update the target field of the virtual machine instance using the identifier of the physical machine associated with the target resource object; wherein the binding information includes the updated target field.
[0089] According to another embodiment of the present disclosure, the target physical machine is determined by the following modules: a target physical machine determination module, which is used to respond to determining that an identifier of a candidate physical machine in at least one physical machine is consistent with a target field, and that the virtual machine instance corresponds to an update event, and the status of the virtual machine instance is that creation has been completed, and use the candidate physical machine as the target physical machine.
[0090] According to another embodiment of the present disclosure, the binding module further includes: a second updating submodule, configured to update the label value of the target resource object using the target value; wherein the binding information also includes the updated label value.
[0091] According to another embodiment of the present disclosure, the target resource object determination module includes: a target resource object determination submodule, configured to determine the target resource object from candidate resource objects that are in an idle state and in an online state.
[0092] According to another embodiment of the present disclosure, the candidate resource object being in an online state includes: a heartbeat signal between the candidate resource object and an associated physical machine has not timed out.
[0093] According to another embodiment of the present disclosure, the apparatus further includes: a second creation module, configured to, in response to receiving a startup message of a target application in any one of at least one physical machine, create a candidate resource object associated with any one of the physical machines according to the startup message.
[0094] According to another embodiment of the present disclosure, the second creation module includes: a creation submodule, which is used to create a candidate resource object based on a custom resource definition.
[0095] According to another embodiment of the present disclosure, the apparatus further includes: an acquisition module and an update module. The acquisition module is used to acquire the working status of the virtual machine in response to determining that the virtual machine has been started. The update module is used to update the status field in the virtual machine instance using the working status.
[0096] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, comprising at least one processor; and a memory communicatively connected to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned method of starting a virtual machine.
[0097] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the above-mentioned method of starting a virtual machine.
[0098] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the computer program implements the above-mentioned method of starting a virtual machine.
[0099] Figure 7 It is a structural block diagram of an electronic device for implementing the method of starting a virtual machine of an embodiment of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0100] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the device 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0101] A number of components in the device 700 are connected to the I / O interface 705, including: an input unit 706, such as a keyboard, a mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a disk, an optical disk, etc.; and a communication unit 709, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 709 allows the device 700 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0102] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above, such as a method for starting a virtual machine. For example, in some embodiments, the method for starting a virtual machine may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the method for starting a virtual machine described above may be performed. Alternatively, in other embodiments, the computing unit 701 may be configured to execute a method for starting a virtual machine in any other appropriate manner (e.g., by means of firmware).
[0103] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0104] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0105] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0107] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0108] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0109] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0110] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for starting a virtual machine, comprising: In response to receiving target parameters for a virtual machine to be started, creating a virtual machine instance according to the target parameters; Determine a target resource object from the at least one candidate resource object according to the respective states of the at least one candidate resource object; the at least one candidate resource object is associated with at least one physical machine; as well as A target physical machine in the at least one physical machine is controlled to start the virtual machine according to the virtual machine instance; wherein the target physical machine is associated with the target resource object.
2. The method according to claim 1, further comprising: Binding the virtual machine instance and the target resource object to obtain binding information; In response to determining the target physical machine, triggering and controlling the target physical machine in the at least one physical machine, and starting the operation of the virtual machine according to the virtual machine instance; The target physical machine is determined according to the binding information.
3. The method according to claim 2, wherein: Binding the virtual machine instance and the target resource object to obtain binding information includes: The target field of the virtual machine instance is updated using the identifier of the physical machine associated with the target resource object; wherein the binding information includes the updated target field.
4. The method according to claim 3, wherein: The target physical machine is determined in the following manner: In response to determining that the identifier of the candidate physical machine in the at least one physical machine is consistent with the target field, the virtual machine instance corresponds to an update event, and the status of the virtual machine instance is creation completed, the candidate physical machine is used as the target physical machine.
5. The method according to claim 4, wherein: Binding the virtual machine instance and the target resource object to obtain binding information further includes: The target value is used to update the label value of the target resource object; wherein the binding information also includes the updated label value.
6. The method according to claim 1, wherein: The determining the target resource object from the at least one candidate resource object comprises: The target resource object is determined from candidate resource objects that are in an idle state and in an online state.
7. The method according to claim 6, wherein: The candidate resource object being in the online state includes: a heartbeat signal between the candidate resource object and the associated physical machine has not timed out.
8. The method according to claim 1, further comprising: In response to receiving a start message of a target application in any one of the at least one physical machine, the candidate resource object associated with the any one physical machine is created according to the start message.
9. The method according to claim 1, wherein: The creating the candidate resource object associated with any one of the physical machines comprises: Based on the custom resource definition, the candidate resource object is created.
10. The method according to claim 1, further comprising: In response to determining that the virtual machine has been started, obtaining a working state of the virtual machine; The status field in the virtual machine instance is updated using the working status.
11. A device for starting a virtual machine, comprising: A first creation module, configured to, in response to receiving a target parameter for a virtual machine to be started, create a virtual machine instance according to the target parameter; a target resource object determination module, configured to determine a target resource object from at least one candidate resource object according to a respective state of at least one candidate resource object; the at least one candidate resource object is associated with at least one physical machine; as well as A control module is used to control a target physical machine in the at least one physical machine and start the virtual machine according to the virtual machine instance; wherein the target physical machine is associated with the target resource object.
12. The apparatus according to claim 11, further comprising: A binding module, used to bind the virtual machine instance and the target resource object to obtain binding information; a trigger module, configured to trigger and control the target physical machine in the at least one physical machine in response to determining the target physical machine, and start the operation of the virtual machine according to the virtual machine instance; The target physical machine is determined according to the binding information.
13. The device according to claim 12, wherein: The binding module includes: The first updating submodule is used to update the target field of the virtual machine instance by using the identifier of the physical machine associated with the target resource object; wherein the binding information includes the updated target field.
14. The device according to claim 13, wherein: The target physical machine is determined by the following modules: A target physical machine determination module is used to determine that the identifier of a candidate physical machine in the at least one physical machine is consistent with the target field, and the virtual machine instance corresponds to an update event, and the status of the virtual machine instance is that the creation has been completed, and use the candidate physical machine as the target physical machine.
15. The device according to claim 14, wherein: The binding module also includes: The second updating submodule is used to update the label value of the target resource object using the target value; wherein the binding information also includes the updated label value.
16. The device according to claim 11, wherein The target resource object determination module includes: The target resource object determination submodule is used to determine the target resource object from the candidate resource objects that are in an idle state and in an online state.
17. The device according to claim 16, wherein: The candidate resource object being in the online state includes: a heartbeat signal between the candidate resource object and the associated physical machine has not timed out.
18. The apparatus according to claim 11, further comprising: The second creation module is configured to, in response to receiving a startup message of a target application in any one of the at least one physical machine, create the candidate resource object associated with the any one physical machine according to the startup message.
19. The device according to claim 11, wherein: The second creation module includes: A submodule is created to create the candidate resource object based on the custom resource definition.
20. The apparatus according to claim 11, further comprising: an acquisition module, configured to acquire a working state of the virtual machine in response to determining that the virtual machine has been started; An updating module is used to update a status field in the virtual machine instance using the working status.
21. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 10.
22. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 10.
23. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Pervasive computing environment virtual machine platform and creation method thereof
CN102479100A
Resource scheduling system and method based on edge computing in heterogeneous environment
CN111858054A
Method and device for creating virtual machine in physical system
CN113127142A
Network system, network configuration method and equipment
CN113726547A
Cloud computing instance creation method and device
CN115361389A