CN114637473A - Virtual resource allocation method and device, electronic equipment and storage medium - Google Patents

Virtual resource allocation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114637473A
CN114637473A CN202210343037.9A CN202210343037A CN114637473A CN 114637473 A CN114637473 A CN 114637473A CN 202210343037 A CN202210343037 A CN 202210343037A CN 114637473 A CN114637473 A CN 114637473A
Authority
CN
China
Prior art keywords
virtual
resource
controller
physical
secondary controller
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210343037.9A
Other languages
Chinese (zh)
Inventor
李瀚卿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202210343037.9A priority Critical patent/CN114637473A/en
Publication of CN114637473A publication Critical patent/CN114637473A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0629Configuration or reconfiguration of storage systems
    • G06F3/0631Configuration or reconfiguration of storage systems by allocating resources to storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0664Virtualisation aspects at device level, e.g. emulation of a storage device or system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a virtual resource allocation method and device, an electronic device and a storage medium, wherein the method comprises the following steps: under the condition of receiving a virtualization management command sent by a physical host, virtualizing a plurality of secondary controllers by using primary controllers corresponding to physical devices, wherein each secondary controller corresponds to one virtual device; and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request. By the method and the device, the problem that a virtual resource allocation scheme with common commonality is not provided based on an SSD virtualization technology in the related technology is solved.

Description

Virtual resource allocation method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of solid-state memory technologies, and in particular, to a method and an apparatus for allocating virtual resources, an electronic device, and a storage medium.
Background
At present, in a scenario of implementing physical resource sharing or virtual resource allocation by using a virtualization technology of a solid state memory (SSD), for the SSD virtualization technology, each SSD vendor is still in an expansion and expansion stage, the technology is far from mature, and a universal virtual resource allocation scheme is not proposed yet.
Disclosure of Invention
The application provides a virtual resource allocation method and device, an electronic device and a storage medium, so as to at least solve the problem that a virtual resource allocation scheme with common commonality is not provided based on an SSD virtualization technology in the related technology.
According to an aspect of an embodiment of the present application, a method for allocating virtual resources is provided, where the method includes: under the condition of receiving a virtualization management command sent by a physical host, virtualizing a plurality of secondary controllers by using primary controllers corresponding to physical devices, wherein each secondary controller corresponds to one virtual device;
and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for allocating virtual resources, the apparatus including:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for virtualizing a plurality of secondary controllers by utilizing a primary controller corresponding to physical equipment under the condition of receiving a virtualization management command sent by a physical host, and each secondary controller corresponds to one virtual equipment;
and the resource allocation unit is used for the primary controller to perform virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied when the user sends a request.
Optionally, the resource allocation unit includes:
the setting module is used for setting the secondary controller to be in an online state by the primary controller by utilizing the virtualization management command;
and the allocation module is used for allocating virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand under the condition that the secondary controller is in the online state.
Optionally, the allocation module comprises:
a determining subunit, configured to determine, according to the user resource demand, physical resources correspondingly allocated to the primary controller;
the establishing subunit is used for establishing a mapping relation between the physical resources and the virtual resources;
the obtaining subunit is configured to obtain the virtual resource according to the mapping relationship;
a first allocating subunit, configured to allocate the virtual resource to the secondary controller, where the secondary controller is configured to manage the virtual resource for the virtual device.
Optionally, the setting module sets the secondary controller to be in an online state according to the following steps:
a first setting subunit, configured to set, by the primary controller, the secondary controller to an offline state by using the virtualization management command;
the second sub-distribution subunit is used for the primary controller to distribute the virtual queue resources and the virtual interrupt resources to the secondary controller;
and the second setting subunit is configured to, after the virtual device corresponding to the secondary controller is determined, perform function level reset on the virtual device, and set the secondary controller to the online state by using the virtualization management command.
Optionally, the apparatus further comprises:
the storage unit is used for storing the physical resources in a physical resource pool;
a deleting 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, where the first physical resource is any physical resource in the physical resource pool.
Optionally, the apparatus further comprises:
the setting unit is used for setting the naming space of the primary controller and the secondary controller;
and the dividing unit is used for dividing the data space of the primary controller and the logical block address corresponding to the data space of the secondary controller into units according to the name space to obtain the name subspaces of a plurality of units.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory communicate with each other through the communication bus; wherein the memory is used for storing the computer program; a processor for performing the method steps in any of the above embodiments by running the computer program stored on the memory.
According to a further aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the method steps of any of the above embodiments when the computer program is executed.
In the embodiment of the application, a plurality of secondary controllers are virtualized by using a primary controller corresponding to a physical device under the condition of receiving a virtualization management command sent by a physical host, wherein each secondary controller corresponds to a virtual device; and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request. According to the embodiment of the application, the SSD device is provided with the plurality of controllers (the first controller and the second controller) by applying the virtualization technical environment, the plurality of second controllers are virtualized based on the first controller, the plurality of virtual devices are further virtualized, physical resource sharing is performed under the condition of the plurality of virtual devices, the high performance of the SSD is fully exerted, the SSD can be guaranteed to stably and quickly allocate virtual resources to the virtual devices, the technical effect of flexible allocation is achieved, and the problem that a virtual resource allocation scheme with common commonality is not provided based on the SSD virtualization technology in the related technology is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of an alternative virtual resource allocation method according to an embodiment of the present application;
FIG. 2 is a diagram illustrating an alternative relationship between a host, a virtual device, and a controller according to an embodiment of the present application;
FIG. 3 is a diagram illustrating an alternative mapping relationship between physical resources and virtual resources according to an embodiment of the present application;
FIG. 4 is a schematic diagram of namespace management for an alternative controller according to an embodiment of the application;
fig. 5 is a block diagram illustrating an alternative virtual resource allocation apparatus according to an embodiment of the present disclosure;
fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In the virtual resource allocation of the SSD virtualization technology, each SSD vendor is still in an expansion and expansion stage, the technology is far from mature, and a general common virtual resource allocation scheme has not been proposed yet. In order to solve the foregoing problems, an embodiment of the present application provides a method for allocating virtual resources, where the method is applied to an SSD side, and the method includes the following steps:
step S101, virtualizing a plurality of secondary controllers by utilizing a primary controller corresponding to physical equipment under the condition of receiving a virtualization management command sent by a physical host, wherein each secondary controller corresponds to one virtual equipment;
and S102, the primary controller performs virtual resource allocation to the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount occupied by the user when the user sends a request.
Optionally, after the SSD is powered on, if a virtualization management command sent from the Physical host is received, virtualizing a plurality of secondary controllers by using a real Physical controller (referred to as a primary controller herein) corresponding to a Physical device (Physical Function, PF) of the SSD, where the number of the primary controllers and the number of the secondary controllers are not limited in the embodiment of the present application, but the number of the secondary controllers is the same as the number of the virtualized Virtual devices (VFs). It should be noted that, in the embodiment of the present application, a hardware I/O Virtualization technology standard of SR-IOV (Single Root I/O Virtualization) is used, and as a hardware I/O Virtualization solution, SR-IOV defines that an I/O device is natively sharable, and one SR-IOV device can create a plurality of virtual devices, and the virtual devices are allocated to different virtual machines, so that sharing of physical hardware is achieved. The combination of the NVMe SSD and the SR-IOV can share physical resources under the condition of a plurality of virtual machines, the high performance of the SSD is fully exerted, and particularly the number of PCIe devices required by customers can be reduced under the virtualization and cloud computing scenes by means of the SR-IOV virtualization technology.
In addition, in this embodiment of the present application, the physical host may further send an identification command and a virtualization management command to the physical device of the SSD, and then determine and manage the secondary controller based on the identification command and the virtualization management command, for example, the physical host may send the identification command to the secondary controller, obtain the secondary controller associated with the primary controller in the controller list, and know information such as the total number of virtual devices supported by the SSD device, the maximum resource limit allocated to each virtual device, and the like through the identification command. The primary controller uses the virtualization management command to allocate physical resources of the primary controller and virtual resources of the secondary controller, and sets corresponding states.
It can be known that, when allocating virtual resources to the secondary controller, in addition to referring to the virtualization management command, the virtual resources need to be allocated in combination with the real resource amount requirement of the user. It should be noted that the number of users may be multiple, and is usually the user who sends some requests, so that the total amount of the allocated virtual resources may be determined based on the corresponding required occupied resource amount in the request information sent by the user.
For easier understanding, refer to the relationship diagram shown in fig. 2: in order to fully exert the high performance of the SSD, the SSD device has a plurality of controllers, which may be primary controllers or secondary controllers, in this embodiment, it is assumed that the SSD device has only one primary controller, n secondary controllers are virtualized from the primary controller, the primary controller is only used as a management controller, and does not execute a read/write service, and the secondary controller is responsible for completing an IO read/write task; from the host level, each virtual machine can see one SSD device, which is a virtual device of the SSD, and each virtual device is supported by one secondary controller; the primary controller corresponds to a physical device of the SSD.
In the embodiment of the application, a plurality of secondary controllers are virtualized by using a primary controller corresponding to a physical device under the condition of receiving a virtualization management command sent by a physical host, wherein each secondary controller corresponds to a virtual device; and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request. According to the embodiment of the application, the SSD device is provided with the plurality of controllers (the first controller and the second controller) by applying the virtualization technical environment, the plurality of second controllers are virtualized based on the first controller, the plurality of virtual devices are further virtualized, physical resource sharing is performed under the condition of the plurality of virtual devices, the high performance of the SSD is fully exerted, the SSD can be guaranteed to stably and quickly allocate virtual resources to the virtual devices, the technical effect of flexible allocation is achieved, and the problem that a virtual resource allocation scheme with common commonality is not provided based on the SSD virtualization technology in the related technology is solved.
As an optional embodiment, the performing, by the primary controller, virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand includes:
the primary controller sets the secondary controller to be in an online state by using a virtualization management command;
and under the condition that the secondary controller is in an online state, distributing the virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand.
Alternatively, the secondary controller may define the following two states: Online-Online state, the required resources are allocated normally, in this state (CC _ EN: 0- >1 and csts. rdy is set) the secondary controller can be used normally. Offline-Offline state, csts. cfs needs to be set to 1 when the secondary controller cannot be used by the host.
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 may issue some commands to control the primary controller to set the online state of the secondary controller, specifically, set the online state of the secondary controller according to the following steps:
the primary controller sets the secondary controller to be in an off-line state by using a virtualization management command;
the first-level controller distributes virtual queue resources and virtual interrupt resources to the second-level controller;
after the virtual device corresponding to the secondary controller is determined, the function level of the virtual device is reset, and the secondary controller is set to be in an online state by using the virtualization management command.
It should be noted that the physical host may also use the virtualization management command to perform the online and offline conversion of the secondary controller. All virtual queue resources and virtual interrupt resources need to be removed from the secondary controller when transitioning from online to offline.
And then under the condition that the secondary controller is in an online state, the primary controller allocates the virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand.
In the embodiment of the present application, it is required to ensure that the physical host can accurately confirm that the SSD has the capability of the secondary controller, so that the virtual resource can be reasonably allocated.
As an optional embodiment, allocating virtual resources to virtual devices corresponding to the secondary controllers according to the user resource demand includes:
determining physical resources correspondingly allocated to the primary controller according to the user resource demand;
establishing a mapping relation between the physical resources and the virtual resources;
acquiring virtual resources according to the mapping relation;
and allocating the virtual resources to a secondary controller, wherein the secondary controller is used for managing the virtual resources for the virtual equipment.
Alternatively, in order to make the virtual device work as a physical device, the necessary controller resources need to be allocated to the virtual device, and the controller resources are allocated or deleted by a virtualization management command issued to the primary controller. Several controller resources are defined:
(1) virtual queue resources: a kind of resource type to manage and Submit Queue (SQ) and finish queue (CQ), support the first class controller of the virtual queue resource should have at least two pairs of specialized resource queues at least, in order to guarantee the master controller has 1 pair of Admin queues and 1 pair of I/O queues all the time; each secondary controller at least allocates 1 pair of Admin queues and 1 pair of IO queues; i.e. the minimum number of allocated VQ resources of the secondary controller is 2.
(2) Virtual interrupt resources: one resource type for managing interrupts, such as MSI-X, when creating I/O CQs, the controller needs to map the interrupt vectors of MSI-X onto the corresponding CQs.
(3) Namespace resources: one type of space resource, each virtual device must allocate a namespace resource of sufficient size to ensure that the user has sufficient storage space for reading and writing data.
On the other hand, all resources can be classified into private resources and flexibly allocatable resources (FR, public resources). According to the protocol specification, either a private resource or a public resource can be allocated to the physical device, but the virtual device can only allocate a certain resource, and usually only allocates the public resource.
The virtual queue resource allocation and the allocation of the primary/secondary controller are set through a virtualization management command issued by a physical host, and a one-to-one mapping relation between physical resources and virtual resources is established in the main control. For example, the physical resources correspondingly allocated to the primary controller are determined according to the user resource demand, then, because a one-to-one mapping relationship is established between the physical resources and the virtual resources, the virtual resources are obtained according to the mapping relationship, and then the virtual resources are allocated to the secondary controller for managing the virtual resources, so that the virtual devices include the allocated virtual resources.
Taking SQ as an example, as shown in fig. 3, a one-to-one mapping relationship between an SQ physical resource and an SQ virtual resource is shown, and it is assumed that there are 1024 physical commit queues, 1 physical device and 63 virtual devices, in fig. 3, a physical commit queue is bound for the virtual commit queue of each virtual device, the virtual commit queue with id ═ 0 is an admin commit queue, and the others are IO commit queues. Each virtual queue and physical queue must be in a one-to-one mapping relationship, but may not be mapped in the order in the figure, for example: the VSQ0 of the VF1 corresponds to the physical commit queue SQ 10. Therefore, a data structure must be established to store the mapping from the virtual queue to the physical queue, and the following data structure is established in the embodiment of the application:
typedef struct{
u32 FunctionID;
u32 vSubQ2pSubQ[MAXVSUB];
u32 vCplQ2pCplQ[MAXVCPL];
u32 vInt2pInt[MAXVINT];
}funcVirtual2Physical_map_t
funcVirtual2Physical_map_t funcVirtual2Physical_map[64];
in the process of actually issuing a command by a physical host, it is necessary to quickly search from a physical queue to a virtual queue to determine to which virtual device the command is sent. Creating a register mapped to the virtual queue for each physical queue, wherein the structure of each register is as shown in table 1:
TABLE 1
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
Therefore, in the above example, there are 1024 SubQ registers for mapping the physical commit queue to the virtual commit queue. In addition, both the completion queue CQ and the MSI-X interrupts will have corresponding one-to-one mapping data structures.
In addition, each virtual commit queue is bound to a virtual commit queue for return of commands issued by the physical host.
In the embodiment of the application, a simple and efficient mapping mode of physical resources and virtual resources is set, so that the quick response of resource mapping during the execution of services by the SSD can be ensured, and the stable and efficient operation of the SSD is guaranteed.
As an alternative embodiment, the method further comprises:
storing the physical resources in a physical resource pool;
and deleting 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.
Optionally, physical resources are provided in the SSD, and these physical resources are stored in a physical resource pool. Still referring to fig. 3, the function id of the physical device must be 0, that is, the first function is PF, and the controller, the virtual devices sequentially increment to the back function id, the physical device of fig. 3 is allocated two submission queues, each virtual device is allocated 3 submission queues, which are tree mappings, these queues are collectively referred to as virtual submission queues, and the virtual resource number subordinate to each virtual device starts from 0; the last column containing SQ0 … … SQn is the physical resource (supportable by the device), with the resource number starting at 0; the virtual commit queue and the physical commit queue are in a one-to-one correspondence, and once a physical resource is allocated, i.e., any physical resource is allocated, it disappears from the resource pool.
As an alternative embodiment, the method further comprises:
setting a naming space for the first-level controller and the second-level controller;
and according to the naming space, unit division is carried out on the data space of the primary controller and the logical block address corresponding to the data space of the secondary controller, and the naming subspaces of a plurality of units are obtained.
Alternatively, a controller supporting virtualization needs to manage the namespaces of both the primary and secondary controllers, and a single namespace can only be accessed by a single controller, but does not support multi-path access. As shown in fig. 4, in the embodiment of the present application, 1 physical device +63V virtual device needs to be supported, all controllers support protocol function support for create/delete/attach/detach of a namespace (that is, namespace), the namespace is divided, the management of obtaining logical block addresses adopts the manner shown in fig. 4, the whole namespace is divided into units according to 256 logical block addresses, and then the states of the 256 logical block address units are mapped and managed by using a bitmap.
In the embodiment of the application, a multi-namespace management mode realized by the SSD is used, and different namespaces are allocated to different virtual hosts to achieve mutual isolation of data IO and performance guarantee of QoS.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., a ROM (Read-Only Memory)/RAM (Random Access Memory), a magnetic disk, an optical disk) and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the methods of the embodiments of the present application.
According to another aspect of the embodiments of the present application, there is also provided an apparatus for allocating virtual resources, which is used for implementing the method for allocating virtual resources. Fig. 5 is a block diagram of an optional virtual resource allocation apparatus according to an embodiment of the present application, and as shown in fig. 5, the apparatus may include:
a receiving unit 501, configured to virtualize multiple secondary controllers by using a primary controller corresponding to a physical device under the condition of receiving a virtualization management command sent by a physical host, where each secondary controller corresponds to a virtual device;
and the resource allocation unit 502 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 the user resource demand, where the user resource demand is a resource amount required to be occupied when the user sends a request.
It should be noted that the receiving unit 501 in this embodiment may be configured to execute the step S101, and the resource allocating unit 502 in this embodiment may be configured to execute the step S102.
Through the modules, the SSD device is provided with the plurality of controllers (the first controller and the second controller) by applying the virtualization technical environment, the plurality of second controllers are virtualized on the basis of the first controller, and then the plurality of virtual devices are virtualized, physical resource sharing is carried out under the condition of the plurality of virtual devices, the high performance of the SSD is fully exerted, the SSD can be guaranteed to stably and quickly distribute virtual resources for the virtual devices, the technical effect of flexible distribution is achieved, and the problem that a virtual resource distribution scheme with common commonality is not provided based on the SSD virtualization technology in the related technology is solved.
As an alternative embodiment, the resource allocation unit includes:
the setting module is used for setting the secondary controller to be in an online state by the primary controller by utilizing the virtualization management command;
and the allocation module is used for allocating the virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand under the condition that the secondary controller is in an online state.
As an alternative embodiment, the allocation module comprises:
the determining subunit is used for determining the physical resources correspondingly allocated to the primary controller according to the user resource demand;
the establishing subunit is used for establishing a mapping relation between the physical resources and the virtual resources;
the obtaining subunit is used for obtaining the virtual resource according to the mapping relation;
the system comprises a first allocating subunit, a second controller and a third allocating subunit, wherein the first allocating subunit is used for allocating the virtual resources to the second controller, and the second controller is used for managing the virtual resources for the virtual devices.
As an alternative embodiment, the setting module sets the secondary controller to be in an online state according to the following steps:
the first setting subunit is used for setting the secondary controller to be in an offline state by the primary controller by utilizing the virtualization management command;
the second sub-distribution subunit is used for the primary controller to distribute the virtual queue resources and the virtual interrupt resources to the secondary controller;
and the second setting subunit is used for resetting the function level of the virtual equipment after the virtual equipment corresponding to the secondary controller is determined, and setting the secondary controller to be in an online state by using the virtualization management command.
As an alternative embodiment, the apparatus further comprises:
the storage unit is used for storing the physical resources in the physical resource pool;
and the deleting unit is used for deleting 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.
As an alternative embodiment, the apparatus further comprises:
the setting unit is used for setting the naming space of the primary controller and the secondary controller;
and the dividing unit is used for dividing the unit of the logical block address corresponding to the data space of the primary controller and the data space of the secondary controller according to the naming space to obtain the naming subspace of a plurality of units.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments.
According to another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the above method for allocating virtual resources, where the electronic device may be a server, a terminal, or a combination thereof.
Fig. 6 is a block diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 6, including a processor 601, a communication interface 602, a memory 603, and a communication bus 604, where the processor 601, the communication interface 602, and the memory 603 complete communication with each other through the communication bus 604, where,
a memory 603 for storing a computer program;
the processor 601, when executing the computer program stored in the memory 603, implements the following steps:
under the condition of receiving a virtualization management command sent by a physical host, virtualizing a plurality of secondary controllers by using primary controllers corresponding to physical devices, wherein each secondary controller corresponds to one virtual device;
and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request.
Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory, such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
As an example, as shown in fig. 6, the memory 603 may include, but is not limited to, a receiving unit 501 and a resource allocation unit 502 in the allocation apparatus that includes the virtual resource. In addition, the virtual resource allocation apparatus may further include, but is not limited to, other module units in the virtual resource allocation apparatus, which is not described in this example again.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
In addition, the electronic device further includes: and the display is used for displaying the allocation result of the virtual resources.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 6 is only an illustration, and the device implementing the virtual resource allocation method may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 6 is a diagram illustrating a structure of the electronic device. For example, the terminal device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 6, or have a different configuration than shown in FIG. 6.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to still another aspect of an embodiment of the present application, there is also provided a storage medium. Alternatively, in this embodiment, the storage medium may be a program code for executing the virtual resource allocation method.
Optionally, in this embodiment, the storage medium may be located on at least one of a plurality of network devices in a network shown in the embodiment.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
under the condition of receiving a virtualization management command sent by a physical host, virtualizing a plurality of secondary controllers by using primary controllers corresponding to physical devices, wherein each secondary controller corresponds to one virtual device;
and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied when a user sends a request.
Optionally, for a specific example in this embodiment, reference may be made to the example described in the foregoing embodiment, and details of this are not described again in this embodiment.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing program codes, such as a U disk, a ROM, a RAM, a removable hard disk, a magnetic disk, or an optical disk.
According to yet another aspect of an embodiment of the present application, there is also provided a computer program product or a computer program comprising 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 make the computer device execute the steps of the virtual resource allocation method in any one of the embodiments.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solutions of the present application, or portions of the technical solutions or all or portions of the technical solutions that contribute to the prior art, may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the virtual resource allocation method according to the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit is merely a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, and may also be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution provided in the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.

