A storage device access method, device and system

By configuring I/O adapters and virtual channels in the computer system, the access operation of virtual machines to storage devices is simplified, and the redundancy problem exists during the virtual machine access process is solved, and efficient storage device access is achieved.

CN111831588BActive Publication Date: 2025-01-17HUAWEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010517281.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2015-10-21
Publication Date
2025-01-17
Estimated Expiration
2035-10-21

AI Technical Summary

Technical Problem

In the prior art, there is mechanism redundancy in access operations of virtual machines to storage devices, and new technologies are needed to simplify the access process of virtual machines to storage devices.

Method used

By configuring an I/O adapter on the computer system, the access request of the virtual machine is obtained, and access instructions carrying virtual address information and virtual channel identification are generated, and sent to the storage device target. The virtual channel is used to connect the virtual machine and the storage device target. simplifies the virtual machine's access to storage devices.

Benefits of technology

It realizes direct access of virtual machines to storage devices, simplifies the access process, and reduces the consumption of memory resources and computing resources by the software layer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111831588B_ABST
    Figure CN111831588B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a storage device access method, apparatus and system for a virtual machine to access a storage device. The method includes: an I / O adapter obtains an access request from a virtual machine, the access request carries the virtual address information of the storage area to be accessed, an access instruction is generated according to the access request, the access instruction carries the virtual address information and the identifier of the virtual channel of the virtual machine, the virtual channel corresponds to the virtual machine one by one, and is used to connect the corresponding virtual machine with the storage device target, the storage device target is used to manage the access operation to the storage device, and send the access instruction to the storage device target. Thereby, direct access of the virtual machine to the storage device is realized, the access method of the storage device is simplified, the I / O access process is shortened, and the consumption of memory resources and computing resources by the software layer is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the computer field, and in particular to a storage device access method, device and system. Background Art

[0002] Virtualization technology originated from the demand for time-sharing systems. Its main goal is to run multiple operating systems on a host computer in order to make full use of the expensive computing resources on the mainframe. With the performance improvement of x86 processors and the popularization of applications, the development of virtualization technology has also begun to enter the field of x86 architecture. In particular, in the late 1990s, virtualization software vendors opened the way for the application of virtualization technology on the x86 platform, providing software solutions for virtualization of personal computer (PC) server platforms centered on the virtual machine monitor (Virtual Machine Monitor, referred to as VMM). The virtual machine (Virtual Machine, referred to as VM) is responsible for virtualizing multiple independent virtual hardware systems with the same instruction set architecture (ISA) and actual hardware on a hardware platform, where each virtual hardware system can run a different operating system, namely the user operating system (Guest OS). The user operating system will access the actual physical resources through the virtual machine monitor VMM.

[0003] In the prior art, the access of a virtual machine to a peripheral device must go through the conversion operations of multiple software layers, and there is a mechanism redundancy in the access operation to the storage device. Therefore, it is necessary to develop new technologies to solve this problem. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a storage device access method, apparatus and system to simplify the access operation of a virtual machine to a storage device.

[0005] In the first aspect, an embodiment of the present invention provides a storage device access method, which manages the access operation of a virtual machine running on the computer system to the storage device by configuring an I / O adapter on the computer system. After the I / O adapter obtains an access request from the virtual machine carrying the virtual address information of the storage area to be accessed, it generates an access instruction according to the access request and sends the access instruction to the storage device target. The access instruction carries the virtual address information and the identifier of the virtual channel of the virtual machine. The virtual channel is used to connect the virtual machine and the storage device target. The virtual machine and the virtual channel correspond one to one. The storage device target is used to manage the access operation to the storage device.

[0006] There is a one-to-one correspondence between virtual machines and virtual channels. A virtual channel refers to a data transmission channel that is established on a physical medium using a storage transmission protocol during data transmission and represents a unique connection relationship between a virtual machine and a storage device. Virtual channels and virtual channel identifiers are used to characterize the unique connection relationship between a virtual machine and a storage device (storage device target). Each virtual machine is connected to a storage device (storage device target) through a virtual channel identified by a unique virtual channel identifier. In specific implementation, a virtual channel can be implemented in a variety of forms, for example, it can be implemented by time-division multiplexing a physical connection channel.

[0007] The virtual channel between the virtual machine and the storage device is maintained through the I / O adapter, and the identifier of the virtual channel corresponding to the virtual machine is added to the access instruction, thereby enabling the virtual machine to access the storage device and simplifying the access process.

[0008] It should be understood that in the present application, virtual channels correspond one-to-one to virtual machines, and if a subject corresponds one-to-one to a virtual channel, it also corresponds one-to-one to the virtual machine. In some descriptions of the present application, "corresponding to a virtual machine" and "corresponding to a virtual channel" can be replaced with each other, and "associated with a virtual machine" and "associated with a virtual channel" can also be replaced with each other.

[0009] In combination with the first aspect, in a first possible implementation of the first aspect, before the I / O adapter generates an access instruction according to an access request, the identifier of the virtual channel corresponding to the virtual machine is determined by querying a preset first correspondence relationship, wherein the first correspondence relationship includes a correspondence between the identifier of each virtual machine and the identifier of each virtual channel, and the first correspondence relationship can be configured in advance, or determined by negotiation between the I / O adapter and the storage device target. Among them, the corresponding relationship can be implemented in various forms, for example, it can be represented in the form of a data table, or it can be represented by configuring a register for each virtual machine, and the register stores the identifier of the corresponding virtual channel for representation, and this application does not limit this.

[0010] In combination with the first aspect or any possible implementation of the first aspect or above, in a second possible implementation of the first aspect, the I / O adapter is configured with at least one cache queue, and each cache queue corresponds one-to-one to each virtual channel; after the I / O adapter obtains an access request from a virtual machine, if it is not currently in an idle state or is under a large load, the access request can be further placed in a first cache queue corresponding to the virtual channel of the virtual machine; and before generating an access instruction based on the access request, the access request is taken out from the first cache queue corresponding to the virtual channel of the virtual machine.

[0011] By adding a cache queue to each virtual channel, the I / O adapter can work more flexibly and will not lose access requests under heavy load. Using a cache queue similar to a First In First Out (FIFO) structure to cache access requests of all virtual machines is also an optional implementation method. However, the FIFO structure cannot distinguish information such as the priority of the virtual machine. By configuring a cache queue for each virtual channel, access requests that can be merged can be merged for processing.

[0012] In combination with the first aspect or any possible implementation manner above the first aspect, in a third possible implementation manner of the first aspect, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter generates access instructions based on the access requests, including: the I / O adapter generates access instructions corresponding to the virtual machine with a higher priority, and then generates access instructions corresponding to the virtual machine with a lower priority, in order of priority, based on the priorities of the at least two virtual machines corresponding to the at least two access requests.

[0013] By setting priorities for different virtual machines, access operations of important virtual machines or virtual machines with high service levels can be processed first, making the access operations of virtual machines to storage devices more flexible.

[0014] In combination with the first aspect or any possible implementation manner above the first aspect, in a fourth possible implementation manner of the first aspect, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter generates an access instruction based on the access request, including: the I / O adapter first generates an access instruction corresponding to the access request received first, and then generates an access instruction corresponding to the access request received later, based on the time sequence in which the at least two access requests are obtained.

[0015] By processing access requests in order according to the order in which they are received, the system architecture can be simplified. Only a FIFO cache structure is required, and there is no need to cache access requests of different virtual machines separately.

[0016] In combination with the first aspect or any possible implementation method above the first aspect, in a fifth possible implementation method of the first aspect, after the I / O adapter sends the access instruction to the storage device target, it further obtains a feedback message from the storage device target, the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine, and determines the virtual machine based on the identifier of the virtual channel, and sends the execution result of the access instruction to the virtual machine.

[0017] In combination with the first aspect or any possible implementation manner above the first aspect, in a sixth possible implementation manner of the first aspect, the I / O adapter obtains an access request from a virtual machine, including: the I / O adapter receives a first doorbell notification from the virtual machine, and obtains the access request from an I / O shared ring shared with the virtual machine, the access request is placed by the virtual machine into the I / O shared ring, and the first doorbell notification is used to indicate that an access request has arrived in the I / O shared ring; the I / O adapter sends an execution result of the access instruction to the virtual machine, including: the I / O adapter places the execution result of the access request into the I / O shared ring shared with the virtual machine, and sends a second doorbell notification to the virtual machine, and the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0018] In combination with the first aspect or any possible implementation of the first aspect or above, in a seventh possible implementation of the first aspect, the virtual machine runs on a computing device independent of the storage device, and the access instruction is a small computer system interface SCSI instruction that can be processed by a host bus adapter driver layer; the I / O adapter sends the access instruction to the storage device target, including: the I / O adapter sends the access instruction to the storage device target through the host bus adapter driver layer.

[0019] If the virtual machine runs on a storage device, that is, in an all-in-one application scenario, the I / O adapter and the storage device target may not transmit messages such as access instructions through the HBA driver layer.

[0020] In a second aspect, an embodiment of the present invention provides a computer-readable medium, comprising computer-executable instructions. When a processor of a computer executes the computer-executable instructions, the computer executes the method in the first aspect or any possible implementation of the first aspect.

[0021] In a third aspect, an embodiment of the present invention provides a storage device access device, comprising: a processor, a memory, a bus and a communication interface; the memory is used to store execution instructions, the processor is connected to the memory through the bus, and when the storage device access device is running, the processor executes the execution instructions stored in the memory so that the device executes the method in the first aspect or any possible implementation of the first aspect.

[0022] In a fourth aspect, an embodiment of the present invention provides a storage device access method for managing a virtual machine's access operation to a storage device, comprising: a storage device target obtains an access instruction, the access instruction carries virtual address information and an identifier of a virtual channel of the virtual machine, the virtual channel is used to connect the virtual machine and the storage device target, the virtual machine and the virtual channel correspond one-to-one, and the virtual address information is used to represent the virtual address of a storage area to be accessed in the virtual machine; the storage device target determines the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine; the storage device target operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device.

