CN114090476A - SCSI hard disk simulation method, system and medium - Google Patents
SCSI hard disk simulation method, system and medium Download PDFInfo
- Publication number
- CN114090476A CN114090476A CN202111224760.7A CN202111224760A CN114090476A CN 114090476 A CN114090476 A CN 114090476A CN 202111224760 A CN202111224760 A CN 202111224760A CN 114090476 A CN114090476 A CN 114090476A
- Authority
- CN
- China
- Prior art keywords
- scsi
- hard disk
- command
- scst
- host
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 25
- 238000004088 simulation Methods 0.000 title claims abstract description 18
- 238000012545 processing Methods 0.000 claims abstract description 25
- 238000004891 communication Methods 0.000 claims abstract description 9
- 230000006870 function Effects 0.000 claims description 29
- 230000000977 initiatory effect Effects 0.000 claims description 17
- 238000005192 partition Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 2
- 239000003999 initiator Substances 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 230000004044 response Effects 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 239000007787 solid Substances 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 230000003442 weekly effect Effects 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/12—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
- G06F13/124—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine
- G06F13/126—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine and has means for transferring I/O instructions and statuses between control unit and main processor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1446—Point-in-time backing up or restoration of persistent data
- G06F11/1448—Management of the data involved in backup or backup restore
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/16—Handling requests for interconnection or transfer for access to memory bus
- G06F13/1668—Details of memory controller
- G06F13/1673—Details of memory controller using buffers
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Quality & Reliability (AREA)
- Computer Hardware Design (AREA)
- Microelectronics & Electronic Packaging (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a SCSI hard disk simulation method, a system and a medium, wherein the method comprises the following steps: carrying out SCSI communication with a host corresponding to the SCSI hard disk based on the SCSI interface card; setting target end drive of the SCSI interface card based on the SCST project; saving data on the SCSI hard disk as a mirror image file; registering an interrupt processing function of the SCSI interface card based on the SCST project; when detecting a SCSI command request, the SCSI interface card triggers an interrupt processing function to run; for the received SCSI command, the interrupt processing function initializes the message frame structure corresponding to the SCSI command and registers the SCSI command to the SCST kernel; determining a host hard disk writing command or a host hard disk reading command according to the SCSI command, and executing writing operation or reading operation; when the SCSI command is processed, the interrupt processing function sends the SCSI command status code and clears the message frame structure. The invention realizes seamless upgrade of the storage medium.
Description
Technical Field
The invention relates to the field of computers, in particular to a SCSI hard disk simulation method, a SCSI hard disk simulation system and a SCSI hard disk simulation medium.
Background
Conventional flight simulator computer systems employ IBM RS/6000 or RS530/550 series computers as hosts. A parallel SCSI interface hard disk is used. The parallel SCSI interface hard disk has entered a downtime. Once the parallel SCSI interface hard disk cannot be purchased, the flight simulator computer system cannot operate normally.
Disclosure of Invention
The present invention is directed to solving at least one of the problems of the prior art. Therefore, the invention provides a SCSI hard disk simulation method, which can seamlessly replace the traditional SCSI standard hard disk into a standard PC running a Linux operating system, and ensures that the host still interacts with the original SCSI hard disk under the condition of not needing any setting change through a series of self-owned software services, thereby realizing the seamless upgrade of the storage medium.
The invention also provides a SCSI hard disk simulation system for realizing the SCSI hard disk simulation method.
The embodiment of the invention also provides a computer readable storage medium for implementing the SCSI hard disk simulation method.
The SCSI hard disk simulation method according to the first aspect of the embodiment of the invention is applied to a PC, and comprises the following steps: carrying out SCSI communication with a host corresponding to the SCSI hard disk based on the SCSI interface card; setting a target end drive of the SCSI interface card based on an SCST project, wherein the target end drive comprises setting a storage position of a virtual hard disk, an identification address of a simulated target hard disk and an identification address corresponding to an SCSI initiating end; saving the data on the SCSI hard disk as a mirror image file according to the storage position of the virtual hard disk; registering an interrupt processing function of the SCSI interface card based on the SCST project; when the SCSI interface card detects a SCSI command request, triggering the interrupt processing function to run; for the received SCSI command, the interrupt processing function initializes a message frame structure corresponding to the SCSI command and registers the SCSI command to an SCST kernel; determining a host hard disk writing command or a host hard disk reading command according to the SCSI command, and executing writing operation or reading operation; and after the SCSI command is processed, the interrupt processing function sends a SCSI command state code and clears the message frame structure.
The SCSI hard disk simulation method according to the embodiment of the invention at least has the following beneficial effects: the method of the embodiment of the invention seamlessly replaces the traditional SCSI standard hard disk with a PC, so that the host computer is still considered to interact with the original SCSI hard disk under the condition of not changing any setting, thereby realizing seamless upgrade of the storage medium. The method of the embodiment of the invention matches the SCSI bus with a novel storage interface through conversion, thereby not only facilitating the interchangeability of spare parts, but also reducing the cost.
According to some embodiments of the present invention, the determining the host hard disk write command or the host hard disk read command according to the SCSI command, and performing the write operation or the read operation includes: if the SCSI command is a host hard disk writing command, the SCST kernel distributes buffer space and informs a target end of driving, and the interrupt processing function sends data transmitted by the host to the SCST kernel; if the SCSI command is a host hard disk reading command, the SCST kernel sends data to the target drive, and the data is returned to the host through the SCSI interface card.
According to some embodiments of the invention, saving the data on the SCSI hard disk as an image file comprises: and saving the disk data mirror image file in the btrfs data partition by default.
According to some embodiments of the invention, the method further comprises: and managing the disk data mirror image file, including creating and recovering a historical snapshot of a file system and setting an automatic backup strategy at regular intervals of year, month, week, day and time.
The SCSI hard disk simulation system according to the second aspect of the embodiment of the invention comprises: the SCST core module is used for being responsible for the operation logic of the SCSI command and the corresponding buffer memory management; the target end driving module is used for receiving an SCSI command from the initiating end, transmitting the SCSI command to the SCST core module and returning data to the initiating end; the storage drive module is used for interacting with different storage media and storing the disk data mirror image file in the btrfs data partition; the SCST service configuration management module is used for managing configuration files, and the configuration files are used for configuring the SCST core module, the target end driving module and the storage driving module; the Btrfs file system is used for storing SCSI hard disk data mirror files; the file system snapshot management module is used for creating and recovering historical snapshots of the file system and setting automatic backup strategies at regular intervals of year, month, week, day and time; SCSI interface card and SCSI interface card firmware, is used for realizing carrying on SCSI communication with host computer that SCSI hard disk corresponds to; storage device and system storage device operator interface.
The SCSI hard disk simulation system according to the embodiment of the invention at least has the following beneficial effects: the system of the embodiment of the invention seamlessly replaces the traditional SCSI standard hard disk with a PC, so that the host computer is still considered to interact with the original SCSI hard disk under the condition of not changing any setting, and the seamless upgrade of the storage medium is realized. The system of the embodiment of the invention matches the SCSI bus with a novel storage interface through conversion, thereby not only facilitating the interchangeability of spare parts, but also reducing the cost.
According to some embodiments of the invention, the SCSI interface card is an LSI20320IE interface card.
According to some embodiments of the invention, the storage device comprises one of: SATA hard disk, NVMe hard disk, USB hard disk and NAS hard disk.
The computer-readable storage medium according to an embodiment of the third aspect of the invention has stored thereon a computer program which, when executed by a processor, performs the method of any of the embodiments of the first aspect of the invention.
All the advantages of the first aspect of the present invention are achieved because the computer-readable storage medium of the embodiment of the present invention stores thereon computer-executable instructions for executing the SCSI hard disk emulation method according to any one of the first aspect of the present invention.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a block schematic diagram of modules of a system of an embodiment of the invention;
FIG. 2 is a schematic diagram of a model in which a computer host with an original design standard communicates with a hard disk via a SCSI bus;
FIG. 3 is a schematic diagram of the interaction of a conventional SCST core with a target driver;
FIG. 4 is a schematic diagram of the SCST core and target driven interaction according to an embodiment of the present invention;
FIG. 5 is a flow chart illustrating a method according to an embodiment of the present invention.
Reference numerals:
the system comprises an SCST core module 101, a target end driver module 102, a storage driver module 103, an SCST service configuration management module 104, a Btrfs file system 201, a file system snapshot management module 202, an SCSI interface card 301, an SCSI interface card firmware 302, a storage device 401 and a system storage device operation interface 402.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
In the description of the present invention, the meaning of a plurality of means is one or more, the meaning of a plurality of means is two or more, and more than, less than, more than, etc. are understood as excluding the present number, and more than, less than, etc. are understood as including the present number. If the first and second are described for the purpose of distinguishing technical features, they are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated or implicitly indicating the precedence of the technical features indicated.
Interpretation of terms:
SCSI, Small Computer System Interface, is an independent processor standard for System-level interfacing between computers and their peripherals (hard disks, floppy drives, optical drives, printers, scanners, etc.).
The invention is based on the technical specification of the industry that the computer supports SCSI.
Referring to fig. 2, fig. 2 is a schematic diagram of a model in which a computer host of an original design standard communicates with a hard disk through a SCSI bus. During communication between a host and a storage medium, the host computer typically acts as a SCSI Initiator (Initiator). In computer storage, the SCSI initiator is the endpoint that initiates the SCSI session, meaning that it sends SCSI commands. The storage medium (i.e., a standard SCSI hard disk) typically serves as a SCSI Target (Target) that receives and processes SCSI commands. The SCSI target waits for the command from the initiator and then provides the requested input/output data translation.
The SCSI target typically provides one or more Logical Unit Numbers (LUNs) to the initiator. On computer storage media, a LUN is simply a number assigned to a logical unit. The logical unit is a SCSI protocol entity and the actual I/O operations only deal with this entity. Each SCSI target may provide one or more logic units; it does not perform I/O itself, but instead of a specific logical unit.
In a storage area, a LUN typically represents a SCSI disk on which a host can perform read and write operations. FIG. 2 shows how the SCSI client/server model works. The initiating end firstly sends a command to the target end, and then the target end decodes the command and requests data to the initiating end, or sends the data to the initiating end. After that, the target sends the status to the initiator. If the state is damaged, the initiating end sends a request detection (sense) instruction to the target end. The target will return test data telling the initiator where the error occurred.
A standard SCSI hard disk typically implements response control for various SCSI commands in its firmware. The invention replaces the traditional SCSI standard hard disk (namely SCSI target device in figure 2) into a standard PC running Linux operating system seamlessly, and through a series of self-owned software services, the host considers that the host still interacts with the original SCSI hard disk under the condition of not changing any setting, thereby realizing the seamless upgrade of the storage medium.
Referring to fig. 1, the SCSI hard disk simulation system according to the embodiment of the present invention includes: the SCST core module 101 is responsible for the operation logic of SCSI commands and the corresponding buffer memory management; the target end driving module 102 is used for receiving the SCSI command from the initiating end, transmitting the SCSI command to the SCST core module and returning data to the initiating end; the storage drive module 103 is used for interacting with different storage media and storing the disk data mirror image file in the btrfs data partition; the SCST service configuration management module 104 is configured to manage configuration files, and the configuration files are used to configure the SCST core module, the target driver module, and the storage driver module. The Btrfs file system 201 is used for storing SCSI hard disk data mirror files; the file system snapshot management module 202 is used to create and restore historical snapshots of the file system, and to set up automatic backup strategies at regular intervals of year, month, week, day, and time. A SCSI interface card 301 and SCSI interface card firmware 302, which are used to implement SCSI communication with a host corresponding to the SCSI hard disk. A storage device 401 and a system storage device operating interface 402.
The SCST is an open source SCSI target software stack independent of the version of the Linux kernel, the target of the SCST is to provide a uniform and consistent interface between the Linux kernel and a SCSI target driver, and simultaneously provide the Linux kernel to be connected with a handle of a storage back end and connect a real or simulated storage back end with the target driver.
Its purpose is to provide convenience for designing SAN device firmware, but at the same time any link that supports SCSI data exchange may be used, including fibre channel, iSCSI, SAS, InfiniBand and parallel (wide) SCSI. This makes it possible to use a PC to simulate a SCSI hard disk (target device).
As shown in fig. 1, SCST includes 3 software modules running and operating system kernel-state: the system comprises an SCST core module 101, a target end driving module 102 and a storage driving module 103. The configuration of these modules is implemented by the sysfs interface of Linux and a tool called scstadmin is provided (i.e. the above-mentioned SCST service configuration management module 104) for managing the configuration file, which will be automatically called at the configuration operation/etc/scst.conf when the system is started.
For the SCSI interface hardware portion, an embodiment of the present invention uses an LSI20320IE interface card (SCSI interface card 301). The interface card is usually used as an initiating side host interface to connect to the SCSI hard disk, and in the hard disk emulation system of this embodiment, it is used as a target side hardware interface for emulating the hard disk to connect to the existing host initiating side, which is equivalent to the master-slave role, so that it is necessary to match with the firmware (SCSI interface card firmware 302) that is flushed with a specific version to meet the working requirement.
The system of the embodiment can support any storage subsystem as long as the storage subsystem is an operation interface supported by a PC. For a data partition, a btrfs partition format is selected, which is one of the most advanced file systems in the current Linux system, and is particularly beneficial to exerting the performance advantages of a solid state disk, and more importantly, the characteristic of Copy-On-Write (snapshot) of the data partition makes the function of a snapshot (snapshot) of the data partition extremely efficient. In order to manage historical snapshots of btrfs, a snapshot management module 202 of a user layer software snapper (namely, a file system snapshot management module) is used, and through the software, historical snapshots of a file system can be created and replied at any time, and meanwhile, automatic backup strategies of the historical snapshots of the file system according to the period of year, month, week, day and time can be freely set.
Referring to FIG. 3, a schematic diagram of the interaction of the existing SCST core with the target driver. The processing of SCSI commands by the core begins with the target driver calling scst _ rx _ cmd () and the function returns a pointer to the scst _ cmd structure for the core to interact with information after the target driver. After initializing the structure by the target driver, calling scst _ cmd _ init _ done () to submit to the core for subsequent processing.
The SCST core reads the SCST _ cmd structure, converts the structure into the local Device according to the LUN number, determines the data transmission direction, and calls a pars () function request of a corresponding storage Device driver (Device Handler) to obtain a data buffer area.
(1) If the command does not require data transfer, it will be passed to the SCSI intermediate layer, either directly or through a storage device driven exec () callback function.
(2) If the command is a read command, the corresponding buffer space is allocated first, and then the command is transferred to the SCSI intermediate layer directly or through an exec () callback function driven by the storage device.
(3) If the command is a write command, the corresponding buffer space is allocated first, and then the rdy _ to _ xfer () callback function of the target driver is called to tell the target driver that the buffer is ready and the data transfer can be started. When the target driver reads all the written data, it will call scst _ rx _ data (), and then the command is passed to the SCSI middle layer either directly or through the exec () callback function of the storage device driver.
When the SCSI middle layer finishes processing the command, the dev _ done () callback function of the storage driver is called, and then xmit _ response () of the target driver is called to instruct the target driver to return the command result to the initiating terminal. After the command response (including data return) is finished, the target driver calls scst _ tgt _ cmd _ done (), telling the core that the command structure and the data buffer can be released.
In the release phase of the command, the on _ free _ cmd () driven by the storage device and the target device will be called in turn.
With further reference to fig. 4, for the parallel SCSI interface, the 20320IE of the LSI used in the embodiment of the present invention is a SCSI interface card based on the PCI-E bus, although the existing LSI-MPT underlying driver can be referred to. However, the open source driver is in the alpha stage, the related application documents are not clear, the functions are not complete, and secondary development is needed on the basis of the open source driver, so that the selected SCSI interface card can be normally identified and operated in the SCST system.
Stm _ tgt _ reply () is registered as an interrupt processing function of the SCSI interface card of the LSI20320, and this function is triggered to run when the SCSI interface card hardware detects a SCSI command request from the host. If the SCSI command is a host write hard disk command, the SCST core sends mpt _ rdy _ to _ xfer () notification driver after being ready, and stm _ tgt _ reply () then calls SCST _ rx _ data () to send the data transmitted by the host to the core. If the SCSI command is a host disk reading command, the SCST kernel sends mpt _ xmit _ response () to send data to the target drive, and the data is finally sent back to the host through the SCSI interface board. After the SCSI command processing is completed, stm _ tgt _ reply () finally issues a SCSI command status code and clears the message frame structure.
Referring to fig. 5, the SCSI hard disk simulation method according to the embodiment of the present invention includes the following steps: carrying out SCSI communication with a host corresponding to the SCSI hard disk based on the SCSI interface card; setting a target end drive of an SCSI interface card based on an SCST project, wherein the target end drive comprises setting a storage position of a virtual hard disk, an identification address of a simulated target hard disk and an identification address corresponding to an SCSI initiating end; saving the data on the SCSI hard disk as a mirror image file according to the storage position of the virtual hard disk; registering an interrupt processing function of the SCSI interface card based on the SCST project; when detecting a SCSI command request, the SCSI interface card triggers an interrupt processing function to run; for the received SCSI command, the interrupt processing function initializes the message frame structure corresponding to the SCSI command and registers the SCSI command to the SCST kernel; determining a host hard disk writing command or a host hard disk reading command according to the SCSI command, and executing writing operation or reading operation; when the SCSI command is processed, the interrupt processing function sends the SCSI command status code and clears the message frame structure.
Wherein, determining the host hard disk writing command or the host hard disk reading command according to the SCSI command, and executing the writing operation or the reading operation comprises: if the SCSI command is a host hard disk writing command, the SCST kernel distributes buffer space and informs a target end of driving, and the interrupt processing function sends data transmitted by the host to the SCST kernel; if the SCSI command is a host hard disk reading command, the SCST kernel sends data to the target drive, and the data is returned to the host through the SCSI interface card.
In some embodiments, saving the data on the SCSI hard disk as an image file comprises: and saving the disk data mirror image file in the btrfs data partition by default.
In some embodiments, managing disk data image files includes creating and restoring historical snapshots of a file system and setting an automatic backup strategy on a periodic basis, such as yearly, monthly, weekly, daily, or on-time basis.
The embodiment of the invention seamlessly replaces the traditional SCSI standard hard disk (namely SCSI target equipment in figure 2) with a standard PC running a Linux operating system, and ensures that the host still interacts with the original SCSI hard disk under the condition of not needing any setting change through a series of self-owned software services, thereby realizing the seamless upgrade of the storage medium. The SCSI bus is matched with novel storage interfaces (SATA, NVMe, USB, NAS and the like) through conversion, so that the interchangeability of spare parts is facilitated, and the cost is reduced. Meanwhile, by mapping the SCSI hard disk to the mirror image file on the new medium, the backup operation is only to copy one data file. And the novel Linux file system snapshot function is utilized to realize the automatic backup of data.
The embodiment of the invention provides a solution for completely replacing a traditional SCSI hard disk by using a computer simulation program, which is applied to a parallel SCSI bus and comprises a parallel SCSI interface of Single-Ended (Single-Ended) or Differential (Differential) electrical signals of 40 pins, 68 pins, 80 pins and the like. Using LSI20320IE interface card to carry out SCSI communication with a host computer, and corresponding interface card target end driver software, wherein the driver supports: the method comprises the steps of storing the data of a virtual hard disk, using a fast read-write buffer area, simulating parameter settings such as an identification address (SCSI target ID) of a target hard disk, an identification address (SCSI initiator ID) corresponding to an SCSI initiating end and the like; parallel access queues supporting multiple CPU threads. On the physical hard disks (including mechanical hard disks and solid state disks) of the novel buses such as SATA, NVMe, USB, NAS and the like, the traditional SCSI mechanical hard disk is simulated, and any electrical interface and data content modification of the simulated original hard disk system are not required. On the same SCSI bus, the hard disk access service of 1-7 hosts can be supported, and each host corresponds to a respective access queue and can support different data contents. The disk data is stored in the mirror image file, and the disk mirror image file can realize the rapid data backup and reply of the simulation hard disk data in a mode of file system snapshot or paste copy. An automatic backup strategy can be established on a regular basis, such as yearly, monthly, weekly, daily, or on-time basis.
Although specific embodiments have been described herein, those of ordinary skill in the art will recognize that many other modifications or alternative embodiments are equally within the scope of this disclosure. For example, any of the functions and/or processing capabilities described in connection with a particular device or component may be performed by any other device or component. In addition, while various illustrative implementations and architectures have been described in accordance with embodiments of the present disclosure, those of ordinary skill in the art will recognize that many other modifications of the illustrative implementations and architectures described herein are also within the scope of the present disclosure.
The embodiments of the present invention have been described in detail with reference to the accompanying drawings, but the present invention is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the gist of the present invention.
Claims (8)
1. A SCSI hard disk simulation method is applied to a PC, and is characterized by comprising the following steps:
carrying out SCSI communication with a host corresponding to the SCSI hard disk based on the SCSI interface card;
setting a target end drive of the SCSI interface card based on an SCST project, wherein the target end drive comprises setting a storage position of a virtual hard disk, an identification address of a simulated target hard disk and an identification address corresponding to an SCSI initiating end;
saving the data on the SCSI hard disk as a mirror image file according to the storage position of the virtual hard disk;
registering an interrupt processing function of the SCSI interface card based on the SCST project;
when the SCSI interface card detects a SCSI command request, triggering the interrupt processing function to run;
for the received SCSI command, the interrupt processing function initializes a message frame structure corresponding to the SCSI command and registers the SCSI command to an SCST kernel;
determining a host hard disk writing command or a host hard disk reading command according to the SCSI command, and executing writing operation or reading operation;
and after the SCSI command is processed, the interrupt processing function sends a SCSI command state code and clears the message frame structure.
2. The method according to claim 1, wherein said determining a host write hard disk command or a host read hard disk command according to the SCSI command, and performing a write operation or a read operation comprises:
if the SCSI command is a host hard disk writing command, the SCST kernel distributes buffer space and informs a target end of driving, and the interrupt processing function sends data transmitted by the host to the SCST kernel;
if the SCSI command is a host hard disk reading command, the SCST kernel sends data to the target drive, and the data is returned to the host through the SCSI interface card.
3. The SCSI hard disk emulation method according to claim 1, wherein saving the data on the SCSI hard disk as an image file comprises:
and saving the disk data mirror image file in the btrfs data partition by default.
4. The SCSI hard disk emulation method according to claim 3, further comprising: and managing the disk data mirror image file, including creating and recovering a historical snapshot of a file system and setting an automatic backup strategy at regular intervals of year, month, week, day and time.
5. A SCSI hard disk emulation system for implementing the method of any of claims 1 to 4, comprising:
the SCST core module is used for being responsible for the operation logic of the SCSI command and the corresponding buffer memory management;
the target end driving module is used for receiving an SCSI command from the initiating end, transmitting the SCSI command to the SCST core module and returning data to the initiating end;
the storage drive module is used for interacting with different storage media and storing the disk data mirror image file in the btrfs data partition;
the SCST service configuration management module is used for managing configuration files, and the configuration files are used for configuring the SCST core module, the target end driving module and the storage driving module;
the Btrfs file system is used for storing SCSI hard disk data mirror files;
the file system snapshot management module is used for creating and recovering historical snapshots of the file system and setting automatic backup strategies at regular intervals of year, month, week, day and time;
SCSI interface card and SCSI interface card firmware, is used for realizing carrying on SCSI communication with host computer that SCSI hard disk corresponds to;
storage device and system storage device operator interface.
6. The SCSI hard disk emulation system of claim 5, wherein the SCSI interface card is an LSI20320IE interface card.
7. The SCSI hard disk emulation system of claim 5, wherein the storage device comprises one of: SATA hard disk, NVMe hard disk, USB hard disk and NAS hard disk.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111224760.7A CN114090476B (en) | 2021-10-20 | SCSI hard disk simulation method, system and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111224760.7A CN114090476B (en) | 2021-10-20 | SCSI hard disk simulation method, system and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114090476A true CN114090476A (en) | 2022-02-25 |
CN114090476B CN114090476B (en) | 2024-07-12 |
Family
ID=
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117931555A (en) * | 2024-03-22 | 2024-04-26 | 新华三信息技术有限公司 | Method and device for simulating SCSI equipment fault under kernel mode |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104750433A (en) * | 2015-03-26 | 2015-07-01 | 浪潮集团有限公司 | Cache design method based on SCST |
KR101564712B1 (en) * | 2015-04-01 | 2015-11-02 | 인하대학교 산학협력단 | A system of all flash array storage virtualisation using SCST |
CN105117307A (en) * | 2015-09-25 | 2015-12-02 | 北京飞杰信息技术有限公司 | Data real-time backing-up method and system |
CN105812468A (en) * | 2016-03-15 | 2016-07-27 | 山东超越数控电子有限公司 | High-availability storage method based on SCST |
US9747180B1 (en) * | 2015-03-31 | 2017-08-29 | EMC IP Holding Company LLC | Controlling virtual endpoint failover during administrative SCSI target port disable/enable |
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104750433A (en) * | 2015-03-26 | 2015-07-01 | 浪潮集团有限公司 | Cache design method based on SCST |
US9747180B1 (en) * | 2015-03-31 | 2017-08-29 | EMC IP Holding Company LLC | Controlling virtual endpoint failover during administrative SCSI target port disable/enable |
KR101564712B1 (en) * | 2015-04-01 | 2015-11-02 | 인하대학교 산학협력단 | A system of all flash array storage virtualisation using SCST |
CN105117307A (en) * | 2015-09-25 | 2015-12-02 | 北京飞杰信息技术有限公司 | Data real-time backing-up method and system |
CN105812468A (en) * | 2016-03-15 | 2016-07-27 | 山东超越数控电子有限公司 | High-availability storage method based on SCST |
Non-Patent Citations (1)
Title |
---|
陈学辉: "磁盘阵列双控制器缓存镜像技术研究", 《中国优秀硕士学位论文全文数据库 信息科技辑(月刊)》, no. 06, 15 June 2014 (2014-06-15) * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117931555A (en) * | 2024-03-22 | 2024-04-26 | 新华三信息技术有限公司 | Method and device for simulating SCSI equipment fault under kernel mode |
CN117931555B (en) * | 2024-03-22 | 2024-06-07 | 新华三信息技术有限公司 | Method and device for simulating SCSI equipment fault under kernel mode |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6273353B2 (en) | Computer system | |
CN106104500B (en) | Method and apparatus for storing data | |
US8607230B2 (en) | Virtual computer system and migration method of virtual computer | |
CN101305334B (en) | Intelligent storage engine for disk drive operations with reduced local bus traffic | |
KR960003413B1 (en) | Data processing system | |
US7305591B2 (en) | Method, apparatus and program storage device for providing data path optimization | |
US8073674B2 (en) | SCSI device emulation in user space facilitating storage virtualization | |
US8700570B1 (en) | Online storage migration of replicated storage arrays | |
US20060123189A1 (en) | Tape storage emulation for open systems environments | |
US5062042A (en) | System for managing data which is accessible by file address or disk address via a disk track map | |
US20240037060A1 (en) | Computing device, virtualization acceleration device, remote control method and storage medium | |
US10346065B2 (en) | Method for performing hot-swap of a storage device in a virtualization environment | |
US7627464B2 (en) | Bootable solid state floppy disk drive | |
US7725664B2 (en) | Configuration definition setup method for disk array apparatus, and disk array apparatus | |
US5996045A (en) | IDE disk drive arrangement that combines the capacity of a master drive and slave drive while hiding the presence of slave drive to a host computer | |
US7003617B2 (en) | System and method for managing target resets | |
US12019521B2 (en) | Logical backup using a storage system | |
EP2370897A2 (en) | Composite device emulation | |
US10789018B2 (en) | Supporting non-disruptive movement of a logical volume of non-volatile data storage between storage appliances | |
US11226756B2 (en) | Indirect storage data transfer | |
CN114090476B (en) | SCSI hard disk simulation method, system and medium | |
WO2005115108A2 (en) | System and method for unit attention handling | |
CN114090476A (en) | SCSI hard disk simulation method, system and medium | |
US7219353B2 (en) | Finite state machine with a single process context for a RAID system | |
US10579481B1 (en) | Restoring data from a storage device to a cloud |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |