1. Field of Invention
The present invention relates to a method of accessing a virtual disk (VD). More particularly, the present invention relates to a VD access system in a dual-controller system and a method therefor.
2. Related Art
Recently, in a single-controller system, all the entity disks are subordinate to one unique controller. The controller can establish a VD through redundant arrays of independent disks (RAID) and logical volume management (LVM), so as to be provided for systems or used as shared disks for customer applications such as file transfer protocol (FTP) and server message block (SMB).
However, in the dual-controller system, all the entity disks are interactively connected, i.e., respectively connected to two controllers of the system at the same time. These hard disks are not subordinate to one specific controller, and each controller can operate the entity disks through individual RAID and LVM, so as to establish a VD. However, different from the VD in the single-controller system, the VD in the dual-controller system is only subordinate to the controller establishing the same, and is invisible for the other controller. The reason is that in the dual-controller system, each controller can be considered as a relatively independent sub-system, and the RAID and LVM in each sub-system are both independent from the other sub-system. Thus, apparently, the VD established by the RAID and LVM in a sub-system is only visible in the present sub-system, while invisible for the other sub-system. Therefore, it is impossible for each controller to directly operate the VD in the other controller, and the limitation is inconvenient for the subscriber, thus affecting the data sharing, and alleviating the usability of the system.
In order to solve the problems and disadvantages in the conventional art, the present invention is directed to provide a VD router system, so as to fulfill the process of the local controller application on the access request of the VD of the remote controller.
The present invention is also directed to provide a system capable of fulfilling the overall access to the VDs in a dual-controller system and a method therefor, such that any single-controller can directly or indirectly access all the VDs in the dual-controller system.
Thereby, the present invention discloses a VD router system applied to a dual-control system having a first controller and a second controller. The VD router system is disposed in the first controller, and comprises a virtual block device (VBD) management module, a mapping list management module, and a communication management module. Here, the VBD management module establishes a mapped VBD corresponding to the VD of the second controller in the first controller, and processes an access request of the VD issued to the first controller. The mapping list management module establishes a mapping relation list of the VD of the second controller and the corresponding VBD, and looks up the VD and the corresponding mapped VBD thereof in the mapping relation list according to the access request of the VD issued to the first controller. The communication management module is used to establish a data transmission channel of the VD of the second controller and the corresponding mapped VBD thereof.
The present invention also discloses a VD access system applied to a dual-control system having a first controller and a second controller. The VD access system comprises a first VD router disposed in the first controller, for determining the position of the VD issuing an access request to the first controller, so as to select a transmission path to transmit the access request to the VD and transmit the response data to the access request from the VD; and a second VD router disposed in the second controller, for determining the position of the VD issuing an access request to the second controller, so as to select a transmission path to transmit the access request to the VD and transmit the response data to the access request from the VD.
According to the VD access system of the present invention, the first VD router comprises a first VBD management module, a first mapping list management module, and a first communication management module. Here, the first VBD management module establishes a mapped VBD corresponding to the VD of the second controller in the first controller. The first mapping list management module establishes a mapping relation list of the VD of the second controller and the corresponding VBD thereof, and looks up the VD and the corresponding mapped VBD thereof in the mapping relation list according to the access request of the VD issued to the first controller. The first communication management module is used to establish a data transmission channel of the VD of the second controller and the corresponding mapped VBD thereof. Further, the second VD router comprises a second VBD management module, a second mapping list management module, and a second communication management module. Here, the second VBD management module establishes a mapped VBD corresponding to the VD of the first controller in the second controller. The second mapping list management module establishes a mapping relation list of the VD of the second controller and the corresponding VBD thereof, and looks up the VD and the corresponding mapped VBD thereof in the mapping relation list according to the access request of the VD issued to the second controller. The second communication management module is used to establish a data transmission channel of the VD of the first controller and the corresponding mapped VBD thereof.
Further, the present invention provides a method of accessing a VD applied to a dual-control system having a first controller and a second controller. The method comprises: establishing a mapped VBD corresponding to a VD of the second controller and/or the first controller in the first controller and/or the second controller; establishing a mapped VBD relation list of the VD of the second controller and/or the first controller and the corresponding VBD thereof; looking up the VD and the corresponding mapped VBD thereof in the mapping relation list, according to the access request of the VD issued to the first controller/the second controller, so as to determine the position of the VD; and establishing a data transmission channel of the VD and the corresponding mapped VBD thereof, when the VD issuing the access request to the first controller/the second controller is located in the second controller/the first controller.
The VD router system of the present invention establishes the mapped VBD of the VD of the remote controller and the mapping management list in the local controller, and establishes the data transmission channel between the two, thereby fulfilling the access request of the local controller to the VD of the remote controller.
Further, the VD access system of the dual-controller system of the present invention respectively disposes a VD router in each sub-system of the dual-controller system, such that any controller can directly or indirectly access all the VDs in the system. It is not necessary for the subscriber to care which sub-system the accessed VD is located in, in order to fulfill the overall access of the VDs in the dual-control system.
The method of accessing the VD of the dual-controller system according to the present invention respectively establishes the mapped VBD of the VD and the mapping relation list thereof in two sub-systems, and establishes the data transmission channel of the two, thereby fulfilling the overall access of the VDs in the dual-controller system, and improving the usability of the system and the flexibility of the disk access.
Further scope of applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.
The present invention will become more fully understood from the detailed description given herein below for illustration only, and thus is not limitative of the present invention, and wherein:
The features and practice of the preferred embodiments of the present invention will be illustrated in detail below with the accompanying drawings.
Referring to
As shown in
Seen from
Similarly, the second VD router module 202 of the second controller 200 also includes a second VBD management module 208, a second mapping list management module 204, and a second communication management module 206, which respectively have the function and structure similar to the corresponding modules of the first VBD management module 108, and thus will not be described herein again.
It is known from the system structural view of
The illustration of the establishment of the VD, the VBD, and the mapping relation thereof is given below with reference to
In this embodiment, after the first controller 100 operates the hard disk 300 to establish the VD 110, the corresponding information is sent to the first VD router module 102. The first communication management module 106 receives the establishment information and informs the first mapping list management module 104. The first mapping list management module 104 is used to establish a first corresponding relation list of the VD and the mapped VBD thereof. Therefore, the first mapping list management module 104 adds an item corresponding to the VD 110 into the first mapping list. The structures constituting each item of the mapping list mainly include: a) a VD identifier (VD_ID), used to identify the VD in a one-to-one mapping relation; (b) a VBD identifier (VBD_ID), used to identify the VBD in a one-to-one mapping relation; (c) a flag, used to identify which controller sub-system the VD in a one-to-one mapping relation is in, for example, 1 represents the local controller, and 2 represents the remote controller.
The VD_ID is unique in the whole dual-control system 10. That is, if a VD with a VD_ID of VD001 exists in the first controller 100, a VD with a VD_ID of VD001 will not exist in the second controller 200. The VBD_ID does not have the limitation of uniqueness.
In this embodiment, the first mapping list management module 104 sets the flag of an item corresponding to the VD 110 is 1, indicating that the VDE 110 is located in the local first controller 100. Then, an arbitrary algorithm is used to randomly obtain a VBD_ID as the ID of the mapped VBD 212 of the VDE 110, and the mapping relation item is saved. The selection algorithm of the VBD_ID is, for example, an ID pool is established, and each time an ID is randomly selected from the pool and returned after being used; or, an ID queue is established, and each time an ID is selected from the queue and put to the end of the queue after being used, and so on. Various conventional schemes can be employed here, which is not limited by the present invention and will not be described herein again. The first mapping list management module 104 informs the first communication management module 106 after finishing the above operations, and sends the item to the first communication management module 106.
The first communication management module 106 provides an exclusive transmission channel for the VD 110 with the VD_ID thereof as the unique identity for transmitting data, waits for the response of the second communication management module 206 of the second controller 200, and then returns the ready information and the item of VD 110 added in the first mapping list to the first controller 100. On receiving the returned information, the first controller 100 transmits the information on the establishment of the VDI 110 to the second controller 200.
In the second controller 200, the second communication management module 206 receives the information and informs the second mapping list module 204, so as to add the item of the VD 110 into the established second mapping list, and meanwhile save the item after setting the flag of the item as 2. Afterward, the second communication management module 206 informs the second VBD management module 208 to establish the mapped VBD 212 corresponding to the VD 110 and set the ID of the VBD 212. Here, the second communication management module 206 responds to the exclusive transmission channel provided by the first communication management module 106 for the VD 110, and finishes the establishment of the exclusive transmission channel.
In this manner, the establishment of the VD and the mapped VBD thereof is finished, and the mapping relation is saved in the mapping list. The VBD 212 becomes a mapping of the VD in the sub-system of the second controller 200. The establishment of the mapped VBDs of other VDs of the first controller 100 in the second controller 200 or the establishment of the mapped VBD of the VD of the second controller 200 in the first controller 100 can be achieved by the process described above, and the details will not be described herein again. For example, the corresponding relations of the VDs and the mapped VBDs thereof in the first controller 100 and the second controller 200 are as shown in
Whenever a new VD is established in the dual-control system 10, the mapping list management modules 104 and 204 on both ends may add a new item in the maintained mapping relation list, respectively. Similarly, whenever a VD is deleted from the dual-control system 10, the mapping list management modules 104 and 204 on both ends may also delete the corresponding item in the maintained mapping relation list, respectively. The flow of the deletion operation is similar to that of the establishment operation. First, the device node of the VBD is deleted, the exclusive transmission channel is closed, the corresponding item in the mapping list is deleted, then the VD is deleted, and all the used resources are released in the deletion process, which may not be described herein again. For each existing mapping relation, the mapping lists in the two controller sub-systems 100, 200 respectively have an item, in which only the flags of the corresponding items are different, i.e. one represents the local controller, the other represents the remote controller, and other IDs are completely identical.
The principle of accessing the VD of an arbitrary controller sub-system in the dual-control system by the application is illustrated with
As shown in
According to this embodiment, as the accessed VD 110 is remote, the application 20 receives the device ID of the VBD 212. The VBD 212 is only a virtual mapping, not an actual device existing in the local controller, so the process of the access operation request from the application 20 to the VD 110 is described as follow.
When the application 20 performs an operation such as read and write on the mapped VBD 212 of the VD 110, the second VBD management module 208 collects the operation request from the buffer area of the VBD 212, and encapsulates the collected operation request into a data packet to be sent to the second communication management module 206 for processing. The second communication management module 206 sends the data packet to the first communication management module 106 of the first controller 100 via the established data transmission channel. The first communication management module 106 receives and sends the data packet to the first VBD management module 108. The first VBD management module 108 decapsulates the data packet, and the operation is applied to the actual VD 110. The VD 110 returns the operation result to the first VBD management module 108, and reencapsulates the operation result into a data packet. Then, the first communication management module 106 and the second communication management module 206 send the operation result data packet to the second VBD management module 208. The second VBD management module 208 decapsulates and sends the data packet back to the buffer area of the VBD 212. Finally, the application 20 reads the operation result of the VD 110 from the buffer area of the VBD 212, thereby fulfilling the access request from the application 20 to the VD of the remote controller.
If the application 20 accesses the local end, i.e. the VD in the second controller 200, the ID of the actual VD is received, and the actual device can be directly operated. Here, no matter for VD or VBD, the second VD router module 202 may return a device ID to the application 20 for operation. The application 20 only operates a device ID, and though it is not known whether the device ID represents a VBD of the local VD or the remote VD, the VD is overall for the application 20.
A detailed description of the method of accessing the VD according to the present invention is given below with reference to
Referring to
When the application of the client issues an access request of the VD to a local controller, according to the access request, the device ID of the VD is looked up in the established mapping relation list (Step 406). Then, according to the ID, it is determined whether the access VD exists in the current controller (Step 408). The above determination step is described in detail in
According to the above position determination step of the VD, if the VD is located in the local controller, the VD_ID is returned, and the application directly operates the VD (Step 410); otherwise, it indicates that the VD to be accessed is located in the remote controller, and the data transmission channel of the VD and the corresponding mapped VBD in the current controller is established (Step 412). The data transmission channel is used to transmit the access request to the remote controller (Step 414). Next, the ID of the VBD is returned as a response to the access request of the application of the local controller (Step 416).
The data transmission step between the remote controller and the local controller for accessing the remote VD is described in
The invention being thus described, it will be obvious that the same may be varied in many ways. Such variations are not to be regarded as a departure from the spirit and scope of the invention, and all such modifications as would be obvious to one skilled in the art are intended to be included within the scope of the following claims.