Virtual machine resource calling method, device and storage medium

By using the target virtual container to process resource calling instructions in the cloud system, the problem of multiple virtual machines calling physical machine hardware resources at the same time is solved, and flexible resource allocation and applicability improvement are achieved.

CN115794386BActive Publication Date: 2024-09-20北京天数智芯半导体科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211426694.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-15
Publication Date
2024-09-20
Estimated Expiration
2042-11-15

AI Technical Summary

Technical Problem

The existing technology is difficult to meet the simultaneous call requirements of multiple virtual machines for physical machine hardware resources, resulting in greater application limitations and insufficient applicability of resource calls.

Method used

By introducing the target virtual container into the cloud system, the target virtual container receives the resource calling instruction, obtains the calling result from the physical machine hardware device, and returns the result according to the interface information of the virtual machine, realizing resource allocation and calling of multiple virtual machines. deal with.

Benefits of technology

It can meet the resource calling requirements of multiple virtual machines, improves the applicability of resource calling, does not need to rely on the hardware structure of the device, and is suitable for any type of physical machine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115794386B
    Figure CN115794386B
Patent Text Reader

Abstract

This application provides a method, device, and storage medium for virtual machine resource invocation, belonging to the field of computer processing technology. The method includes: a target virtual machine sending a resource invocation instruction to a server; the target virtual machine being at least one of multiple virtual machines; the resource invocation instruction including: interface information of the target virtual machine and resource information to be invoked; the server generating a target virtual container corresponding to the target virtual machine based on the resource invocation instruction; the target virtual container executing the resource invocation instruction and obtaining the invocation result from the corresponding hardware device in the physical machine; and the target virtual container returning the invocation result to the target virtual machine according to the interface information of the target virtual machine. This application can meet the resource invocation needs of multiple virtual machines and improves the applicability of virtual resource invocation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer processing technology, and in particular to a resource calling method, device and storage medium of a virtual machine. Background Art

[0002] A virtual machine is usually a virtual computer device set up in a physical machine to simulate the functions of the physical machine. In the actual use of the virtual machine, there may be a demand for hardware resources, so it is necessary to call the hardware resources in the physical machine.

[0003] In the prior art, when a virtual machine calls hardware resources in a physical machine, it is usually based on a pre-configured transparent transmission solution in the application system to obtain corresponding software resources after hardware virtualization processing to implement resource calls for the virtual machine.

[0004] However, with this method, the same hardware can only be transparently transmitted to one virtual machine for use, which cannot meet the needs of multiple virtual machines, resulting in significant limitations in practical applications. Summary of the invention

[0005] The purpose of the present application is to provide a method, device and storage medium for calling resources of a virtual machine, which can meet the resource calling requirements of multiple virtual machines and improve the applicability of virtual resource calling.

[0006] The embodiment of the present application is implemented as follows:

[0007] In one aspect of an embodiment of the present application, a method for calling resources of a virtual machine is provided. The method is applied to a cloud system. The cloud system includes: a physical machine and a server. The physical machine is in communication connection with the server. A plurality of virtual machines are deployed in the physical machine. The method includes:

[0008] The target virtual machine sends a resource calling instruction to the server, the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0009] The server generates a target virtual container corresponding to the target virtual machine based on the resource call instruction;

[0010] The target virtual container executes the resource call instruction and obtains the call result from the corresponding hardware device in the physical machine;

[0011] The target virtual container returns the call result to the target virtual machine according to the interface information of the target virtual machine.

[0012] Optionally, the target virtual container executes the resource call instruction and obtains the call result from the corresponding hardware device in the physical machine, including:

[0013] The target virtual container determines the target calling hardware after virtualization processing;

[0014] The target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called, and obtains a calling result.

[0015] Optionally, the target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called, and obtains a calling result, including:

[0016] The target virtual container determines the required resource ratio based on the resource information to be called;

[0017] The target virtual container makes resource calls to the virtualized target calling hardware according to the required resource ratio to obtain a call result.

[0018] Optionally, if there are multiple target virtual containers that perform resource calls on the virtualized target calling hardware; after the target virtual container determines the required resource ratio based on the resource information to be called, the method further includes:

[0019] The target virtual container determines the duration for each target virtual machine to perform resource calling on the target calling hardware based on the required resource ratio corresponding to each target virtual container.

[0020] Optionally, the target virtual container determines the target calling hardware after virtualization processing, including:

[0021] The target virtual container determines the target calling hardware according to the resource information to be called;

[0022] The target virtual container packages the hardware information in the target calling hardware according to a predetermined format through a physical machine to obtain the target calling hardware after virtualization.

[0023] Optionally, before the target virtual machine sends the resource call instruction to the server, the method further includes:

[0024] The physical machine establishes an initial virtual machine according to the configuration data, wherein the initial virtual machine includes a pre-configured virtual computing platform and a virtual software development kit;

[0025] The physical machine replaces data in the software interface library in the virtual software development kit based on the pre-configured replacement file to obtain the target virtual machine.

[0026] Optionally, the target calling hardware is a graphics processor.

[0027] Another aspect of an embodiment of the present application provides a method for calling resources of a virtual machine, the method being applied to a server in a cloud system, the cloud system comprising: a physical machine and a server, the physical machine being communicatively connected to the server, and a plurality of virtual machines being deployed in the physical machine, the method comprising:

