FIELD

The present application relates to the field of computer technologies, and in particular, to a storage device operation method and a physical server.

BACKGROUND

With rapid development of computer technologies, a distributed storage system is increasingly widely applied to large-scale data storage because of its advantages such as reliability, inexpensiveness and easy scalability. The distributed storage system can provide storage resources for a physical server, and the distributed storage system usually may include two software control ends: a client and a server. The client may be configured in the physical server, to provide a storage function for a virtual machine in the physical server, and the server may be configured in the physical server or another physical server, to manage a physical storage device deployed in the distributed storage system. When the physical server uses the distributed storage system, the virtual machine in the physical server usually performs an input/output (I/O) operation on the physical storage device in the distributed storage system, to write or read operating data in the virtual machine into or from the physical storage device.

Currently, the client of the distributed storage system is directly deployed in the physical server. In this case, if the virtual machine in the physical server needs to perform an I/O operation on the physical storage device in the distributed storage system, the I/O operation needs to be implemented based on a hypervisor in the physical server. The hypervisor is an intermediate software layer running between a physical hardware layer and a virtual machine layer, and is responsible for coordinating access to hardware resources and for protection between virtual machines. Specifically, as shown inFIG. 1, a correspondence between a front-end driver in the virtual machine and a back-end driver in a hypervisor is established, and a correspondence between the back-end driver in the hypervisor and a virtual storage device in a client is established. Then, the virtual machine can send an I/O request to the client by using the front-end driver and the back-end driver. When receiving the I/O request, the client can send the I/O request to the server in the distributed storage system, so that the server performs an I/O operation on the physical storage device based on the I/O request.

Because the client of the distributed storage system is directly deployed in the physical server, during a running process, the client and the back-end driver in the hypervisor consume physical computing resources, such as a physical central processing unit (CPU) resource and physical memory, in the physical server. In addition, during a running process, the front-end driver in the virtual machine consumes virtual computing resources, such as a virtual CPU resource and virtual memory, in the physical server. Consequently, a relatively large amount of computing resources is consumed during a process of using the distributed storage system by the physical server.

SUMMARY

To resolve problems of related technologies, embodiments of the present application provide a storage device operation method and a physical server. The technical solutions are as follows.

According to a first aspect, a storage device operation method is provided, and applied to a physical server, where a virtual machine is installed on the physical server, and a storage card is inserted into the physical server; and the method includes: when the virtual machine receives a data read/write instruction, generating an input/output I/O request for a physical storage device; sending, by the virtual machine, the I/O request to a client in the storage card, where the storage card can directly communicate with the virtual machine; and when the client receives the I/O request, sending the I/O request to a server, so that the server performs an I/O operation on the physical storage device based on the I/O request, where a distributed storage system includes the client and the server, the client is configured to provide a storage function for the virtual machine, and the server is configured to manage the physical storage device.

It should be noted that an embedded system runs on the storage card. To be specific, the storage card may include modules such as a CPU and a memory. For example, the storage card may be a Peripheral Component Interconnect (PCI) card or a Peripheral Component Interconnect Express (PCIe) card, or may be another storage card or the like that can directly communicate with the virtual machine. This is not specifically limited in this embodiment of the present application.

In this embodiment of the present application, because the storage card can directly communicate with the virtual machine, when sending the I/O request to the client in the storage card, the virtual machine can send the I/O request to the client without using a hypervisor in the physical server, thereby saving computing resources of the physical server. In addition, because the client in this embodiment of the present application is deployed on the storage card, during a running process, the client consumes computing resources of the storage card rather than computing resources of the physical server, thereby further saving computing resources of the physical server.

The sending, by the virtual machine, the I/O request to a client in the storage card includes: sending, by the virtual machine, the I/O request to a target virtual interface of the storage card, where the target virtual interface is a virtual interface corresponding to the virtual machine; and when the target virtual interface of the storage card receives the I/O request, sending the I/O request to a target virtual storage device in the client, where the target virtual storage device is a virtual storage device corresponding to the target virtual interface.

It should be noted that when the virtual machine sends the I/O request to the target virtual interface of the storage card, a storage card driver in the virtual machine may send the I/O request to the target virtual interface of the storage card.

In this embodiment of the present application, the virtual machine can directly send the I/O request to the client by using the target virtual interface of the storage card without using the hypervisor in the physical server in this sending process, thereby omitting participation of a front-end driver and a back-end driver in related technologies, and therefore greatly saving computing resources of the physical server.