[0023] Through the configuration of virtual channels, the storage device target can identify different virtual machines, because the virtual channel represents the unique connection relationship between the virtual machine and the storage device. Therefore, even if the virtual machine identifiers running on different physical machines are repeated, the storage device can distinguish the virtual machines on different physical machines, thereby uniquely determining the physical address of the storage area to be accessed by the virtual machine based on the virtual address information and the identifier of the virtual channel of the virtual machine.

[0024] In combination with the fourth aspect, in a first possible implementation method of the fourth aspect, the storage device target determines the physical address of the storage area to be accessed in the storage device based on the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine, including: the storage device target queries a preset second correspondence relationship to determine the physical address of the storage area to be accessed in the storage device based on the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine, wherein the second correspondence relationship includes a correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0025] The second corresponding relationship here can be implemented in various forms. It can be represented in the form of a data table, or by configuring a register for each virtual machine to store the corresponding virtual channel identifier in the register. This application does not limit this.

[0026] In combination with the fourth aspect or any possible implementation of the fourth aspect or above, in a second possible implementation of the fourth aspect, the storage device target is configured with at least one cache queue, each cache queue corresponds one-to-one to each virtual channel; after the storage device target obtains the access instruction, it further includes: the storage device target puts the access instruction into the second cache queue corresponding to the virtual channel of the virtual machine; before the storage device target determines the physical address of the storage area to be accessed in the storage device, it further includes: the storage device target takes out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0027] By configuring a corresponding cache queue for each virtual channel, the storage device target can work more flexibly and respond to sudden increases in the number of virtual machine accesses in a targeted manner. It can also prioritize the access requests of certain virtual machines as needed, and can merge access requests that can be merged.

[0028] Optionally, the cache queue of the storage device target may also adopt a FIFO structure.

[0029] In combination with the fourth aspect or any possible implementation method above the fourth aspect, in a third possible implementation method of the fourth aspect, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target determines the physical address of the storage area to be accessed in the storage device, including: the storage device target first determines the physical address of the storage area to be accessed in the storage device of the virtual machine with a higher priority in order of priority, and then determines the physical address of the storage area to be accessed in the storage device of the virtual machine with a lower priority.

[0030] By setting priorities for different virtual channels (virtual machines), the storage device target can prioritize access requests from important virtual machines or virtual machines with high user service levels, increasing the flexibility of the storage device target in managing access to storage devices. The priority order can be adjusted dynamically.

[0031] In combination with the fourth aspect or any possible implementation method above the fourth aspect, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target determines the physical address of the storage area to be accessed in the storage device, including: the storage device target first determines the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received first, and then determines the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received later, based on the time sequence of obtaining the at least two access instructions.

[0032] By processing the access instructions in the order in which they are received, the system architecture of the storage device can be simplified, and the demand can be met by only using a FIFO cache structure.

[0033] In combination with the fourth aspect or any possible implementation method above the fourth aspect, in a fifth possible implementation method of the fourth aspect, after the storage device target operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device, it further includes: the storage device target returns a feedback message, and the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine.

[0034] In a fifth aspect, an embodiment of the present invention provides a computer-readable medium, comprising computer-executable instructions. When a processor of a computer executes the computer-executable instructions, the computer executes the method in the fourth aspect or any possible implementation of the fourth aspect.

[0035] In the sixth aspect, an embodiment of the present invention provides a storage device access device, comprising: a processor, a memory, a bus and a communication interface; the memory is used to store execution instructions, the processor is connected to the memory through the bus, and when the storage device access device is running, the processor executes the execution instructions stored in the memory, so that the device executes the method in the fourth aspect or any possible implementation of the fourth aspect.

[0036] In a seventh aspect, an embodiment of the present invention provides a storage device access apparatus for managing access operations of a virtual machine running on a computer system to a storage device, comprising: an acquisition unit, for acquiring an access request from a virtual machine, the access request carrying virtual address information of a storage area to be accessed; a generation unit, for generating an access instruction according to the access request, the access instruction carrying virtual address information and an identifier of a virtual channel of the virtual machine, the virtual channel being used to connect the virtual machine with a storage device target, the virtual machine and the virtual channel corresponding one-to-one, the storage device target being used to manage access operations to the storage device; and a sending unit, for sending the access instruction to the storage device target.

[0037] In combination with the seventh aspect, in a first possible implementation method of the seventh aspect, before the generation unit generates an access instruction based on an access request, it is also used to: query a preset first correspondence relationship based on the identifier of the virtual machine to determine the identifier of the virtual channel, wherein the first correspondence relationship includes a correspondence between the identifier of each virtual machine and the identifier of each virtual channel.

[0038] In combination with the seventh aspect or any possible implementation manner above the seventh aspect, in a second possible implementation manner of the seventh aspect, the device is configured with at least one cache queue, each cache queue corresponding one-to-one to each virtual channel; after the acquisition unit acquires the access request from the virtual machine, it is also used to: put the access request into the first cache queue corresponding to the virtual channel of the virtual machine; before the generation unit generates an access instruction according to the access request, it is also used to: take out the access request from the first cache queue corresponding to the virtual channel of the virtual machine.

[0039] In combination with the seventh aspect or any possible implementation method above the seventh aspect, in a third possible implementation method of the seventh aspect, if the acquisition unit acquires at least two access requests from at least two virtual machines, the generation unit is used to generate access instructions based on the access requests, including: the generation unit is used to generate access instructions corresponding to the virtual machine with a higher priority in order of priority, and then generate access instructions corresponding to the virtual machine with a lower priority in order of priority, according to the priorities of at least two virtual machines corresponding to the at least two access requests.

[0040] In combination with the seventh aspect or any possible implementation method above the seventh aspect, if the acquisition unit obtains at least two access requests from at least two virtual machines, the generation unit is used to generate access instructions based on the access requests, including: the generation unit is used to first generate access instructions corresponding to the access request received first, and then generate access instructions corresponding to the access request received later, according to the time order in which the at least two access requests are obtained.

[0041] In combination with the seventh aspect or any possible implementation method above the seventh aspect, in the fifth possible implementation method of the seventh aspect, after the sending unit sends the access instruction to the storage device target, the obtaining unit is also used to: obtain a feedback message from the storage device target, the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine; the sending unit is also used to: determine the virtual machine based on the identifier of the virtual channel, and send the execution result of the access instruction to the virtual machine.

[0042] In combination with the seventh aspect or any possible implementation manner above the seventh aspect, in a sixth possible implementation manner of the seventh aspect, an acquisition unit is used to obtain an access request from a virtual machine, including: the acquisition unit is used to receive a first doorbell notification from the virtual machine, and obtain the access request from the I / O shared ring shared with the virtual machine, the access request is placed by the virtual machine into the I / O shared ring, and the first doorbell notification is used to indicate that an access request has arrived in the I / O shared ring; a sending unit is used to send an execution result of the access instruction to the virtual machine, including: the sending unit is used to place the execution result of the access request into the I / O shared ring shared with the virtual machine, and send a second doorbell notification to the virtual machine, and the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0043] In combination with the seventh aspect or any possible implementation method above the seventh aspect, in the seventh possible implementation method of the seventh aspect, the access instruction is a small computer system interface SCSI instruction that can be processed by the host bus adapter driver layer; the sending unit is used to send the access instruction to the storage device target, including: the sending unit is used to send the access instruction to the storage device target through the host bus adapter driver layer.

[0044] It should be understood that the seventh aspect is an apparatus implementation method corresponding to the method of the first aspect, and the feature description in the first aspect or any possible implementation method of the first aspect is applicable to the seventh aspect or any possible implementation method of the seventh aspect, and will not be repeated here.

[0045] In an eighth aspect, an embodiment of the present invention provides a storage device access device, characterized in that it is used to manage the access operation of a virtual machine to a storage device, including: an acquisition unit, used to acquire an access instruction, the access instruction carries virtual address information and an identifier of a virtual channel of the virtual machine, the virtual channel is used to connect the virtual machine to the device, the virtual machine and the virtual channel correspond one-to-one, and the virtual address information is used to represent the virtual address of the storage area to be accessed in the virtual machine; a determination unit, used to determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine; a processing unit, used to operate on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device.

[0046] In combination with the eighth aspect, in a first possible implementation method of the eighth aspect, the determination unit is used to determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine, including: the determination unit is used to query a preset second correspondence relationship according to the virtual address information carried in the access instruction and the identifier of the virtual channel of the virtual machine, and determine the physical address of the storage area to be accessed in the storage device, wherein the second correspondence relationship includes a correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0047] In combination with the eighth aspect or any possible implementation of the eighth aspect or above, in a second possible implementation of the eighth aspect, the device is configured with at least one cache queue, each cache queue corresponding to each virtual channel one by one; after the acquisition unit acquires the access instruction, it is also used to: put the access instruction into the second cache queue corresponding to the virtual channel of the virtual machine; before the determination unit determines the physical address of the storage area to be accessed in the storage device, it is also used to: take out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0048] In combination with the eighth aspect or any possible implementation manner above the eighth aspect, in a third possible implementation manner of the eighth aspect, if the acquisition unit acquires at least two access instructions from at least two virtual machines, the determination unit is used to determine the physical address of the storage area to be accessed in the storage device, including: the determination unit is used to determine the physical address of the storage area to be accessed in the storage device of the virtual machine with a higher priority in order of priority according to the priorities of the at least two virtual machines corresponding to the at least two access instructions, and then determine the physical address of the storage area to be accessed in the storage device of the virtual machine with a lower priority.

[0049] In combination with the eighth aspect or any possible implementation manner above the eighth aspect, in a fourth possible implementation manner of the eighth aspect, if the acquisition unit acquires at least two access instructions from at least two virtual machines, the determination unit is used to determine the physical address of the storage area to be accessed in the storage device, including: the determination unit is used to first determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received first, and then determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received later, according to the time sequence in which the at least two access instructions are acquired by the acquisition unit.

[0050] In combination with the eighth aspect or any possible implementation method above the eighth aspect, in the fifth possible implementation method of the eighth aspect, after the processing unit operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device, it is also used to: return a feedback message, the feedback message including the execution result of the access instruction and the identifier of the virtual channel of the virtual machine.