[0028] receiving a resource calling instruction sent by a target virtual machine, where the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0029] Generate a target virtual container corresponding to the target virtual machine based on the resource call instruction;

[0030] The resource call instruction is executed through the target virtual container, and the call result is obtained from the corresponding hardware device in the physical machine; the call result is returned to the target virtual machine according to the interface information of the target virtual machine.

[0031] Another aspect of the embodiment of the present application provides a resource calling device for a virtual machine, the device is applied to a cloud system, the cloud system includes: a physical machine and a server, the physical machine is in communication connection with the server, and a plurality of virtual machines are deployed in the physical machine, the device includes: an instruction module, a generation module, a calling module, and a return module;

[0032] An instruction module, used to send a resource calling instruction to the server through a target virtual machine, where the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0033] A generation module, used to generate a target virtual container corresponding to a target virtual machine based on a resource call instruction through a server;

[0034] A calling module is used to execute resource calling instructions through the target virtual container and obtain the calling result from the corresponding hardware device in the physical machine;

[0035] The return module is used to return the call result to the target virtual machine through the target virtual container according to the interface information of the target virtual machine.

[0036] Optionally, the calling module is specifically used to determine the virtualized target calling hardware through the target virtual container; the target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called to obtain the calling result.

[0037] Optionally, the calling module is specifically used to determine the required resource ratio based on the resource information to be called through the target virtual container; the target virtual container performs resource calling on the virtualized target calling hardware according to the required resource ratio to obtain the calling result.

[0038] Optionally, if there are multiple target virtual containers that make resource calls to the virtualized target calling hardware, the calling module is specifically used to determine the duration of each target virtual machine's resource call to the target calling hardware based on the required resource ratio corresponding to each target virtual container through the target virtual container.

[0039] Optionally, the calling module is further used to determine the target calling hardware according to the resource information to be called through the target virtual container; the target virtual container packages the hardware information in the target calling hardware according to a predetermined format through a physical machine to obtain the virtualized target calling hardware.

[0040] Optionally, the instruction module is also used to establish an initial virtual machine according to the configuration data through a physical machine, wherein the initial virtual machine includes a pre-configured virtual computing platform and a virtual software development kit; the physical machine replaces the data of the software interface library in the virtual software development kit based on the pre-configured replacement file to obtain the target virtual machine.

[0041] Optionally, in the device, the target calling hardware is a graphics processor.

[0042] In another aspect of an embodiment of the present application, a resource calling device for a virtual machine is provided, the device is applied to a server in a cloud system, the cloud system includes: a physical machine and a server, the physical machine is communicatively connected with the server, and a plurality of virtual machines are deployed in the physical machine, the device includes: a receiving module, a container generating module, and a container executing module;

[0043] A receiving module, configured to receive a resource calling instruction sent by a target virtual machine, where the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0044] A container generation module, used to generate a target virtual container corresponding to a target virtual machine based on a resource call instruction;

[0045] The container execution module is used to execute resource call instructions through the target virtual container, obtain the call result from the corresponding hardware device in the physical machine, and return the call result to the target virtual machine according to the interface information of the target virtual machine.

[0046] Another aspect of an embodiment of the present application provides a computer device, including: a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and when the processor executes the computer program, the steps of the resource calling method of the virtual machine are implemented.

[0047] In another aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the resource calling method of a virtual machine are implemented.

[0048] The beneficial effects of the embodiments of the present application include:

[0049] In the resource calling method, device and storage medium of the virtual machine provided in the embodiment of the present application, a resource calling instruction can be sent to the server through the target virtual machine, and then the server generates a target virtual container corresponding to the target virtual machine based on the resource calling instruction, and the target virtual container executes the resource calling instruction, obtains the calling result from the corresponding hardware device in the physical machine, and returns the calling result to the target virtual machine according to the interface information of the target virtual machine. Among them, through the target virtual container calling method, resource allocation processing can be implemented for the case where there are multiple virtual machines, and the resource calling requirements for multiple virtual machines can be met. In addition, in the process of resource calling, it is not necessary to rely on the hardware structure of the device, so that resource calling can be implemented for virtual machines in any type of physical machine, which improves the applicability of resource calling. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0051] Figure 1 A schematic diagram of the structure of the cloud system provided in the embodiment of the present application;

[0052] Figure 2 A schematic diagram of a flow chart of a resource calling method for a virtual machine provided in an embodiment of the present application;

[0053] Figure 3 Another schematic diagram of a flow chart of a resource calling method for a virtual machine provided in an embodiment of the present application;

[0054] Figure 4 Another schematic diagram of a flow chart of a resource calling method for a virtual machine provided in an embodiment of the present application;

[0055] Figure 5 A schematic diagram of the relationship between multi-virtual machine resource calls provided in an embodiment of the present application;

[0056] Figure 6 Another schematic diagram of a flow chart of a resource calling method for a virtual machine provided in an embodiment of the present application;

[0057] Figure 7 Another schematic diagram of a flow chart of a resource calling method for a virtual machine provided in an embodiment of the present application;

[0058] Figure 8 Another flowchart of the resource calling method of the virtual machine provided in the embodiment of the present application;

[0059] Fig. 9 A schematic diagram of the structure of a resource calling device for a virtual machine provided in an embodiment of the present application;

[0060] Fig.10 Another structural diagram of a resource calling device for a virtual machine provided in an embodiment of the present application;

[0061] Fig.11 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.

[0063] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

[0064] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0065] In the description of the present application, it should be noted that the terms "first", "second", "third", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.

[0066] In the prior art, when a virtual machine calls hardware resources in a physical machine, it is usually based on a pre-configured transparent transmission solution in the application system. For example, for a Linux operating system, a hardware virtualization process can be performed based on a pre-configured vfio (Virtual Function IO, user-mode driver) framework to obtain corresponding software resources to implement resource calls to the virtual machine.

[0067] Alternatively, it can also be based on hardware or software virtualization solutions, for example: hardware virtualization is achieved through SR-IOV (Single Root I / O Virtualization) operating system, MIG (Multi-Instance GPU) operating system, etc.; software virtualization is achieved through mdev function, etc., to realize the calling process of virtual resources.

[0068] However, the transparent transmission solution can only transparently transmit a hardware to a virtual machine for use, which cannot meet the needs of multiple virtual machines, resulting in great limitations in practical applications; for software or hardware virtualization solutions, it will rely on the actual structural functions of the hardware, and the corresponding virtualization processing cannot be implemented for hardware that does not meet the functionality requirements.

[0069] In order to solve the above-mentioned technical problems existing in the prior art, a resource calling method of a virtual machine is provided in an embodiment of the present application, which can be specifically applied to a cloud system. The architecture of the cloud system is specifically explained below.

[0070] Figure 1 For a schematic diagram of the structure of the cloud system provided in the embodiment of the present application, please refer to Figure 1 The method is applied to a cloud system, which includes a physical machine 110 and a server 120 . The physical machine 110 is in communication connection with the server 120 , and a plurality of virtual machines 111 are deployed in the physical machine 110 .

[0071] Optionally, the cloud system may specifically be composed of multiple computer devices (such as the physical machine 110 and the server 120, etc. Figure 1 As shown in the figure, there are two physical machines and one server. In the actual configuration, there can be more) A system built through network connection or local connection, etc., in which the orchestration management platform k8s (kubernetes) of portable containers can run. Through this management platform, information transmission between various physical devices or virtual devices can be realized.

[0072] Among them, the physical machine 110 can be any type of computer device, such as: a mobile phone, a computer, a tablet computer, a dedicated electronic device, etc., without specific limitation here. The server 120 can be a cloud server deployed in the cloud or a local server deployed locally, without specific limitation here.

[0073] It should be noted that a virtual machine 111 may be configured in the physical machine 110. The number of virtual machines 111 may be one or more. The virtual machine 111 may be a virtual device that simulates an actual physical machine in a software manner. For example, a computer, a mobile phone, etc. may be simulated through a virtual machine. No specific limitation is made here.

[0074] The server 120 can also be used as a special physical machine to create a virtual container POD. The virtual container can be used as a carrier of transportation instructions or transportation data. It can also have certain processing functions and can transmit messages in the cloud system where the entire k8s platform is located.

[0075] The physical machine 110 and the server 120 may be different devices or the same device. If a virtual machine is running in a computer device and the creation of a virtual container can be implemented in the computer device, the device can be used as both a physical machine 110 and a server 120. The specific division method is based on the functions actually used and has nothing to do with the physical structure of the device.

[0076] The following is a detailed explanation of the specific implementation process of the resource calling method of the virtual machine in the embodiment of the present application based on the structure of the cloud system explained above.

[0077] Figure 2 For a flow chart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 2 , the method comprising:

[0078] S210: The target virtual machine sends a resource calling instruction to the server.

[0079] The target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called.

[0080] Optionally, the target virtual machine may be at least one of the multiple virtual machines, for example, it may be one or more virtual machines. If there are multiple virtual machines, these virtual machines may send resource call instructions to the same server.

[0081] It should be noted that the resource call instruction may specifically be an instruction to instruct the server to generate a corresponding virtual container so as to make a resource call to the target virtual machine, wherein the interface information of the target virtual machine may refer to the virtual interface for receiving data corresponding to the target virtual machine; the resource information to be called may refer to the relevant information of the resource to be called, such as: the address of the resource, the size of the computing power to be called, and the type of resource, etc., and no specific restrictions are made here, and the content of the corresponding resource information to be called can be selected according to the actual calling requirements.

[0082] It should be noted that the target virtual machine can realize information exchange with the server through the k8s platform, so as to send resource call instructions to the server.

[0083] S220: The server generates a target virtual container corresponding to the target virtual machine based on the resource calling instruction.

[0084] Optionally, after receiving the resource calling instruction sent by the target virtual machine, the server may generate a target virtual container corresponding to the target virtual machine based on the resource calling instruction.

[0085] For example, if there are multiple target virtual machines, a corresponding virtual container may be generated for each virtual machine, and the generated virtual containers are matched with the virtual machines one by one, and each target virtual machine may correspond to one target virtual container.

[0086] S230: The target virtual container executes the resource call instruction and obtains the call result from the corresponding hardware device in the physical machine.