Further, before the sending, by the virtual machine, the I/O request to a client in the storage card, the method further includes: when a first setting instruction is received, invoking a management interface of the storage card to generate N virtual interfaces, and invoking a management interface of the client to generate M virtual storage devices, where the N virtual interfaces include the target virtual interface, the M virtual storage devices include the target virtual storage device, and both N and M are natural numbers not less than 1; and establishing a correspondence between the target virtual interface and the virtual machine, and establishing a correspondence between the target virtual interface and the target virtual storage device.

It should be noted that the first setting instruction may be manually triggered by a user, or may be automatically triggered by a management system of the physical server, and the first setting instruction is used to instruct to establish a communication path between the virtual machine and the client in the storage card based on the target virtual interface of the storage card.

In addition, establishing the correspondence between the target virtual interface and the virtual machine means associating the target virtual interface with the virtual machine, or means allocating the target virtual interface to the virtual machine for use. Establishing the correspondence between the target virtual interface and the target virtual storage device means associating the target virtual interface with the target virtual storage device, or means allocating the target virtual storage device to the virtual machine corresponding to the target virtual interface for use.

In this embodiment of the present application, the correspondence between the target virtual interface and the virtual machine can be established, and the correspondence between the target virtual interface and the target virtual storage device can be established. The two correspondences are established, which means that the communication path between the virtual machine and the client in the storage card is established, so that subsequently, the virtual machine sends the I/O request to the client in the storage card based on the communication path.

The sending, by the virtual machine, the I/O request to a client in the storage card includes: sending, by the virtual machine, the I/O request to a physical interface of the storage card; and when the physical interface of the storage card receives the I/O request, sending the I/O request to a virtual storage device in the client.

It should be noted that when the virtual machine sends the I/O request to the physical interface of the storage card, the storage card driver in the virtual machine may send the I/O request to the physical interface of the storage card.

In this embodiment of the present application, the virtual machine can directly send the I/O request to the client by using the physical interface of the storage card without using the hypervisor in the physical server in this sending process, thereby omitting participation of a front-end driver and a back-end driver in related technologies, and therefore greatly saving computing resources of the physical server.

Further, before the sending, by the virtual machine, the I/O request to a client in the storage card, the method further includes: when a second setting instruction is received, invoking a management interface of the client to generate M virtual storage devices; and establishing a correspondence between the physical interface of the storage card and the virtual machine, and establishing a correspondence between the physical interface of the storage card and the M virtual storage devices.

It should be noted that the second setting instruction may be manually triggered by a user, or may be automatically triggered by a management system of the physical server, and the second setting instruction is used to instruct to establish a communication path between the virtual machine and the client in the storage card based on the physical interface of the storage card.

In this embodiment of the present application, the correspondence between the physical interface of the storage card and the virtual machine can be established, and the correspondence between the physical interface of the storage card and the M virtual storage devices can be established. The two correspondences are established, which means that the communication path between the virtual machine and the client in the storage card is established, so that subsequently, the virtual machine sends the I/O request to the client in the storage card based on the communication path.

It should be noted that the server is deployed on the storage card; or the server is deployed on another physical server different from the physical server.

According to a second aspect, a physical server is provided, where a virtual machine is installed on the physical server, and a storage card is inserted into the physical server; and the physical server includes: the virtual machine configured to: when receiving a data read/write instruction, generate an input/output I/O request for a physical storage device, where the virtual machine is further configured to send the I/O request to a client in the storage card, where the storage card can directly communicate with the virtual machine; and the client configured to: when receiving the I/O request, send the I/O request to a server, so that the server performs an I/O operation on the physical storage device based on the I/O request, where a distributed storage system includes the client and the server, the client is configured to provide a storage function for the virtual machine, and the server is configured to manage the physical storage device.

The virtual machine is further configured to send the I/O request to a target virtual interface of the storage card, where the target virtual interface is a virtual interface corresponding to the virtual machine; and the storage card is configured to: when the target virtual interface receives the I/O request, send the I/O request to a target virtual storage device in the client, where the target virtual storage device is a virtual storage device corresponding to the target virtual interface.

Further, the physical server further includes: a processor configured to: when receiving a first setting instruction, invoke a management interface of the storage card to generate N virtual interfaces, and invoke a management interface of the client to generate M virtual storage devices, where the N virtual interfaces include the target virtual interface, the M virtual storage devices include the target virtual storage device, and both N and M are natural numbers not less than 1, where the processor is further configured to establish a correspondence between the target virtual interface and the virtual machine, and establish a correspondence between the target virtual interface and the target virtual storage device.

The virtual machine is further configured to send the I/O request to a physical interface of the storage card; and the storage card is configured to: when the physical interface receives the I/O request, send the I/O request to a virtual storage device in the client.

Further, the physical server further includes: a processor configured to: when receiving a second setting instruction, invoke a management interface of the client to generate M virtual storage devices, where the processor is further configured to establish a correspondence between the physical interface of the storage card and the virtual machine, and establish a correspondence between the physical interface of the storage card and the M virtual storage devices.

It should be noted that the server is deployed on the storage card; or the server is deployed on another physical server different from the physical server.

According to a third aspect, a physical server is provided, where the physical server includes a first processor and a first memory, a storage card is inserted into the physical server, and the storage card includes a second processor and a second memory.

The first processor executes an instruction in the first memory, so that the physical server performs the following operations: when a data read/write instruction is received, generating an input/output I/O request for a physical storage device; and sending the I/O request to a client in the storage card, where the storage card can directly communicate with the virtual machine.

The second processor executes an instruction in the second memory, so that the storage card performs the following operation: when the I/O request is received, sending the I/O request to a server, so that the server performs an I/O operation on the physical storage device based on the I/O request, where a distributed storage system includes the client and the server, the client is configured to provide a storage function for the virtual machine, and the server is configured to manage the physical storage device.

The first processor executes the instruction in the first memory, so that the physical server further performs the following operation: sending the I/O request to a target virtual interface of the storage card, where the target virtual interface is a virtual interface corresponding to the virtual machine.

The second processor executes the instruction in the second memory, so that the storage card performs the following operation: when the target virtual interface receives the I/O request, sending the I/O request to a target virtual storage device in the client, where the target virtual storage device is a virtual storage device corresponding to the target virtual interface.

Further, the first processor executes the instruction in the first memory, so that the physical server further performs the following operations: when a first setting instruction is received, invoking a management interface of the storage card to generate N virtual interfaces, and invoking a management interface of the client to generate M virtual storage devices, where the N virtual interfaces include the target virtual interface, the M virtual storage devices include the target virtual storage device, and both N and M are natural numbers not less than 1; and establishing a correspondence between the target virtual interface and the virtual machine, and establishing a correspondence between the target virtual interface and the target virtual storage device.

The first processor executes the instruction in the first memory, so that the physical server further performs the following operation: sending the I/O request to a physical interface of the storage card.

The second processor executes the instruction in the second memory, so that the storage card further performs the following operation: when the physical interface receives the I/O request, sending the I/O request to a virtual storage device in the client.

Further, the first processor executes the instruction in the first memory, so that the physical server further performs the following operations: when a second setting instruction is received, invoking a management interface of the client to generate M virtual storage devices; and establishing a correspondence between the physical interface of the storage card and the virtual machine, and establishing a correspondence between the physical interface of the storage card and the M virtual storage devices.

It should be noted that the server is deployed on the storage card; or the server is deployed on another physical server different from the physical server.

According to a fourth aspect, an embodiment of the present application provides a computer storage medium configured to store a computer software instruction used by the physical servers provided in the second aspect and the third aspect, or configured to store a program designed for the physical server according to the second aspect and the third aspect.

Technical effects obtained in the second aspect and the third aspect of the foregoing embodiments of the present application are similar to those obtained by using a corresponding technical means in the first aspect, and details are not described herein again.

Beneficial effects brought by the technical solutions provided in the embodiments of the present application are as follows: In the embodiments of the present application, when receiving the data read/write instruction, the virtual machine generates the input/output I/O request for the physical storage device, and sends the I/O request to the client in the storage card. Because the storage card can directly communicate with the virtual machine, when sending the I/O request to the client in the storage card, the virtual machine can directly send the I/O request to the client without using the hypervisor in the physical server, thereby saving computing resources of the physical server. Then, when receiving the I/O request, the client sends the I/O request to the server, so that the server performs an I/O operation on the physical storage device based on the I/O request. Because the client in the embodiments of the present application is deployed on the storage card, during a running process, the client consumes computing resources of the storage card rather than computing resources of the physical server, thereby further saving computing resources of the physical server.