[0051] It should be understood that the eighth aspect is a device implementation method corresponding to the method of the fourth aspect, and the feature description in the fourth aspect or any possible implementation method of the fourth aspect is applicable to the eighth aspect or any possible implementation method of the eighth aspect, and will not be repeated here.

[0052] In the ninth aspect, an embodiment of the present invention provides a storage device access system, including an I / O adapter and a storage device target, the I / O adapter is used to obtain an access request from a virtual machine, the access request carries virtual address information of a storage area to be accessed, generates an access instruction according to the access request, and sends the access instruction to the storage device target, the access instruction carries virtual address information and an identifier of a virtual channel of the virtual machine, the virtual channel is used to connect the virtual machine and the storage device target, and the virtual machine and the virtual channel correspond one to one; the storage device target is used to obtain the access instruction, determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel, and operate on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device.

[0053] In combination with the ninth aspect, before the I / O adapter generates an access instruction based on an access request, it is also used to: query a preset first correspondence relationship based on the identifier of the virtual machine to determine the identifier of the virtual channel, wherein the first correspondence relationship includes a correspondence between the identifier of each virtual machine and the identifier of each virtual channel.

[0054] In combination with the ninth aspect or any possible implementation of the ninth aspect or above, in a second possible implementation of the ninth aspect, the I / O adapter is configured with at least one cache queue, each cache queue corresponding one-to-one to each virtual channel; after the I / O adapter obtains the access request from the virtual machine, it is also used to: put the access request into the first cache queue corresponding to the virtual channel of the virtual machine; before the I / O adapter generates an access instruction according to the access request, it is also used to: take out the access request from the first cache queue corresponding to the virtual channel of the virtual machine.

[0055] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in a third possible implementation method of the ninth aspect, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter is used to generate access instructions based on the access requests, including: the I / O adapter is used to generate access instructions corresponding to the virtual machine with a higher priority in order of priority, and then generate access instructions corresponding to the virtual machine with a lower priority in order of priority, according to the priorities of the at least two virtual machines corresponding to the at least two access requests.

[0056] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in a fourth possible implementation method of the ninth aspect, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter is used to generate access instructions based on the access requests, including: the I / O adapter is used to first generate an access instruction corresponding to the access request received first, and then generate an access instruction corresponding to the access request received later, based on the time sequence in which the at least two access requests are obtained.

[0057] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in the fifth possible implementation method of the ninth aspect, after the I / O adapter sends the access instruction to the storage device target, it is also used to: obtain a feedback message from the storage device target, the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine, and determine the virtual machine based on the identifier of the virtual channel, and send the execution result of the access instruction to the virtual machine.

[0058] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in a sixth possible implementation method of the ninth aspect, the I / O adapter is used to obtain an access request from a virtual machine, including: the I / O adapter is used to receive a first doorbell notification from the virtual machine, and obtain the access request from the I / O shared ring shared with the virtual machine, the access request is placed by the virtual machine into the I / O shared ring, and the first doorbell notification is used to indicate that an access request has arrived in the I / O shared ring; the I / O adapter is used to send the execution result of the access instruction to the virtual machine, including: the I / O adapter is used to place the execution result of the access request into the I / O shared ring shared with the virtual machine, and send a second doorbell notification to the virtual machine, and the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0059] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in the seventh possible implementation method of the ninth aspect, the access instruction is a small computer system interface SCSI instruction that can be processed by the host bus adapter driver layer; the I / O adapter is used to send the access instruction to the storage device target, including: the I / O adapter is used to send the access instruction to the storage device target through the host bus adapter driver layer.

[0060] In combination with the ninth aspect or any possible implementation manner above the ninth aspect, in an eighth possible implementation manner of the ninth aspect, the storage device target is used to determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel, including: the storage device target is used to query a preset second correspondence relationship according to the virtual address information carried in the access instruction and the identifier of the virtual channel, and determine the physical address of the storage area to be accessed in the storage device, wherein the second correspondence relationship includes a correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0061] In combination with the ninth aspect or any possible implementation manner above the ninth aspect, in a ninth possible implementation manner of the ninth aspect, the storage device target is configured with at least one cache queue, each cache queue corresponding one-to-one to each virtual channel; after the storage device target obtains the access instruction, it is also used to: put the access instruction into the second cache queue corresponding to the virtual channel of the virtual machine; before the storage device target determines the physical address of the storage area to be accessed in the storage device, it is also used to: take out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0062] In combination with the ninth aspect or any possible implementation manner above the ninth aspect, in a tenth possible implementation manner of the ninth aspect, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target is used to determine the physical address of the storage area to be accessed in the storage device, including: the storage device target is used to determine the physical address of the storage area to be accessed in the storage device of the virtual machine with a higher priority in order of priority according to the priorities of the at least two virtual machines corresponding to the at least two access instructions, and then determine the physical address of the storage area to be accessed in the storage device of the virtual machine with a lower priority.

[0063] In combination with the ninth aspect or any possible implementation manner above the ninth aspect, in an eleventh possible implementation manner of the ninth aspect, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target is used to determine the physical address of the storage area to be accessed in the storage device, including: the storage device target is used to first determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received first, and then determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received later, according to the time sequence of obtaining the at least two access instructions.

[0064] In combination with the ninth aspect or any possible implementation method above the ninth aspect, in the twelfth possible implementation method of the ninth aspect, after the storage device target operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device, it is also used to: return a feedback message, wherein the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine.

[0065] It should be understood that the ninth aspect is a system implementation corresponding to the methods of the first aspect and the fourth aspect. The feature description in the first aspect or any possible implementation of the first aspect, or the fourth aspect or any possible implementation of the fourth aspect is applicable to the ninth aspect or any possible implementation of the ninth aspect, and will not be repeated here.

[0066] According to the technical solution disclosed in the present application, by configuring an I / O adapter between a virtual machine and a storage device, and by configuring a virtual channel corresponding to the virtual machine one by one between the I / O adapter and the storage device, and carrying the identifier of the corresponding virtual channel in the access instruction, the storage device target can uniquely determine the physical address of the area to be accessed according to the virtual address information and the identifier of the virtual channel of the virtual machine, thereby realizing direct access of the virtual machine to the storage device, simplifying the access method of the storage device, shortening the I / O access process, and reducing the consumption of memory resources and computing resources by the software layer. BRIEF DESCRIPTION OF THE DRAWINGS

[0067] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0068] Figure 1 A schematic diagram of the structure of a virtualization system;

[0069] Figure 2 A schematic diagram of the structure of a storage device access system according to an embodiment of the present invention;

[0070] Figure 3 A schematic diagram of a storage device access architecture;

[0071] Figure 4 A schematic diagram of a storage device access architecture according to an embodiment of the present invention;

[0072] Figure 5 A signaling diagram of a storage device access method according to an embodiment of the present invention;

[0073] Figure 6is an exemplary flow chart of a storage device access method according to an embodiment of the present invention;

[0074] Figure 7 is an exemplary flow chart of a storage device access method according to an embodiment of the present invention;

[0075] Figure 8 A schematic diagram of the logical structure of a storage device access apparatus according to an embodiment of the present invention;

[0076] Fig. 9 A schematic diagram of the logical structure of a storage device access apparatus according to an embodiment of the present invention;

[0077] Fig.10 The figure is a schematic diagram of the hardware structure of a storage device access apparatus according to an embodiment of the present invention. DETAILED DESCRIPTION

[0078] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0079] Figure 1 is a structural diagram of a virtualization system 100, such as Figure 1 As shown, the system 100 includes: physical hardware 106, a virtual machine monitor 104 (Virtual Machine Monitor, VMM) and N virtual machines 102 running on the physical hardware, where N is a positive integer greater than 0.

[0080] The Virtual Machine Monitor (VMM) is a software description layer between the virtual machine operating system and the physical hardware. It is responsible for processor scheduling and memory allocation between virtual machines. VMM not only abstracts the hardware of the virtual machine, but also controls the execution of each virtual machine.

[0081] VMM can also be used to manage the creation, destruction, suspension, resumption and migration of virtual machines, as well as CPU scheduling, memory allocation and device access between virtual machines.

[0082] VMM provides an abstraction layer to the virtual machine, which includes the application programming interface (API) for management and virtual hardware. VMM provides the virtual machine with basic virtual hardware such as the virtual central processing unit (VCPU) and the virtual memory management unit (MMU), and provides the virtual machine with the corresponding hardware interface (secure hardware interface) to ensure that device access is carried out safely.

[0083] The secure hardware interface provides hardware virtualization tasks such as direct memory access (DMA), input and output (I / O), drivers, virtual peripheral component interconnect (PCI) address configuration, and virtual hardware interrupts.

[0084] The system 100 can support paravirtualization and full virtualization. A paravirtualized (PV) virtual machine running on a VMM runs an operating system with a modified kernel, or a system in which a paravirtualized driver is installed on the upper operating system. A full virtualized virtual machine running on a VMM runs an operating system with an unmodified kernel and no paravirtualized driver installed.

[0085] Figure 2 FIG. 2 is a schematic diagram of a storage device access system 200 (a) and 200 (b) according to an embodiment of the present invention. Figure 2 As shown, the storage device access system according to the embodiment of the present invention includes two structures.

[0086] like Figure 2 As shown in (a), the system 200 (a) includes a storage device 202 and M computing devices 204, each of which runs Figure 1 In the virtualization system 100 shown, M is a positive integer greater than 0.

[0087] As shown in the figure, at least one virtual machine is running on each computing device 204, the storage device 202 is shared by the virtual machines on the M computing devices 204, the computing device 204 and the storage device 202 are separated from each other, and the computing device 204 and the storage device 202 can be connected to each other via an optical fiber or a serial cable or other connection methods. The embodiment of the present invention does not limit the connection method between the storage device 202 and the computing device 204.

[0088] Figure 2 (a) describes an application scenario of a computing device 204 and a storage device 202 in a general storage area network (SAN). In this scenario, after a virtual machine running on each computing device 204 generates data, the data is processed by the computing device 204 and then stored in the storage array of the storage device 202.

[0089] The storage device 202 is composed of a storage array, and the types of storage devices 202 are various, including, but not limited to, RAM, ROM, EEPROM, flash memory, other memory technologies, CD-ROM, digital versatile disks, other optical storage, magnetic cassettes, magnetic tapes, magnetic disk storage, other magnetic storage devices, and any other medium that can be used to store the required information and can be accessed by the computing device 204. The embodiment of the present invention does not limit the implementation of the storage device 202.

[0090] In its basic configuration, computing device 204 typically includes at least one processor and memory. The memory can be volatile, such as random access memory (RAM), non-volatile, such as read-only memory (ROM), flash memory, or some combination of the two.

[0091] This basic configuration may have additional features and functions. For example, it may include peripheral storage (removable and non-removable), including but not limited to, magnetic disks and tapes and optical disks and optical tapes. Computer storage media include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data.

[0092] The computing device 204 may also include a communication channel that allows it to communicate with other devices. The media of the communication channel include, but are not limited to, optical media, wired media such as wired networks and direct-wired connections, wireless media such as acoustic, RF, infrared and other wireless media.

[0093] It should be understood that the embodiments of the present invention are merely exemplary, and the computing device 204 may also include other functional modules, which will not be described in detail here.

[0094] like Figure 2 As shown in (b), in another implementation of the embodiment of the present invention, the storage device access system 200 (b) includes a storage device 202 and M storage controllers 206, and the storage controller 206 runs Figure 1 In the virtualization system 100 shown, M is a positive integer greater than 0.

[0095] As shown in the figure, at least one virtual machine is running on each storage controller 206, and the storage device 202 is shared by the virtual machines on the M storage controllers 206. The storage controller 206 and the storage device 202 together form a storage integrated machine. In an implementation of the embodiment of the present invention, the storage controller 206 can hot-swap the storage device 202.

[0096] Figure 2 (b) describes the application scenario of the storage device 202 after the computing device is omitted in the SAN. In this scenario, the virtual machine runs directly on the memory controller 206 of the storage device 202. The data generated by the virtual machine is processed by the storage controller 206, and the valid data is stored in the storage array of the storage device 202.

[0097] In its basic configuration, the storage controller 206 generally includes at least one processor and memory. The memory can be volatile, such as random access memory (RAM), non-volatile, such as read-only memory (ROM), flash memory, or some combination of the two.

[0098] Storage controller 206 may also include a communication channel that allows it to communicate with other devices. The media of the communication channel include, but are not limited to: optical media, wired media such as wired networks and direct-line connections, wireless media such as sound, RF, infrared and other wireless media.

[0099] It should be understood that Figure 1 The physical hardware 106 in the embodiment may be a specific computer, or a storage controller of the storage device 202, or any combination of the two. Figure 2 The system can be implemented in various forms, such as the computing device 204 and the storage device 202 being separated from each other and connected to each other in any manner, or the storage controller 206 and the storage device 202 being integrated into a storage all-in-one machine. The embodiment of the present invention does not limit the specific implementation of the physical hardware 106 and the system 200. For the convenience of description, in the following description, the computing device 204, the storage controller 206, or any combination of the two, are collectively referred to as a physical machine.

[0100] Figure 3 A schematic diagram of a storage device access architecture is shown in FIG. Figure 3As shown, taking a kernel-based virtual machine (KVM) as an example, the entire storage device access process must go through the virtual machine 102, the virtual machine host target (Vhost target) 302, the block device layer (Block level) 304, the small computer system interface middle layer (Small Computer System Interface level, SCSI level) 306 and the storage device 202.

[0101] exist Figure 2 In the scenario 200(a), it is also necessary to pass through the host bus adapter driver (HBA driver) of the computing device 204 and the storage device 202. The HBA driver is the operating system SCSI protocol transport layer (also called the HBA driver layer) on the physical machine, connecting the internal bus of the physical machine and the storage device, and as the carrier layer of the SCSI protocol, completing the packaging and parsing between the SCSI protocol and the specific protocol messages, cooperating with the SCSI middle layer to complete the error handling, and responsible for transmitting the SCSI commands issued by the SCSI middle layer.

[0102] The storage array of the storage device 202 may be divided into a plurality of logical unit number (LUN) devices, each of which has a LUN. The LUN devices of the storage device 202 are allocated to a plurality of virtual machines for use, wherein the plurality of virtual machines may be run on the same physical machine or on different physical machines, which is not limited in the embodiment of the present invention.

[0103] Before the entire system is run, there is first a LUN device configuration process for the physical machine and the storage device 202, so that the LUN device of the storage device 202 presents a physical drive letter at the block device layer of the physical machine. Secondly, the user needs to use the configuration tool to configure the physical drive letters on the block device to multiple virtual machines running on the physical machine, so that virtual drive letters are presented inside the virtual machines. For the convenience of description, in the embodiment of the present invention, the drive letter inside the virtual machine is called a virtual drive letter, and the drive letter presented at the block device layer of the physical machine is called a physical drive letter.

[0104] When the application layer inside the virtual machine 102 has a need to access the storage device 202, the virtual machine 102 will generate a corresponding block read and write request (BLOCK Input and Output Request, BIO), and then you will send the BIO to the block device of the virtual machine (inside the virtual machine). The block device of the virtual machine generates a request Request based on the BIO, and then merges, sorts, caches, and schedules based on the Requst. Then, the Request is sent to the SCSI middle layer of the virtual machine (inside the virtual machine) through the scheduling algorithm. The SCSI middle layer of the virtual machine will generate a SCSI command and send it to the virtual disk driver virtio-scsi. Virtio-scsi generates a virtio_scsi_cmd request based on the SCSI command. The virtio_scsi_cmd request contains a SCSI command descriptor (CommandDistription Block, CBD), data space description information and data transmission direction information, as well as other IO attributes and other data. The virtio_scsi_cmd carries the virtual drive letter information provided to the virtual machine 102 by the block device layer (Block level) 304.

[0105] The virtual disk driver virtio-scsi of the virtual machine sends the virtio_scsi_cmd request to the I / O shared ring vring of the virtual machine, and notifies Vhost target 302 of the arrival of a new I / O request through the doorbell mechanism.

[0106] After receiving the doorbell signal, the vhost target 302 takes out the virtio_scsi_cmd from the vring, parses and processes the request. If it is not a read or write command, it is directly simulated in the vhost target 302; if it is a read or write command, the corresponding BIO is generated and sent to the specified block device layer 304.

[0107] The block device layer 304 generates a request Request based on the BIO, and then merges, sorts, caches, and schedules based on the Request, and then sends the Request to the SCSI middle layer 306 of the virtual machine through a scheduling algorithm.

[0108] The SCSI middle layer 306 performs mapping from virtual drive letters to physical drive letters, and repackages the Request into a SCSI command, and sends it to the storage device 202. The SCSI command carries the physical drive letter information.

[0109] exist Figure 2In the scenario shown in 200 (a), the SCSI middle layer sends the SCSI command to the storage device 202 through the HBA drivers of the computing device 204 and the storage device 202. The storage device 202 implements the mapping of the physical drive letter to the LUN device of the storage array.

[0110] Figure 3 The embodiment realizes the access of the virtual machine 102 to the storage device 202, but the entire access process must go through the internal vhost target 302, the block device layer 304, and the SCSI middle layer 306 multi-layer conversion to realize the access operation of the virtual machine 102 to the storage device 202. And the access request goes through the cache, merging, sorting, scheduling, and SCSI command conversion of the block device twice, once in the virtual machine and once in the physical machine.

[0111] Figure 4 FIG. 4 is a schematic diagram of a storage device access architecture 400 according to an embodiment of the present invention. Figure 4 As shown, the architecture 400 includes: a virtual machine 102 , an I / O adapter 402 , and a storage device 202 .

[0112] The storage device 202 can be used by multiple virtual machines 102 running on multiple physical machines. Before the entire system is run, there is first a configuration process of the virtual machine 102 running on the physical machine and the LUN device of the storage device 202, so that the LUN device of the storage device 202 appears as a virtual LUN device in the virtual machine 102 running on the physical machine. The LUN device of the storage device 202 can be allocated to multiple virtual machines for use, and multiple virtual machines can run on one physical machine or on multiple physical machines, which is not limited in the embodiment of the present invention.

[0113] For the convenience of description, in the embodiment of the present invention, the LUN device inside the virtual machine is called a virtual LUN, which is used to identify the virtual LUN device, and the LUN device of the storage array of the storage device 202 is called a physical LUN device, which is used to identify the physical LUN.

[0114] In the specific implementation process, the I / O adapter 402 can configure the physical LUN device as the virtual LUN device inside the virtual machine 102, or the VMM can complete the configuration of the physical LUN device to the virtual LUN device of the virtual machine 102; the configuration of the physical LUN device to the virtual machine LUN device can be completed when the virtual machine 102 is created, or the configuration of the physical LUN device to the virtual LUN device can be performed during the subsequent dynamic adjustment of resources. The embodiment of the present invention does not limit the configuration subject and configuration time.

[0115] In a possible implementation of an embodiment of the present invention, the addressing methods inside different virtual machines are the same, and the addressing of virtual lun devices inside different virtual machines can be repeated. The configuration of a physical lun device to a virtual lun device can be merely the conversion of a physical lun device number to a virtual lun device number, and the attribute information of the physical lun device can be transparently transmitted to the virtual machine, for example, whether automatic thin provisioning is supported, whether cluster continuous reservation is supported, whether offloaded data transmission is supported, whether path switching is supported, and other attribute information. Among them, the configuration process from a physical lun device to a virtual lun device can be completed through negotiation between an I / O adapter or a VMM and a storage device target, and the embodiment of the present invention is not limited to this.

[0116] The storage device access process signaling diagram under architecture 400 is as follows Figure 5 As shown, the access process includes:

[0117] 502 : The virtual machine 102 generates an access request to the storage device 202 .

[0118] When the virtual machine 102 receives a request from an upper-layer application to access a storage array in the storage device 202 , the virtual machine 102 first generates an access request, which carries virtual address information of a storage area to be accessed.

[0119] In an implementation of the embodiment of the present invention, the access request may carry the virtual LUN of the virtual LUN device to be accessed by the virtual machine 102 and the starting address and address length of the storage area to be accessed in the virtual LUN device.

[0120] Taking KVM virtualization as an example, in one implementation of the embodiment of the present invention, when the application layer inside the virtual machine 102 has a need to access the storage device 202, the virtual machine 102 will generate a corresponding block read and write request BIO, and send the BIO to the block device of the virtual machine 102 (inside the virtual machine), the block device of the virtual machine 102 generates a request Request based on the BIO, and then merges, sorts, caches, and schedules based on the Requst, and then sends the Request to the SCSI middle layer of the virtual machine 102 (inside the virtual machine) through the scheduling algorithm, the SCSI middle layer of the virtual machine 102 generates a SCSI command based on the Request, and sends the SCSI command to the virtual disk driver virtio-scsi, and virtio-scsi generates an access request virtio_scsi_cmd based on the SCSI command. Among them, the access request virtio_scsi_cmd carries the virtual LUN used to identify the virtual LUN device and the starting address and address length of the storage area to be accessed in the virtual LUN device.

[0121] 504 : The virtual machine 102 sends the access request to the I / O adapter 402 .

[0122] The virtual machine 102 places the access request into the I / O shared ring shared with the I / O adapter 402, and sends a first doorbell notification to the I / O adapter, wherein the first doorbell notification is used to indicate that an access request has arrived in the I / O shared ring. After receiving the first doorbell notification from the virtual machine, the I / O adapter 402 obtains the access request from the I / O shared ring shared with the virtual machine.

[0123] Taking KVM virtualization as an example, in the specific implementation process, the virtual disk driver virtio-scsi of the virtual machine 102 puts the access request virtio_scsi_cmd into the I / O shared ring vring of the virtual machine 102 and the I / O adapter, and notifies the I / O adapter 402 of the arrival of a new access request through the doorbell mechanism. After receiving the doorbell notification, the I / O adapter 402 will go to the corresponding I / O shared ring to retrieve the access request virtio_scsi_cmd put by the virtual machine 102.

[0124] 506: The I / O adapter 402 generates an access instruction according to the access request.

[0125] The I / O adapter 402 generates an access instruction according to the access request virtio_scsi_cmd. The access instruction carries the virtual address information of the storage area to be accessed and the identifier of the virtual channel corresponding to the virtual machine 102.

[0126] In one implementation of an embodiment of the present invention, the access instruction may carry the virtual LUN of the virtual LUN device to be accessed by the virtual machine 102, the identifier of the virtual channel corresponding to the virtual machine 102, and the starting address and address length of the storage area to be accessed in the virtual LUN device.

[0127] Among them, the virtual channel is used to connect the virtual machine 102 and the storage device 202, and the virtual machine 102 corresponds to the virtual channel one-to-one. More specifically, the virtual channel is used to connect the virtual machine 102 and the storage device target of the storage device 202. The storage device target is used to manage access operations to the storage device 202. Because the storage device 202 can be shared by multiple virtual machines, or even shared by multiple virtual machines running on multiple physical machines, in order for the storage device target to be able to identify which virtual machine is accessing the storage device 202, a correspondence between the virtual machine and the virtual channel needs to be established. The virtual channel between the virtual machine and the storage array target is unique, that is, the virtual machine and the virtual channel correspond one-to-one, and the virtual channel identifier can uniquely identify the virtual machine.

[0128] It should be understood that the virtual channel and the virtual channel identifier are to characterize the unique connection relationship between the virtual machine 102 and the storage device 202. The virtual channel refers to a data transmission channel that is established on a physical medium using a storage transmission protocol during data transmission and represents the unique connection relationship between the virtual machine and the storage device. Each virtual machine is connected to the storage device through a virtual channel identified by a unique virtual channel identifier. In specific implementation, the virtual channel can be implemented in a variety of forms, for example, it can be implemented by time-division multiplexing of a physical connection channel.

[0129] Because the virtual machine identifiers of virtual machines running on different physical machines can be repeated, the virtual machine identifier cannot uniquely represent the virtual machine, and the virtual channel corresponds to the virtual machine one by one. The essential purpose of the virtual channel identifier is to uniquely represent the virtual machine connected to the virtual channel. There are many specific implementation forms of the virtual machine identifier, which is not limited by the embodiment of the present invention. Any identifier that can uniquely represent the identity of the virtual machine can be used to achieve this purpose. The channel that transmits the virtual channel identifier that uniquely represents the identity of the virtual machine between the virtual machine and the storage device is the unique virtual channel connecting the virtual machine and the storage device.

[0130] The virtual channel can be determined by negotiation between the I / O adapter 402 and the storage device 202, or can be configured in advance. For example, when creating a virtual machine, the virtual machine monitor (Virtual Machine Manager, VMM) or the privileged domain that creates the virtual machine configures the virtual channel. The embodiment of the present invention does not limit the configuration method of the virtual channel and the virtual channel identifier. The virtual channel can have various attributes, such as carrying capacity, address space of the corresponding storage array, fault handling method, etc.

[0131] A one-to-one correspondence between virtual channels and virtual machines is maintained inside the I / O adapter 402. For example, a data table can be used to record the one-to-one correspondence between virtual machines and virtual channels. In the specific implementation process, a virtual machine identifier can be used to indicate a virtual machine, and a virtual channel identifier can be used to indicate a virtual channel.

[0132] Before generating an access instruction according to the access request, the I / O adapter 402 determines the identifier of the virtual channel corresponding to the virtual machine by querying a preset correspondence relationship, wherein the correspondence relationship includes a one-to-one correspondence between the identifier of the virtual channel and the virtual machine.

[0133] Through the configuration of virtual channels, the storage device target can identify different virtual machines, because the virtual channel represents the unique connection relationship between the virtual machine and the storage device. Therefore, even if the virtual machine identifiers running on different physical machines are repeated, the storage device can distinguish the virtual machines on different physical machines, thereby uniquely determining the physical address of the storage area to be accessed by the virtual machine based on the virtual address information and the virtual channel identifier of the virtual machine.

[0134] The one-to-one correspondence between virtual channels and virtual machines can be adjusted dynamically. When a new virtual machine is created, the correspondence between the newly created virtual machine and its corresponding virtual channel can be newly added to the correspondence. When a virtual machine is deleted, the correspondence between the corresponding virtual machine and the virtual channel is also deleted from the correspondence.

[0135] In an implementation of the embodiment of the present invention, the I / O adapter converts the virtio_scsi_cmd instruction into a standard access instruction scsi_cmnd, and uses the upper two bytes of the LUN address field of scsi_cmnd to record the identifier of the virtual channel corresponding to the virtual machine 102.

[0136] Because the LUN address format generally does not exceed 6 bytes, and the LUN address field defined in the SCSI model actually has 8 bytes, and the high-order bytes of the LUN address field generally have two spare fields, the two spare high-order bytes of the LUN address field can be used to carry the virtual channel identifier to distinguish different virtual channels.

[0137] It should be understood that the access instruction can also use other fields or extended fields to carry the virtual channel identifier, and the embodiment of the present invention is not limited to this. For example, if the number of virtual channels is less than 256, only one high-order byte of the LUN address field can be used to record the virtual channel identifier.

[0138] The partial conversion pseudo code from access request to access instruction is shown below. The upper two bytes of the LUN address field are used to record the virtual channel identifier Virtual_Channel_no. The specific implementation is to shift Virtual_Channel_no left by 48 bits (i.e. 6 bytes), and then perform a "bit OR" operation with LUN. Because the upper two bytes of the LUN address field are 0 by default, after the "bit OR" operation, the upper two bytes of the LUN address field record the virtual channel identifier Virtual_Channel_no. Using two bytes can distinguish 65536 different virtual channels.

[0139] Access request pseudo code:

[0140] struct virtio_scsi_cmd{

[0141] lun[8];

[0142] cdb

[32] ;

[0143] sdb;

[0144] tag;

[0145] …

[0146] }

[0147] Access instruction pseudo code:

[0148] struct scsi_cmnd{

[0149] Cmnd = cdb

[32] ;

[0150] sdb=sdb;

[0151] lun=lun[8]|Virtual_Channel_no<<48;

[0152] tag=tag;

[0153] …

[0154] }

[0155] It should be understood that the above pseudo code is only for illustrative purposes. In a specific implementation, the actual code may be different from the above pseudo code, and the embodiments of the present invention are not limited to this.

[0156] In one implementation of the embodiment of the present invention, the I / O adapter 402 is configured with at least one cache queue, each cache queue is associated with a virtual channel, and each cache queue corresponds to each virtual channel one by one; after the I / O adapter 402 obtains the access request from the virtual machine, it further puts the access request into the first cache queue corresponding to the virtual channel of the virtual machine; before the I / O adapter 402 generates the access instruction according to the access request, it takes out the access request from the first cache queue corresponding to the virtual channel of the virtual machine.

[0157] If the I / O adapter 402 obtains at least two access requests from at least two virtual machines, the I / O adapter 402 can generate access instructions corresponding to the virtual machine with a higher priority and then generate access instructions corresponding to the virtual machine with a lower priority in order of priority based on the priorities of the at least two virtual machines corresponding to the at least two access requests.

[0158] If the I / O adapter 402 obtains at least two access requests from at least two virtual machines, the I / O adapter 402 may also generate access instructions corresponding to the access requests received first and then generate access instructions corresponding to the access requests received later, based on the time sequence in which the at least two access requests are obtained.

[0159] It should be understood that the above manner in which the I / O adapter 402 processes multiple received access requests separately according to the virtual machine priority or in the order of acquisition time is merely an example, and the embodiment of the present invention does not limit the order in which the I / O adapter 402 processes the received access requests.

[0160] 508 : The I / O adapter sends the access instruction to the storage device 202 .

[0161] In the specific implementation process, Figure 2 In the scenario 200 (a) shown, the access instruction is a Small Computer System Interface SCSI instruction that can be processed by the host bus adapter driver layer, and the I / O adapter 402 sends the access instruction to the storage device 202 through the HBA drivers of the computing device 204 and the storage device 202.

[0162] Specifically, the I / O adapter 402 sends the access instruction to the storage array target, which is used to manage the access operation to the storage device 202.

[0163] After the storage array target obtains the access instruction from the I / O adapter 402, the physical address of the storage area to be accessed in the storage device is determined according to the virtual address information carried in the access instruction and the identifier of the virtual channel. Specifically, the storage device target queries a preset second correspondence relationship according to the virtual address of the storage area to be accessed by the virtual machine 102 and the identifier of the virtual channel of the virtual machine 102, and determines the physical address of the storage area to be accessed in the storage device, wherein the second correspondence relationship includes the correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0164] Table 1 exemplarily shows the mapping relationship between the virtual address of the virtual machine and the physical address of the storage array. As shown in Table 1, the virtual address inside each virtual channel is unique, and the addresses inside different virtual channels can be repeated. The storage device target can uniquely determine the physical address of the storage area to be accessed based on the virtual address and the identifier of the virtual channel.

[0165] Because the physical address of the storage area to be accessed is determined based on the virtual channel identifier and the virtual address, even if the virtual machine identifiers of the virtual machines running on different physical machines are the same, the storage device target can still uniquely determine the physical address based on the virtual channel identifier and the virtual address because the virtual channel corresponding to the virtual machine is unique.

[0166] As shown in Table 1, even if the virtual addresses of the virtual channels with virtual channel identifiers 0 and 1 overlap each other, because the identifiers of the two virtual channels are different, the storage device target can map the virtual "virtual channel identifier 0 + virtual address VA1" to the physical address PA1; and map the "virtual channel identifier 1 + virtual address VA1" to the physical address PA4.

[0167] Table 1 Address mapping table

[0168]

[0169]

[0170] In the specific implementation process, the virtual address is the indication information of the virtual LUN and the storage area to be accessed and the virtual LUN device, and the physical address is the indication information of the physical LUN and the storage area to be accessed in the physical LUN device. The storage device target can map the virtual LUN inside the virtual machine 102 to the actual physical LUN.

[0171] In a possible implementation of an embodiment of the present invention, the storage device target is configured with at least one cache queue, each cache queue corresponds to each virtual channel one by one; after the storage device target obtains the access instruction, the access instruction is further placed in a second cache queue corresponding to the virtual channel of the virtual machine; before the storage device target determines the physical address of the storage area to be accessed in the storage device, it takes out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0172] If the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target can first determine the physical address of the storage area to be accessed by the virtual machine with a higher priority in the storage device according to the priorities of the at least two virtual machines corresponding to the at least two access instructions, and then determine the physical address of the storage area to be accessed by the virtual machine with a lower priority in the storage device.

[0173] If the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target can also first determine the physical address of the storage area to be accessed corresponding to the access instruction received first in the storage device, and then determine the physical address of the storage area to be accessed corresponding to the access instruction received later in the storage device, based on the time sequence of obtaining the at least two access instructions.

[0174] It should be understood that the above storage device target processes multiple received access instructions according to priority or in order of acquisition time, which is merely an example, and the embodiment of the present invention does not limit the order in which the storage device target processes the received access instructions.

[0175] 510: The storage device target performs an access operation on the storage area to be accessed according to the physical address and access instruction of the storage area to be accessed by the virtual machine.

[0176] In the specific implementation process, if the access instruction is a data write instruction, the storage device target writes the data to be written to the storage area indicated by the physical address; if the access instruction is a data read instruction, the storage device target reads the data to be read from the storage area indicated by the physical address.

[0177] 512 : The storage device target returns the execution result of the access instruction to the I / O adapter 402 .

[0178] In one implementation of the embodiment of the present invention, the storage device target sends a feedback message to the I / O adapter 402, wherein the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine. The I / O adapter determines the virtual machine according to the identifier of the virtual channel. Optionally, the I / O searches for a virtual machine corresponding to a higher identifier of the virtual channel according to the identifier of the virtual channel according to a preset first corresponding relationship.

[0179] 514 : The I / O adapter 402 returns the execution result of the access instruction to the virtual machine 102 .

[0180] In one implementation of an embodiment of the present invention, the I / O adapter 402 places the execution result of the access request into an I / O shared ring shared with the virtual machine 102, and sends a second doorbell notification to the virtual machine 102, where the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0181] According to the technical solution disclosed in the embodiment of the present invention, by configuring an I / O adapter between a virtual machine and a storage device, and by configuring a virtual channel corresponding to the virtual machine one by one between the I / O adapter and the storage device, the identifier of the corresponding virtual channel is carried in the access instruction, so that the storage device target can uniquely determine the physical address of the area to be accessed according to the virtual address information and the identifier of the virtual channel of the virtual machine, thereby realizing direct access of the virtual machine to the storage device, simplifying the access method of the storage device, shortening the I / O access process, and reducing the consumption of memory resources and computing resources by the software layer.

[0182] Figure 6 This is an exemplary flow chart of a storage device access method 600 according to an embodiment of the present invention. At least one virtual machine is running on a computer system. An I / O adapter is configured on the computer system. The I / O adapter is used to manage the access operation of the virtual machine running on the computer system to the storage device. The method 600 includes:

[0183] S602: The I / O adapter obtains an access request from the virtual machine, where the access request carries virtual address information of a storage area to be accessed.

[0184] In a possible implementation of the embodiment of the present invention, when a virtual machine receives a request from an upper-layer application to access a storage array in a storage device, the virtual machine first generates an access request that carries virtual address information of a storage area to be accessed.

[0185] Taking the KVM virtualization system as an example, when the application layer inside the virtual machine has a need to access the storage device, the virtual machine will generate a corresponding block read and write request BIO and send the BIO to the block device of the virtual machine (inside the virtual machine). The block device of the virtual machine generates a request Request based on the BIO, and then merges, sorts, caches, and schedules based on the Requst. Then, the Request is sent to the SCSI middle layer of the virtual machine (inside the virtual machine) through the scheduling algorithm. The SCSI middle layer of the virtual machine generates a SCSI command based on the Request and sends the SCSI command to the virtual disk driver virtio-scsi. Virtio-scsi generates an access request virtio_scsi_cmd based on the SCSI command.

[0186] In an implementation of an embodiment of the present invention, the I / O adapter obtains an access request from a virtual machine, including: the I / O adapter receives a first doorbell notification from the virtual machine, and obtains the access request from an I / O shared ring shared with the virtual machine, the access request is placed by the virtual machine into the I / O shared ring, and the first doorbell notification is used to indicate that an access request has arrived at the I / O shared ring.

[0187] Taking the KVM virtualization system as an example, the virtual disk driver virtio-scsi of the virtual machine puts the access request virtio_scsi_cmd into the I / O shared ring vring of the virtual machine and the I / O adapter, and notifies the I / O adapter of the arrival of a new access request through the doorbell mechanism. After receiving the doorbell notification, the I / O adapter will go to the corresponding I / O shared ring to retrieve the access request virtio_scsi_cmd put in by the virtual machine.

[0188] S604: The I / O adapter generates an access instruction according to the access request. The access instruction carries the virtual address information and the identifier of the virtual channel of the virtual machine. The virtual channel is used to connect the virtual machine with the storage device target. The virtual machine and the virtual channel correspond one to one. The storage device target is used to manage access operations to the storage device.

[0189] Among them, the virtual channel is used to connect the virtual machine and the storage device. Specifically, the virtual channel is used to connect the virtual machine and the storage device target of the storage device. Because the storage device can be shared by multiple virtual machines, or even shared by multiple virtual machines running on multiple physical machines, the virtual machine identifiers running on different physical machines can be repeated. In order for the storage device target to be able to identify which virtual machine is accessing the storage device, a correspondence between the virtual machine and the virtual channel needs to be established. The virtual channel between the virtual machine and the storage array target is unique, that is, the virtual machine and the virtual channel correspond one-to-one, and the virtual channel identifier can uniquely identify the virtual machine.

[0190] Before the I / O adapter generates an access instruction according to the access request, the method further includes: the I / O adapter queries a preset first correspondence relationship according to the identifier of the virtual machine to determine the identifier of the virtual channel, wherein the first correspondence relationship includes a correspondence between the identifier of each virtual machine and the identifier of each virtual channel.

[0191] The virtual channel can be determined by negotiation between the I / O adapter and the storage device, or can be configured in advance. For example, when creating a virtual machine, the virtual machine monitor (Virtual Machine Manager, VMM) or the privileged domain that creates the virtual machine configures the virtual channel. The embodiment of the present invention does not limit the configuration method of the virtual channel and the identifier of the virtual channel.

[0192] Taking the KVM virtualization system as an example, the I / O adapter generates an access instruction according to the access request virtio_scsi_cmd. The access instruction carries the virtual address information of the storage area to be accessed and the identifier of the virtual channel corresponding to the virtual machine.

[0193] In the specific implementation process, because the LUN address format generally does not exceed 6 bytes, and the LUN address field defined in the SCSI model actually has 8 bytes, the high-order bytes of the LUN address field generally have two spare fields, so the two spare high-order bytes of the LUN address field can be used to carry the virtual channel identifier to distinguish different virtual channels. It should be understood that the access instruction can also use other fields or extended fields to carry the virtual channel identifier, and the embodiment of the present invention does not limit this. For example, if the number of virtual channels is less than 256, only one high-order byte of the LUN address field can be used to record the virtual channel identifier.

[0194] In an implementation of the embodiment of the present invention, the I / O adapter converts the virtio_scsi_cmd instruction into a standard access instruction scsi_cmnd, and uses the upper two bytes of the LUN address field of scsi_cmnd to record the identifier of the virtual channel corresponding to the virtual machine.

[0195] In an implementation of the embodiment of the present invention, the I / O adapter is configured with at least one cache queue, and each cache queue corresponds to each virtual channel one by one; after the I / O adapter obtains the access request from the virtual machine, it further includes: the I / O adapter puts the access request into the first cache queue corresponding to the virtual channel of the virtual machine; before the I / O adapter generates the access instruction according to the access request, it further includes: the I / O adapter takes out the access request from the first cache queue corresponding to the virtual channel of the virtual machine.

[0196] Optionally, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter generates access instructions based on the access requests, including: the I / O adapter generates access instructions corresponding to the virtual machine with the higher priority and then generates access instructions corresponding to the virtual machine with the lower priority in order of priority based on the priorities of the at least two virtual machines corresponding to the at least two access requests.

[0197] Optionally, if the I / O adapter obtains at least two access requests from at least two virtual machines, the I / O adapter generates an access instruction based on the access request, including: the I / O adapter first generates an access instruction corresponding to the access request received first, and then generates an access instruction corresponding to the access request received later, based on the time sequence in which the at least two access requests are obtained.

[0198] It should be understood that the above I / O adapter processes multiple received access requests according to the virtual machine priority or in the order of acquisition time, which is merely an example, and the embodiment of the present invention does not limit the order in which the I / O adapter processes the received access requests.

[0199] S606: The I / O adapter sends the access instruction to the storage device target.

[0200] After the I / O adapter sends the access instruction to the storage device target, the method further includes: the I / O adapter obtains a feedback message from the storage device target, wherein the feedback message includes an execution result of the access instruction and an identifier of the virtual channel of the virtual machine; the I / O adapter determines the virtual machine according to the identifier of the virtual channel, and sends the execution result of the access instruction to the virtual machine.

[0201] Specifically, the I / O adapter sends the execution result of the access instruction to the virtual machine, including: the I / O adapter puts the execution result of the access request into an I / O shared ring shared with the virtual machine, and sends a second doorbell notification to the virtual machine, wherein the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0202] In the specific implementation process, Figure 2 In the scenario 200(a) shown, the access instruction is a small computer system interface SCSI instruction that can be processed by the host bus adapter driver layer; the I / O adapter sends the access instruction to the storage device target, including: the I / O adapter sends the access instruction to the storage device target through the host bus adapter driver layer.

[0203] It should be understood that Figure 6 The embodiment is Figure 5 The I / O adapter side method of the embodiment, Figure 5 The characteristic description of the embodiment section applies to Figure 6 The embodiments are not described in detail here.

[0204] According to the technical solution disclosed in the embodiment of the present invention, by configuring an I / O adapter between a virtual machine and a storage device, and by configuring a virtual channel corresponding to the virtual machine one-to-one between the I / O adapter and the storage device, direct access of the virtual machine to the storage device is achieved, the access method of the storage device is simplified, the I / O access process is shortened, and the consumption of memory resources and computing resources by the software layer is reduced.

[0205] Figure 7This is an exemplary flow chart of a storage device access method 700 according to an embodiment of the present invention. The storage device may be shared by multiple virtual machines. The multiple virtual machines may be virtual machines running on the same physical machine or virtual machines running on different physical machines. The virtual machine identifiers on different physical machines may be the same. The storage target is used to manage access operations to the storage device. The method 700 includes:

[0206] S702: The storage device target obtains an access instruction, which carries virtual address information and an identifier of a virtual channel of the virtual machine. The virtual channel is used to connect the virtual machine and the storage device target. The virtual machine and the virtual channel correspond one-to-one. The virtual address information is used to indicate the virtual address of the storage area to be accessed in the virtual machine.

[0207] Among them, the virtual channel is used to connect the virtual machine and the storage device. Specifically, the virtual channel is used to connect the virtual machine and the storage device target of the storage device. Because the storage device can be shared by multiple virtual machines, or even shared by multiple virtual machines running on multiple physical machines, the virtual machine identifiers running on different physical machines can be repeated. In order for the storage device target to be able to identify which virtual machine is accessing the storage device, a correspondence between the virtual machine and the virtual channel needs to be established. The virtual channel between the virtual machine and the storage array target is unique, that is, the virtual machine and the virtual channel correspond one-to-one, and the virtual channel identifier can uniquely identify the virtual machine.

[0208] The virtual channel can be determined by the virtual machine controller on the physical machine side or the virtual machine or other modules and the storage device through negotiation, or it can be configured in advance. For example, when creating a virtual machine, the virtual machine monitor (Virtual Machine Manager, VMM) or the privileged domain that creates the virtual machine configures the virtual channel. The embodiment of the present invention does not limit the configuration method of the virtual channel and the virtual channel identifier.

[0209] In the specific implementation process, because the LUN address format generally does not exceed 6 bytes, and the LUN address field defined in the SCSI model actually has 8 bytes, the high-order bytes of the LUN address field generally have two spare fields, so the two spare high-order bytes of the LUN address field can be used to carry the virtual channel identifier to distinguish different virtual channels. It should be understood that the access instruction can also use other fields or extended fields to carry the virtual channel identifier, and the embodiment of the present invention does not limit this. For example, if the number of virtual channels is less than 256, only one high-order byte of the LUN address field can be used to record the virtual channel identifier.

[0210] S704: The storage device target determines the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel.

[0211] In a possible implementation manner of an embodiment of the present invention, the storage device target determines the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel, including: the storage device target queries a preset second correspondence relationship to determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel, wherein the second correspondence relationship includes a correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0212] Among them, the virtual address inside each virtual channel is unique, and the addresses inside different virtual channels can be repeated. The storage device target can uniquely determine the physical address of the storage area to be accessed based on the virtual address and the virtual channel identifier. Because when determining the physical address of the storage area to be accessed, it is determined based on the virtual channel identifier and the virtual address, even if the virtual machine identifiers of the virtual machines running on different physical machines are the same, because the virtual channel corresponding to the virtual machine is unique, the storage device target can still uniquely determine the physical address based on the virtual channel identifier and the virtual address.

[0213] In a specific implementation process, the storage device target can map the virtual LUN inside the virtual machine to an actual physical LUN.

[0214] In a possible implementation of an embodiment of the present invention, the storage device target is configured with at least one cache queue, and each cache queue corresponds one-to-one to each virtual channel; after the storage device target obtains the access instruction, it further includes: the storage device target puts the access instruction into a second cache queue corresponding to the virtual channel of the virtual machine; before the storage device target determines the physical address of the storage area to be accessed in the storage device, it further includes: the storage device target takes out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0215] Optionally, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target determines the physical address of the storage area to be accessed in the storage device, including: the storage device target first determines the physical address of the storage area to be accessed of the virtual machine with a higher priority in the storage device, and then determines the physical address of the storage area to be accessed of the virtual machine with a lower priority in the storage device, according to the priorities of the at least two virtual machines corresponding to the at least two access instructions.

[0216] Optionally, if the storage device target obtains at least two access instructions from at least two virtual machines, the storage device target determines the physical address of the storage area to be accessed in the storage device, including: the storage device target first determines the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received first, and then determines the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received later, based on the time sequence of obtaining the at least two access instructions.

[0217] It should be understood that the above storage device target processes multiple received access instructions according to priority or in order of acquisition time, which is merely an example, and the embodiment of the present invention does not limit the order in which the storage device target processes the received access instructions.

[0218] S706: The storage device target operates the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device.

[0219] In the specific implementation process, if the access instruction is a data write instruction, the storage device target writes the data to be written to the storage area indicated by the physical address; if the access instruction is a data read instruction, the storage device target reads the data to be read from the storage area indicated by the physical address.

[0220] Optionally, after the storage device target operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device, the storage device target further includes: the storage device target returns a feedback message, and the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine.

[0221] It should be understood that Figure 7 The embodiment is Figure 5 The method of the storage device target side of the embodiment, Figure 5 The characteristic description of the embodiment section applies to Figure 7 The embodiments are not described in detail here.

[0222] According to the technical solution disclosed in the embodiment of the present invention, by establishing a virtual channel between a virtual machine and a storage device, and carrying the corresponding virtual channel identifier in an access instruction, the storage device target can uniquely determine the physical address of the area to be accessed based on the virtual address information and the virtual channel identifier of the virtual machine, thereby realizing direct access of the virtual machine to the storage device, simplifying the access method of the storage device, shortening the I / O access process, and reducing the consumption of memory resources and computing resources by the software layer.

[0223] Figure 8 FIG. 8 is a schematic diagram of a logical structure of a storage device access apparatus 800 according to an embodiment of the present invention. The apparatus 800 is used to manage access operations of a virtual machine running on a computer system to a storage device. Figure 8 As shown, the apparatus 800 includes an acquisition unit 802, a generation unit 804 and a sending unit 806, wherein:

[0224] An acquiring unit 802 is configured to acquire an access request from a virtual machine, wherein the access request carries virtual address information of a storage area to be accessed;

[0225] A generating unit 804 is used to generate an access instruction according to the access request, wherein the access instruction carries the virtual address information and the identifier of the virtual channel of the virtual machine, wherein the virtual channel is used to connect the virtual machine with the storage device target, and the virtual machine and the virtual channel correspond one to one, and the storage device target is used to manage access operations to the storage device.

[0226] The sending unit 806 is used to send the access instruction to the storage device target.

[0227] Specifically, before generating an access instruction according to the access request, the generating unit 804 is further used to: query a preset first correspondence according to the identifier of the virtual machine to determine the identifier of the virtual channel, wherein the first correspondence includes a correspondence between the identifier of each virtual machine and the identifier of each virtual channel.

[0228] Optionally, the device 800 is configured with at least one cache queue, each cache queue corresponding to each virtual channel one by one; after the acquisition unit 802 acquires the access request from the virtual machine, it is also used to: put the access request into the first cache queue corresponding to the virtual channel of the virtual machine; before the generation unit 804 generates the access instruction according to the access request, it is also used to: take out the access request from the first cache queue corresponding to the virtual channel of the virtual machine.

[0229] Optionally, if the acquisition unit 802 acquires at least two access requests from at least two virtual machines, the generation unit 804 is used to generate access instructions based on the access requests, including: the generation unit 804 is used to generate access instructions corresponding to the virtual machine with the higher priority in order of priority, and then generate access instructions corresponding to the virtual machine with the lower priority in order of priority, according to the priorities of at least two virtual machines corresponding to the at least two access requests.

[0230] Optionally, if the acquisition unit 802 acquires at least two access requests from at least two virtual machines, the generation unit 804 is used to generate access instructions based on the access requests, including: the generation unit 804 is used to generate access instructions corresponding to the access request received first, and then generate access instructions corresponding to the access request received later, according to the time sequence in which the at least two access requests are acquired.

[0231] In a possible implementation of an embodiment of the present invention, after the sending unit 806 sends the access instruction to the storage device target, the obtaining unit 802 is further used to: obtain a feedback message from the storage device target, the feedback message including the execution result of the access instruction and the identifier of the virtual channel of the virtual machine; the sending unit 806 is further used to: determine the virtual machine based on the identifier of the virtual channel, and send the execution result of the access instruction to the virtual machine.

[0232] In a possible implementation of an embodiment of the present invention, the acquisition unit 802 is used to obtain an access request from a virtual machine, including: the acquisition unit 802 is used to receive a first doorbell notification from the virtual machine, and obtain the access request from an I / O shared ring shared with the virtual machine, the access request is placed by the virtual machine into the I / O shared ring, and the first doorbell notification is used to indicate that an access request has arrived in the I / O shared ring; the sending unit 806 is used to send an execution result of the access instruction to the virtual machine, including: the sending unit 806 is used to place the execution result of the access request into the I / O shared ring shared with the virtual machine, and send a second doorbell notification to the virtual machine, and the second doorbell notification is used to indicate that an execution result has arrived in the I / O shared ring.

[0233] In the specific implementation process, Figure 2 In the scenario 200(a) shown, the access instruction is a small computer system interface SCSI instruction that can be processed by the host bus adapter driver layer; the sending unit 806 is used to send the access instruction to the storage device target, including: the sending unit 806 is used to send the access instruction to the storage device target through the host bus adapter driver layer.

[0234] Embodiments of the present invention Figure 6 Corresponding to the method embodiment, Figure 5 and Figure 6 The feature description in the embodiment section is applicable to the embodiments of the present invention and will not be repeated here.

[0235] Fig. 9 FIG. 9 is a schematic diagram of a logical structure of a storage device access apparatus 900 according to an embodiment of the present invention. The apparatus 900 is used to manage the access operation of a virtual machine to a storage device. Fig. 9 As shown, the device 900 includes an acquisition unit 902, a determination unit 904 and a processing unit 906, wherein:

[0236] An acquisition unit 902 is used to acquire an access instruction, wherein the access instruction carries virtual address information and an identifier of a virtual channel of the virtual machine, wherein the virtual channel is used to connect the virtual machine and the device, and the virtual machine and the virtual channel have a one-to-one correspondence, and the virtual address information is used to indicate a virtual address of a storage area to be accessed in the virtual machine;

[0237] A determining unit 904, configured to determine a physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel;

[0238] The processing unit 906 is configured to operate the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device.

[0239] Specifically, the determination unit 904 is used to determine the physical address of the storage area to be accessed in the storage device according to the virtual address information carried in the access instruction and the identifier of the virtual channel, including: the determination unit 904 is used to query a preset second correspondence relationship according to the virtual address information carried in the access instruction and the identifier of the virtual channel, and determine the physical address of the storage area to be accessed in the storage device, wherein the second correspondence relationship includes a correspondence between the identifier of each virtual channel and the physical address of the storage area allocated to each virtual channel.

[0240] Optionally, the device is configured with at least one cache queue, each cache queue corresponding to each virtual channel one by one; after the acquisition unit 902 acquires the access instruction, it is also used to: put the access instruction into the second cache queue corresponding to the virtual channel of the virtual machine; before the determination unit 904 determines the physical address of the storage area to be accessed in the storage device, it is also used to: take out the access instruction from the second cache queue corresponding to the virtual channel of the virtual machine.

[0241] Optionally, if the acquisition unit 902 acquires at least two access instructions from at least two virtual machines, the determination unit 904 is used to determine the physical address of the storage area to be accessed in the storage device, including: the determination unit 904 is used to determine, according to the priorities of at least two virtual machines corresponding to the at least two access instructions, first the physical address of the storage area to be accessed of the virtual machine with a higher priority in the storage device, and then determine the physical address of the storage area to be accessed of the virtual machine with a lower priority in the storage device.

[0242] Optionally, if the acquisition unit 902 acquires at least two access instructions from at least two virtual machines, the determination unit 904 is used to determine the physical address of the storage area to be accessed in the storage device, including: the determination unit 904 is used to first determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received first, and then determine the physical address of the storage area to be accessed in the storage device corresponding to the access instruction received later, according to the time sequence in which the acquisition unit 902 acquires the at least two access instructions.

[0243] In one implementation of an embodiment of the present invention, after the processing unit 906 operates on the storage area to be accessed according to the access instruction and the physical address of the storage area to be accessed in the storage device, it is also used to: return a feedback message, wherein the feedback message includes the execution result of the access instruction and the identifier of the virtual channel of the virtual machine.

[0244] Embodiments of the present invention Figure 7 Corresponding to the method embodiment, Figure 5 and Figure 7 The feature description in the embodiment section is applicable to the embodiments of the present invention and will not be repeated here.

[0245] Fig.10 FIG. 1 is a schematic diagram of the hardware structure of a storage device access apparatus 1000 according to an embodiment of the present invention. Fig.10 As shown, the apparatus 1000 includes a processor 1002, a memory 1004, an input / output interface 1006, a communication interface 1008, and a bus 1010. The processor 1002, the memory 1004, the input / output interface 1006, and the communication interface 1008 are connected to each other through the bus 1010.

[0246] The processor 1002 may be a general-purpose central processing unit (CPU), a microprocessor, an application specific integrated circuit (ASIC), or one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.

[0247] The memory 1004 may be a read-only memory (ROM), a static storage device, a dynamic storage device or a random access memory (RAM). The memory 1004 may store an operating system and other application programs. When the technical solution provided by the embodiment of the present invention is implemented by software or firmware, the program code for implementing the technical solution provided by the embodiment of the present invention is stored in the memory 1004 and executed by the processor 1002.

[0248] The input / output interface 1006 is used to receive input data and information, and output data such as operation results.

[0249] The communication interface 1008 uses a transceiver device such as, but not limited to, a transceiver to implement communication between the apparatus 1000 and other devices or a communication network.

[0250] The bus 1010 may include a pathway for transmitting information between various components of the device 1000 (eg, the processor 1002 , the memory 1004 , the input / output interface 1006 , and the communication interface 1008 ).

[0251] It should be noted that although Fig.10 The device 1000 shown only shows the processor 1002, the memory 1004, the input / output interface 1006, the communication interface 1008 and the bus 1010. However, in the specific implementation process, those skilled in the art should understand that the device 1000 also includes other devices necessary for normal operation. At the same time, according to specific needs, those skilled in the art should understand that the device 1000 may also include hardware devices for implementing other additional functions. In addition, those skilled in the art should understand that the device 1000 may also only include the devices necessary for implementing the embodiments of the present invention, and does not necessarily include Fig.10 All devices shown in .

[0252] Fig.10 The hardware structure shown and the above description are applicable to various storage device access apparatuses and systems provided in the embodiments of the present invention, and are applicable to executing various storage device access methods provided in the embodiments of the present invention.

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

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

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

[0256] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a mobile hard disk, a read-only memory (English: Read-Only Memory, referred to as ROM), a random access memory (English: Random Access Memory, referred to as RAM), a disk or an optical disk, and other media that can store program codes.

[0257] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.

Claims

1. A storage device access method, characterized in that: Applied to a computer system, wherein a first virtual machine and a second virtual machine are running on the computer system, comprising: Configure two virtual channels; Allocating a first virtual channel of the two virtual channels to the first virtual machine, an access request from the first virtual machine reaches the storage device through the first virtual channel, the first virtual channel corresponds to a first cache queue, and the access request from the first virtual machine is stored in the first cache queue; The second virtual channel of the two virtual channels is allocated to the second virtual machine, and the access request from the second virtual machine reaches the storage device through the second virtual channel. The second virtual channel corresponds to a second cache queue, and the access request from the second virtual machine is stored in the second cache queue; wherein the virtual channel and the virtual machine are in a one-to-one correspondence.

2. The method according to claim 1, characterized in that The virtual channel refers to a data transmission channel established on a physical medium using a storage transmission protocol during data transmission, which represents a unique connection relationship between a virtual machine and a storage device.

3. The method according to claim 1, characterized in that The virtual channel is realized by time-division multiplexing the physical connection channel.

4. A storage device access device, characterized in that: Applied to a computer system, wherein a first virtual machine and a second virtual machine are running on the computer system, comprising: A generating unit is configured to configure two virtual channels; a first virtual channel of the two virtual channels is allocated to the first virtual machine, an access request from the first virtual machine reaches the storage device through the first virtual channel, the first virtual channel corresponds to a first cache queue, and the access request from the first virtual machine is stored in the first cache queue; a second virtual channel of the two virtual channels is allocated to the second virtual machine, an access request from the second virtual machine reaches the storage device through the second virtual channel, the second virtual channel corresponds to a second cache queue, and the access request from the second virtual machine is stored in the second cache queue, wherein there is a one-to-one correspondence between virtual channels and virtual machines; A sending unit is used to send the access request from the first virtual machine to the storage device through the first virtual channel, or to send the access request from the second virtual machine to the storage device through the second virtual channel.

5. The device according to claim 4, characterized in that The virtual channel refers to a data transmission channel established on a physical medium using a storage transmission protocol during data transmission, which represents a unique connection relationship between a virtual machine and a storage device.

6. The device according to claim 4, characterized in that The virtual channel is realized by time-division multiplexing the physical connection channel.

7. A computer-readable medium, characterized in that The method comprises computer-executable instructions. When a processor of a computer executes the computer-executable instructions, the computer executes the method according to any one of claims 1 to 3.

8. A storage device access device, characterized in that: include: Processors, memories, buses, and communication interfaces; The memory is used to store execution instructions, and the processor is connected to the memory through the bus. When the storage device accesses the transposition operation, the processor executes the execution instructions stored in the memory, so that the device executes the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Virtual Machine Fast Emulation Assist

    US20110246171A1

  • Data storage systems and methods

    US20150237140A1