[0087] Optionally, after the target virtual container is generated, the target virtual container can execute the resource call instruction sent by the target virtual machine. The specific execution process can be to parse the resource call instruction, determine the task to be executed, and then execute the corresponding task, that is, to obtain the call result from the corresponding hardware device in the physical machine.

[0088] The corresponding hardware device in the physical machine may be obtained by the target virtual container through parsing information such as the address of the resource and the type of the resource in the resource information to be called.

[0089] The call result may specifically be the call resource obtained after executing the called task. For example, if the hardware device is a graphics processor, such as a graphics card, the call resource may be the way to use the graphics processor. The virtual machine may use the graphics processor based on these call resources.

[0090] S240: The target virtual container returns the call result to the target virtual machine according to the interface information of the target virtual machine.

[0091] Optionally, after the target virtual container obtains the call result, it can return the call result to the corresponding interface of the target virtual machine according to the interface information of the target virtual machine. The interface can be, for example, a VCUDA (Virtual Compute Unified Device Architecture) interface. The target virtual machine can receive the call result through the corresponding interface and can use the corresponding hardware device based on the call result.

[0092] It should be noted that since the virtual machine is a software structure and the hardware device is a hardware structure, in the process of implementation and use, the computing power of the hardware device can be virtualized, thereby realizing the use of the hardware device by the virtual machine.

[0093] In the resource calling method of a virtual machine provided in the embodiment of the present application, a resource calling instruction can be sent to a server through a target virtual machine, and then the server generates a target virtual container corresponding to the target virtual machine based on the resource calling instruction, and the target virtual container executes the resource calling instruction, obtains the calling result from the corresponding hardware device in the physical machine, and returns the calling result to the target virtual machine according to the interface information of the target virtual machine. Among them, by calling the target virtual container, resource allocation processing can be implemented for the case where there are multiple virtual machines, and the resource calling requirements for multiple virtual machines can be met. In addition, in the process of resource calling, it is not necessary to rely on the hardware structure of the device, so that resource calling can be implemented for virtual machines in any type of physical machine, which improves the applicability of resource calling.

[0094] Another specific implementation process of the resource calling method of the virtual machine provided in the embodiment of the present application is explained in detail below.

[0095] Figure 3 For another flow chart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 3 , the target virtual container executes the resource call instruction and obtains the call result from the corresponding hardware device in the physical machine, including:

[0096] S310: The target virtual container determines the target calling hardware after virtualization processing.

[0097] Optionally, the target virtual container can specifically determine the target calling hardware after virtualization processing based on the resource information to be called in the resource calling instruction, wherein the target calling hardware can be any hardware device that can implement resource calling, for example: any type of processor, such as GPU (Graphic Processing Unit), CPU (Central Processing Unit) or storage device (such as: USB flash drive), input device (such as: mouse, keyboard, handle) and other types of hardware devices, without specific limitation here.

[0098] The target calling hardware after virtualization processing may be the target calling hardware subjected to virtualization processing of computing power, thereby realizing the software-based calling of resources.

[0099] For example, the target calling hardware can be determined to be a certain graphics processor through the resource information to be called in the resource calling instruction, and then the graphics processor can be virtualized to obtain the target calling hardware after virtualization.

[0100] Optionally, in the embodiment of the present application, the target calling hardware may specifically be a graphics processor.

[0101] S320: The target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called, and obtains a calling result.

[0102] Optionally, resource allocation specifically refers to allocation of resource usage time, for example, the target calling hardware after virtualization processing can be called within a certain allocated time.

[0103] It should be noted that if the target virtual container is one (that is, there is a target virtual machine that calls the target calling hardware), then the resource allocation of the virtualized target calling hardware can be performed according to the resource information to be called in the resource calling instruction sent by the target virtual machine to determine the calling result of the target virtual container on the target calling hardware.

[0104] If there are multiple target virtual containers, and the target calling hardware called by the multiple target virtual containers is different, resource allocation can be performed on the corresponding virtualized target calling hardware according to the resource information to be called in the resource calling instructions sent by each target virtual machine, so as to determine the calling result of each target virtual container on its corresponding target calling hardware.

[0105] If there are multiple target virtual containers, and the target calling hardware called by the multiple target virtual containers is the same, then resource allocation can be performed on the virtualized target calling hardware according to the resource information to be called in the resource calling instructions sent by each target virtual machine. That is, further resource allocation is performed on the same virtualized target calling hardware to ensure that each target virtual container is allocated, thereby determining the calling result of each target virtual container on the target calling hardware.

[0106] In the resource calling method of a virtual machine provided in the embodiment of the present application, the target calling hardware after virtualization processing can be determined by the target virtual container, and then the target virtual container allocates resources to the target calling hardware after virtualization processing based on the resource information to be called to obtain the calling result. Among them, by allocating resources through the target virtual container, the allocation problem when there are multiple virtual machines making resource calls can be more accurately realized, thereby more accurately realizing the allocation processing of resources.

[0107] Another specific implementation process of the resource calling method of the virtual machine provided in the embodiment of the present application is explained in detail below.

[0108] Figure 4 For another flow chart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 4 The target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called, and obtains the calling result, including:

[0109] S410: The target virtual container determines a required resource ratio based on the resource information to be called.