Claims (10)

1. A method for allocating virtual resources, the method comprising:
under the condition of receiving a virtualization management command sent by a physical host, virtualizing a plurality of secondary controllers by using primary controllers corresponding to physical devices, wherein each secondary controller corresponds to one virtual device;
and the primary controller performs virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request.
2. The method of claim 1, wherein the step of the primary controller performing virtual resource allocation to the virtual device corresponding to the secondary controller according to the virtualization management command and the user resource demand comprises:
the primary controller sets the secondary controller to be in an online state by utilizing the virtualization management command;
and under the condition that the secondary controller is in the online state, allocating virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand.
3. The method of claim 2, wherein the allocating virtual resources to the virtual devices corresponding to the secondary controllers according to the user resource demand comprises:
determining the physical resources correspondingly allocated to the primary controller according to the user resource demand;
establishing a mapping relation between the physical resources and the virtual resources;
acquiring the virtual resource according to the mapping relation;
allocating the virtual resource to the secondary controller, wherein the secondary controller is configured to manage the virtual resource for the virtual device.
4. The method of claim 2, wherein the primary controller setting the secondary controller to an online state using the virtualization management commands comprises performing the steps of:
the primary controller sets the secondary controller to be in 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 the virtual device corresponding to the secondary controller is determined, resetting the function level of the virtual device, and setting the secondary controller to be in the online state by using the virtualization management command.
5. The method of claim 2, further comprising:
storing the physical resources in a physical resource pool;
deleting 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.
6. The method of claim 1, further comprising:
setting a naming space for the primary controller and the secondary controller;
and according to the name space, carrying out unit division on the data space of the primary controller and the logical block address corresponding to the data space of the secondary controller to obtain the name subspaces of a plurality of units.
7. An apparatus for allocating virtual resources, the apparatus comprising:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for virtualizing a plurality of secondary controllers by utilizing a primary controller corresponding to physical equipment under the condition of receiving a virtualization management command sent by a physical host, and each secondary controller corresponds to one virtual equipment;
and the resource allocation unit is used for the primary controller to perform virtual resource allocation on the virtual equipment corresponding to the secondary controller according to the virtualization management command and the user resource demand, wherein the user resource demand is the resource amount required to be occupied by the user when the user sends a request.
8. The apparatus of claim 7, wherein the resource allocation unit comprises:
the setting module is used for setting the secondary controller to be in an online state by the primary controller by utilizing the virtualization management command;
and the allocation module is used for allocating virtual resources to the virtual equipment corresponding to the secondary controller according to the user resource demand under the condition that the secondary controller is in the online state.
9. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein said processor, said communication interface and said memory communicate with each other via said communication bus,
the memory for storing a computer program;
the processor for performing the method steps of any one of claims 1 to 6 by running the computer program stored on the memory.
10. A computer-readable storage medium, in which a computer program is stored, wherein the computer program realizes the method steps of any one of claims 1 to 6 when executed by a processor.
CN202210343037.9A 2022-03-31 2022-03-31 Virtual resource allocation method and device, electronic equipment and storage medium Pending CN114637473A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210343037.9A CN114637473A (en) 2022-03-31 2022-03-31 Virtual resource allocation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210343037.9A CN114637473A (en) 2022-03-31 2022-03-31 Virtual resource allocation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114637473A true CN114637473A (en) 2022-06-17

