Virtual resource allocation method and device, electronic device, and storage medium

By introducing a primary controller and multiple secondary controllers into the SSD, and combining them with SR-IOV hardware I/O virtualization technology, stable and rapid resource allocation of the SSD in a virtualization environment is achieved. This solves the problem of inconsistent resource allocation in SSD virtualization technology and improves the flexibility and efficiency of resource allocation.

CN114637473BActive Publication Date: 2025-11-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210343037.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2025-11-28
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

There is currently no universal and common virtual resource allocation scheme for solid-state storage (SSD) virtualization technology, which leads to the immaturity of SSD virtualization technology.

Method used

By introducing a primary controller and multiple secondary controllers into the SSD, and utilizing SR-IOV hardware I/O virtualization technology, multiple virtual devices are created based on virtualization management commands and user resource requirements. Physical resources are then flexibly allocated, and a mapping relationship between physical and virtual resources is established.

Benefits of technology

It achieves stable and rapid resource allocation for SSDs in a virtualization environment, fully leverages the high performance of SSDs, solves the problem of inconsistent resource allocation in SSD virtualization technology, and improves the flexibility and efficiency of resource allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114637473B_ABST
    Figure CN114637473B_ABST
Patent Text Reader

Abstract

The application provides a virtual resource allocation method and device, an electronic device and a storage medium, and the method comprises the following steps: in the case that a virtualization management command issued by a physical host is received, a plurality of secondary controllers are virtually generated by using a primary controller corresponding to a physical device, wherein each secondary controller corresponds to a virtual device; and the primary controller performs virtual resource allocation on the virtual device corresponding to the secondary controller according to the virtualization management command and a user resource demand, wherein the user resource demand is the resource demand occupied by the user when the user issues a request. Through the application, the problem that a general and common virtual resource allocation scheme based on the SSD virtualization technology has not been proposed in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of solid-state memory, and in particular to a virtual resource allocation method and device, an electronic device, and a storage medium. BACKGROUND

[0002] At present, in the scene of realizing physical resource sharing or virtual resource allocation by using solid-state memory (SSD) virtualization technology, for the SSD virtualization technology, various SSD manufacturers are still in the stage of expansion and expansion, and the technology is far from mature, and a common virtual resource allocation scheme has not been proposed. SUMMARY

[0003] The present application provides a virtual resource allocation method and device, an electronic device, and a storage medium to at least solve the problem that a common virtual resource allocation scheme has not been proposed based on the SSD virtualization technology in the related art.

[0004] According to an aspect of an embodiment of the present application, a virtual resource allocation method is provided, which includes: in the case of receiving a virtualization management command issued by a physical host, using a primary controller corresponding to a physical device to virtually create a plurality of secondary controllers, wherein each secondary controller corresponds to a virtual device;

[0005] The primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and a user resource demand amount, wherein the user resource demand amount is the resource amount required to be occupied by the user when the user issues a request.

[0006] According to another aspect of an embodiment of the present application, a virtual resource allocation device is also provided, which includes:

[0007] A receiving unit is configured to, in the case of receiving a virtualization management command issued by a physical host, use a primary controller corresponding to a physical device to virtually create a plurality of secondary controllers, wherein each secondary controller corresponds to a virtual device;

[0008] A resource allocation unit is configured to perform virtual resource allocation to the virtual device corresponding to the secondary controller by the primary controller according to the virtualization management command and a user resource demand amount, wherein the user resource demand amount is the resource amount required to be occupied by the user when the user issues a request.

[0009] Optionally, the resource allocation unit includes:

[0010] A setting module is configured to set the secondary controller to an online state by the primary controller using the virtualization management command;

[0011] an allocation module, configured to allocate virtual resources to the virtual devices corresponding to the secondary controllers according to the user resource demand amount when the secondary controllers are in the online state.

[0012] Optionally, the allocation module comprises:

[0013] a determination subunit, configured to determine the physical resources allocated to the primary controller according to the user resource demand amount;

[0014] an establishment subunit, configured to establish a mapping relationship between the physical resources and the virtual resources;

[0015] an acquisition subunit, configured to acquire the virtual resources according to the mapping relationship;

[0016] a first allocation subunit, configured to allocate the virtual resources to the secondary controllers, wherein the secondary controllers are configured to manage the virtual resources for the virtual devices.

[0017] Optionally, the setting module sets the secondary controllers to the online state according to the following steps:

[0018] a first setting subunit, configured to set the secondary controllers to an offline state by the primary controller using the virtualization management command;

[0019] a second allocation subunit, configured to allocate virtual queue resources and virtual interrupt resources to the secondary controllers by the primary controller;

[0020] a second setting subunit, configured to reset the function level of the virtual devices corresponding to the secondary controllers and set the secondary controllers to the online state by the virtualization management command.

[0021] Optionally, the apparatus further comprises:

[0022] a storage unit, configured to store the physical resources in a physical resource pool;

[0023] a deletion unit, configured to delete a first physical resource from the physical resource pool after the first physical resource is allocated to the mapped virtual resource, wherein the first physical resource is any physical resource in the physical resource pool.

[0024] Optionally, the apparatus further comprises:

[0025] a setting unit, configured to set a namespace for the primary controller and the secondary controllers;

[0026] The partition unit is configured to partition logical block addresses corresponding to the data space of the primary controller and the data space of the secondary controller according to the namespace, to obtain a plurality of units of the namespace.

[0027] According to yet another aspect of the embodiments of the present application, an electronic device is provided, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus; the memory is configured to store a computer program; and the processor is configured to execute the method steps in any of the above embodiments by running the computer program stored in the memory.

[0028] According to yet another aspect of the embodiments of the present application, a computer readable storage medium is provided, which stores a computer program, wherein the computer program is configured to execute the method steps in any of the above embodiments when running.

[0029] In the embodiments of the present application, a plurality of secondary controllers are virtually generated by using a primary controller corresponding to a physical device in the case that a virtualization management command issued by a physical host is received, wherein each secondary controller corresponds to a virtual device; the primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and a user resource demand, wherein the user resource demand is the resource demand occupied by the user when issuing a request. Due to the embodiments of the present application, the virtualization technology environment is applied to make the SSD device have a plurality of controllers (the first controller and the second controller), and a plurality of second controllers are virtually generated based on the first controller, and then a plurality of virtual devices are virtually generated, physical resource sharing is performed in the case of the plurality of virtual devices, the high performance of the SSD is fully played, the SSD can stably and quickly allocate virtual resources to the virtual device, the technical effect of flexible allocation is achieved, and the problem that a general and common virtual resource allocation scheme based on the SSD virtualization technology has not been proposed in the related art is solved. BRIEF DESCRIPTION OF DRAWINGS

[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.

[0032] Figure 1is a flow diagram of an optional virtual resource allocation method according to an embodiment of the present application;

[0033] Figure 2 is a relationship diagram among an optional host, virtual device and controller according to an embodiment of the present application;

[0034] Figure 3 is a diagram of a mapping relationship between an optional physical resource and virtual resource according to an embodiment of the present application;

[0035] Figure 4 is a namespace management diagram of an optional controller according to an embodiment of the present application;

[0036] Figure 5 is a structural block diagram of an optional virtual resource allocation apparatus according to an embodiment of the present application;

[0037] Figure 6 is a structural block diagram of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0038] In order to make the personnel in the art better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present application.

[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0040] For virtual resource allocation in SSD virtualization technology, various SSD manufacturers are still in the expansion and expansion stage, and the technology is far from mature, and a common virtual resource allocation scheme has not yet been proposed. In order to solve the above problems, the present application provides a virtual resource allocation method, which is applied to the SSD side, and the method comprises the following steps:

[0041] In a case where the virtualization management command sent by the physical host is received, a plurality of secondary controllers are virtually created by using a primary controller corresponding to the physical device, and each of the secondary controllers corresponds to a virtual device;

[0042] In step S102, the primary controller allocates virtual resources to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource demand of the user when the user sends a request.

[0043] Optionally, after the SSD is powered on, if a virtualization management command sent by the physical host is received, a plurality of secondary controllers are virtually created by using a real physical controller (hereinafter referred to as a primary controller) corresponding to the physical device (Physical Function, PF) of the SSD, and the number of the primary controller and the secondary controller is not limited in the embodiment of the application, but the number of the secondary controller is the same as the number of the virtual device (Virtual Function, VF) virtually created. It needs to be introduced that the hardware I / O virtualization technology standard of SR-IOV (Single Root I / O Virtualization) is used in the embodiment of the application, and as a hardware I / O virtualization solution, SR-IOV defines that the I / O device is natively shareable, and a plurality of virtual devices can be created from an SR-IOV device, and the virtual devices are allocated to different virtual machines, so that the sharing of the physical hardware is realized. The combination of NVMe SSD and SR-IOV can share physical resources in the case of a plurality of virtual machines, and the high performance of the SSD can be fully utilized, especially in the virtualization and cloud computing scenarios, the virtualization technology of SR-IOV can reduce the number of PCIe devices required by the customer.

[0044] In addition, in the embodiment of the application, the physical host can also send an identification command and a virtualization management command to the physical device of the SSD at the same time, and then determine and manage the secondary controller based on the identification command and the virtualization management command, for example, the physical host can send an identification command to the controller, and obtain the secondary controller associated with the primary controller in the controller list. Through the identification command, the total number of virtual devices supported by the SSD device, the maximum resource limit allocated to each virtual device and other information can be known. The primary controller uses the virtualization management command to allocate the virtual resources of the secondary controller and set the corresponding state.

[0045] It can be known that in addition to referring to the virtualization management command, the virtual resource allocation to the secondary controller also needs to be combined with the actual resource quantity demand of the user. It should be noted that the number of users here can be multiple, and is usually a user who sends some requests, so the total amount of virtual resources allocated can be determined based on the resource quantity that needs to be occupied corresponding to the request information sent by the user.

[0046] For better understanding, see the relationship diagram shown in Figure 2 To fully exert the high performance of the SSD, the SSD device has multiple controllers, which can be primary controllers or secondary controllers. In the embodiments of the present application, it is assumed that the SSD device only has one primary controller, n secondary controllers are virtually created by the primary controller, the primary controller only serves as a management controller and does not perform read-write business, and the secondary controllers are responsible for completing IO read-write tasks. From the perspective of the host, each virtual machine can see an SSD device, which is a virtual device of the SSD, and each virtual device is supported by a secondary controller. The primary controller corresponds to the physical device of the SSD.

[0047] In the embodiments of the present application, multiple secondary controllers are virtually created by the primary controller corresponding to the physical host by receiving the virtualization management command, wherein each secondary controller corresponds to a virtual device. The primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand quantity, wherein the user resource demand quantity is the resource quantity required to be occupied when the user sends a request. Due to the embodiments of the present application, the virtualization technology environment is applied to make the SSD device have multiple controllers (the first controller and the second controller), and multiple second controllers are virtually created based on the first controller, and multiple virtual devices are virtually created, physical resource sharing is performed under the condition of multiple virtual devices, the high performance of the SSD is fully exerted, the SSD can stably and quickly allocate virtual resources to the virtual device, the technical effect of flexible allocation is achieved, and the problem that a general and common virtual resource allocation scheme has not been proposed based on the SSD virtualization technology in the related art is solved.

[0048] As an optional embodiment, the primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand quantity, including:

[0049] The primary controller sets the secondary controller to an online state by using the virtualization management command;

[0050] In the case that the secondary controller is in the online state, the virtual resource is allocated to the virtual device corresponding to the secondary controller according to the user resource demand quantity.

[0051] Optionally, the secondary controller defines two states: Online - an online state in which the required resources are normally allocated, and in which state (CC_EN: 0->1 and CSTS.RDY is set) the secondary controller can be normally used. Offline - an offline state in which the secondary controller cannot be used by the host, and CSTS.CFS needs to be set to 1.

[0052] Therefore, in order to ensure that the physical host can accurately confirm that the SSD has the capability of the secondary controller, the physical host issues some commands to control the primary controller to set the online state of the secondary controller. Specifically, the online state of the secondary controller is set according to the following steps:

[0053] The primary controller sets the secondary controller to an offline state by using a virtualization management command.

[0054] The primary controller allocates virtual queue resources and virtual interrupt resources to the secondary controller.

[0055] After determining the virtual device corresponding to the secondary controller, the virtual device is functionally reset, and the secondary controller is set to an online state by using a virtualization management command.

[0056] It should be noted that the physical host can also use a virtualization management command to convert the online and offline states of the secondary controller. When converted from online to offline, all virtual queue resources and virtual interrupt resources need to be removed from the secondary controller.

[0057] Then, in the case that the secondary controller is in an online state, the primary controller allocates virtual resources to the virtual device corresponding to the secondary controller according to the user resource demand.

[0058] In the embodiments of the present application, it is necessary to ensure that the physical host can accurately confirm that the SSD has the capability of the secondary controller, so as to realize reasonable allocation of virtual resources.

[0059] As an optional embodiment, allocating virtual resources to the virtual device corresponding to the secondary controller according to the user resource demand includes:

[0060] Determining the physical resources allocated by the primary controller according to the user resource demand;

[0061] Establishing a mapping relationship between the physical resources and the virtual resources;

[0062] Obtaining the virtual resources according to the mapping relationship;

[0063] Allocating the virtual resources to the secondary controller, wherein the secondary controller is used to manage the virtual resources for the virtual device.

[0064] Optionally, in order to enable the virtual device to work like a physical device, the virtual device needs to be allocated necessary controller resources, and the controller resources are allocated or deleted by issuing virtualization management commands to the primary controller. The following controller resources are defined:

[0065] (1) Virtual queue resource: a resource type for managing submission queue (SQ) and completion queue (CQ), and a primary controller supporting virtual queue resource should have at least two pairs of dedicated resource queues to ensure that the host controller always has at least one pair of Admin queue and one pair of I / O queue; each secondary controller needs to be allocated at least one pair of Admin queue and one pair of IO queue; that is, the minimum number of VQ resources allocated to the secondary controller is 2.

[0066] (2) Virtual interrupt resource: a resource type for managing MSI-X interrupts, and when creating an I / O CQ, the controller needs to map the MSI-X interrupt vector to the corresponding CQ.

[0067] (3) Namespace resource: a space resource type, and each virtual device must be allocated a namespace resource of sufficient size to ensure that the user has sufficient storage space for reading and writing data.

[0068] On the other hand, all resources can be divided into private resources and flexible allocation resources (FR, public resources). According to the protocol specification, both private resources and public resources can be allocated to physical devices, but virtual devices can only be allocated a certain type of resource, usually only public resources.

[0069] The allocation of virtual queue resources and the allocation of primary / secondary controllers are set by the virtualization management commands issued by the physical host, and a one-to-one mapping relationship between physical resources and virtual resources is established inside the host. For example, the physical resources allocated by the primary controller are determined according to the user's resource demand, and then the virtual resources are obtained according to the one-to-one mapping relationship between the physical resources and the virtual resources, and then the virtual resources are allocated to the secondary controller for virtual resource management. In this way, the virtual device contains the allocated virtual resources.

[0070] Taking SQ as an example, as shown in Figure 3 , a one-to-one mapping relationship between SQ physical resources and SQ virtual resources is shown, assuming that there are 1024 physical submission queues, 1 physical device and 63 virtual devices, Figure 3In the middle, the physical submission queue is bound to each virtual submission queue of the virtual device, each virtual submission queue with id=0 is the admin submission queue, and the others are IO submission queues. Each virtual queue and physical queue must be in one-to-one mapping relationship, but can not be mapped in the order shown in the figure, for example: VSQ0 of VF1 corresponds to physical submission queue SQ10. Therefore, a data structure must be established to save the mapping from virtual queue to physical queue, and the following data structure is established in the embodiment of the present application:

[0071] typedef struct{

[0072] u32 FunctionID;

[0073] u32 vSubQ2pSubQ[MAXVSUB];

[0074] u32 vCplQ2pCplQ[MAXVCPL];

[0075] u32 vInt2pInt[MAXVINT];

[0076] }funcVirtual2Physical_map_t

[0077] funcVirtual2Physical_map_t funcVirtual2Physical_map

[64] ;

[0078] In the process of the physical host actually issuing a command, it is necessary to quickly search from the physical queue to the virtual queue for determining to which virtual device the command is sent. A register mapping to the virtual queue is created for each physical queue, and the structure of each register is as shown in Table 1:

[0079] Table 1

[0080] bit field field name type default value Description 31:20 reserved RO 0 19:11 VF RW 0x100 Virtual function id 10:0 VSQ RW 0 Virtual queue id

[0081] Therefore, in the above example, there are 1024 SubQ registers for mapping from the physical submission queue to the virtual submission queue. In addition, there are corresponding one-to-one mapping data structures for the completion queue CQ and the MSI-X interrupt.

[0082] In addition, each virtual submission queue is bound to a physical submission queue for returning the command issued by the physical host.

[0083] In the embodiment of the present application, a simple and efficient mapping method of physical resources and virtual resources is set, which can ensure that the SSD responds quickly to resource mapping when executing a service, and provides a guarantee for stable and efficient operation of the SSD.

[0084] As an optional embodiment, the method further comprises:

[0085] The physical resources are stored in a physical resource pool.

[0086] After the first physical resource is allocated to the mapped virtual resource, the first physical resource is deleted from the physical resource pool, wherein the first physical resource is any physical resource in the physical resource pool.

[0087] Optionally, the physical resources in the SSD are stored in a physical resource pool. Still referring to Figure 3 , the function id of the physical device must be 0, i.e. the first function is PF, and the controller, and the virtual device sequentially increases the function id, Figure 3 The physical device is allocated two submission queues, and each virtual device is allocated three submission queues, for tree mapping, and the queues are collectively referred to as virtual submission queues, and the virtual resource number belonging to each virtual device starts from 0; the last column containing SQ0…SQn is a physical resource (supported by the device), and the resource number starts from 0; the virtual submission queue and the physical submission queue are one-to-one corresponding, and once the physical resource is allocated, i.e. any physical resource is allocated, it disappears from the resource pool.

[0088] As an optional embodiment, the method further comprises:

[0089] The namespace of the primary controller and the secondary controller is set.

[0090] According to the namespace, the logical block addresses corresponding to the data space of the primary controller and the data space of the secondary controller are divided into units to obtain a plurality of unit namespace.

[0091] Optionally, the controller supporting virtualization needs to manage the namespace of the primary controller and the secondary controller at the same time, and a single namespace can only be accessed by a single controller, and does not support multi-path access. For example Figure 4 , the embodiment of the application needs to support 1 physical device + 63V virtual devices, and all controllers support the protocol function of create / delete / attach / detach of the namespace (i.e. namespace), and the namespace is divided to obtain the management of the logical block address in the manner of Figure 4 The entire namespace is divided into units according to 256 logical block addresses, and the state of the 256 logical block address units is managed by bitmap mapping.

[0092] In the embodiments of the present application, the multi-namespace management mode realized by using the SSD is used, different namespaces are allocated to different virtual hosts to achieve mutual isolation of data IO and performance guarantee of QoS.

[0093] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.

[0094] From the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk, or an optical disk), and includes a number of instructions to make an end device (which can be a mobile phone, a computer, a server, or a network device) execute the method of each embodiment of the present application.

[0095] According to another aspect of the embodiments of the present application, a virtual resource allocation apparatus for implementing the above-mentioned virtual resource allocation method is also provided. Figure 5 is a structural block diagram of an optional virtual resource allocation apparatus according to the embodiments of the present application, as shown in Figure 5 The apparatus can include:

[0096] The receiving unit 501 is configured to, in the case of receiving a virtualization management command issued by a physical host, virtualize a plurality of secondary controllers by using a primary controller corresponding to a physical device, wherein each secondary controller corresponds to a virtual device.

[0097] The resource allocation unit 502 is configured to perform virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and a user resource demand amount by the primary controller, wherein the user resource demand amount is the resource amount required to be occupied by the user when the user issues a request.

[0098] It should be noted that the receiving unit 501 in this embodiment can be used to perform the above step S101, and the resource allocation unit 502 in this embodiment can be used to perform the above step S102.​

[0099] By the above module, the application virtualization technology environment enables the SSD device to have multiple controllers (the first controller and the second controller), and based on the first controller, multiple second controllers are virtually created, and multiple virtual devices are virtually created, physical resource sharing is performed in the multiple virtual devices, the high performance of the SSD is fully played, the SSD can stably and quickly allocate virtual resources for the virtual devices, the technical effect of flexible allocation is achieved, and the problem that a common virtual resource allocation scheme has not been proposed based on the SSD virtualization technology in the related art is solved.

[0100] As an optional embodiment, the resource allocation unit comprises:

[0101] The setting module is configured to set the second controller to an online state by the first controller using a virtualization management command.

[0102] The allocation module is configured to allocate the virtual resources to the virtual devices corresponding to the second controller according to the user resource demand in the case that the second controller is in the online state.

[0103] As an optional embodiment, the allocation module comprises:

[0104] The determination subunit is configured to determine the physical resources allocated by the first controller according to the user resource demand.

[0105] The establishment subunit is configured to establish a mapping relationship between the physical resources and the virtual resources.

[0106] The acquisition subunit is configured to acquire the virtual resources according to the mapping relationship.

[0107] The first allocation subunit is configured to allocate the virtual resources to the second controller, and the second controller is configured to manage the virtual resources for the virtual devices.

[0108] As an optional embodiment, the setting module sets the second controller to the online state according to the following steps:

[0109] The first setting subunit is configured to set the second controller to an offline state by the first controller using a virtualization management command.

[0110] The second allocation subunit is configured to allocate the virtual queue resources and the virtual interrupt resources to the second controller by the first controller.

[0111] The second setting subunit is configured to reset the function level of the virtual devices after determining the virtual devices corresponding to the second controller, and set the second controller to the online state by using the virtualization management command.

[0112] As an optional embodiment, the apparatus further comprises:

[0113] a storage unit, configured to store the physical resource in the physical resource pool;

[0114] a deletion unit, configured to delete the first physical resource from the physical resource pool after the first physical resource is allocated to the mapped virtual resource, wherein the first physical resource is any physical resource in the physical resource pool.

[0115] As an optional embodiment, the apparatus further comprises:

[0116] a setting unit, configured to set the namespace for the primary controller and the secondary controller;

[0117] a division unit, configured to divide the logical block addresses corresponding to the data space of the primary controller and the data space of the secondary controller according to the namespace to obtain a plurality of namespace subspaces of the units.

[0118] It should be noted that the above modules and the examples and application scenarios realized by the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments.

[0119] According to another aspect of the embodiments of the present application, an electronic device for implementing the above-mentioned virtual resource allocation method is also provided, which can be a server, a terminal, or a combination thereof.

[0120] Figure 6 is a structural block diagram of an optional electronic device according to an embodiment of the present application, as shown in Figure 6 includes a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 complete mutual communication through the communication bus 604, and

[0121] the memory 603 is configured to store a computer program;

[0122] the processor 601 is configured to execute the computer program stored in the memory 603 to realize the following steps:

[0123] when receiving the virtualization management command issued by the physical host, a plurality of secondary controllers are virtually created by using the primary controller corresponding to the physical device, wherein each secondary controller corresponds to a virtual device;

[0124] the primary controller allocates virtual resources to the virtual devices corresponding to the secondary controllers according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource demand required by the user when issuing the request.

[0125] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0126] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0127] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0128] As an example, such as Figure 6 As shown, the memory 603 may include, but is not limited to, the receiving unit 501 and the resource allocation unit 502 in the virtual resource allocation device. Furthermore, it may include, but is not limited to, other module units in the virtual resource allocation device, which will not be elaborated upon in this example.

[0129] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0130] In addition, the aforementioned electronic device also includes a display for showing the allocation results of virtual resources.

[0131] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.

[0132] Those skilled in the art will understand that Figure 6The structure shown is for illustrative purposes only. The device implementing the above virtual resource allocation method can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile Internet Devices (MID), PAD, etc. Figure 6 This does not limit the structure of the aforementioned electronic devices. For example, the terminal device may also include components that are more advanced than those described above. Figure 6 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same ​ The different configurations shown.

[0133] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.

[0134] According to another aspect of the embodiments of this application, a storage medium is also provided. Optionally, in this embodiment, the storage medium can be used to execute program code for a virtual resource allocation method.

[0135] Optionally, in this embodiment, the storage medium may be located on at least one of the network devices in the network shown in the above embodiment.

[0136] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:

[0137] Upon receiving a virtualization management command from a physical host, multiple secondary controllers are virtualized using the primary controller corresponding to the physical device, with each secondary controller corresponding to a virtual device.

[0138] The primary controller allocates virtual resources to the virtual devices corresponding to the secondary controller based on virtualization management commands and user resource requirements. The user resource requirements are the amount of resources required when a user makes a request.

[0139] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.

[0140] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.

[0141] According to still another aspect of the embodiments of the present application, a computer program product or computer program is also provided, which includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to enable the computer device to perform the method steps of the virtual resource allocation method in any of the above embodiments.

[0142] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0143] The integrated units in the above embodiments, if realized in the form of software function units and sold or used as independent products, can be stored in the above computer readable storage medium. Based on such understanding, the technical solutions of the present application, essentially or in other words, the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a number of instructions to enable one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the virtual resource allocation method of the embodiments of the present application.

[0144] In the above embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0145] In the several embodiments provided by the present application, it should be understood that the disclosed client can be implemented in other ways. Of course, the above device embodiment is only illustrative, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed units can be indirect coupling or communication connection through some interfaces, units or modules, and can be electrical or other forms.

[0146] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the scheme provided in the embodiments.

[0147] In addition, each of the functional units in the various embodiments of the present application can be integrated in one processing unit, or each of the units can exist physically, or two or more units can be integrated in one unit. The integrated unit can be implemented in the form of hardware, or in the form of a software functional unit.

[0148] The above is only the preferred embodiment of the present application, and it should be pointed out that, for those skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should also be considered as the protection scope of the present application.

Claims

1. A method of allocating virtual resources, characterized by, The method comprises: In the case that a virtualization management command issued by a physical host is received, a plurality of secondary controllers are virtually created by using a primary controller corresponding to a physical device, wherein each of the secondary controllers corresponds to a virtual device; The primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and a user resource demand, wherein the user resource demand is a resource demand required by the user when the user issues a request, and the primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand, which comprises: in the case that the secondary controller is in an online state, allocating virtual resources to the virtual device corresponding to the secondary controller according to the user resource demand; the allocation of the virtual resources to the virtual device corresponding to the secondary controller according to the user resource demand comprises: determining physical resources allocated by the primary controller according to the user resource demand; establishing a mapping relationship between the physical resources and the virtual resources; obtaining the virtual resources according to the mapping relationship; and allocating the virtual resources to the secondary controller, wherein the secondary controller is used to manage the virtual resources for the virtual device; The primary controller performs virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand, which comprises: The primary controller sets the secondary controller to an online state by using the virtualization management command, and performs the following steps to set the online state: the primary controller sets the secondary controller to an offline state by using the virtualization management command; the primary controller allocates virtual queue resources and virtual interrupt resources to the secondary controller; after determining the virtual device corresponding to the secondary controller, the primary controller resets the function level of the virtual device, and sets the secondary controller to the online state by using the virtualization management command; The virtualized controller sets and manages a namespace for the primary controller and the secondary controller, and a single namespace can only be accessed by a single controller, and multi-path access is not supported; According to the namespace, a logical block address corresponding to a data space of the primary controller and a data space of the secondary controller is divided into units to obtain a plurality of unit namespaces.

2. The method of claim 1, wherein, The method further comprises: The physical resources are stored in a physical resource pool; After a first physical resource is allocated to a mapped virtual resource, the first physical resource is deleted from the physical resource pool, wherein the first physical resource is any physical resource in the physical resource pool.

3. An apparatus for allocating virtual resources, characterized by The apparatus comprises: A receiving unit configured to, in the case that a virtualization management command issued by a physical host is received, virtually create a plurality of secondary controllers by using a primary controller corresponding to a physical device, wherein each of the secondary controllers corresponds to a virtual device; The receiving unit is configured to, in the case that a virtualization management command issued by a physical host is received, virtually create a plurality of secondary controllers by using a primary controller corresponding to a physical device, wherein each of the secondary controllers corresponds to a virtual device; The resource allocation unit is configured to allocate virtual resources to the virtual device corresponding to the secondary controller according to the virtualization management command and user resource demand of the primary controller, wherein the user resource demand is the resource demand of the user when the user sends a request. The setting module is configured to set the secondary controller to an online state by using the virtualization management command. The setting module is further configured to set the secondary controller to an offline state by using the virtualization management command. The virtualized controller sets and manages the namespace of the primary controller and the secondary controller, and a single namespace can only be accessed by a single controller, and multi-path access is not supported. According to the namespace, the logical block addresses corresponding to the data space of the primary controller and the data space of the secondary controller are divided into units to obtain a plurality of unit namespaces.

4. The apparatus of claim 3, wherein, The resource allocation unit includes an allocation module configured to allocate virtual resources to the virtual device corresponding to the secondary controller according to the user resource demand when the secondary controller is in the online state. The processor, the communication interface, and the memory complete communication with each other through the communication bus.

5. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein, The memory is configured to store a computer program. The processor is configured to execute the method steps of any one of claims 1-2 by running the computer program stored on the memory. The storage medium stores a computer program, and the computer program is executed by the processor to implement the method steps in any one of claims 1-2.

6. A computer readable storage medium, characterized in that, ​

Citation Information

Patent Citations

  • Method and device for dispatching dynamic resources of virtual cluster

    CN104484220A

  • Two-stage embedded virtual machine hypervisor architecture and embedded system

    CN114064200A