[0110] Optionally, the required resource ratio may be determined specifically according to the amount of computing power required to be called in the resource information to be called.

[0111] For example, if there are two target virtual containers, both of which call the hardware device for the same target, and the computing power required to be called is the same, it can be determined that the required resource ratio of each target virtual container is 50%.

[0112] It should be noted that the above is only one example. If there are more target virtual containers, or there is a preset maximum resource ratio setting, the result of the ratio allocation can also be adjusted. For example, if there are three target virtual containers, all of which call the hardware device for the same target, and the computing power required to call the three target virtual containers is the same, if there is a preset maximum resource ratio of 90%, the required resource ratio can be divided under the premise of the maximum resource ratio, that is, the required resource ratio of each target virtual container is 30%.

[0113] S420: The target virtual container performs resource calls on the virtualized target calling hardware according to the required resource ratio to obtain a call result.

[0114] Optionally, after determining the required resource ratio based on the above method, the target virtual container may perform resource calls on the virtualized target calling hardware according to the required resource ratio to obtain a call result.

[0115] It should be noted that the calling method for calling resources may also be determined according to the resource ratio, and the calling result may be determined according to the corresponding calling method.

[0116] In the resource calling method of the virtual machine provided in the embodiment of the present application, the target virtual container can determine the required resource ratio based on the resource information to be called; and then the target virtual container performs resource calling on the virtualized target calling hardware according to the required resource ratio to obtain the calling result. Among them, based on the required resource ratio, the resource calling of the target calling hardware can be more reasonably realized, so that the allocation of resource calling can be realized more accurately and balanced, and the efficiency of resource use can be improved.

[0117] Optionally, if there are multiple target virtual containers that make resource calls to the target calling hardware after virtualization processing; after the target virtual container determines the required resource ratio based on the resource information to be called, the method also includes: the target virtual container determines the duration of each target virtual machine making a resource call to the target calling hardware based on the required resource ratio corresponding to each target virtual container.

[0118] Specifically, the target virtual container can determine the duration of resource calls made by each target virtual machine to the target calling hardware based on the demand resource ratio corresponding to each target virtual container. For example, if the demand resource ratio corresponding to a certain target virtual container is 50%, 50% of the usage time of the target calling hardware can be attributed to the target virtual machine corresponding to the target virtual container. In the process of determining the resource calling duration, a specific time interval can be determined. For example, 0:00-12:00 can be allocated to the virtual machine corresponding to the target virtual container for resource calls based on 24 hours a day. The length of the time interval can be fixed. The corresponding interval can be selected according to actual needs during specific allocation. For example, it can also be 1:00 to 13:00, or the time interval can be split, such as 1:00 to 12:00 and 13:00 to 14:00.

[0119] After determining the duration of the resource call, the duration of the resource call can also be used as a part of the call result and returned by the target virtual container to the corresponding target virtual machine.

[0120] In order to more clearly demonstrate the allocation of usage duration for multiple virtual machines, a specific implementation method for allocating the duration of resource calls of multiple virtual machines is explained below through specific examples.

[0121] Figure 5 For the relationship diagram of multi-virtual machine resource calls provided in the embodiment of the present application, please refer to Figure 5 , Figure 5 In the example, resource calls are made by three target virtual machines, wherein the first target virtual machine 510 , the second target virtual machine 520 , and the third target virtual machine 530 all make calls to the target calling hardware 540 .

[0122] Among them, the required resources account for 50% of the first target virtual machine 510, and the required resources account for 25% of the second target virtual machine 520 and the third target virtual machine 530. The resource calling time corresponding to the first target virtual machine 510 is 12 hours / day; the resource calling time corresponding to the second target virtual machine 520 and the third target virtual machine 530 is 6 hours / day. The specific usage time can be allocated according to actual needs. No specific restrictions are made here. Within the corresponding time interval, only the corresponding target virtual machine can implement the call to the target call hardware 540.

[0123] In the resource calling method of the virtual machine provided in the embodiment of the present application, the duration of resource calling of each target virtual machine on the target calling hardware can be determined by the target virtual container based on the required resource ratio corresponding to each target virtual container. Among them, by determining the resource calling duration, the resource allocation method and the ratio can be better determined when there are multiple target virtual machines, so that the reasonable allocation of resources can be achieved, the waste of calling resources can be avoided, and the applicability of calling resources can be improved.

[0124] Another feasible implementation of the resource calling method of the virtual machine provided in the embodiment of the present application is explained in detail below.

[0125] Figure 6 For another flow chart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 6 , the target virtual container determines the target calling hardware after virtualization processing, including:

[0126] S610: The target virtual container determines the target calling hardware according to the resource information to be called.

[0127] Optionally, the target virtual container may determine the corresponding target calling control according to address information of the resource to be called in the resource information to be called, and the like.

[0128] For example: if the target calling hardware is hardware outside the physical machine (the hardware is connected to the physical machine through the interface of the physical machine), the address information can specifically be the location of a hardware interface in the physical machine; if the target calling control is hardware on the physical machine (the hardware is integrated and set at a certain location in the physical machine), the address information can specifically be the location of an existing hardware in the physical machine.

[0129] After the corresponding hardware location is determined in the above manner, the corresponding call processing can be performed.

[0130] S620: The target virtual container packages the hardware information in the target calling hardware according to a predetermined format through the physical machine to obtain the virtualized target calling hardware.

[0131] Optionally, after determining the target calling hardware, the target virtual container can package and process the hardware information in the target calling hardware through the physical machine in a predetermined format to obtain the virtualized target calling hardware. For example, the hardware information can be packaged and processed in a format negotiated with the data service unit (such as the kvm_cuda_service unit) in the target virtual container to obtain the virtualized target calling hardware.

[0132] After obtaining the virtualized target calling hardware, the target virtual machine can call the target virtual container by remote calling, thereby realizing the process of transmitting the virtualized target calling hardware to the target virtual machine.

[0133] In the resource calling method of the virtual machine provided in the embodiment of the present application, the target calling hardware can be determined by the target virtual container according to the resource information to be called; the target virtual container packages the hardware information in the target calling hardware according to a predetermined format through the physical machine to obtain the virtualized target calling hardware. Among them, the packaging process performed by the target virtual container can realize the virtualization processing of the hardware device, thereby facilitating the calling of resources by the virtual machine and improving the efficiency of the call.

[0134] The following is a detailed explanation of the specific implementation steps that need to be performed before using the virtual machine in the embodiment of the present application.

[0135] Figure 7 For another flow chart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 7 Before the target virtual machine sends a resource call instruction to the server, the method further includes:

[0136] S710: The physical machine creates an initial virtual machine according to the configuration data.

[0137] The initial virtual machine includes a pre-configured virtual computing platform and a virtual software development kit.

[0138] Optionally, the initial virtual machine may be established in response to a worker's operation, or may be an initial virtual machine created based on a pre-configured automatic creation program. These are initial virtual machines established according to configuration data after relevant data is pre-configured in a physical machine.

[0139] The initial virtual machine may include the above-mentioned VCUDA, that is, a virtual computing platform, may be configured with corresponding relevant virtual interfaces, may also include SDK (Software Development Kit, virtual software development kit), and may not be configured with relevant drivers.

[0140] S720: The physical machine replaces data in the software interface library in the virtual software development kit based on the pre-configured replacement file to obtain a target virtual machine.

[0141] Optionally, the virtual software development kit may include a software interface library "libcuda", and the pre-configured replacement file may be a "libcuda_kvm.so" file, which may specifically be an instruction for hijacking application layer CUDA calls. The virtual machine obtained after replacing the data of the initial virtual machine based on the above method is the above target virtual machine.

[0142] It should be noted that after replacing the data in the above manner, a hijacked call can be implemented. Specifically, the target virtual machine can organize the call result into a data packet based on the data, and the data packet can be stored in a resource call instruction and sent to the target virtual container, thereby realizing a series of call operations of the target virtual container, such as: executing the call, calling the return process, etc., that is, the configuration of the execution method in the target virtual container can be realized through the initial configuration of the virtual machine.

[0143] In the resource calling method of the virtual machine provided in the embodiment of the present application, an initial virtual machine can be established by a physical machine according to configuration data; and then the physical machine replaces the data of the software interface library in the virtual software development kit based on the pre-configured replacement file to obtain the target virtual machine. Among them, by replacing the data of the software interface library by the physical machine, the software interface library of the target virtual machine can be changed, and then the configuration of the target virtual machine to the target virtual container can be realized, so that the execution call and call return and other related functions of the target virtual container can be realized, and the corresponding call is executed by the target virtual container, which can also improve the efficiency of the call.

[0144] Another implementation of the resource calling method of the virtual machine provided in the embodiment of the present application is explained in detail below.

[0145] Figure 8 For another flowchart of the resource calling method of the virtual machine provided in the embodiment of the present application, please refer to Figure 8 , the method comprising:

[0146] S810: Receive a resource calling instruction sent by a target virtual machine.

[0147] The target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called.

[0148] Optionally, the execution subject of the method may be the above-mentioned server, and the server may receive the resource calling instruction sent by the target virtual machine.

[0149] The target virtual machine may be one or more than one, and no specific limitation is given here. For the same server, resource calling instructions sent by multiple target virtual machines may be received.

[0150] S820: Generate a target virtual container corresponding to the target virtual machine based on the resource calling instruction.

[0151] Optionally, after receiving the resource calling instruction, the server may generate a target virtual container corresponding to the target virtual machine based on the resource calling instruction. For each resource calling instruction sent by the target virtual machine, a corresponding target virtual container may be generated.

[0152] For example, if the server receives resource call instructions sent by two different target virtual machines, two different target virtual containers may be generated according to the two resource call instructions, each of which corresponds to one of the target virtual machines.

[0153] S830: Execute the resource call instruction through the target virtual container, obtain the call result from the corresponding hardware device in the physical machine, and return the call result to the target virtual machine according to the interface information of the target virtual machine.

[0154] Optionally, after obtaining the target virtual container, the target virtual container can execute the corresponding resource call instruction, and during the execution process, the call result can be obtained from the corresponding hardware device in the physical machine, and the call result is returned to the target virtual machine according to the interface information of the target virtual machine.

[0155] It should be noted that the specific implementation process of the above steps has been explained accordingly in the aforementioned S210-S240 and will not be repeated here.

[0156] In the resource calling method of a virtual machine provided in the embodiment of the present application, a server can receive a resource calling instruction sent by a target virtual machine, generate a target virtual container corresponding to the target virtual machine based on the resource calling instruction, and execute the resource calling instruction by the target virtual container, obtain the calling result from the corresponding hardware device in the physical machine, and return the calling result to the target virtual machine according to the interface information of the target virtual machine. Among them, by calling the target virtual container, resource allocation processing can be implemented for the case where there are multiple virtual machines, and the resource calling requirements for multiple virtual machines can be met. In addition, in the process of resource calling, it is not necessary to rely on the hardware structure of the device, so that resource calling can be implemented for virtual machines in any type of physical machine, thereby improving the applicability of resource calling.

[0157] The following describes the apparatus, device, storage medium, etc. corresponding to the resource calling method of the virtual machine provided in the present application for executing. The specific implementation process and technical effects are as mentioned above and will not be repeated below.

[0158] Fig. 9 For a structural diagram of a resource calling device for a virtual machine provided in an embodiment of the present application, please refer to Fig. 9The device is applied to a cloud system, the cloud system includes: a physical machine and a server, the physical machine is in communication connection with the server, and a plurality of virtual machines are deployed in the physical machine. The device includes: an instruction module 910, a generation module 920, a call module 930, and a return module 940;

[0159] The instruction module 910 is used to send a resource calling instruction to the server through a target virtual machine, where the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0160] A generation module 920, configured to generate a target virtual container corresponding to a target virtual machine based on a resource call instruction through a server;

[0161] The calling module 930 is used to execute the resource calling instruction through the target virtual container and obtain the calling result from the corresponding hardware device in the physical machine;

[0162] The return module 940 is used to return the call result to the target virtual machine through the target virtual container according to the interface information of the target virtual machine.

[0163] Optionally, the calling module 930 is specifically configured to determine the virtualized target calling hardware through the target virtual container; the target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called to obtain a calling result.

[0164] Optionally, the calling module 930 is specifically configured to determine a required resource ratio based on resource information to be called through the target virtual container; the target virtual container performs resource calling on the virtualized target calling hardware according to the required resource ratio to obtain a calling result.

[0165] Optionally, if there are multiple target virtual containers that make resource calls to the virtualized target calling hardware, the calling module 930 is specifically used to determine the duration of each target virtual machine making resource calls to the target calling hardware based on the required resource ratio corresponding to each target virtual container through the target virtual container.

[0166] Optionally, the calling module 930 is also used to determine the target calling hardware according to the resource information to be called through the target virtual container; the target virtual container packages the hardware information in the target calling hardware according to a predetermined format through the physical machine to obtain the virtualized target calling hardware.

[0167] Optionally, instruction module 910 is also used to establish an initial virtual machine according to configuration data through a physical machine, wherein the initial virtual machine includes a pre-configured virtual computing platform and a virtual software development kit; the physical machine replaces data in the software interface library in the virtual software development kit based on the pre-configured replacement file to obtain a target virtual machine.

[0168] Optionally, in the device, the target calling hardware is a graphics processor.

[0169] In the resource calling device of the virtual machine provided in the embodiment of the present application, the target virtual machine can send a resource calling instruction to the server, and then the server generates a target virtual container corresponding to the target virtual machine based on the resource calling instruction, and the target virtual container executes the resource calling instruction, obtains the calling result from the corresponding hardware device in the physical machine, and returns the calling result to the target virtual machine according to the interface information of the target virtual machine. Among them, through the target virtual container calling method, resource allocation processing can be implemented for the case where there are multiple virtual machines, and the resource calling requirements for multiple virtual machines can be met. In addition, in the process of resource calling, it is not necessary to rely on the hardware structure of the device, so that resource calling can be implemented for virtual machines in any type of physical machine, which improves the applicability of resource calling.

[0170] Fig.10 For another structural diagram of the resource calling device of the virtual machine provided in the embodiment of the present application, please refer to Fig.10 , a virtual machine resource calling device is provided, the device is applied to a server in a cloud system, the cloud system includes: a physical machine and a server, the physical machine is in communication connection with the server, and a plurality of virtual machines are deployed in the physical machine, the device includes: a receiving module 950, a container generating module 960, and a container executing module 970;

[0171] The receiving module 950 is used to receive a resource calling instruction sent by a target virtual machine, where the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called;

[0172] The container generation module 960 is used to generate a target virtual container corresponding to the target virtual machine based on the resource call instruction;

[0173] The container execution module 970 is used to execute the resource call instruction through the target virtual container, obtain the call result from the corresponding hardware device in the physical machine, and return the call result to the target virtual machine according to the interface information of the target virtual machine.

[0174] In the resource calling method of a virtual machine provided in the embodiment of the present application, a server can receive a resource calling instruction sent by a target virtual machine, generate a target virtual container corresponding to the target virtual machine based on the resource calling instruction, and execute the resource calling instruction by the target virtual container, obtain the calling result from the corresponding hardware device in the physical machine, and return the calling result to the target virtual machine according to the interface information of the target virtual machine. Among them, by calling the target virtual container, resource allocation processing can be implemented for the case where there are multiple virtual machines, and the resource calling requirements for multiple virtual machines can be met. In addition, in the process of resource calling, it is not necessary to rely on the hardware structure of the device, so that resource calling can be implemented for virtual machines in any type of physical machine, thereby improving the applicability of resource calling.

[0175] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0176] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASICs), or one or more microprocessors, or one or more field programmable gate arrays (FPGAs). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0177] Fig.11 For a schematic diagram of the structure of the computer device provided in the embodiment of the present application, please refer to Fig.11 The computer device includes: a memory 980 and a processor 990. The memory 980 stores a computer program that can be run on the processor 990. When the processor 990 executes the computer program, the steps of the resource calling method of the virtual machine are implemented.

[0178] Optionally, the above-mentioned computer device may specifically be any physical machine or server structure in the cloud system, which is not specifically limited here.

[0179] In another aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the resource calling method of the virtual machine are implemented.

[0180] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0181] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0182] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0183] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

[0184] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0185] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for calling resources of a virtual machine, It is characterized in that The method is applied to a cloud system, the cloud system comprising: a physical machine and a server, the physical machine is communicatively connected with the server, a plurality of virtual machines are deployed in the physical machine, and the method comprises: The target virtual machine sends a resource calling instruction to the server, the target virtual machine is at least one of the multiple virtual machines, and the resource calling instruction includes: interface information of the target virtual machine and resource information to be called; The server generates a target virtual container corresponding to the target virtual machine based on the resource call instruction. If there are multiple target virtual machines, the target virtual machines correspond to the target virtual containers one by one, and the target virtual containers serve as carriers of transport instructions or transport data. The target virtual container executes the resource calling instruction and obtains a calling result from a corresponding hardware device in the physical machine, wherein the calling result includes a calling resource in the corresponding hardware device in the physical machine; The target virtual container returns the call result to the target virtual machine according to the interface information of the target virtual machine; The target virtual machine uses the calling resources in the corresponding hardware device according to the calling result; The target virtual container executes the resource call instruction and obtains a call result from a corresponding hardware device in the physical machine, including: The target virtual container determines the target calling hardware according to the resource information to be called, wherein the resource information to be called includes at least address information, the target calling hardware is hardware outside the physical machine or hardware on the physical machine, and the address information is a location of a hardware interface in the physical machine or a location of hardware in the physical machine; The target virtual container packages the hardware information in the target calling hardware according to a predetermined format through the physical machine to obtain the virtualized target calling hardware; The target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called to obtain the calling result.

2. The method for calling a resource of a virtual machine according to claim 1, It is characterized in that The target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called to obtain the calling result, including: The target virtual container determines the required resource ratio based on the resource information to be called; The target virtual container performs resource calling on the virtualized target calling hardware according to the required resource ratio to obtain the calling result.

3. The resource calling method of a virtual machine according to claim 2, It is characterized in that If there are multiple target virtual containers, the virtualized target calling hardware is used to make resource calls; After the target virtual container determines the required resource ratio based on the resource information to be called, the method further includes: The target virtual container determines the duration for each target virtual machine to call the target calling hardware for resources based on the required resource ratio corresponding to each target virtual container.

4. The resource calling method of a virtual machine according to claim 1, It is characterized in that Before the target virtual machine sends a resource call instruction to the server, the method further includes: The physical machine establishes an initial virtual machine according to the configuration data, wherein the initial virtual machine includes a pre-configured virtual computing platform and a virtual software development kit; The physical machine replaces data in the software interface library in the virtual software development kit based on a pre-configured replacement file to obtain the target virtual machine.

5. The method for calling a resource of a virtual machine according to any one of claims 2 to 3, It is characterized in that The target calling hardware is a graphics processor.

6. A method for calling resources of a virtual machine, It is characterized in that The method is applied to a server in a cloud system, the cloud system comprising: a physical machine and the server, the physical machine being communicatively connected to the server, and a plurality of virtual machines being deployed in the physical machine, the method comprising: receiving a resource calling instruction sent by a target virtual machine, the target virtual machine being at least one of the multiple virtual machines, the resource calling instruction including: interface information of the target virtual machine and resource information to be called; Generate a target virtual container corresponding to the target virtual machine based on the resource call instruction. If there are multiple target virtual machines, the target virtual machines correspond to the target virtual containers one by one, and the target virtual containers serve as carriers of transport instructions or transport data; Executing the resource call instruction through the target virtual container, obtaining a call result from the corresponding hardware device in the physical machine, the call result including the call resource in the corresponding hardware device in the physical machine; returning the call result to the target virtual machine according to the interface information of the target virtual machine, so that the target virtual machine uses the call resource in the corresponding hardware device according to the call result; Executing the resource call instruction through the target virtual container to obtain a call result from a corresponding hardware device in the physical machine includes: The target calling hardware is determined through the target virtual container according to the resource information to be called, wherein the resource information to be called includes at least address information, the target calling hardware is hardware outside the physical machine or hardware on the physical machine, and the address information is the location of the hardware interface in the physical machine or the location of the hardware in the physical machine; the target virtual container packages the hardware information in the target calling hardware according to a predetermined format through the physical machine to obtain the virtualized target calling hardware; and the target virtual container allocates resources to the virtualized target calling hardware based on the resource information to be called to obtain the calling result.

7. A computer device, It is characterized in that include: A memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of claims 1 to 5.