Family

ID=81950863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210343037.9A Pending CN114637473A (en) 2022-03-31 2022-03-31 Virtual resource allocation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114637473A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309592A (en) * 2022-09-01 2022-11-08 北京火山引擎科技有限公司 Resource scheduling method and device, computer equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115309592A (en) * 2022-09-01 2022-11-08 北京火山引擎科技有限公司 Resource scheduling method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US10768862B2 (en) Extending existing storage devices in virtualized environments
TWI752066B (en) Method and device for processing read and write requests
CN107894913B (en) Computer system and storage access device
CN102722414B (en) Input/output (I/O) resource management method for multi-root I/O virtualization sharing system
US8281303B2 (en) Dynamic ejection of virtual devices on ejection request from virtual device resource object within the virtual firmware to virtual resource driver executing in virtual machine
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
EP4089544A1 (en) Method and apparatus for extending pcie domain
CN113312143A (en) Cloud computing system, command processing method and virtualization simulation device
CN113722248A (en) Command processing method and command processing device
CN114637473A (en) Virtual resource allocation method and device, electronic equipment and storage medium
US10374825B2 (en) Bridging between differing communication buses
CN116483740B (en) Memory data migration method and device, storage medium and electronic device
WO2015043175A1 (en) Server system and operation system starting method thereof, and starting management node
CN109617954B (en) Method and device for creating cloud host
CN114281516A (en) Resource allocation method and device based on NUMA attribute
CN110096355B (en) Shared resource allocation method, device and equipment
CN107357674B (en) Information processing method, device and storage medium
US20160378510A1 (en) Configuration Method, Data Exchange Method and Server System
CN114564440A (en) System on chip, chip and electronic equipment
CN116909689B (en) Virtual machine thermomigration method and device, storage medium and electronic equipment
CN111949414B (en) Method, system, terminal and storage medium for optimizing performance of storage controller
CN115658281A (en) Cloud host complete machine speed limiting method and device, storage medium and electronic equipment
CN109857521B (en) Host computer relocation method and device
CN114327741A (en) Server system, container setting method and device
CN113918283A (en) Data storage method, device, system and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination